| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
test (GH-129406) (GH-130507)
(cherry picked from commit fc8d2cba541f378df0a439412665f3dbe0b9ae3c)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
| |
|
|
|
|
|
|
| |
(#129612)
gh-101944: Clarify PyModule_AddObjectRef() documentation (GH-129433)
(cherry picked from commit 04264a286e5ddfe8ac7423f7376ca34a2ca8b7ba)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
|
|
|
| |
(#124709) (#125208)
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>
|
| |
|
|
|
|
|
| |
(#124244)
gh-118915: Add/fix docs entries for some new 3.13 C API (GH-124134)
(cherry picked from commit 32119fc377a4d9df524a7bac02b6922a990361dd)
|
| |
|
|
|
|
|
|
|
| |
(#122971)
GH-109975: Copyedit 3.13 What's New: Release Highlights (GH-122958)
(cherry picked from commit db6f5e193315a3bbfa7b0b6644203bae3f76b638)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
|
| |
|
|
|
|
| |
GH-121970: Rewrite the C-API annotations extension (#121985)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
(cherry picked from commit 22c9d9c1fcc3bb6186524330b169eda6df450f1b)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
immortalizing in other API (GH-121364) (GH-121854)
* 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
(cherry picked from commit b4aedb23ae7954fb58084dda16cd41786819a8cf)
|
| |
|
|
|
|
|
| |
(GH-121750) (GH-121752)
(cherry picked from commit 26dfb2771236bfd96cdaa1081103f75141ecff47)
Co-authored-by: Dominic H <dom@dominic.sk>
|
| |
|
|
|
|
|
|
| |
descriptions (GH-121616) (#121618)
gh-121615: Improve `module.rst` C-API docs with better error descriptions (GH-121616)
(cherry picked from commit e6264b44dc7221c713b14dfa0f5929b33d362829)
Co-authored-by: sobolevn <mail@sobolevn.me>
|
| |
|
|
|
|
|
|
| |
(GH-119017) (#119367)
Docs: Add central references to free-threading-related options (GH-119017)
(cherry picked from commit 9fa206aaeccc979a4bd03852ba38c045294a3d6f)
Co-authored-by: Brett Simmers <swtaarrs@users.noreply.github.com>
|
| |
|
|
| |
(GH-118645)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This PR adds the ability to enable the GIL if it was disabled at
interpreter startup, and modifies the multi-phase module initialization
path to enable the GIL when loading a module, unless that module's spec
includes a slot indicating it can run safely without the GIL.
PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went
with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148.
A warning will be issued up to once per interpreter for the first
GIL-using module that is loaded. If `-v` is given, a shorter message
will be printed to stderr every time a GIL-using module is loaded
(including the first one that issues a warning).
|
| | |
|
| |
|
|
|
| |
PEP 683 (immortal objects) revealed some ways in which the Python documentation has been unnecessarily coupled to the implementation details of reference counts. In the end users should focus on reference ownership, including taking references and releasing them, rather than on how many reference counts an object has.
This change updates the documentation to reflect that perspective. It also updates the docs relative to immortal objects in a handful of places.
|
| |
|
| |
It was added in 3.12 for PEP 684 (per-interpreter GIL).
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
It is a fixed implementation of PyModule_AddObject() which consistently
steals reference both on success and on failure.
|
| |
|
|
|
|
|
|
|
|
|
| |
* Uncomment object removal in pairindextypes
* Use new-style index directive ('object') - C API
* Use new-style index directive ('object') - Library
* Use new-style index directive ('object') - Reference
* Use new-style index directive ('object') - Tutorial
|
| | |
|
| |
|
|
| |
(#97774)
|
| | |
|
| |
|
|
|
| |
I think that none of these API calls can fail, but only few of them are
documented as such. Add the sentence "This function always succeeds" (which is
the same already used e.g. by PyNumber_Check) to all of them.
|
| |
|
|
|
| |
Added PyModule_AddObjectRef() function: similar to
PyModule_AddObjectRef() but don't steal a reference to the value on
success.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
Adds a short description of `PyDoc_STRVAR` and `PyDoc_STR` to "Useful macros" section of C-API docs.
Currently, there is [one lone mention](https://docs.python.org/3/c-api/module.html?highlight=pydoc_strvar#c.PyModuleDef) in the C-API reference, despite the fact that `PyDoc_STRVAR` is ubiquitous to `Modules/`.
Additionally, this properly uses `c:macro` within `Doc/c-api/module.rst` to link.
|
| |
|
|
| |
Fix PyInterpreterState_New(): Don't call PyErr_SetString() when there
is no current Python thread state (if tstate is NULL).
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Extension modules: m_traverse, m_clear and m_free functions of
PyModuleDef are no longer called if the module state was requested
but is not allocated yet. This is the case immediately after the
module is created and before the module is executed (Py_mod_exec
function). More precisely, these functions are not called if m_size is
greater than 0 and the module state (as returned by
PyModule_GetState()) is NULL.
Extension modules without module state (m_size <= 0) are not affected.
Co-Authored-By: Petr Viktorin <encukou@gmail.com>
|
| |
|
|
|
| |
This was never intented to be called manually from PyInit_*.
Also, clarify PyState_RemoveModule return value.
|
| |
|
|
| |
Replace all *NULL* with ``NULL``.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add a note to the PyModule_AddObject docs.
* Correct example usages of PyModule_AddObject.
* Whitespace.
* Clean up wording.
* 📜🤖 Added by blurb_it.
* First code review.
* Add < 0 in the tests with PyModule_AddObject
|
| |
|
|
| |
highlightlang is deprecated since April 2018 in Sphinx.
See https://github.com/sphinx-doc/sphinx/pull/4845
|
| |
|
|
|
| |
Multi-phase initialized modules allow m_traverse to be called while the
module is still being initialized, so module authors may need to account
for that.
|
| |
|
| |
`PyModule_New()` now refers to `PyModule_NewObject()`
|
| | |
|
| |
|
|
|
|
|
|
| |
Multi-phase extension module import now correctly allows the
``m_methods`` field to be used to add module level functions
to instances of non-module types returned from ``Py_create_mod``.
Patch by Xiang Zhang.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
This affects documentation, code comments, and a debugging messages.
|
| |
|
|
| |
Patch by Petr Viktorin.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Known limitations of the current implementation:
- documentation changes are incomplete
- there's a reference leak I haven't tracked down yet
The leak is most visible by running:
./python -m test -R3:3 test_importlib
However, you can also see it by running:
./python -X showrefcount
Importing the array or _testmultiphase modules, and
then deleting them from both sys.modules and the local
namespace shows significant increases in the total
number of active references each cycle. By contrast,
with _testcapi (which continues to use single-phase
initialisation) the global refcounts stabilise after
a couple of cycles.
|
| |\ |
|
| | |
| |
| |
| |
| | |
The signature and description of PyException_SetCause now use "cause"
rather than "ctx" to match the code.
|
| |\ \
| |/ |
|
| | | |
|