summaryrefslogtreecommitdiff
path: root/Doc/c-api
Commit message (Collapse)AuthorAgeFilesLines
* 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-291-3/+4
|
* bpo-40429: PyFrame_GetCode() result cannot be NULL (GH-19772)Victor Stinner2020-04-291-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-262-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-071-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-021-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-101-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
* bpo-39542: Convert PyType_Check() to static inline function (GH-18364)Victor Stinner2020-02-051-6/+6
| | | | Convert PyType_HasFeature(), PyType_Check() and PyType_CheckExact() macros to static inline functions.
* bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)Victor Stinner2020-02-032-42/+4
| | | | | | | | | | | Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
* bpo-39511: PyThreadState_Clear() calls on_delete (GH-18296)Victor Stinner2020-02-011-0/+4
| | | | | | | | | | | | | | | | | | PyThreadState.on_delete is a callback used to notify Python when a thread completes. _thread._set_sentinel() function creates a lock which is released when the thread completes. It sets on_delete callback to the internal release_sentinel() function. This lock is known as Threading._tstate_lock in the threading module. The release_sentinel() function uses the Python C API. The problem is that on_delete is called late in the Python finalization, when the C API is no longer fully working. The PyThreadState_Clear() function now calls the PyThreadState.on_delete callback. Previously, that happened in PyThreadState_Delete(). The release_sentinel() function is now called when the C API is still fully working.
* bpo-38631: Replace Py_FatalError() with assert() in ceval.c (GH-18279)Victor Stinner2020-01-301-1/+1
| | | | | | | Replace a few Py_FatalError() calls if tstate is NULL with assert(tstate != NULL) in ceval.c. PyEval_AcquireThread(), PyEval_ReleaseThread() and PyEval_RestoreThread() must never be called with a NULL tstate.
* bpo-39153: Clarify C API *SetItem refcounting semantics (GH-18220)Joannah Nanjekye2020-01-293-6/+9
| | | | | | | | | | | | Some of the *SetItem methods in the C API steal a reference to the given value. This annotates the better behaved ones to assure the reader that these are not the ones with the inconsistent behaviour. * 📜🤖 Added by blurb_it. * make docs consistent with signature Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-39429: Add a new "Python Development Mode" doc page (GH-18132)Victor Stinner2020-01-241-1/+1
|
* PyLong_AsLongLong() docs should say 'long long' (#18082)Keith Erskine2020-01-211-1/+1
|
* bpo-39161: Document multi-phase init modules under Py_NewInterpreter() ↵Petr Viktorin2020-01-091-17/+35
| | | | | | | | | (GH-17896) \+ this also adds a stronger warning against sharing objects between (sub-)interpreters. https://bugs.python.org/issue39161
* bpo-39136: Fixed typos (GH-17720)Gurupad Hegde2019-12-283-3/+3
| | | | | funtion -> function; configuraton -> configuration; defintitions -> definitions; focusses -> focuses; necesarily -> necessarily; follwing -> following; Excape -> Escape,
* Fix the miscellaneous typo (GH-17700)cocoatomo2019-12-251-1/+1
| | | A character "i" is omitted.