summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/module.rst
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-129405: Fix doc for Py_mod_multiple_interpreters default, and add ↵Miss Islington (bot)2025-02-241-1/+1
| | | | | | | test (GH-129406) (GH-130507) (cherry picked from commit fc8d2cba541f378df0a439412665f3dbe0b9ae3c) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.13] gh-101944: Clarify PyModule_AddObjectRef() documentation (GH-129433) ↵Miss Islington (bot)2025-02-031-3/+4
| | | | | | | | (#129612) gh-101944: Clarify PyModule_AddObjectRef() documentation (GH-129433) (cherry picked from commit 04264a286e5ddfe8ac7423f7376ca34a2ca8b7ba) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-101100: Consolidate documentation on `ModuleType` attributes ↵Alex Waygood2024-10-091-10/+12
| | | | | | | | (#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>
* [3.13] gh-118915: Add/fix docs entries for some new 3.13 C API (GH-124134) ↵Petr Viktorin2024-09-231-0/+2
| | | | | | | (#124244) gh-118915: Add/fix docs entries for some new 3.13 C API (GH-124134) (cherry picked from commit 32119fc377a4d9df524a7bac02b6922a990361dd)
* [3.13] GH-109975: Copyedit 3.13 What's New: Release Highlights (GH-122958) ↵Miss Islington (bot)2024-08-131-1/+1
| | | | | | | | | (#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>
* [3.13] GH-121970: Rewrite the C-API annotations extension (#121985) (#122027)Adam Turner2024-07-191-2/+4
| | | | | | GH-121970: Rewrite the C-API annotations extension (#121985) Co-authored-by: Petr Viktorin <encukou@gmail.com> (cherry picked from commit 22c9d9c1fcc3bb6186524330b169eda6df450f1b)
* [3.13] gh-113993: Don't immortalize in PyUnicode_InternInPlace; keep ↵Petr Viktorin2024-07-171-0/+15
| | | | | | | | | | | | | | | | | 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)
* [3.13] gh-121749: Fix discrepancy in docs for `PyModule_AddObjectRef` ↵Miss Islington (bot)2024-07-141-1/+1
| | | | | | | (GH-121750) (GH-121752) (cherry picked from commit 26dfb2771236bfd96cdaa1081103f75141ecff47) Co-authored-by: Dominic H <dom@dominic.sk>
* [3.13] gh-121615: Improve `module.rst` C-API docs with better error ↵Miss Islington (bot)2024-07-111-8/+15
| | | | | | | | 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>
* [3.13] Docs: Add central references to free-threading-related options ↵Miss Islington (bot)2024-05-211-2/+2
| | | | | | | | (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-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL ↵Petr Viktorin2024-05-061-1/+1
| | | | (GH-118645)
* gh-116322: Add Py_mod_gil module slot (#116882)Brett Simmers2024-05-031-0/+38
| | | | | | | | | | | | | | 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).
* gh-107298: Fix numerous ref errors and typos in the C API docs (GH-108258)Serhiy Storchaka2023-08-221-0/+4
|
* gh-98154: Clarify Usage of "Reference Count" In the Docs (gh-107552)Eric Snow2023-08-071-1/+1
| | | | | 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.
* gh-107306: Add a Doc Entry for Py_mod_multiple_interpreters (#107403)Eric Snow2023-07-311-0/+31
| | | It was added in 3.12 for PEP 684 (per-interpreter GIL).
* gh-107298: Fix yet more Sphinx warnings in the C API doc (GH-107345)Serhiy Storchaka2023-07-271-1/+1
|
* gh-107298: Fix more Sphinx warnings in the C API doc (#107329)Victor Stinner2023-07-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | 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
* gh-107091: Fix some uses of :c:member: role (GH-107129)Serhiy Storchaka2023-07-261-4/+4
|
* gh-107091: Fix the use of some C domain roles (#107092)Serhiy Storchaka2023-07-231-1/+1
|
* gh-106919: Use role :c:macro: for referencing the C "constants" (GH-106920)Serhiy Storchaka2023-07-211-3/+3
|
* bpo-42327: C API: Add PyModule_Add() function (GH-23443)Serhiy Storchaka2023-07-181-34/+31
| | | | | It is a fixed implementation of PyModule_AddObject() which consistently steals reference both on success and on failure.
* GH-97950: Use new-style index directive ('object') (#104158)Adam Turner2023-05-041-1/+1
| | | | | | | | | | | * 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
* gh-101973: Fix parameter reference for PyModule_FromDefAndSpec (#101976)Oleg Iarygin2023-02-171-2/+2
|
* gh-93738: Documentation C syntax (Function glob patterns -> literal markup) ↵Adam Turner2022-10-051-2/+2
| | | | (#97774)
* Note that tp_clear and m_clear are not always called (GH-27581)Petr Viktorin2021-08-041-0/+6
|
* bpo-42528: Improve the docs of most Py*_Check{,Exact} API calls (GH-23602)Antonio Cuni2021-01-061-1/+2
| | | | | 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.
* bpo-1635741: Add PyModule_AddObjectRef() function (GH-23122)Victor Stinner2020-11-041-14/+90
| | | | | Added PyModule_AddObjectRef() function: similar to PyModule_AddObjectRef() but don't steal a reference to the value on success.
* bpo-40204, doc: Fix syntax of C variables (GH-21846)Victor Stinner2020-08-131-2/+2
| | | | | | | | | | | | | | | 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-38387: Formally document PyDoc_STRVAR and PyDoc_STR macros (GH-16607)Brad Solomon2020-04-271-1/+1
| | | | | | | 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.
* bpo-38644: Make tstate more explicit inside pystate.c (GH-19182)Victor Stinner2020-03-261-0/+4
| | | | Fix PyInterpreterState_New(): Don't call PyErr_SetString() when there is no current Python thread state (if tstate is NULL).
* bpo-40024: Add PyModule_AddType() helper function (GH-19088)Dong-hee Na2020-03-221-1/+11
|
* bpo-39824: module_traverse() don't call m_traverse if md_state=NULL (GH-18738)Victor Stinner2020-03-171-10/+34
| | | | | | | | | | | | | 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>
* bpo-38159: Clarify documentation of PyState_AddModule (GH-16101)Petr Viktorin2019-11-011-0/+11
| | | | | This was never intented to be called manually from PyInit_*. Also, clarify PyState_RemoveModule return value.
* bpo-38600: Change the mark up of NULL in the C API documentation. (GH-16950)Serhiy Storchaka2019-10-301-17/+17
| | | | Replace all *NULL* with ``NULL``.
* bpo-26868: Fix example usage of PyModule_AddObject. (#15725)Brandt Bucher2019-09-121-1/+16
| | | | | | | | | | | | | | | | * 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
* Doc: Replace the deprecated highlightlang directive by highlight. (#13377)Stéphane Wirtel2019-05-171-1/+1
| | | | highlightlang is deprecated since April 2018 in Sphinx. See https://github.com/sphinx-doc/sphinx/pull/4845
* bpo-32374: m_traverse may be called with m_state=NULL (GH-5140)Marcel Plch2018-03-171-3/+9
| | | | | 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.
* bpo-30656: Fix Python C API Module Objects documentation (GH-2170)Emily Morehouse2017-06-131-1/+1
| | | `PyModule_New()` now refers to `PyModule_NewObject()`
* bpo-29918: Add missed "const" modifiers in C API documentation. (#846)Serhiy Storchaka2017-03-301-4/+4
|
* Issue #27782: Fix m_methods handling in multiphase initNick Coghlan2016-08-211-1/+1
| | | | | | | | 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.
* Issue #12946: Document that PyModule_GetDict can fail in some casesBerker Peksag2016-08-191-4/+7
|
* Issue #24314: Fix doc links for general attributes like __name__, __dict__Martin Panter2016-06-181-2/+2
|
* Issue #27125: Remove duplicated words from documentation and commentsMartin Panter2016-05-301-1/+1
|
* Correct “an” → “a” with “Unicode”, “user”, “UTF”, etcMartin Panter2016-04-151-1/+1
| | | | This affects documentation, code comments, and a debugging messages.
* Close #24458: PEP 489 documentationNick Coghlan2015-07-031-77/+243
| | | | Patch by Petr Viktorin.
* PEP 489: Multi-phase extension module initializationNick Coghlan2015-05-231-26/+66
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Merge with 3.3Zachary Ware2014-02-261-1/+1
|\
| * Fix several C-API doc typos caught by tomo cocoa on docs@.Zachary Ware2014-02-261-1/+1
| | | | | | | | | | The signature and description of PyException_SetCause now use "cause" rather than "ctx" to match the code.
* | Issue #18668: Further clarify m_size setting for non-negative valuesEli Bendersky2013-08-101-4/+4
|\ \ | |/
| * Issue #18668: Further clarify m_size setting for non-negative valuesEli Bendersky2013-08-101-4/+4
| |