cpython/Modules/_testcapi
Petr Viktorin 4d82f628c4
gh-47146: Soft-deprecate structmember.h, expose its contents via Python.h (GH-99014)
The ``structmember.h`` header is deprecated, though it continues to be available
and there are no plans to remove it. There are no deprecation warnings. Old code
can stay unchanged (unless the extra include and non-namespaced macros bother
you greatly). Specifically, no uses in CPython are updated -- that would just be
unnecessary churn.
The ``structmember.h`` header is deprecated, though it continues to be
available and there are no plans to remove it.

Its contents are now available just by including ``Python.h``,
with a ``Py`` prefix added if it was missing:

- `PyMemberDef`, `PyMember_GetOne` and`PyMember_SetOne`
- Type macros like `Py_T_INT`, `Py_T_DOUBLE`, etc.
  (previously ``T_INT``, ``T_DOUBLE``, etc.)
- The flags `Py_READONLY` (previously ``READONLY``) and
  `Py_AUDIT_READ` (previously all uppercase)

Several items are not exposed from ``Python.h``:

- `T_OBJECT` (use `Py_T_OBJECT_EX`)
- `T_NONE` (previously undocumented, and pretty quirky)
- The macro ``WRITE_RESTRICTED`` which does nothing.
- The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of
  `Py_AUDIT_READ`.
- In some configurations, ``<stddef.h>`` is not included from ``Python.h``.
  It should be included manually when using ``offsetof()``.

The deprecated header continues to provide its original
contents under the original names.
Your old code can stay unchanged, unless the extra include and non-namespaced
macros bother you greatly.

There is discussion on the issue to rename `T_PYSSIZET` to `PY_T_SSIZE` or
similar. I chose not to do that -- users will probably copy/paste that with any
spelling, and not renaming it makes migration docs simpler.


Co-Authored-By: Alexander Belopolsky <abalkin@users.noreply.github.com>
Co-Authored-By: Matthias Braun <MatzeB@users.noreply.github.com>
2022-11-22 08:25:43 +01:00
..
clinic gh-90928: Statically Initialize the Keywords Tuple in Clinic-Generated Code (gh-95860) 2022-08-11 15:25:49 -06:00
datetime.c gh-99300: Replace Py_INCREF() with Py_NewRef() (#99513) 2022-11-16 10:39:47 +01:00
docstring.c gh-93649: Split memory and docstring tests from _testcapimodule.c (#99517) 2022-11-16 14:09:10 +01:00
float.c gh-93649: Split float/long tests from _testcapimodule.c (GH-99549) 2022-11-17 00:56:56 -08:00
getargs.c gh-93649: Split getargs tests from _testcapimodule.c (#99346) 2022-11-14 22:23:41 +01:00
heaptype.c GH-95245: Move weakreflist into the pre-header. (GH-95996) 2022-08-16 13:57:18 +01:00
long.c gh-93649: Split float/long tests from _testcapimodule.c (GH-99549) 2022-11-17 00:56:56 -08:00
mem.c gh-93649: Split memory and docstring tests from _testcapimodule.c (#99517) 2022-11-16 14:09:10 +01:00
parts.h gh-47146: Soft-deprecate structmember.h, expose its contents via Python.h (GH-99014) 2022-11-22 08:25:43 +01:00
pytime.c gh-93649: Split pytime and datetime tests from _testcapimodule.c (#99494) 2022-11-15 08:17:52 +01:00
README.txt gh-93649: Split vectorcall testing from _testcapimodule.c (GH-94549) 2022-07-08 08:56:26 -07:00
structmember.c gh-47146: Soft-deprecate structmember.h, expose its contents via Python.h (GH-99014) 2022-11-22 08:25:43 +01:00
testcapi_long.h gh-93649: Split float/long tests from _testcapimodule.c (GH-99549) 2022-11-17 00:56:56 -08:00
unicode.c gh-94808: Cover PyUnicode_Count in CAPI (#96929) 2022-10-06 17:20:22 +02:00
vectorcall.c gh-99300: Use Py_NewRef() in Modules/ directory (#99440) 2022-11-13 16:04:33 +01:00
vectorcall_limited.c gh-98586: Add vector call APIs to the Limited API (GH-98587) 2022-10-27 11:45:42 +02:00
watchers.c gh-93649: Split watcher API tests from _testcapimodule.c (#99532) 2022-11-16 20:13:32 +01:00

Tests in this directory are compiled into the _testcapi extension.
The main file for the extension is Modules/_testcapimodule.c, which
calls `_PyTestCapi_Init_*` from these functions.