Skip to content

Commit e3a4134

Browse files
committed
Guard ctypes complex type codes
1 parent 3bd8325 commit e3a4134

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

stdlib/ctypes/__init__.pyi

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,26 @@ if sys.version_info >= (3, 14) and sys.platform != "win32":
333333
# https://github.com/python/cpython/issues/148464
334334

335335
class c_double_complex(_SimpleCData[complex]):
336-
_type_: ClassVar[Literal["Zd"]]
336+
if sys.version_info >= (3, 15):
337+
_type_: ClassVar[Literal["Zd"]]
338+
else:
339+
_type_: ClassVar[Literal["D"]]
337340
__ctype_be__: ClassVar[type[Self]]
338341
__ctype_le__: ClassVar[type[Self]]
339342

340343
class c_float_complex(_SimpleCData[complex]):
341-
_type_: ClassVar[Literal["Zf"]]
344+
if sys.version_info >= (3, 15):
345+
_type_: ClassVar[Literal["Zf"]]
346+
else:
347+
_type_: ClassVar[Literal["F"]]
342348
__ctype_be__: ClassVar[type[Self]]
343349
__ctype_le__: ClassVar[type[Self]]
344350

345351
class c_longdouble_complex(_SimpleCData[complex]):
346-
_type_: ClassVar[Literal["Zg"]]
352+
if sys.version_info >= (3, 15):
353+
_type_: ClassVar[Literal["Zg"]]
354+
else:
355+
_type_: ClassVar[Literal["G"]]
347356

348357
class c_char(_SimpleCData[bytes]):
349358
_type_: ClassVar[Literal["c"]]

0 commit comments

Comments
 (0)