summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] Fix `c-api/file.rst` indexes (GH-114608) (#124786)sobolevn2024-09-301-2/+3
| | | (cherry picked from commit 23fb9f0777b054526b3b32f58e60b2a03132bf45)
* [3.12] gh-113993: Make interned strings mortal (GH-120520, GH-121364, ↵Petr Viktorin2024-09-273-6/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GH-121903, GH-122303) (#123065) This backports several PRs for gh-113993, making interned strings mortal so they can be garbage-collected when no longer needed. * Allow interned strings to be mortal, and fix related issues (GH-120520) * Add an InternalDocs file describing how interning should work and how to use it. * Add internal functions to *explicitly* request what kind of interning is done: - `_PyUnicode_InternMortal` - `_PyUnicode_InternImmortal` - `_PyUnicode_InternStatic` * Switch uses of `PyUnicode_InternInPlace` to those. * Disallow using `_Py_SetImmortal` on strings directly. You should use `_PyUnicode_InternImmortal` instead: - Strings should be interned before immortalization, otherwise you're possibly interning a immortalizing copy. - `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to `SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in backports, as they are now part of public API and version-specific ABI. * Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery. Make sure the statically allocated string singletons are unique. This means these sets are now disjoint: - `_Py_ID` - `_Py_STR` (including the empty string) - one-character latin-1 singletons Now, when you intern a singleton, that exact singleton will be interned. * Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic). * Intern `_Py_STR` singletons at startup. * Beef up the tests. Cover internal details (marked with `@cpython_only`). * Add lots of assertions * Don't immortalize in PyUnicode_InternInPlace; keep immortalizing in other API (GH-121364) * Switch PyUnicode_InternInPlace to _PyUnicode_InternMortal, clarify docs * Document immortality in some functions that take `const char *` This is PyUnicode_InternFromString; PyDict_SetItemString, PyObject_SetAttrString; PyObject_DelAttrString; PyUnicode_InternFromString; and the PyModule_Add convenience functions. Always point out a non-immortalizing alternative. * Don't immortalize user-provided attr names in _ctypes * Immortalize names in code objects to avoid crash (GH-121903) * Intern latin-1 one-byte strings at startup (GH-122303) There are some 3.12-specific changes, mainly to allow statically allocated strings in deepfreeze. (In 3.13, deepfreeze switched to the general `_Py_ID`/`_Py_STR`.) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.12] GH-95079: document error behaviour for some unicode C APIs (GH-95080) ↵Miss Islington (bot)2024-09-271-0/+9
| | | | | | | (#124662) (cherry picked from commit b79a21ea429844e84509430e636d808ea9cff244) Co-authored-by: Max Bachmann <kontakt@maxbachmann.de>
* [3.12] gh-101100: Add a table of class attributes to the "Custom classes" ↵Alex Waygood2024-09-254-18/+20
| | | | section of the data model docs (#124480) (#124558)
* [3.12] Use pep role instead of url (GH-121611) (#124173)Miss Islington (bot)2024-09-172-4/+4
| | | | Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
* [3.12] Swap the and from in sentence in init_config.rst (GH-120086) (#123743)Miss Islington (bot)2024-09-051-1/+1
| | | | Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
* [3.12] gh-123517: Remove unnecessary `:meth:` parentheses (gh-123518) ↵Wei-Hsiang (Matt) Wang2024-09-021-2/+2
| | | | (GH-123576)
* [3.12] gh-123492: Remove unnecessary `:func:` parentheses (gh-123493) (#123512)Wei-Hsiang (Matt) Wang2024-08-302-2/+2
|
* [3.12] gh-123254: Improve `tuple` C API docs with more info about errors ↵Miss Islington (bot)2024-08-281-8/+16
| | | | | | | | | (GH-123255) (#123415) gh-123254: Improve `tuple` C API docs with more info about errors (GH-123255) (cherry picked from commit 6f563e364d1a7902417573f842019746a79cdc1b) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.12] gh-122613: Document PyLong_GetInfo() (part of Limited API) ↵Sergey B Kirpichev2024-08-051-0/+11
| | | | | | (GH-122280) (#122644) [3.12] gh-122613: Document PyLong_GetInfo() (part of Limited API) (GH-GH-122280) (cherry picked from commit d91ac525ef166edc0083acf5a96f81b87324fe7f)
* [3.12] gh-122623: Improve `c-api/bytearray.rst` with error handling info ↵Miss Islington (bot)2024-08-031-2/+7
| | | | | | | | (GH-122624) (#122659) gh-122623: Improve `c-api/bytearray.rst` with error handling info (GH-122624) (cherry picked from commit 151934a324789c58cca9c7bbd6753d735454df5a) Co-authored-by: sobolevn <mail@sobolevn.me>
* [3.12] Docs: spelling and grammar fixes (GH-122084) (#122107)Russell Keith-Magee2024-07-221-2/+2
| | | | | | (cherry picked from commit bc264eac3ad14dab748e33b3d714c2674872791f) Co-authored-by: Ville Skyttä <ville.skytta@iki.fi> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.12] GH-121970: Rewrite the C-API annotations extension (GH-121985) (#122025)Adam Turner2024-07-191-2/+4
| | | | | (cherry picked from commit 22c9d9c1fcc3bb6186524330b169eda6df450f1b) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.12] gh-121905: Consistently use "floating-point" instead of "floating ↵Serhiy Storchaka2024-07-194-14/+14
| | | | | point" (GH-121907) (GH-122013) (cherry picked from commit 1a0c7b9ba48a2dffb70bb0c7327abae1d3e87356)
* [3.12] gh-121834: Improve `complex` C-API docs (GH-121835) (#121897)sobolevn2024-07-171-6/+18
| | | | | | | | * [3.12] gh-121834: Improve `complex` C-API docs (GH-121835) (cherry picked from commit 72dccd60735b597e99c007a7b69210763a746877) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.12] gh-121749: Fix discrepancy in docs for `PyModule_AddObjectRef` ↵Miss Islington (bot)2024-07-141-1/+1
| | | | | | | (GH-121750) (GH-121753) (cherry picked from commit 26dfb2771236bfd96cdaa1081103f75141ecff47) Co-authored-by: Dominic H <dom@dominic.sk>
* [3.12] gh-121615: Improve `module.rst` C-API docs with better error ↵sobolevn2024-07-111-7/+14
| | | | | descriptions (GH-121616) (#121619) (cherry picked from commit e6264b44dc7221c713b14dfa0f5929b33d362829)
* [3.12] gh-121567: Improve `slice` C-API docs by mentioning exceptions ↵Miss Islington (bot)2024-07-101-3/+5
| | | | | | | | | (GH-121568) (#121579) gh-121567: Improve `slice` C-API docs by mentioning exceptions (GH-121568) (cherry picked from commit 84a5597b08b7d53aced2fbd0048271ce762807a8) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.12] gh-121533: Improve `PyCell_[Get,Set]` docs: mention the exceptions ↵Miss Islington (bot)2024-07-091-3/+6
| | | | | | | | | (GH-121534) (#121540) gh-121533: Improve `PyCell_[Get,Set]` docs: mention the exceptions (GH-121534) (cherry picked from commit 649d5b6d7b04607dd17810ac73e8f16720c6dc78) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (GH-112237) ↵Miss Islington (bot)2024-07-031-2/+2
| | | | | | | | (#121310) docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (GH-112237) (cherry picked from commit 4232976b02cb999335c6bfdec3315520b21954f2) Co-authored-by: da-woods <dw-git@d-woods.co.uk>
* [3.12] gh-120838: Add a Note in the Docs About Expectations for ↵Miss Islington (bot)2024-06-211-3/+10
| | | | | | | Py_Finalize() (gh-120853) (cherry picked from commit 03fa2df92707b543c304a426732214002f81d671, AKA gh-120839) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.12] gh-119467: Fix Py_buffer.format type and correct documentation typo ↵Miss Islington (bot)2024-05-271-2/+2
| | | | | | | | (GH-119475) (#119603) gh-119467: Fix Py_buffer.format type and correct documentation typo (GH-119475) (cherry picked from commit 3b26cd8ca0e6c65e4b61effea9aa44d06e926797) Co-authored-by: Aditya Borikar <adityaborikar2@gmail.com>
* [3.12] docs: fix a few typos identified by codespell (GH-119516) (#119571)Hugo van Kemenade2024-05-261-2/+2
| | | | Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
* [3.12] Format None, True, False and NotImplemented as literals (GH-118758) ↵Serhiy Storchaka2024-05-081-1/+1
| | | | | (GH-118794) (cherry picked from commit 05c2fe1acda9ea5a57061642c36e8b73bb4fbba4)
* [3.12] gh-116935: Document that heap types need to support garbage ↵Miss Islington (bot)2024-04-191-1/+2
| | | | | | | | collection (GH-118021) (GH-118092) gh-116935: Document that heap types need to support garbage collection (GH-118021) (cherry picked from commit 5d544365742a117027747306e2d4473f3b73d921) Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
* [3.12] gh-117518: Clarify PyTuple_GetItem() borrowed reference in the doc ↵Miss Islington (bot)2024-04-191-0/+6
| | | | | | | | (GH-117920) (#118087) gh-117518: Clarify PyTuple_GetItem() borrowed reference in the doc (GH-117920) (cherry picked from commit 4605a197bd84da1a232bd835d8e8e654f2fef220) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-73231: Update documentation for PyErr_SetFromWindowsErr() ↵Miss Islington (bot)2024-04-171-4/+5
| | | | | | | (GH-117226) (GH-117973) (cherry picked from commit 438b7c3071eebaccd1ba215f15a239345b22f813) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] Docs: add link roles with Sphinx extlinks (GH-117850) (#117910)Hugo van Kemenade2024-04-151-1/+1
| | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* [3.12] gh-115664: Fix ordering of more versionadded and versionchanged ↵Serhiy Storchaka2024-03-074-8/+8
| | | | | directives (GH-116298) (GH-116450) (cherry picked from commit 808a77612fb89b125d25efac2788522a100e8a6d)
* [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-115653: Document PyCode_GetFirstFree() (GH-115654) (#115752)Miss Islington (bot)2024-02-211-2/+6
| | | | | | | | gh-115653: Document PyCode_GetFirstFree() (GH-115654) Correct the return type of the PyCode_GetNumFree() documentation. (cherry picked from commit 10fc4675fdb14e19f2fdd15102c6533b9f71e992) Co-authored-by: Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com>
* [3.12] gh-101100: Fix Sphinx warnings in `whatsnew/3.2.rst` (GH-115580) ↵Miss Islington (bot)2024-02-172-0/+52
| | | | | | | (#115589) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* [3.12] gh-113437: Update documentation about PyUnicode_AsWideChar() function ↵Miss Islington (bot)2024-02-141-1/+6
| | | | | | | (GH-113455) (GH-115407) (cherry picked from commit 5719aa23ab7f1c7a5f03309ca4044078a98e7b59) Co-authored-by: qqwqqw689 <114795525+qqwqqw689@users.noreply.github.com>
* [3.12] gh-101100: Fix sphinx warnings in `c-api/gcsupport.rst` (GH-114786) ↵Miss Islington (bot)2024-02-131-3/+8
| | | | | | (#115263) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-101100: Clean up Doc/c-api/exceptions.rst and Doc/c-api/sys.rst ↵Miss Islington (bot)2024-02-112-18/+28
| | | | | | | | (GH-114825) (GH-115308) (cherry picked from commit e1552fd19de17e7a6daa3c2a6d1ca207bb8eaf8e) Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com>
* [3.12] gh-115172: Fix explicit index extries for the C API (GH-115173) ↵Serhiy Storchaka2024-02-1111-150/+147
| | | | | (GH-115292) (cherry picked from commit 573acb30f22a84c0f2c951efa002c9946e29b6a3)
* [3.12] Docs: correctly link to code objects (GH-115214) (#115216)Miss Islington (bot)2024-02-091-2/+3
| | | | | (cherry picked from commit 769d4448260aaec687d9306950225316f9faefce) Co-authored-by: Erlend E. Aasland <erlend@python.org>
* [3.12] gh-101100: Fix Py_DEBUG dangling Sphinx references (GH-115003) (#115135)Miss Islington (bot)2024-02-071-5/+6
| | | | | | gh-101100: Fix Py_DEBUG dangling Sphinx references (GH-115003) (cherry picked from commit d0322fdf2c1a7292a43959fe5a572d783b88a1c4) Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com>
* [3.12] GH-69695: Update ``PyImport_ImportModule`` description (GH-103836) ↵Miss Islington (bot)2024-02-051-14/+2
| | | | | | | | | | | GH-114925) GH-69695: Update ``PyImport_ImportModule`` description (GH-103836) (cherry picked from commit 9872855a31720f514b84373848b49fca09d66ecd) Co-authored-by: patenaud <33957588+patenaud@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* [3.12] gh-101100: Fix sphinx warnings in `c-api/file.rst` (GH-114546) (#114584)Miss Islington (bot)2024-02-042-2/+15
| | | | | | | * gh-101100: Fix sphinx warnings in `c-api/file.rst` (GH-114546) (cherry picked from commit 01d970c1b8acf3ccf199d5de151a635ffd9d8c61) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* [3.12] gh-101100: Fix sphinx warnings in `Doc/c-api/memoryview.rst` ↵Miss Islington (bot)2024-01-291-0/+13
| | | | | | | (GH-114669) (GH-114704) (cherry picked from commit 97fb2480e4807a34b8197243ad57566ed7769e24) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-113445: Amend PyObject_RichCompareBool() docs (GH-113891) (GH-114638)Miss Islington (bot)2024-01-271-6/+2
| | | | | (cherry picked from commit 926881dc10ebf77069e02e66eea3e0d3ba500fe5) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
* [3.12] Document PyOS_strtoul and PyOS_strtol (GH-114048) (GH-114618)Miss Islington (bot)2024-01-261-0/+36
| | | | | (cherry picked from commit 3f62bf32caf04cedb2c59579a0ce835d1e793d4d) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
* [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-101100: Fix sphinx warnings in `Doc/c-api/memory.rst` (GH-114373) ↵Miss Islington (bot)2024-01-211-2/+2
| | | | | | | | (#114377) gh-101100: Fix sphinx warnings in `Doc/c-api/memory.rst` (GH-114373) (cherry picked from commit 47133d8d869c94c4d1f340b5481cc3f2cdc7d68b) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-112092: clarify unstable ABI recompilation requirements ↵Miss Islington (bot)2024-01-181-1/+1
| | | | | | | | | | (GH-112093) (#114260) gh-112092: clarify unstable ABI recompilation requirements (GH-112093) Use different versions in the examples for when extensions do and do not need to be recompiled to make the examples easier to understand. (cherry picked from commit 68a7b78cd5185cbd9456f42c15ecf872a7c16f44) Co-authored-by: DerSchinken <53398996+DerSchinken@users.noreply.github.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>
* [3.12] gh-101578: [doc] mention that PyErr_GetRaisedException returns NULL ↵Miss Islington (bot)2023-12-311-1/+1
| | | | | | | | when the error indicator is not set (GH-113369) (#113606) gh-101578: [doc] mention that PyErr_GetRaisedException returns NULL when the error indicator is not set (GH-113369) (cherry picked from commit 2849cbb53afc8c6a4465f1b3490c67c2455caf6f) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.12] docs: specify that PyBytes_AsStringAndSize returns 0 on success ↵Miss Islington (bot)2023-12-251-0/+1
| | | | | | | (GH-110888) (GH-111690) (cherry picked from commit 9f33ede12710c454643c394421f52d209247272c) Co-authored-by: lefp <70862148+lefp@users.noreply.github.com>
* [3.12] gh-101100: Improve docs on exception attributes (GH-113057) (#113061)Miss Islington (bot)2023-12-131-6/+10
| | | | | | | gh-101100: Improve docs on exception attributes (GH-113057) (cherry picked from commit d05a180350fe20d5fde56c7e525e394a0b282703) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>