Commit graph

1527 commits

Author SHA1 Message Date
Miss Islington (bot)
c3e705fbe5
[3.12] Doc: C API: Move tp_dealloc paragraph to tp_dealloc section (GH-125737) (#125799)
Doc: C API: Move `tp_dealloc` paragraph to `tp_dealloc` section (GH-125737)

It looks like commit 43cf44ddcc
(gh-31501) accidentally moved the paragraph to the `tp_finalize`
section when the intent was to move it to the `tp_dealloc` section
(according to the commit message).

(cherry picked from commit d880c83ff7)

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2024-10-21 09:55:11 -07:00
Miss Islington (bot)
243a8a9d68
[3.12] gh-101291: Add versionadded directives for PyUnstable_Long_* (GH-125384) (#125408)
gh-101291: Add versionadded directives for PyUnstable_Long_* (GH-125384)
(cherry picked from commit c6d7b644c2)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-10-13 17:45:59 +00:00
Alex Waygood
cba37762ac
[3.12] gh-101100: Consolidate documentation on ModuleType attributes (#124709) (#125211)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Barry Warsaw <barry@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-09 19:18:38 +00:00
Miss Islington (bot)
a62d2d3318
[3.12] gh-124182: Explain naming rules for struct sequence types (GH-124335) (#125056)
gh-124182: Explain naming rules for struct sequence types (GH-124335)
(cherry picked from commit 3287c834e5)

Co-authored-by: ffelixg <142172984+ffelixg@users.noreply.github.com>
2024-10-07 17:59:31 +00:00
Miss Islington (bot)
58f7763b88
[3.12] gh-115145: Update documentation about `PyThreadState_DeleteCurrent` (gh-124920) (gh-124931)
gh-115145: Update documentation about ``PyThreadState_DeleteCurrent`` (gh-124920)
(cherry picked from commit 9eeb21bf76)

Co-authored-by: Donghee Na <donghee.na@python.org>
2024-10-03 10:45:25 +00:00
sobolevn
f9cce95750
[3.12] Fix c-api/file.rst indexes (GH-114608) (#124786)
(cherry picked from commit 23fb9f0777)
2024-09-30 13:50:33 +00:00
Petr Viktorin
49f6beb56a
[3.12] gh-113993: Make interned strings mortal (GH-120520, GH-121364, 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>
2024-09-27 13:28:48 -07:00
Miss Islington (bot)
fb8d604d55
[3.12] GH-95079: document error behaviour for some unicode C APIs (GH-95080) (#124662)
(cherry picked from commit b79a21ea42)

Co-authored-by: Max Bachmann <kontakt@maxbachmann.de>
2024-09-27 10:42:23 +00:00
Alex Waygood
d2068c65a6
[3.12] gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) (#124558) 2024-09-25 23:01:19 +00:00
Miss Islington (bot)
a032a96a92
[3.12] Use pep role instead of url (GH-121611) (#124173)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-09-17 13:08:38 +00:00
Miss Islington (bot)
b01063dbca
[3.12] Swap the and from in sentence in init_config.rst (GH-120086) (#123743)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-09-05 20:11:25 +00:00
Wei-Hsiang (Matt) Wang
d47d7e1124
[3.12] gh-123517: Remove unnecessary :meth: parentheses (gh-123518) (GH-123576) 2024-09-02 16:02:39 +02:00
Wei-Hsiang (Matt) Wang
d5abd02f36
[3.12] gh-123492: Remove unnecessary :func: parentheses (gh-123493) (#123512) 2024-08-30 20:09:55 +03:00
Miss Islington (bot)
248af25fb4
[3.12] gh-123254: Improve tuple C API docs with more info about errors (GH-123255) (#123415)
gh-123254: Improve `tuple` C API docs with more info about errors (GH-123255)
(cherry picked from commit 6f563e364d)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-08-28 07:37:06 +00:00
Sergey B Kirpichev
2ff41583fd
[3.12] gh-122613: Document PyLong_GetInfo() (part of Limited API) (GH-122280) (#122644)
[3.12] gh-122613: Document PyLong_GetInfo() (part of Limited API) (GH-GH-122280)
(cherry picked from commit d91ac525ef)
2024-08-05 20:11:42 +02:00
Miss Islington (bot)
62f224a9ad
[3.12] gh-122623: Improve c-api/bytearray.rst with error handling info (GH-122624) (#122659)
gh-122623: Improve `c-api/bytearray.rst` with error handling info (GH-122624)
(cherry picked from commit 151934a324)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-08-03 22:02:24 +00:00
Russell Keith-Magee
71970d602f
[3.12] Docs: spelling and grammar fixes (GH-122084) (#122107)
(cherry picked from commit bc264eac3a)

Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-21 18:39:48 -07:00
Adam Turner
ff98d9021a
[3.12] GH-121970: Rewrite the C-API annotations extension (GH-121985) (#122025)
(cherry picked from commit 22c9d9c1fc)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-07-19 12:48:50 +00:00
Serhiy Storchaka
39dea212f4
[3.12] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122013)
(cherry picked from commit 1a0c7b9ba4)
2024-07-19 09:08:33 +00:00
sobolevn
6a19d22a19
[3.12] gh-121834: Improve complex C-API docs (GH-121835) (#121897)
* [3.12] gh-121834: Improve `complex` C-API docs (GH-121835)
(cherry picked from commit 72dccd6073)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-07-17 07:30:18 +00:00
Miss Islington (bot)
004758e3a4
[3.12] gh-121749: Fix discrepancy in docs for PyModule_AddObjectRef (GH-121750) (GH-121753)
(cherry picked from commit 26dfb27712)

Co-authored-by: Dominic H <dom@dominic.sk>
2024-07-14 12:31:58 +02:00
sobolevn
5492f84c14
[3.12] gh-121615: Improve module.rst C-API docs with better error descriptions (GH-121616) (#121619)
(cherry picked from commit e6264b44dc)
2024-07-11 09:12:06 +00:00
Miss Islington (bot)
06b2ba3831
[3.12] gh-121567: Improve slice C-API docs by mentioning exceptions (GH-121568) (#121579)
gh-121567: Improve `slice` C-API docs by mentioning exceptions (GH-121568)
(cherry picked from commit 84a5597b08)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-07-10 11:03:22 +00:00
Miss Islington (bot)
e1a223431f
[3.12] gh-121533: Improve PyCell_[Get,Set] docs: mention the exceptions (GH-121534) (#121540)
gh-121533: Improve `PyCell_[Get,Set]` docs: mention the exceptions (GH-121534)
(cherry picked from commit 649d5b6d7b)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-09 19:03:12 +03:00
Miss Islington (bot)
4ade7723e8
[3.12] docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (GH-112237) (#121310)
docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (GH-112237)
(cherry picked from commit 4232976b02)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
2024-07-03 13:50:02 +05:30
Miss Islington (bot)
a57d917a48
[3.12] gh-120838: Add a Note in the Docs About Expectations for Py_Finalize() (gh-120853)
(cherry picked from commit 03fa2df927, AKA gh-120839)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-06-21 19:12:08 +00:00
Miss Islington (bot)
8d7e54af0d
[3.12] gh-119467: Fix Py_buffer.format type and correct documentation typo (GH-119475) (#119603)
gh-119467: Fix Py_buffer.format type and correct documentation typo (GH-119475)
(cherry picked from commit 3b26cd8ca0)

Co-authored-by: Aditya Borikar <adityaborikar2@gmail.com>
2024-05-27 12:22:23 +00:00
Hugo van Kemenade
7f86c769db
[3.12] docs: fix a few typos identified by codespell (GH-119516) (#119571)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2024-05-26 08:15:57 +00:00
Serhiy Storchaka
530c3bb271
[3.12] Format None, True, False and NotImplemented as literals (GH-118758) (GH-118794)
(cherry picked from commit 05c2fe1acd)
2024-05-08 19:55:13 +00:00
Miss Islington (bot)
f278b8fefc
[3.12] gh-116935: Document that heap types need to support garbage collection (GH-118021) (GH-118092)
gh-116935: Document that heap types need to support garbage collection (GH-118021)
(cherry picked from commit 5d54436574)

Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
2024-04-19 11:44:19 +02:00
Miss Islington (bot)
15be34ade8
[3.12] gh-117518: Clarify PyTuple_GetItem() borrowed reference in the doc (GH-117920) (#118087)
gh-117518: Clarify PyTuple_GetItem() borrowed reference in the doc (GH-117920)
(cherry picked from commit 4605a197bd)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-04-19 10:57:51 +02:00
Miss Islington (bot)
ac48fdeb0d
[3.12] gh-73231: Update documentation for PyErr_SetFromWindowsErr() (GH-117226) (GH-117973)
(cherry picked from commit 438b7c3071)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-04-17 10:28:55 +00:00
Hugo van Kemenade
eb0bfb5910
[3.12] Docs: add link roles with Sphinx extlinks (GH-117850) (#117910)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-04-15 13:18:21 -06:00
Serhiy Storchaka
1e75fe1468
[3.12] gh-115664: Fix ordering of more versionadded and versionchanged directives (GH-116298) (GH-116450)
(cherry picked from commit 808a77612f)
2024-03-07 08:21:25 +00:00
Miss Islington (bot)
6e89141d73
[3.12] Fix the PyGetSetDef documentation (GH-116056) (GH-116363)
closure is not a function pointer, it is a user data pointer.
(cherry picked from commit df59401108)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-03-05 16:16:50 +00:00
Miss Islington (bot)
8d0ec39732
[3.12] gh-115653: Document PyCode_GetFirstFree() (GH-115654) (#115752)
gh-115653: Document PyCode_GetFirstFree() (GH-115654)

Correct the return type of the PyCode_GetNumFree() documentation.
(cherry picked from commit 10fc4675fd)

Co-authored-by: Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com>
2024-02-21 11:31:56 +01:00
Miss Islington (bot)
2763f382f9
[3.12] gh-101100: Fix Sphinx warnings in whatsnew/3.2.rst (GH-115580) (#115589)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-17 14:18:30 -07:00
Miss Islington (bot)
03d2c3b804
[3.12] gh-113437: Update documentation about PyUnicode_AsWideChar() function (GH-113455) (GH-115407)
(cherry picked from commit 5719aa23ab)

Co-authored-by: qqwqqw689 <114795525+qqwqqw689@users.noreply.github.com>
2024-02-14 11:24:40 +01:00
Miss Islington (bot)
45e5599130
[3.12] gh-101100: Fix sphinx warnings in c-api/gcsupport.rst (GH-114786) (#115263)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-13 14:25:54 -07:00
Miss Islington (bot)
67688609d2
[3.12] gh-101100: Clean up Doc/c-api/exceptions.rst and Doc/c-api/sys.rst (GH-114825) (GH-115308)
(cherry picked from commit e1552fd19d)

Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com>
2024-02-11 19:02:21 +00:00
Serhiy Storchaka
b9f560258c
[3.12] gh-115172: Fix explicit index extries for the C API (GH-115173) (GH-115292)
(cherry picked from commit 573acb30f2)
2024-02-11 10:34:41 +00:00
Miss Islington (bot)
370cbbbfeb
[3.12] Docs: correctly link to code objects (GH-115214) (#115216)
(cherry picked from commit 769d444826)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-02-09 14:17:49 +00:00
Miss Islington (bot)
a69e68db60
[3.12] gh-101100: Fix Py_DEBUG dangling Sphinx references (GH-115003) (#115135)
gh-101100: Fix Py_DEBUG dangling Sphinx references (GH-115003)
(cherry picked from commit d0322fdf2c)

Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com>
2024-02-07 10:55:21 +00:00
Miss Islington (bot)
d334122d22
[3.12] GH-69695: Update `PyImport_ImportModule` description (GH-103836) GH-114925)
GH-69695: Update ``PyImport_ImportModule`` description (GH-103836)

(cherry picked from commit 9872855a31)

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>
2024-02-05 10:53:57 +01:00
Miss Islington (bot)
cf2ecbc514
[3.12] gh-101100: Fix sphinx warnings in c-api/file.rst (GH-114546) (#114584)
* gh-101100: Fix sphinx warnings in `c-api/file.rst` (GH-114546)
(cherry picked from commit 01d970c1b8)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-02-04 10:57:19 +02:00
Miss Islington (bot)
930f805e72
[3.12] gh-101100: Fix sphinx warnings in Doc/c-api/memoryview.rst (GH-114669) (GH-114704)
(cherry picked from commit 97fb2480e4)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-01-29 10:02:06 +00:00
Miss Islington (bot)
3bf5d90360
[3.12] gh-113445: Amend PyObject_RichCompareBool() docs (GH-113891) (GH-114638)
(cherry picked from commit 926881dc10)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-01-27 08:02:15 +00:00
Miss Islington (bot)
c95cdd0a82
[3.12] Document PyOS_strtoul and PyOS_strtol (GH-114048) (GH-114618)
(cherry picked from commit 3f62bf32ca)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-01-26 17:50:33 +00:00
Miss Islington (bot)
3a588d09d5
[3.12] gh-101100: Fix Sphinx warnings in c-api/structures.rst (GH-113564) (#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>
2024-01-24 13:48:36 +00:00
Miss Islington (bot)
69f876a82a
[3.12] gh-101100: Fix sphinx warnings in Doc/c-api/memory.rst (GH-114373) (#114377)
gh-101100: Fix sphinx warnings in `Doc/c-api/memory.rst` (GH-114373)
(cherry picked from commit 47133d8d86)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-01-21 09:41:00 +00:00