Closed
Description
Bug Report
According to the ctypes
documentation, the ctypes.POINTER
factory function creates new pointer types. If those pointer types are called/instantiated without arguments, then a NULL
pointer is created.
python/typeshed#8446 fixed some errors in the ctypes
type definitions. But now, Mypy still fails to validate legal code creating NULL
pointers.
To Reproduce
from ctypes import POINTER, c_char
charp = POINTER(c_char)
null = charp()
assert not null, "NULL is evaluating to True!"
Expected Behavior
The above snippet should successfully type check.
Actual Behavior
sample.py:4: error: Missing positional argument "arg" in call to "pointer"
null = charp()
^
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 0.982
- Mypy command-line flags:
--pretty
- Mypy configuration options from
mypy.ini
(and other config files): no customizations, no INI file created - Python version used: 3.10.7