cpython/Doc/c-api
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
..
abstract.rst bpo-41103: Resurrect the old buffer protocol. (GH-27437) 2021-07-29 12:46:47 +02:00
allocation.rst Docs: remove redundant "adverb-adjective" hyphens from compound modifiers (GH-94551) 2022-07-05 11:16:10 +02:00
apiabiversion.rst Doc: some rst linting. (GH-30149) 2021-12-17 13:55:03 +01:00
arg.rst gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768) 2022-10-05 11:01:14 -07:00
bool.rst bpo-42528: Improve the docs of most Py*_Check{,Exact} API calls (GH-23602) 2021-01-06 12:38:26 +01:00
buffer.rst Fix types in buffer/memoryview docs (#98118) 2022-10-09 17:55:53 -07:00
bytearray.rst gh-89653: PEP 670: Convert PyBytes macros to functions (#91990) 2022-05-03 20:14:58 +02:00
bytes.rst gh-93202: Always use %zd printf formatter (#93201) 2022-05-25 14:21:36 +02:00
call.rst gh-98586: Add What's New entry and update docs (#99056) 2022-11-06 23:54:55 +01:00
capsule.rst gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768) 2022-10-05 11:01:14 -07:00
cell.rst bpo-42528: Improve the docs of most Py*_Check{,Exact} API calls (GH-23602) 2021-01-06 12:38:26 +01:00
code.rst gh-95913: Fix and copyedit New Features section of 3.11 What's New (GH-95915) 2022-09-19 15:32:51 +02:00
codec.rst bpo-41842: Add codecs.unregister() function (GH-22360) 2020-09-28 23:41:11 +02:00
complex.rst gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768) 2022-10-05 11:01:14 -07:00
concrete.rst bpo-46836: Add Doc/c-api/frame.rst (GH-32051) 2022-03-23 13:19:13 +01:00
contextvars.rst bpo-43959: clarify the documentation of the PyContextVar C-API (GH-25671) 2021-04-28 07:03:19 -07:00
conversion.rst Add a warning message about PyOS_snprintf (#95993) 2022-10-07 11:49:53 -07:00
coro.rst bpo-42528: Improve the docs of most Py*_Check{,Exact} API calls (GH-23602) 2021-01-06 12:38:26 +01:00
datetime.rst gh-90359: Unify documentation style for datetime.rst (gh-94836) 2022-07-14 09:40:10 +09:00
descriptor.rst bpo-40170: Convert PyDescr_IsData() to static inline function (GH-24535) 2021-02-16 08:50:00 +01:00
dict.rst gh-91052: Add PyDict_Unwatch for unwatching a dictionary (#98055) 2022-10-07 17:37:46 -07:00
exceptions.rst gh-93738: Documentation C syntax (Function glob patterns -> literal markup) (#97774) 2022-10-05 08:22:28 -07:00
file.rst gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768) 2022-10-05 11:01:14 -07:00
float.rst gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768) 2022-10-05 11:01:14 -07:00
frame.rst gh-91248: Optimize PyFrame_GetVar() (#99252) 2022-11-13 15:37:03 +01:00
function.rst GH-91049: Introduce set vectorcall field API for PyFunctionObject (GH-92257) 2022-09-15 16:42:37 +01:00
gcsupport.rst bpo-28737: Document when tp_dealloc should call PyObject_GC_UnTrack() (GH-29246) 2021-10-27 21:15:13 +02:00
gen.rst bpo-42528: Improve the docs of most Py*_Check{,Exact} API calls (GH-23602) 2021-01-06 12:38:26 +01:00
import.rst gh-65961: Do not rely solely on __cached__ (GH-97990) 2022-10-06 15:40:22 -07:00
index.rst bpo-36763: Implement the PEP 587 (GH-13592) 2019-05-27 16:39:22 +02:00
init.rst gh-99377: Revert audit events for thread state creation and free, because the GIL is not properly held at these times (GH-99543) 2022-11-17 00:24:16 +00:00
init_config.rst Doc: Replace question mark with fullstop (#99558) 2022-11-18 11:24:23 -08:00
intro.rst gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768) 2022-10-05 11:01:14 -07:00
iter.rst More minor fixes to C API docs (GH-31525) 2022-04-02 12:31:05 -07:00
iterator.rst bpo-42528: Improve the docs of most Py*_Check{,Exact} API calls (GH-23602) 2021-01-06 12:38:26 +01:00
list.rst gh-89653: PEP 670: Amend docs (GH-91813) 2022-04-22 14:59:18 +02:00
long.rst gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768) 2022-10-05 11:01:14 -07:00
mapping.rst More minor fixes to C API docs (GH-31525) 2022-04-02 12:31:05 -07:00
marshal.rst gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768) 2022-10-05 11:01:14 -07:00
memory.rst gh-96997: Clarify the contract of PyMem_SetAllocator() (#98977) 2022-11-02 21:49:12 +00:00
memoryview.rst Fix types in buffer/memoryview docs (#98118) 2022-10-09 17:55:53 -07:00
method.rst More minor fixes to C API docs (GH-31525) 2022-04-02 12:31:05 -07:00
module.rst gh-93738: Documentation C syntax (Function glob patterns -> literal markup) (#97774) 2022-10-05 08:22:28 -07:00
none.rst Doc: Replace the deprecated highlightlang directive by highlight. (#13377) 2019-05-17 15:25:34 +05:30
number.rst Document Py_ssize_t. (GH-92512) 2022-05-13 14:10:16 +02:00
objbuffer.rst bpo-41103: Resurrect the old buffer protocol. (GH-27437) 2021-07-29 12:46:47 +02:00
object.rst gh-93738: Documentation C syntax (:c:type:PyTypeObject* -> :c:expr:PyTypeObject*) (#97778) 2022-10-04 17:56:20 -07:00
objimpl.rst Doc: Replace the deprecated highlightlang directive by highlight. (#13377) 2019-05-17 15:25:34 +05:30
refcounting.rst gh-98724: Fix Py_CLEAR() macro side effects (#99100) 2022-11-09 14:06:36 +01:00
reflection.rst bpo-46836: Add Doc/c-api/frame.rst (GH-32051) 2022-03-23 13:19:13 +01:00
sequence.rst More minor fixes to C API docs (GH-31525) 2022-04-02 12:31:05 -07:00
set.rst More minor fixes to C API docs (GH-31525) 2022-04-02 12:31:05 -07:00
slice.rst bpo-42528: Improve the docs of most Py*_Check{,Exact} API calls (GH-23602) 2021-01-06 12:38:26 +01:00
stable.rst Reword paragraph on specific value for Py_LIMITED_API (GH-26101) 2021-05-13 22:22:44 -07:00
structures.rst gh-47146: Soft-deprecate structmember.h, expose its contents via Python.h (GH-99014) 2022-11-22 08:25:43 +01:00
sys.rst gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768) 2022-10-05 11:01:14 -07:00
tuple.rst no-issue: typo fix in c-api/tuple.rst (gh-98560) 2022-10-23 19:46:56 +09:00
type.rst gh-91051: allow setting a callback hook on PyType_Modified (GH-97875) 2022-10-21 14:41:51 +01:00
typehints.rst gh-93738: Documentation C syntax (:c:type:PyTypeObject* -> :c:expr:PyTypeObject*) (#97778) 2022-10-04 17:56:20 -07:00
typeobj.rst gh-96746: Docs: Clear up Py_TPFLAGS_DISALLOW_INSTANTIATION inheritance (GH-99002) 2022-11-07 19:45:50 +01:00
unicode.rst gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768) 2022-10-05 11:01:14 -07:00
utilities.rst Doc: Replace the deprecated highlightlang directive by highlight. (#13377) 2019-05-17 15:25:34 +05:30
veryhigh.rst gh-93738: Documentation C syntax (:c:type:FILE -> :c:expr:FILE) (#97769) 2022-10-04 16:27:29 -07:00
weakref.rst Docs: remove redundant "adverb-adjective" hyphens from compound modifiers (GH-94551) 2022-07-05 11:16:10 +02:00