[issue46584] Modernize `ctypes/test_python_api` by removing old version check

Nikita Sobolev report at bugs.python.org
Sun Jan 30 09:56:00 EST 2022


New submission from Nikita Sobolev <mail at sobolevn.me>:

Right now Lib/ctypes/test/test_python_api.py has these lines:

```
if sys.version_info > (2, 4):
    c_py_ssize_t = c_size_t
else:
    c_py_ssize_t = c_int
```

Source: https://github.com/python/cpython/blame/8fb36494501aad5b0c1d34311c9743c60bb9926c/Lib/ctypes/test/test_python_api.py#L13-L16

I think that there's no reason to keep code compat for python versions `<=2.3`. Other modules in CPython do refactor this by removing old and unused code, especially in tests.

I propose to do the same here.

----------
components: Tests, ctypes
messages: 412154
nosy: amaury.forgeotdarc, belopolsky, meador.inge, sobolevn, zach.ware
priority: normal
severity: normal
status: open
title: Modernize `ctypes/test_python_api` by removing old version check
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46584>
_______________________________________


More information about the Python-bugs-list mailing list