summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
Commit message (Collapse)AuthorAgeFilesLines
...
* bpo-41123: Doc: PyLong_FromUnicode will be removed in 3.10 (GH-21205)Inada Naoki2020-06-291-1/+1
|
* [3.9] bpo-40939: Deprecate the PyParser_SimpleParse* functions (GH-21012)Lysandros Nikolaou2020-06-211-0/+10
|
* bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var ↵Victor Stinner2020-06-081-0/+9
| | | | | | | (GH-20605) (GH-20725) (cherry picked from commit 8f023a2f664f902a3d0b7a6f64d63afc0d1c15ae) Co-authored-by: Sandro Mani <manisandro@gmail.com>
* bpo-40910: Export Py_GetArgcArgv() function (GH-20721) (GH-20723)Victor Stinner2020-06-081-0/+9
| | | | | | | | | | | | | | Export explicitly the Py_GetArgcArgv() function to the C API and document the function. Previously, it was exported implicitly which no longer works since Python is built with -fvisibility=hidden. * Add PyConfig._orig_argv member. * Py_InitializeFromConfig() no longer calls _PyConfig_Write() twice. * PyConfig_Read() no longer initializes Py_GetArgcArgv(): it is now _PyConfig_Write() responsibility. * _PyConfig_Write() result type becomes PyStatus instead of void. * Write an unit test on Py_GetArgcArgv(). (cherry picked from commit e81f6e687d0f04a45f2389d0b43fafd6d8491624)
* bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for ↵Miss Islington (bot)2020-05-281-1/+15
| | | | | | | | | | | | PyType_FromSpec types (reverts GH-19414) (GH-20264) Heap types now always visit the type in tp_traverse. See added docs for details. This reverts commit 0169d3003be3d072751dd14a5c84748ab63a249f. Automerge-Triggered-By: @encukou (cherry picked from commit 1cf15af9a6f28750f37b08c028ada31d38e818dd) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-39245: Fix docs links to the stable ABI (GH-20388)Miss Islington (bot)2020-05-251-9/+9
| | | | | | Automerge-Triggered-By: @vstinner (cherry picked from commit e50883ccc4bfa198c3d5e3367306324fc49730cb) Co-authored-by: Miro Hrončok <miro@hroncok.cz>
* bpo-40584: Update PyType_FromModuleAndSpec() to process tp_vectorcall_offset ↵Hai Shi2020-05-112-3/+6
| | | | (GH-20026)
* bpo-38787: Update structures.rst docs (PEP 573) (GH-19980)Hai Shi2020-05-071-2/+2
|
* bpo-38787: C API for module state access from extension methods (PEP 573) ↵Petr Viktorin2020-05-072-4/+82
| | | | | | | | | (GH-19936) Module C state is now accessible from C-defined heap type methods (PEP 573). Patch by Marcel Plch and Petr Viktorin. Co-authored-by: Marcel Plch <mplch@redhat.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820)Victor Stinner2020-05-011-0/+2
| | | | | | | | | An isolated subinterpreter cannot spawn threads, spawn a child process or call os.fork(). * Add private _Py_NewInterpreter(isolated_subinterpreter) function. * Add isolated=True keyword-only parameter to _xxsubinterpreters.create(). * Allow again os.fork() in "non-isolated" subinterpreters.
* bpo-40428: Remove references to Py*_ClearFreeList in the docs (GH-19783)Zackery Spytz2020-04-297-42/+0
| | | | They were removed from the C API in commit ae00a5a88534fd45939f86c12e038da9fa6f9ed6.
* bpo-40421: Add PyFrame_GetBack() function (GH-19765)Victor Stinner2020-04-291-0/+11
| | | | | | New PyFrame_GetBack() function: get the frame next outer frame. Replace frame->f_back with PyFrame_GetBack(frame) in most code but frameobject.c, ceval.c and genobject.c.
* bpo-40429: PyThreadState_GetFrame() returns a strong ref (GH-19781)Victor Stinner2020-04-291-3/+3
| | | | The PyThreadState_GetFrame() function now returns a strong reference to the frame.
* bpo-40429: PyFrame_GetCode() now returns a strong reference (GH-19773)Victor Stinner2020-04-281-3/+4
|
* bpo-40429: PyFrame_GetCode() result cannot be NULL (GH-19772)Victor Stinner2020-04-281-0/+1
| | | Add frame_nslots() to factorize duplicate code.
* bpo-40421: Add PyFrame_GetCode() function (GH-19757)Victor Stinner2020-04-282-2/+13
| | | | | | | | | PyFrame_GetCode(frame): return a borrowed reference to the frame code. Replace frame->f_code with PyFrame_GetCode(frame) in most code, except in frameobject.c, genobject.c and ceval.c. Also add PyFrame_GetLineNumber() to the limited C API.
* bpo-40421: Add pyframe.h header file (GH-19755)Victor Stinner2020-04-281-0/+2
| | | | | | | | | | Add a new separated pyframe.h header file of the PyFrame public C API: it is included by Python.h. Add PyFrame_GetLineNumber() to the limited C API. Replace "struct _frame" with "PyFrameObject" in header files. PyFrameObject is now defined as struct _frame by pyframe.h which is included early enough in Python.h.
* bpo-38387: Formally document PyDoc_STRVAR and PyDoc_STR macros (GH-16607)Brad Solomon2020-04-272-1/+34
| | | | | | | 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-40334: Rename PyConfig.use_peg to _use_peg_parser (GH-19670)Victor Stinner2020-04-231-0/+10
| | | | | | | | | | | * Rename PyConfig.use_peg to _use_peg_parser * Document PyConfig._use_peg_parser and mark it a deprecated * Mark -X oldparser option and PYTHONOLDPARSER env var as deprecated in the documentation. * Add use_old_parser() and skip_if_new_parser() to test.support * Remove sys.flags.use_peg: use_old_parser() uses _testinternalcapi.get_configs() instead. * Enhance test_embed tests * subprocess._args_from_interpreter_flags() copies -X oldparser
* bpo-40302: Replace PY_INT64_T with int64_t (GH-19573)Victor Stinner2020-04-171-1/+1
| | | | | | | | | * Replace PY_INT64_T with int64_t * Replace PY_UINT32_T with uint32_t * Replace PY_UINT64_T with uint64_t sha3module.c no longer checks if PY_UINT64_T is defined since it's always defined and uint64_t is always available on platforms supported by Python.
* bpo-40170: Convert PyObject_IS_GC() macro to a function (GH-19464)Hai Shi2020-04-141-0/+9
|
* bpo-40241: Add PyObject_GC_IsTracked and PyObject_GC_IsFinalized to the ↵Pablo Galindo2020-04-111-0/+18
| | | | | public C-API (GH-19461) Add the functions PyObject_GC_IsTracked and PyObject_GC_IsFinalized to the public API to allow to query if Python objects are being currently tracked or have been already finalized by the garbage collector respectively.
* bpo-38644: Make tstate more explicit inside pystate.c (GH-19182)Victor Stinner2020-03-262-0/+6
| | | | Fix PyInterpreterState_New(): Don't call PyErr_SetString() when there is no current Python thread state (if tstate is NULL).
* bpo-39947: Add PyThreadState_GetID() function (GH-19163)Victor Stinner2020-03-251-0/+9
| | | | Add PyThreadState_GetID() function: get the unique identifier of a Python thread state.
* bpo-40024: Add PyModule_AddType() helper function (GH-19088)Dong-hee Na2020-03-221-1/+11
|
* bpo-39947: Add PyThreadState_GetFrame() function (GH-19092)Victor Stinner2020-03-202-4/+18
| | | | Add PyThreadState_GetFrame() function: get the current frame of a Python thread state.
* bpo-39984: Move pending calls to PyInterpreterState (GH-19066)Victor Stinner2020-03-191-0/+10
| | | | | | | | | | | | | | | | | If Py_AddPendingCall() is called in a subinterpreter, the function is now scheduled to be called from the subinterpreter, rather than being called from the main interpreter. Each subinterpreter now has its own list of scheduled calls. * Move pending and eval_breaker fields from _PyRuntimeState.ceval to PyInterpreterState.ceval. * new_interpreter() now calls _PyEval_InitThreads() to create pending calls lock. * Fix Py_AddPendingCall() for subinterpreters. It now calls _PyThreadState_GET() which works in a subinterpreter if the caller holds the GIL, and only falls back on PyGILState_GetThisThreadState() if _PyThreadState_GET() returns NULL.
* 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-39973: Fix the docs for PyObject_GenericSetDict() (GH-19026)Zackery Spytz2020-03-171-1/+1
| | | | PyObject_GenericSetDict() takes three arguments, not two.
* bpo-39947: Add PyThreadState_GetInterpreter() (GH-18981)Victor Stinner2020-03-131-5/+14
| | | | Add PyThreadState_GetInterpreter(tstate): get the interpreter of a Python thread state.
* bpo-39947: Add PyInterpreterState_Get() function (GH-18979)Victor Stinner2020-03-131-0/+12
| | | | | | * Rename _PyInterpreterState_Get() to PyInterpreterState_Get() and move it the limited C API. * Add _PyInterpreterState_Get() alias to PyInterpreterState_Get() for backward compatibility with Python 3.8.
* bpo-35370: Add _PyEval_SetTrace() function (GH-18975)Victor Stinner2020-03-131-0/+5
| | | | | | | | | * sys.settrace(), sys.setprofile() and _lsprof.Profiler.enable() now properly report PySys_Audit() error if "sys.setprofile" or "sys.settrace" audit event is denied. * Add _PyEval_SetProfile() and _PyEval_SetTrace() function: similar to PyEval_SetProfile() and PyEval_SetTrace() but take a tstate parameter and return -1 on error. * Add _PyObject_FastCallTstate() function.
* bpo-38500: Add _PyInterpreterState_SetEvalFrameFunc() (GH-17340)Victor Stinner2020-03-121-0/+26
| | | | | | | | | | | | PyInterpreterState.eval_frame function now requires a tstate (Python thread state) parameter. Add private functions to the C API to get and set the frame evaluation function: * Add tstate parameter to _PyFrameEvalFunction function type. * Add _PyInterpreterState_GetEvalFrameFunc() and _PyInterpreterState_SetEvalFrameFunc() functions. * Add tstate parameter to _PyEval_EvalFrameDefault().
* Doc: Fix grammar in PyErr_ResourceWarning (GH-18879)Daniel Hahler2020-03-121-1/+1
|
* bpo-39877: Deprecate PyEval_InitThreads() (GH-18892)Victor Stinner2020-03-101-5/+9
| | | | Deprecated PyEval_InitThreads() and PyEval_ThreadsInitialized(). Calling PyEval_InitThreads() now does nothing.
* bpo-38249: Expand Py_UNREACHABLE() to __builtin_unreachable() in the release ↵Serhiy Storchaka2020-03-091-1/+14
| | | | | mode. (GH-16329) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-39882: Py_FatalError() logs the function name (GH-18819)Victor Stinner2020-03-061-0/+7
| | | | | | | | | | | | The Py_FatalError() function is replaced with a macro which logs automatically the name of the current function, unless the Py_LIMITED_API macro is defined. Changes: * Add _Py_FatalErrorFunc() function. * Remove the function name from the message of Py_FatalError() calls which included the function name. * Update tests.
* bpo-39778: Add clarification about tp_traverse and ownership (GH-18754)Pablo Galindo2020-03-031-1/+13
| | | Automerge-Triggered-By: @pablogsal
* Doc: int -> int or Py_ssize_t (GH-18663)Inada Naoki2020-02-261-11/+11
|
* fix(doc): set correct RST syntax for c:function (GH-18589)Julien Danjou2020-02-211-2/+2
| | | The current content is not rendered since the syntax is not correct.
* bpo-36465: Update doc of init_config.rst (GH-18520)Hai Shi2020-02-171-1/+1
|
* bpo-39573: Add Py_IS_TYPE() function (GH-18488)Dong-hee Na2020-02-131-0/+8
| | | Co-Author: Neil Schemenauer <nas-github@arctrix.com>
* bpo-39573: Fix bad copy-paste in Py_SET_SIZE (GH-18496)Brandt Bucher2020-02-131-1/+1
|
* bpo-39500: Document PyUnicode_IsIdentifier() function (GH-18397)Victor Stinner2020-02-111-0/+10
| | | | PyUnicode_IsIdentifier() does not call Py_FatalError() anymore if the string is not ready.
* bpo-38374: Remove weakref.ReferenceError from docs (GH-18452)Roger Hurwitz2020-02-111-3/+0
| | | | | | | | | | Reflecting changes to the code, removed weakref.ReferenceError from weakref.rst and exceptions.rst. Issue submitter provided evidence that the `weakref.ReferenceError` alias for `ReferenceError` was removed from the code in 2007. Working with @gvanrossum at PyCascades CPython sprint we looked at the code and confirmed that `weakref.ReferenceError` was no longer in `weakref.py`. Based on that analysis I removed references `weakref.ReferenceError` from the two documents where it was still being referenced: `weakref.rst` and `exceptions.rst`. https://bugs.python.org/issue38374
* Correct the documented default encoding (GH-18429)Eric Wieser2020-02-101-1/+1
| | | | | | | | | | | | | From the source for `PyUnicode_Decode`, the implementation is: ``` if (encoding == NULL) { return PyUnicode_DecodeUTF8Stateful(s, size, errors, NULL); } ``` which is pretty clearly not defaulting to ASCII. --- I assume this needs neither a news entry nor bpo link.
* bpo-39573: Add Py_SET_SIZE() function (GH-18400)Victor Stinner2020-02-071-0/+7
| | | Add Py_SET_SIZE() function to set the size of an object.
* bpo-39573: Add Py_SET_TYPE() function (GH-18394)Victor Stinner2020-02-071-0/+7
| | | Add Py_SET_TYPE() function to set the type of an object.
* bpo-39573: Add Py_SET_REFCNT() function (GH-18389)Victor Stinner2020-02-071-0/+7
| | | | Add a Py_SET_REFCNT() function to set the reference counter of an object.
* bpo-39245: Make Vectorcall C API public (GH-17893)Petr Viktorin2020-02-062-51/+58
| | | | | | | | | | | | | | | | | * Add backcompat defines and move non-limited API declaration to cpython/ This partially reverts commit 2ff58a24e8a1c7e290d025d69ebaea0bbead3b8c which added PyObject_CallNoArgs to the 3.9+ stable ABI. This should not be done; there are enough other call APIs in the stable ABI to choose from. * Adjust documentation Mark all newly public functions as added in 3.9. Add a note about the 3.8 provisional names. Add notes on public API. * Put PyObject_CallNoArgs back in the limited API * Rename PyObject_FastCallDict to PyObject_VectorcallDict