Skip to content

ctypes POINTER invalid incompatible type with None #12736

Closed
@caffeinepills

Description

@caffeinepills

With type checkers (PyCharm's, MyPy) I get the error:
mypy_test.py:6: error: Argument 1 to "POINTER" has incompatible type "None"; expected "type[Never]" [arg-type]

Using this simple example:

from ctypes import POINTER
void = None
POINTER(void)

POINTER(None) in ctypes is equivalent to c_void_p and is valid when ran. Minor issue but is technically a compatible type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedAn actionable problem of low to medium complexity where a PR would be very welcomestubs: false positiveType checkers report false errors

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions