summaryrefslogtreecommitdiffstats
path: root/PC/python3dll.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-121654: Add PyType_Freeze() function (#122457)Victor Stinner2024-10-251-0/+1
| | | Co-authored-by: Petr Viktorin <encukou@gmail.com>
* gh-124502: Add PyUnicode_Equal() function (#124504)Victor Stinner2024-10-071-0/+1
|
* gh-124127: Make Py_REFCNT() opaque in limited C API 3.14 (#124128)Victor Stinner2024-09-241-0/+1
|
* gh-124153: Implement `PyType_GetBaseByToken()` and `Py_tp_token` slot ↵neonene2024-09-181-0/+1
| | | | (GH-124163)
* gh-120389: Add PyLong_FromInt64() and PyLong_AsInt64() (#120390)Victor Stinner2024-08-281-0/+8
| | | | | | | | | | | | Add new functions to convert C <stdint.h> numbers from/to Python int: * PyLong_FromInt32() * PyLong_FromUInt32() * PyLong_FromInt64() * PyLong_FromUInt64() * PyLong_AsInt32() * PyLong_AsUInt32() * PyLong_AsInt64() * PyLong_AsUInt64()
* gh-105201: Add PyIter_NextItem() (#122331)Erlend E. Aasland2024-08-071-0/+1
| | | | | | | | | Return -1 and set an exception on error; return 0 if the iterator is exhausted, and return 1 if the next item was fetched successfully. Prefer this API to PyIter_Next(), which requires the caller to use PyErr_Occurred() to differentiate between iterator exhaustion and errors. Co-authered-by: Irit Katriel <iritkatriel@yahoo.com>
* gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove ↵Pablo Galindo Salgado2024-06-241-1/+0
| | | | | | | from public API/ABI (GH-119680) Signed-off-by: Pablo Galindo <pablogsal@gmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
* gh-120600: Make Py_TYPE() opaque in limited C API 3.14 (#120601)Victor Stinner2024-06-181-0/+1
| | | | In the limited C API 3.14 and newer, Py_TYPE() is now implemented as an opaque function call to hide implementation details.
* gh-74929: Implement PEP 667 (GH-115153)Tian Gao2024-05-041-0/+3
|
* gh-116936: Add PyType_GetModuleByDef() to the limited C API (#116937)Victor Stinner2024-03-251-0/+1
|
* gh-115754: Add Py_GetConstant() function (#116883)Victor Stinner2024-03-211-0/+2
| | | | | | | | | | | | Add Py_GetConstant() and Py_GetConstantBorrowed() functions. In the limited C API version 3.13, getting Py_None, Py_False, Py_True, Py_Ellipsis and Py_NotImplemented singletons is now implemented as function calls at the stable ABI level to hide implementation details. Getting these constants still return borrowed references. Add _testlimitedcapi/object.c and test_capi/test_object.py to test Py_GetConstant() and Py_GetConstantBorrowed() functions.
* gh-111696, PEP 737: Add PyType_GetModuleName() function (#116824)Victor Stinner2024-03-141-0/+1
| | | Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-111696, PEP 737: Add PyType_GetFullyQualifiedName() function (#116815)Victor Stinner2024-03-141-0/+1
| | | Rewrite tests on type names in Python, they were written in C.
* gh-114329: Add `PyList_GetItemRef` function (GH-114504)Sam Gross2024-02-021-0/+1
| | | | | | | The new `PyList_GetItemRef` is similar to `PyList_GetItem`, but returns a strong reference instead of a borrowed reference. Additionally, if the passed "list" object is not a list, the function sets a `TypeError` instead of calling `PyErr_BadInternalCall()`.
* gh-113744: Add a new IncompleteInputError exception to improve incomplete ↵Pablo Galindo Salgado2024-01-301-0/+1
| | | | | input detection in the codeop module (#113745) Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* gh-111089: Revert PyUnicode_AsUTF8() changes (#111833)Victor Stinner2023-11-071-1/+0
| | | | | | | | | | | | | | | | | | | | | * Revert "gh-111089: Use PyUnicode_AsUTF8() in Argument Clinic (#111585)" This reverts commit d9b606b3d04fc56fb0bcc479d7d6c14562edb5e2. * Revert "gh-111089: Use PyUnicode_AsUTF8() in getargs.c (#111620)" This reverts commit cde1071b2a72e8261ca66053ef61431b7f3a81fd. * Revert "gh-111089: PyUnicode_AsUTF8() now raises on embedded NUL (#111091)" This reverts commit d731579bfb9a497cfb0076cb6b221058a20088fe. * Revert "gh-111089: Add PyUnicode_AsUTF8() to the limited C API (#111121)" This reverts commit d8f32be5b6a736dc2fc9dca3f1bf176c82fc9b44. * Revert "gh-111089: Use PyUnicode_AsUTF8() in sqlite3 (#111122)" This reverts commit 37e4e20eaa8f27ada926d49e5971fecf0477ad26.
* gh-111506: Implement Py_SET_REFCNT() as opaque function in limited C API ↵Victor Stinner2023-11-031-0/+1
| | | | | | | | (#111508) In the limited C API version 3.13, Py_SET_REFCNT() function is now implemented as an opaque function call. Add _Py_SetRefcnt() to the stable ABI.
* gh-111089: Add PyUnicode_AsUTF8() to the limited C API (#111121)Victor Stinner2023-10-201-0/+1
| | | | | | | | Add PyUnicode_AsUTF8() function to the limited C API. multiprocessing posixshmem now uses PyUnicode_AsUTF8() instead of PyUnicode_AsUTF8AndSize(): the extension is built with the limited C API. The function now raises an exception if the filename contains an embedded null character instead of truncating silently the filename.
* gh-85283: Add PySys_Audit() to the limited C API (#108571)Victor Stinner2023-10-171-0/+2
| | | | | | | | | | The PySys_Audit() function was added in Python 3.8 by the PEP 578 "Python Runtime Audit Hooks". Add also PySys_AuditTuple() to the limited C API, function added to Python 3.13. Move non-limited "PerfMap" C API from Include/sysmodule.h to Include/cpython/sysmodule.h.
* gh-85283: Add PyMem_RawMalloc() to the limited C API (#108570)Victor Stinner2023-10-171-0/+4
| | | | | | | | | Add PyMem_RawMalloc(), PyMem_RawCalloc(), PyMem_RawRealloc() and PyMem_RawFree() to the limited C API. These functions were added by Python 3.4 and are needed to port stdlib extensions to the limited C API, like grp and pwd. Co-authored-by: Erlend E. Aasland <erlend@python.org>
* gh-110289: C API: Add PyUnicode_EqualToUTF8() and ↵Serhiy Storchaka2023-10-111-0/+2
| | | | PyUnicode_EqualToUTF8AndSize() functions (GH-110297)
* gh-110397: Add Py_IsFinalizing() to the stable ABI (#110441)Victor Stinner2023-10-071-0/+1
|
* gh-110014: Remove PY_TIMEOUT_MAX from limited C API (#110217)Victor Stinner2023-10-021-1/+0
| | | | | | | | If the timeout is greater than PY_TIMEOUT_MAX, PyThread_acquire_lock_timed() uses a timeout of PY_TIMEOUT_MAX microseconds, which is around 280.6 years. This case is unlikely and limiting a timeout to 280.6 years sounds like a reasonable trade-off. The constant PY_TIMEOUT_MAX is not used in PyPI top 5,000 projects.
* gh-110014: Fix _POSIX_THREADS and _POSIX_SEMAPHORES usage (#110139)Victor Stinner2023-09-301-0/+1
| | | | | | | | | | | | | | | | * pycore_pythread.h is now the central place to make sure that _POSIX_THREADS and _POSIX_SEMAPHORES macros are defined if available. * Make sure that pycore_pythread.h is included when _POSIX_THREADS and _POSIX_SEMAPHORES macros are tested. * PY_TIMEOUT_MAX is now defined as a constant, since its value depends on _POSIX_THREADS, instead of being defined as a macro. * Prevent integer overflow in the preprocessor when computing PY_TIMEOUT_MAX_VALUE on Windows: replace "0xFFFFFFFELL * 1000 < LLONG_MAX" with "0xFFFFFFFELL < LLONG_MAX / 1000". * Document the change and give hints how to fix affected code. * Add an exception for PY_TIMEOUT_MAX name to smelly.py * Add PY_TIMEOUT_MAX to the stable ABI
* gh-108511: Add C API functions which do not silently ignore errors (GH-109025)Serhiy Storchaka2023-09-171-0/+4
| | | | | | | | | Add the following functions: * PyObject_HasAttrWithError() * PyObject_HasAttrStringWithError() * PyMapping_HasKeyWithError() * PyMapping_HasKeyStringWithError()
* gh-108444: Add PyLong_AsInt() public function (#108445)Victor Stinner2023-08-241-0/+1
| | | | | | * Rename _PyLong_AsInt() to PyLong_AsInt(). * Add documentation. * Add test. * For now, keep _PyLong_AsInt() as an alias to PyLong_AsInt().
* gh-106004: Add PyDict_GetItemRef() function (#106005)Victor Stinner2023-07-211-0/+2
| | | | | * Add PyDict_GetItemRef() and PyDict_GetItemStringRef() functions. Add these functions to the stable ABI version 3.13. * Add unit tests on the PyDict C API in test_capi.
* bpo-42327: C API: Add PyModule_Add() function (GH-23443)Serhiy Storchaka2023-07-181-0/+1
| | | | | It is a fixed implementation of PyModule_AddObject() which consistently steals reference both on success and on failure.
* gh-106307: C API: Add PyMapping_GetOptionalItem() function (GH-106308)Serhiy Storchaka2023-07-111-0/+2
| | | | Also add PyMapping_GetOptionalItemString() function.
* gh-106521: Add PyObject_GetOptionalAttr() function (GH-106522)Serhiy Storchaka2023-07-111-0/+2
| | | | | | It is a new name of former _PyObject_LookupAttr(). Add also PyObject_GetOptionalAttrString().
* gh-106572: Convert PyObject_DelAttr() to a function (#106611)Victor Stinner2023-07-111-0/+2
| | | | | | | | * Convert PyObject_DelAttr() and PyObject_DelAttrString() macros to functions. * Add PyObject_DelAttr() and PyObject_DelAttrString() functions to the stable ABI. * Replace PyObject_SetAttr(obj, name, NULL) with PyObject_DelAttr(obj, name).
* gh-105927: Add PyWeakref_GetRef() function (#105932)Victor Stinner2023-06-211-0/+1
| | | | Add tests on PyWeakref_NewRef(), PyWeakref_GetObject(), PyWeakref_GET_OBJECT() and PyWeakref_GetRef().
* gh-105922: Add PyImport_AddModuleRef() function (#105923)Victor Stinner2023-06-201-0/+1
| | | | | | * Add tests on PyImport_AddModuleRef(), PyImport_AddModule() and PyImport_AddModuleObject(). * pythonrun.c: Replace Py_XNewRef(PyImport_AddModule(name)) with PyImport_AddModuleRef(name).
* gh-102304: Fix Py_INCREF() stable ABI in debug mode (#104763)Victor Stinner2023-06-061-2/+0
| | | | | | | | | | | When Python is built in debug mode (if the Py_REF_DEBUG macro is defined), the Py_INCREF() and Py_DECREF() function are now always implemented as opaque functions to avoid leaking implementation details like the "_Py_RefTotal" variable or the _Py_DecRefTotal_DO_NOT_USE_THIS() function. * Remove _Py_IncRefTotal_DO_NOT_USE_THIS() and _Py_DecRefTotal_DO_NOT_USE_THIS() from the stable ABI. * Remove _Py_NegativeRefcount() from limited C API.
* gh-102304: doc: Add links to Stable ABI and Limited C API (#105345)Victor Stinner2023-06-061-1/+0
| | | | | | | | | * Add "limited-c-api" and "stable-api" references. * Rename "stable-abi-list" reference to "limited-api-list". * Makefile: Document files regenerated by "make regen-limited-abi" * Remove first empty line in generated files: - Lib/test/test_stable_abi_ctypes.py - PC/python3dll.c
* gh-102304: Fix 2 New Stable ABI Functions (gh-104762)Eric Snow2023-05-301-0/+2
|
* gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)Petr Viktorin2023-05-041-0/+2
| | | | Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-102755: Add PyErr_DisplayException(exc) (#102756)Irit Katriel2023-03-161-0/+1
|
* gh-101758: Add _PyState_AddModule() Back for the Stable ABI (gh-101956)Eric Snow2023-02-161-0/+1
| | | | | | | We're adding the function back, only for the stable ABI symbol and not as any form of API. I had removed it yesterday. This undocumented "private" function was added with the implementation for PEP 3121 (3.0, 2007) for internal use and later moved out of the limited API (3.6, 2016) and then into the internal API (3.9, 2019). I removed it completely yesterday, including from the stable ABI manifest (where it was added because the symbol happened to be exported). It's unlikely that anyone is using _PyState_AddModule(), especially any stable ABI extensions built against 3.2-3.5, but we're playing it safe. https://github.com/python/cpython/issues/101758
* gh-101758: Clean Up Uses of Import State (gh-101919)Eric Snow2023-02-151-1/+0
| | | | | | | | | | | | | | | This change is almost entirely moving code around and hiding import state behind internal API. We introduce no changes to behavior, nor to non-internal API. (Since there was already going to be a lot of churn, I took this as an opportunity to re-organize import.c into topically-grouped sections of code.) The motivation is to simplify a number of upcoming changes. Specific changes: * move existing import-related code to import.c, wherever possible * add internal API for interacting with import state (both global and per-interpreter) * use only API outside of import.c (to limit churn there when changing the location, etc.) * consolidate the import-related state of PyInterpreterState into a single struct field (this changes layout slightly) * add macros for import state in import.c (to simplify changing the location) * group code in import.c into sections *remove _PyState_AddModule() https://github.com/python/cpython/issues/101758
* GH-101578: Normalize the current exception (GH-101607)Mark Shannon2023-02-081-0/+4
| | | | | | | | | | * Make sure that the current exception is always normalized. * Remove redundant type and traceback fields for the current exception. * Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException * Add new API functions: PyException_GetArgs, PyException_SetArgs
* gh-98586: Add vector call APIs to the Limited API (GH-98587)Wenzel Jakob2022-10-271-0/+2
| | | Expose the facilities for making vector calls through Python's limited API.
* gh-97669: Create Tools/build/ directory (#97963)Victor Stinner2022-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Create Tools/build/ directory. Move the following scripts from Tools/scripts/ to Tools/build/: * check_extension_modules.py * deepfreeze.py * freeze_modules.py * generate_global_objects.py * generate_levenshtein_examples.py * generate_opcode_h.py * generate_re_casefix.py * generate_sre_constants.py * generate_stdlib_module_names.py * generate_token.py * parse_html5_entities.py * smelly.py * stable_abi.py * umarshal.py * update_file.py * verify_ensurepip_wheels.py Update references to these scripts.
* gh-93274: Expose receiving vectorcall in the Limited API (GH-95717)Petr Viktorin2022-08-081-0/+2
|
* gh-60074: add new stable API function PyType_FromMetaclass (GH-93012)Wenzel Jakob2022-05-271-0/+1
| | | | | | | | Added a new stable API function ``PyType_FromMetaclass``, which mirrors the behavior of ``PyType_FromModuleAndSpec`` except that it takes an additional metaclass argument. This is, e.g., useful for language binding tools that need to store additional information in the type object.
* gh-91324: List feature macros in the stable ABI manifest, improve tests ↵Petr Viktorin2022-04-281-0/+2
| | | | (GH-32415)
* bpo-47169: Export PyOS_CheckStack on Windows (GH-32414)Petr Viktorin2022-04-211-0/+1
|
* gh-90501: Add PyErr_GetHandledException and PyErr_SetHandledException (GH-30531)Irit Katriel2022-04-151-0/+2
|
* bpo-45459: Add Py_buffer to limited API (GH-29991)Christian Heimes2022-02-021-0/+12
| | | | | | | | | | | - [x] ``Py_buffer`` struct - [x] ``PyBuffer_*()`` API functions - [x] ``PyBUF_*`` constants - [x] ``Py_bf_getbuffer`` and ``Py_bf_releasebuffer`` type slots - [x] ``PyMemoryView_FromBuffer()`` API - [x] tests for limited API - [x] ``make regen-limited-abi`` - [x] documentation update - [ ] export ``PyPickleBuffer*()`` API ???
* bpo-43931: Export Python version as API data (GH-25577)Gabriele N. Tornetta2021-12-101-0/+1
| | | | | When Python is embedded in other applications, it is not easy to determine which version of Python is being used. This change exposes the Python version as part of the API data. Tools like Austin (https://github.com/P403n1x87/austin) can benefit from this data when targeting applications like uWSGI, as the Python version can then be inferred systematically by looking at the exported symbols rather than relying on unreliable pattern matching or other hacks (like remote code execution etc...). Automerge-Triggered-By: GH:pablogsal