| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
(cherry picked from commit 23fb9f0777b054526b3b32f58e60b2a03132bf45)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
| |
(#124662)
(cherry picked from commit b79a21ea429844e84509430e636d808ea9cff244)
Co-authored-by: Max Bachmann <kontakt@maxbachmann.de>
|
| |
|
|
| |
section of the data model docs (#124480) (#124558)
|
| |
|
|
| |
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
|
| |
|
|
| |
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
|
| |
|
|
| |
(GH-123576)
|
| | |
|
| |
|
|
|
|
|
|
|
| |
(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>
|
| |
|
|
|
|
| |
(GH-122280) (#122644)
[3.12] gh-122613: Document PyLong_GetInfo() (part of Limited API) (GH-GH-122280)
(cherry picked from commit d91ac525ef166edc0083acf5a96f81b87324fe7f)
|
| |
|
|
|
|
|
|
| |
(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>
|
| |
|
|
|
|
| |
(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>
|
| |
|
|
|
| |
(cherry picked from commit 22c9d9c1fcc3bb6186524330b169eda6df450f1b)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
| |
|
|
|
| |
point" (GH-121907) (GH-122013)
(cherry picked from commit 1a0c7b9ba48a2dffb70bb0c7327abae1d3e87356)
|
| |
|
|
|
|
|
|
| |
* [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>
|
| |
|
|
|
|
|
| |
(GH-121750) (GH-121753)
(cherry picked from commit 26dfb2771236bfd96cdaa1081103f75141ecff47)
Co-authored-by: Dominic H <dom@dominic.sk>
|
| |
|
|
|
| |
descriptions (GH-121616) (#121619)
(cherry picked from commit e6264b44dc7221c713b14dfa0f5929b33d362829)
|
| |
|
|
|
|
|
|
|
| |
(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>
|
| |
|
|
|
|
|
|
|
| |
(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>
|
| |
|
|
|
|
|
|
| |
(#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>
|
| |
|
|
|
|
|
| |
Py_Finalize() (gh-120853)
(cherry picked from commit 03fa2df92707b543c304a426732214002f81d671, AKA gh-120839)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
|
|
|
| |
(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>
|
| |
|
|
| |
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
|
| |
|
|
|
| |
(GH-118794)
(cherry picked from commit 05c2fe1acda9ea5a57061642c36e8b73bb4fbba4)
|
| |
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
| |
(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>
|
| |
|
|
|
|
|
| |
(GH-117226) (GH-117973)
(cherry picked from commit 438b7c3071eebaccd1ba215f15a239345b22f813)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
| |
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
| |
|
|
|
| |
directives (GH-116298) (GH-116450)
(cherry picked from commit 808a77612fb89b125d25efac2788522a100e8a6d)
|
| |
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
| |
(#115589)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
| |
|
|
|
|
|
| |
(GH-113455) (GH-115407)
(cherry picked from commit 5719aa23ab7f1c7a5f03309ca4044078a98e7b59)
Co-authored-by: qqwqqw689 <114795525+qqwqqw689@users.noreply.github.com>
|
| |
|
|
|
|
| |
(#115263)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|
| |
|
|
|
|
|
|
| |
(GH-114825) (GH-115308)
(cherry picked from commit e1552fd19de17e7a6daa3c2a6d1ca207bb8eaf8e)
Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com>
|
| |
|
|
|
| |
(GH-115292)
(cherry picked from commit 573acb30f22a84c0f2c951efa002c9946e29b6a3)
|
| |
|
|
|
| |
(cherry picked from commit 769d4448260aaec687d9306950225316f9faefce)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
|
| |
|
|
|
|
| |
gh-101100: Fix Py_DEBUG dangling Sphinx references (GH-115003)
(cherry picked from commit d0322fdf2c1a7292a43959fe5a572d783b88a1c4)
Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
| |
(GH-114669) (GH-114704)
(cherry picked from commit 97fb2480e4807a34b8197243ad57566ed7769e24)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|
| |
|
|
|
| |
(cherry picked from commit 926881dc10ebf77069e02e66eea3e0d3ba500fe5)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
| |
|
|
|
| |
(cherry picked from commit 3f62bf32caf04cedb2c59579a0ce835d1e793d4d)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
| |
|
|
|
|
|
|
| |
(#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>
|
| |
|
|
|
|
|
|
| |
(#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>
|
| |
|
|
|
|
|
|
|
|
| |
(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>
|
| |
|
|
|
|
|
|
|
| |
(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>
|
| |
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
| |
(GH-110888) (GH-111690)
(cherry picked from commit 9f33ede12710c454643c394421f52d209247272c)
Co-authored-by: lefp <70862148+lefp@users.noreply.github.com>
|
| |
|
|
|
|
|
| |
gh-101100: Improve docs on exception attributes (GH-113057)
(cherry picked from commit d05a180350fe20d5fde56c7e525e394a0b282703)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|