summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/structures.rst
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] Fix the PyGetSetDef documentation (GH-116056) (GH-116363)Miss Islington (bot)2024-03-051-3/+3
| | | | | | closure is not a function pointer, it is a user data pointer. (cherry picked from commit df594011089a83d151ac7000954665536f3461b5) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-115172: Fix explicit index extries for the C API (GH-115173) ↵Serhiy Storchaka2024-02-111-22/+22
| | | | | (GH-115292) (cherry picked from commit 573acb30f22a84c0f2c951efa002c9946e29b6a3)
* [3.12] gh-101100: Fix Sphinx warnings in `c-api/structures.rst` (GH-113564) ↵Miss Islington (bot)2024-01-241-9/+10
| | | | | | | | (#114527) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.12] gh-102468: Document `PyCFunction_New*` and `PyCMethod_New` ↵Miss Islington (bot)2024-01-171-0/+34
| | | | | | | | | (GH-112557) (GH-114119) gh-102468: Document `PyCFunction_New*` and `PyCMethod_New` (GH-112557) (cherry picked from commit a482bc67ee786e60937a547776fcf9528810e1ce) Co-authored-by: AN Long <aisk@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* Doc: c-api: fix order of PyMemberDef fields (GH-112879)Miss Islington (bot)2023-12-101-4/+4
| | | | Doc: c-api: fix order of PyMemberDef fields (GH-112879) (cherry picked from commit 42a86df3a376a77a94ffe6b4011a82cf51dc336a)
* [3.12] gh-112671: Fixing typo in the Macro Docs (GH-112715) (GH-112726)Miss Islington (bot)2023-12-041-1/+1
| | | | | | Replace Py_T_STRING_INLINE with Py_T_STRING_INPLACE (cherry picked from commit a8ce149628c9eaafb8c38fbf25fbd1ed483d2902) Co-authored-by: Amioplk <amir.worms@dauphine.eu>
* [3.12] gh-110803: Reorganize docs for what PyType_Slot doesn't cover ↵Miss Islington (bot)2023-10-131-1/+5
| | | | | | | | | | | | | | | | | | (GH-110813) (#110823) gh-110803: Reorganize docs for what PyType_Slot doesn't cover (GH-110813) * gh-110803: Reorganize docs for what PyType_Slot doesn't cover - Cover the offset fields first - Mention the old alternative for MANAGED flags, which is needed to support older Pythons - De-emphasize the internal flags: use an inline list. - Add a note to PyMemberDef saying what to do with it * Remove an older draft... (cherry picked from commit 2ab34f0e425d90d0a153104ef2f4343dce2a414d) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.12] gh-107298: Fix more Sphinx warnings in the C API doc (GH-107329) ↵Serhiy Storchaka2023-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-107376) Declare the following functions as macros, since they are actually macros. It avoids a warning on "TYPE" or "macro" argument. * PyMem_New() * PyMem_Resize() * PyModule_AddIntMacro() * PyModule_AddStringMacro() * PyObject_GC_New() * PyObject_GC_NewVar() * PyObject_New() * PyObject_NewVar() Add C standard C types to nitpick_ignore in Doc/conf.py: * int64_t * uint64_t * uintptr_t No longer ignore non existing "__int" type in nitpick_ignore. Update Doc/tools/.nitignore. (cherry picked from commit 8d61a71f9c81619e34d4a30b625922ebc83c561b) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-107091: Fix some uses of :attr: role (GH-107318) (GH-107330)Serhiy Storchaka2023-07-271-8/+8
| | | | | Fix also formatting of PyMethodDef members. (cherry picked from commit d363eb5b0255c055e7b43f5e2c0847f555e1982e)
* [3.12] gh-107091: Fix some uses of :c:member: role (GH-107129) (GH-107310)Miss Islington (bot)2023-07-261-4/+6
| | | | | (cherry picked from commit af61cb9c7837ff3c11da79e3ee1cab3fdd0ba4da) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-106919: Use role :c:macro: for referencing the C "constants" ↵Serhiy Storchaka2023-07-211-27/+45
| | | | | (GH-106920) (GH-106951) (cherry picked from commit fcc816dbff7ca66c26f57a506e4d2330fe41d0ff)
* [3.12] gh-102304: doc: Add links to Stable ABI and Limited C API (#105345) ↵Victor Stinner2023-06-061-1/+1
| | | | | | | | | | | | | | | | | | | (#105371) * gh-102304: doc: Add links to Stable ABI and Limited C API (#105345) * Add "limited-c-api" and "stable-api" references. * Rename "stable-abi-list" reference to "limited-api-list". * Makefile: Document files regenerated by "make regen-limited-abi" * Remove first empty line in generated files: - Lib/test/test_stable_abi_ctypes.py - PC/python3dll.c (cherry picked from commit bae415ad02c79cf3a2eec4aa6969221a12e6716f) * gh-102304: Fix up Simple ABI doc (GH-105351) (cherry picked from commit 0202aa002e06acef9aa55ace0d939103df19cadd)
* [3.12] gh-97908: CAPI docs: Remove repeated struct names from member docs ↵Miss Islington (bot)2023-06-051-6/+6
| | | | | | | | (GH-100054) (#105057) And add raw HTML fragments to keep old links working. (cherry picked from commit 1668b41dc477bc9562e4c50ab36a232839b4621b) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* GH-97950: Use new-style index directive ('builtin') (#104164)Adam Turner2023-05-061-2/+2
| | | | | | | | | | | | | * Uncomment builtin removal in pairindextypes * Use new-style index directive ('builtin') - C API * Use new-style index directive ('builtin') - Extending * Use new-style index directive ('builtin') - Library * Use new-style index directive ('builtin') - Reference * Use new-style index directive ('builtin') - Tutorial
* gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)Petr Viktorin2023-05-041-0/+16
| | | | Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* Fix typos in Doc folder (#100880)Semen Zhydenko2023-01-101-1/+1
|
* gh-97909: Fix markup for `PyMethodDef` members (#100089)ram vikram singh2022-12-171-17/+18
|
* gh-47146: Soft-deprecate structmember.h, expose its contents via Python.h ↵Petr Viktorin2022-11-221-61/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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>
* gh-97909: PyMemberDef & PyGetSetDef members are not marked up (GH-98810)Johnny115022022-11-031-17/+19
|
* gh-97909: Mark up members of PyMemberDef (GH-98473)Johnny115022022-10-241-21/+21
| | | Co-authored-by: T <tnie@tuta.io>
* gh-96258: move Py_REFCNT and Py_SET_REFCNT to reference counting page (#96259)QuakeIV2022-10-151-21/+2
|
* gh-93738: Documentation C syntax (:c:type: to :c:expr:, misc. cases) (#97775)Adam Turner2022-10-041-3/+3
| | | | | * :c:type: to :c:expr: * Update Doc/whatsnew/2.4.rst
* gh-93738: Documentation C syntax (:c:type:`PyObject` -> :c:expr:`PyObject`) ↵Adam Turner2022-10-041-10/+10
| | | | | (#97776) :c:type:`PyObject` -> :c:expr:`PyObject`
* GH-95245: Document use of `MANAGED` flags instead of offsets. (GH-96044)Mark Shannon2022-08-301-6/+8
|
* gh-87961: Remove outdated notes from functions that aren't in the Limited ↵Petr Viktorin2022-06-081-2/+0
| | | | | | | | | | | | API (GH-93581) * Remove outdated notes from functions that aren't in the Limited API Nowadays everything that *is* in the Limited API has a note added automatically. These notes could mislead people to think that these functions could never be added to the limited API. Remove them. * Also remove forgotten note on tp_vectorcall_offset not being finalized
* gh-91768: C API no longer use "const PyObject*" type (#91769)Victor Stinner2022-04-211-7/+12
| | | | | | | | | | | | | Py_REFCNT(), Py_TYPE(), Py_SIZE() and Py_IS_TYPE() functions argument type is now "PyObject*", rather than "const PyObject*". * Replace also "const PyObject*" with "PyObject*" in functions: * _Py_strhex_impl() * _Py_strhex_with_sep() * _Py_strhex_bytes_with_sep() * Remove _PyObject_CAST_CONST() and _PyVarObject_CAST_CONST() macros. * Py_IS_TYPE() can now use Py_TYPE() in its implementation.
* More minor fixes to C API docs (GH-31525)Jelle Zijlstra2022-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | * wording fixes in type.rst * grammar and punctuation in sys.rst * set: grammar fixes * structures: capitalization fix * grammar fixes for sequence * objects: point to Py_TYPE instead of direct object access * numbers: add more explicit Python equivalences * method: add missing period * memory: grammar fix * mapping: grammar fixes * long: grammar fix * iter: fix grammar for PyAIter_Check * init: grammar fix
* bpo-47164: Add _PyCFunction_CAST() macro (GH-32192)Victor Stinner2022-03-311-0/+3
| | | Use the macro in C files of the Python/ directory.
* bpo-39573: Py_TYPE becomes a static inline function (GH-28128)Victor Stinner2021-09-081-3/+10
| | | | | Convert the Py_TYPE() and Py_SIZE() macros to static inline functions. The Py_SET_TYPE() and Py_SET_SIZE() functions must now be used to set an object type and size.
* Document PyMember_GetOne and PyMember_SetOne (GH-27555)Ken Jin2021-08-021-0/+15
|
* bpo-44348: Revert "bpo-39573: Py_TYPE becomes a static inline function ↵Pablo Galindo2021-06-081-10/+3
| | | | | | (GH-26493)" (GH-26596) This reverts commit f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970 as is causing crashes in some Windows tests in the buildbots.
* bpo-39573: Py_TYPE becomes a static inline function (GH-26493)Victor Stinner2021-06-031-3/+10
| | | | | Convert the Py_TYPE() and Py_SIZE() macros to static inline functions. The Py_SET_TYPE() and Py_SET_SIZE() functions must now be used to set an object type and size.
* bpo-43753: Add Py_Is() and Py_IsNone() functions (GH-25227)Victor Stinner2021-04-101-0/+31
| | | | | | | Add the Py_Is(x, y) function to test if the 'x' object is the 'y' object, the same as "x is y" in Python. Add also the Py_IsNone(), Py_IsTrue(), Py_IsFalse() functions to test if an object is, respectively, the None singleton, the True singleton or the False singleton.
* bpo-39573: Convert Py_TYPE() and Py_SIZE() back to macros (GH-23366)Victor Stinner2020-11-181-6/+2
| | | | | | | | | This change partically reverts commit ad3252bad905d41635bcbb4b76db30d570cf0087 and the commit fe2978b3b940fe2478335e3a2ca5ad22338cdf9c. Many third party C extension modules rely on the ability of using Py_TYPE() to set an object type: "Py_TYPE(obj) = type;" or to set an object type using: "Py_SIZE(obj) = size;".
* bpo-42171: Add PEP573-related items to the limited API (GH-23009)Petr Viktorin2020-11-101-2/+4
|
* bpo-42294: Add borrowed/strong reference to doc glossary (GH-23206)Victor Stinner2020-11-091-1/+1
| | | | | | Add "borrowed reference" and "strong reference" to the documentation glossary. Enhance also Py_INCREF() and Py_NewRef() documentation.
* bpo-40204, doc: Fix syntax of C variables (GH-21846)Victor Stinner2020-08-131-9/+9
| | | | | | | | | | | | | | | For example, fix the following Sphinx 3 errors: Doc/c-api/buffer.rst:102: WARNING: Error in declarator or parameters Invalid C declaration: Expected identifier in nested name. [error at 5] void \*obj -----^ Doc/c-api/arg.rst:130: WARNING: Unparseable C cross-reference: 'PyObject*' Invalid C declaration: Expected end of definition. [error at 8] PyObject* --------^ The modified documentation is compatible with Sphinx 2 and Sphinx 3.
* bpo-39573: Convert Py_REFCNT and Py_SIZE to functions (GH-20429)Victor Stinner2020-05-271-9/+10
| | | | | | | | | | | Convert Py_REFCNT() and Py_SIZE() macros to static inline functions. They cannot be used as l-value anymore: use Py_SET_REFCNT() and Py_SET_SIZE() to set an object reference count and size. Replace &Py_SIZE(self) with &((PyVarObject*)self)->ob_size in arraymodule.c. This change is backward incompatible on purpose, to prepare the C API for an opaque PyObject structure.
* bpo-39573: Convert Py_TYPE() to a static inline function (GH-20290)Dong-hee Na2020-05-251-4/+7
|
* bpo-40584: Update PyType_FromModuleAndSpec() to process tp_vectorcall_offset ↵Hai Shi2020-05-111-3/+5
| | | | (GH-20026)
* bpo-38787: Update structures.rst docs (PEP 573) (GH-19980)Hai Shi2020-05-071-2/+2
|
* bpo-38787: C API for module state access from extension methods (PEP 573) ↵Petr Viktorin2020-05-071-3/+47
| | | | | | | | | (GH-19936) Module C state is now accessible from C-defined heap type methods (PEP 573). Patch by Marcel Plch and Petr Viktorin. Co-authored-by: Marcel Plch <mplch@redhat.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-39573: Add Py_IS_TYPE() function (GH-18488)Dong-hee Na2020-02-131-0/+8
| | | Co-Author: Neil Schemenauer <nas-github@arctrix.com>
* bpo-39573: Fix bad copy-paste in Py_SET_SIZE (GH-18496)Brandt Bucher2020-02-131-1/+1
|
* bpo-39573: Add Py_SET_SIZE() function (GH-18400)Victor Stinner2020-02-071-0/+7
| | | Add Py_SET_SIZE() function to set the size of an object.
* bpo-39573: Add Py_SET_TYPE() function (GH-18394)Victor Stinner2020-02-071-0/+7
| | | Add Py_SET_TYPE() function to set the type of an object.
* bpo-39573: Add Py_SET_REFCNT() function (GH-18389)Victor Stinner2020-02-071-0/+7
| | | | Add a Py_SET_REFCNT() function to set the reference counter of an object.
* bpo-39136: Fixed typos (GH-17720)Gurupad Hegde2019-12-281-1/+1
| | | | | funtion -> function; configuraton -> configuration; defintitions -> definitions; focusses -> focuses; necesarily -> necessarily; follwing -> following; Excape -> Escape,
* bpo-36974: expand call protocol documentation (GH-13844)Jeroen Demeyer2019-11-121-1/+2
| | | | | | | | | | | | | | CC @encukou I'm also adding Petr Viktorin as contributor for vectorcall in the "what's new" section. https://bugs.python.org/issue36974 Automerge-Triggered-By: @encukou Automerge-Triggered-By: @encukou
* bpo-38600: Change the mark up of NULL in the C API documentation. (GH-16950)Serhiy Storchaka2019-10-301-10/+10
| | | | Replace all *NULL* with ``NULL``.