mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
* Convert type comments to variable annotations in ctypes.__init__ * Add missing List import in ctypes.__init__ * Add missing bound kwarg to _CT TypeVar in ctypes.__init__ * Fix ctypes._CData classmethod definitions * Fix ctypes Structure/Union __getattr__ definitions Both Structure's metaclass and Structure itself define a __getattr__. The former returns field objects (each representing a field definition in the Structure), while the latter can return anything (the value of the field in a specific Structure instance). Structure also defines a __setattr__, while Structure's metaclass does not. BigEndianStructure, LittleEndianStructure and Union support the same operations as Structure does, but the semantics obviously differ. Depending on the system endianness, exactly one of the EndianStructures is an alias for Structure, and the other one is a special Structure subclass. For simplicity, both EndianStructures are considered subclasses of Structure here, even though this is technically not always accurate. * Fix swapped parameter types in ctypes._CData.in_dll * Add limited support for ctypes._CData.__class__.__mul__ It's not possible to specify the correct return type for __mul__ and __rmul__ here - see comments for explanation. * Make ctypes._FuncPtr extend ctypes._CData * Improve typing of ctypes.cast * Mark class attributes with ClassVar in ctypes.__init__ * Mark ctypes._CData.from_buffer[_copy] offset arg as optional * Remove trailing whitespace in ctypes.__init__ * Don't export ctypes.UnionT * Add ctypes._DLL.__getitem__ * Make ctypes._DLL.__get(attr|item)__ return _FuncPtr instead of Any * Change ctypes DLL inheritance hierarchy to match the real one better * Add some missing attributes to ctypes.CDLL * Rename ctypes._FuncPtr so it doesn't conflict with CDLL._FuncPtr * Fix type of ctypes.CDLL._FuncPtr * Merge _FuncProto into _FuncPointer The function pointer types returned by CFUNCTYPE and friends are the same as those encountered elsewhere, so there's no need to treat them differently. * Fix some leftover references to ctypes._DLL * Simplify definition of ctypes._DLLT * Add ctypes.LibraryLoader.__get(attr|item)__ * Use Text instead of str where appropriate in ctypes.__init__ * Make ctypes.c_char accept ints * Make ctypes.c_[w]char_p accept None * Remove unneeded Generic base from ctypes.py_object * Make ctypes.cast accept _cparam * Fix ctypes._PF being declared too late * Remove incorrect ctypes.PyDLL.__init__ override