KEMBAR78
ctypes.create_unicode_buffer().value type bug · Issue #2111 · python/typeshed · GitHub
Skip to content

ctypes.create_unicode_buffer().value type bug #2111

@remdragon

Description

@remdragon

The test script below in py2 prints out "<type 'unicode'>" but mypy --py2 reveal_type yields 'builtins.str'

The test script below in py3 prints out "<class 'str'>" but mypy reveal_type yields 'builtins.bytes'

I believe that typeshed is incorrectly reporting create_unicode_buffer().value to be of type bytes when it's supposed to be type Text.

import ctypes
buf = ctypes.create_unicode_buffer ( 42 )
print ( type ( buf.value ) )

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions