summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40204, doc: Fix syntax of C variables (GH-21846)Victor Stinner2020-08-1318-103/+103
| | | | | | | | | | | | | | | 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-40204: Fix duplicates in the documentation (GH-21857)Victor Stinner2020-08-132-26/+13
| | | | | | | | | Fix two Sphinx 3 issues: Doc/c-api/buffer.rst:304: WARNING: Duplicate C declaration, also defined in 'c-api/buffer'. Declaration is 'PyBUF_ND'. Doc/c-api/unicode.rst:1603: WARNING: Duplicate C declaration, also defined in 'c-api/unicode'. Declaration is 'PyObject* PyUnicode_Translate(PyObject *str, PyObject *table, const char *errors)'.
* bpo-41324 Add a minimal decimal capsule API (#21519)Stefan Krah2020-08-102-0/+232
|
* bpo-41098: Doc: Add missing deprecated directives (GH-21162)Inada Naoki2020-08-071-0/+10
| | | | PyUnicodeEncodeError_Create has been deprecated with `Py_DEPRECATED` macro. But it was not documented.
* bpo-36346: Doc: Update removal schedule of legacy Unicode (GH-21479)Inada Naoki2020-08-051-9/+30
| | | See PEP 623 for detail.
* bpo-41211: Doc: Fix PyLong_FromUnicodeObject (GH-21325)Inada Naoki2020-07-051-3/+1
| | | It doesn't use PyUnicode_EncodeDecimal. It uses a private API instead.
* Doc: Minor fix to init config C API documentation (GH-21198)tomerv2020-07-011-2/+2
| | | Co-authored-by: Tomer Vromen <tomer.vromen@intel.com>
* bpo-41123: Remove PyUnicode_AsUnicodeCopy (GH-21209)Inada Naoki2020-06-301-14/+0
|
* bpo-23427: Add sys.orig_argv attribute (GH-20729)Victor Stinner2020-06-291-0/+21
| | | | | | | Add sys.orig_argv attribute: the list of the original command line arguments passed to the Python executable. Rename also PyConfig._orig_argv to PyConfig.orig_argv and document it.
* bpo-41123: Remove PyLong_FromUnicode() (GH-21204)Inada Naoki2020-06-291-11/+0
|
* bpo-41103: Remove old buffer protocol support (#21117)Inada Naoki2020-06-252-56/+0
| | | They are deprecated since Python 3.0.
* bpo-40943: PY_SSIZE_T_CLEAN required for '#' formats (GH-20784)Victor Stinner2020-06-191-19/+17
| | | | | | | The PY_SSIZE_T_CLEAN macro must now be defined to use PyArg_ParseTuple() and Py_BuildValue() "#" formats: "es#", "et#", "s#", "u#", "y#", "z#", "U#" and "Z#". See the PEP 353. Update _testcapi.test_buildvalue_issue38913().
* bpo-36020: Require vsnprintf() to build Python (GH-20899)Victor Stinner2020-06-151-7/+3
| | | | | | | | The C99 functions snprintf() and vsnprintf() are now required to build Python. PyOS_snprintf() and PyOS_vsnprintf() no longer call Py_FatalError(). Previously, they called Py_FatalError() on a buffer overflow on platforms which don't provide vsnprintf().
* bpo-40939: Remove the old parser (GH-20768)Pablo Galindo2020-06-111-10/+0
| | | This commit removes the old parser, the deprecated parser module, the old parser compatibility flags and environment variables and all associated support code and documentation.
* bpo-40854: PYTHONPLATLIBDIR env var added to 3.9 (GH-20735)Victor Stinner2020-06-081-1/+1
|
* bpo-40910: Export Py_GetArgcArgv() function (GH-20721)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().
* bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var ↵Sandro Mani2020-06-081-0/+9
| | | | (GH-20605)
* bpo-40839: PyDict_GetItem() requires the GIL (GH-20580)Victor Stinner2020-06-021-0/+4
| | | | Calling PyDict_GetItem() without GIL held had been allowed for historical reason. It is no longer allowed.
* bpo-40792: Make the result of PyNumber_Index() always having exact type int. ↵Serhiy Storchaka2020-05-281-0/+4
| | | | | | | | | | | | (GH-20443) Previously, the result could have been an instance of a subclass of int. Also revert bpo-26202 and make attributes start, stop and step of the range object having exact type int. Add private function _PyNumber_Index() which preserves the old behavior of PyNumber_Index() for performance to use it in the conversion functions like PyLong_AsLong().
* bpo-39573: Convert Py_REFCNT and Py_SIZE to functions (GH-20429)Victor Stinner2020-05-271-9/+10
| | | | | | | | | | | Convert Py_REFCNT() and Py_SIZE() macros to static inline functions. They cannot be used as l-value anymore: use Py_SET_REFCNT() and Py_SET_SIZE() to set an object reference count and size. Replace &Py_SIZE(self) with &((PyVarObject*)self)->ob_size in arraymodule.c. This change is backward incompatible on purpose, to prepare the C API for an opaque PyObject structure.
* bpo-37999: Fix outdated __int__ and nb_int references in comments (GH-20449)Mark Dickinson2020-05-271-30/+25
| | | | | | | | | * Fix outdated __int__ and nb_int references in comments * Also update C-API documentation * Add back missing 'method' word * Remove .. deprecated notices
* bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for ↵Pablo Galindo2020-05-271-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
* bpo-39573: Convert Py_TYPE() to a static inline function (GH-20290)Dong-hee Na2020-05-251-4/+7
|
* bpo-39245: Fix docs links to the stable ABI (GH-20388)Miro Hrončok2020-05-251-9/+9
| | | Automerge-Triggered-By: @vstinner
* 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.