Skip to content

c_char array value attribute returns incorrectly #112860

Open
@evilzhou

Description

@evilzhou

Bug report

Bug description:

When the array starts with \x00:

from ctypes import create_string_buffer, c_char, addressof

bs = b"\x00\x01\x02\x03\x04"

s = create_string_buffer(bs)
array = (c_char * 16).from_address(addressof(s))
print(array.value)

out:
b''

CPython versions tested on:

3.9

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X