Commit graph

1862 commits

Author SHA1 Message Date
Hugo van Kemenade
aeff92d86a Python 3.15.0a1 2025-10-14 13:46:08 +03:00
Mikhail Efimov
52996aaa78
gh-107073: fix relevant typo in PyObject_ClearManagedDict (#140032) 2025-10-13 13:23:09 +02:00
Dino Viehland
ff7bb565d8
gh-139924: Add PyFunction_PYFUNC_EVENT_MODIFY_QUALNAME event for function watchers (#139925)
Add PyFunction_PYFUNC_EVENT_MODIFY_QUALNAME event for function watchers
2025-10-10 15:25:38 -07:00
Victor Stinner
d0b18b19fa
gh-129813: Fix PyBytesWriter tests (#139892) 2025-10-10 13:01:06 +02:00
Victor Stinner
e31c22dbf9
gh-111489: Add PyTuple_FromArray() function (#139691) 2025-10-10 08:54:12 +02:00
Stan Ulbrych
d2deb8fdef
gh-101100: Fix reference warnings in c-api/init.rst documenting PyGILState_STATE (#139572) 2025-10-09 12:34:35 +03:00
Petr Viktorin
80cdf3ef74
Document that PyInterpreterState_GetDict returns a borrowed reference (#139451) 2025-10-01 09:46:06 +05:30
Bénédikt Tran
a5e0562350
gh-133644: remove PyWeakref_GetObject and PyWeakref_GET_OBJECT (GH-133657) 2025-09-24 11:25:56 +02:00
Peter Bierma
89ff88be89
Document Py_AddPendingCall() change with subinterpreters in 3.12 (GH-139117)
Prior to 3.9, Py_AddPendingCall() would always run pending calls in the main interpreter, but then each interpreter got their own ceval state, and they were scheduled for any interpreter. In GH-104813, this was undone, so Py_AddPendingCall() would always schedule for the main interpreter.
2025-09-18 12:10:41 +00:00
Rafael Fontenelle
d22b25081b
Remove unmatched closing parenthesis (GH-139082) 2025-09-18 10:01:09 +01:00
Rajhans Jadhao
e1eca8b308
gh-129368: In PyRun C API docs, clarify what a "start token" is (#129935) 2025-09-17 14:51:20 +00:00
Victor Stinner
9a8bc6d4a4
gh-129813, PEP 782: Add doc reference link (#138986) 2025-09-16 15:51:45 +02:00
Victor Stinner
d61dda52ba
gh-129813, PEP 782: Soft deprecate _PyBytes_Resize() (#138964)
Soft deprecate _PyBytes_Resize() and
PyBytes_FromStringAndSize(NULL, size).
2025-09-16 10:38:43 +02:00
Pablo Galindo Salgado
f01181b595
gh-138794: Communicate to PyRefTracer when they are being replaced (#138797) 2025-09-15 11:12:09 +01:00
sobolevn
baf7470515
gh-138886: Remove deprecated PySys_ResetWarnOptions C-API function (#138887) 2025-09-15 12:01:33 +03:00
sobolevn
1c984ba953
gh-136355: Deprecate -b and -bb CLI flags in 3.15 (#136363)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-09-14 20:00:03 +03:00
Victor Stinner
c3fca5d478
gh-129813, PEP 782: Add PyBytesWriter_Format() (#138824)
Modify PyBytes_FromFormatV() to use the public PyBytesWriter API
rather than the _PyBytesWriter private API.
2025-09-12 14:21:57 +02:00
Victor Stinner
adb414044f
gh-129813, PEP 782: Add PyBytesWriter C API (#138822) 2025-09-12 13:41:59 +02:00
Sergey B Kirpichev
fd2e3d1633
Add impl-detail block for PyLong_FromLong docs (#126422)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-09-09 11:22:40 +02:00
sobolevn
4f0c267b40
gh-138644: Update c-api docs of PyInterpreterState about PEP-684 (#138651)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-09-08 16:44:44 +03:00
Petr Viktorin
0c74fc8af0
gh-137210: Add a struct, slot & function for checking an extension's ABI (GH-137212)
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2025-09-05 16:23:18 +02:00
Kumar Aditya
5ae8b97f6b
enhance docs for critical sections (#137334) 2025-08-26 22:43:02 +05:30
PrinceNaroliya
9ee0214b5d
gh-138098: Clarify strong references in PyDict_Next docs on the free-threaded build (GH-138106) 2025-08-25 10:53:26 -04:00
Sergey Miryanov
5baa7a0de0
gh-95245: Document Py_TPFLAGS_PREHEADER (GH-135861)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-08-25 12:15:51 +02:00
Steve Dower
7d06a0af17
gh-120037: Disable user site packages when a ._pth file is used (GH-137428) 2025-08-19 21:28:28 +01:00
Sergey B Kirpichev
bc4996c125
gh-128813: cleanup C-API docs for PyComplexObject (GH-137579)
* move non-deprecated API up
* make a dedicated section for deprecated low-leved API
2025-08-11 13:51:39 +02:00
da-woods
70218b4008
Fix documentation of hash in PyHash_FuncDef (#137595)
Because of a small typo, it wasn't showing up in the generated docs.
2025-08-11 13:18:37 +02:00
Sergey B Kirpichev
9743d069bd
gh-128813: deprecate cval field of the PyComplexObject struct (#137271)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-08-08 10:36:42 +00:00
Sergey B Kirpichev
4dd85b347f
gh-137368: document __index__() support for PyLong_AsInt32/64() (GH-137369) 2025-08-04 15:30:29 +02:00
Serhiy Storchaka
1612dcbafe
gh-137341: Remove more word duplications (GH-137342) 2025-08-03 19:41:12 +03:00
Sergey B Kirpichev
9ced5c4ace
gh-128813: soft-deprecate _Py_c_*() functions (GH-137261) 2025-08-01 09:40:12 +02:00
Nathan Goldbaum
b13a5df52f
gh-133296: Fix versionadded for C API functions that were backported (#137024) 2025-07-22 21:27:50 +01:00
Nazım Can Altınova
a667800558
gh-136459: Add perf trampoline support for macOS (#136461) 2025-07-22 16:47:24 +01:00
Serhiy Storchaka
3a89dfe32b
Revert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303)" (#136991) 2025-07-22 16:39:50 +03:00
Nathan Goldbaum
89c220b93c
gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899)
This makes the following APIs public:

* `Py_BEGIN_CRITICAL_SECTION_MUTEX(mutex),`
* `Py_BEGIN_CRITICAL_SECTION2_MUTEX(mutex1, mutex2)`
* `void PyCriticalSection_BeginMutex(PyCriticalSection *c, PyMutex *mutex)`
* `void PyCriticalSection2_BeginMutex(PyCriticalSection2 *c, PyMutex *mutex1, PyMutex *mutex2)`

The macros are identical to the corresponding `Py_BEGIN_CRITICAL_SECTION` and
`Py_BEGIN_CRITICAL_SECTION2` macros (e.g., they include braces), but they
accept a `PyMutex` instead of an object.

The new macros are still paired with the existing END macros
(`Py_END_CRITICAL_SECTION`, `Py_END_CRITICAL_SECTION2`).
2025-07-21 17:25:43 -04:00
Disconnect3d
d19bb44713
Doc/c-api/memory.rst: extend --without-pymalloc doc with ASan information (GH-136790)
* Doc/c-api/memory.rst: extend --without-pymalloc doc with ASan information

This commit extends the documentation for disabling pymalloc with the `--without-pymalloc` flag regarding why it is worth to use it when enabling AddressSanitizer for Python build (which is done, e.g., in CPython's CI builds).

I have tested the CPython latest main build with both ASan and pymalloc enabled and it seems to work just fine. I did run the `python -m test` suite which didn't uncover any ASan crashes (though, it detected some memory leaks, which I believe are irrelevant here).

I have discussed ASan and this flag with @encukou on the CPython Core sprint on EuroPython 2025. We initially thought that the `--without-pymalloc` flag is needed for ASan builds due to the fact pymalloc must hit the begining of page when determining if the memory to be freed comes from pymalloc or was allocated by the system malloc. In other words, we thought, that ASan would crash CPython during free of big objects (allocated by system malloc). It may be that this was the case in the past, but it is not the case anymore as the `address_in_range` function used by pymalloc is annotated to be skipped from the ASan instrumentation.

This code can be seen here:
acefb978dc/Objects/obmalloc.c (L2096-L2110)

While the annotation macro is defined here:
acefb978dc/Include/pyport.h (L582-L598)

And the corresponding attribute is documented in:
* for gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-no_005fsanitize_005faddress-function-attribute
* for clang: https://clang.llvm.org/docs/AttributeReference.html#no-sanitize-address-no-address-safety-analysis

* Update Doc/c-api/memory.rst

* Improve --with-address-sanitizer and pymalloc docs

---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-19 13:52:54 +02:00
Adam Turner
c89a66feb1
GH-133711: Enable UTF-8 mode by default (PEP 686) (#133712)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-15 10:45:41 +01:00
Sergey B Kirpichev
e4654e0b3e
gh-136663: fix signatures of PyFloat_Pack/Unpack in docs (#136664) 2025-07-15 11:00:12 +05:30
Serhiy Storchaka
e18829a8ad
gh-132629: Deprecate accepting out-of-range values for unsigned integers in PyArg_Parse (GH-132630)
For unsigned integer formats in the PyArg_Parse* functions,
accepting Python integers with value that is larger than
the maximal value the corresponding C type or less than
the minimal value for the corresponding signed integer type
is now deprecated.
2025-07-13 12:44:54 +03:00
Peter Bierma
0d4fd10fba
Docs: Fix and improve the PyUnstable_Object_EnableDeferredRefcount documentation (GH-135323) 2025-07-13 02:46:13 -04:00
Petr Viktorin
85bc89f35f
gh-136209: Add .. c:var:: declarations for C exception types (GH-136210)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-10 13:07:55 +02:00
Petr Viktorin
73e1207a4e
gh-135913: Document ob_refcnt, ob_type, ob_size (GH-135914)
* gh-135913: Document ob_refcnt, ob_type, ob_size

In `typeobj.rst`, instead of `:c:member:` it would be better to
use `.. c:member::` with a `:no-index:` option, see:

See ref. https://www.sphinx-doc.org/en/master/usage/domains/index.html#basic-markup

However, `c:member` currently does not support `:no-index:`.
2025-07-07 14:05:17 +02:00
Petr Viktorin
2468aafe98
gh-135755: Document __future__.* and CO_* as proper Sphinx objects (GH-135980)
* Turn the __future__ table to list-table.
  This'll make it easier to add entries that need longer markup
* Semantic markup for __future__ feature descriptions.
* Document CO_* C macros.
2025-07-07 12:31:13 +02:00
Victor Stinner
da79ac9d26
gh-135075: Make PyObject_SetAttr() fail with NULL value and exception (#136180)
Make PyObject_SetAttr() and PyObject_SetAttrString() fail if called
with NULL value and an exception set.
2025-07-03 14:51:44 +02:00
Sam Gross
f41e9c750e
gh-134009: Expose PyMutex_IsLocked in the public C API (gh-134365)
The `PyMutex_IsLocked()` function is useful in assertions for verifying
that code maintains certain locking invariants.
2025-07-01 13:26:13 -04:00
Nicolas Trangez
579acf4562
gh-76595: Add note on PyCapsule_Import behavior (GH-134022) 2025-06-28 09:01:41 -04:00
Brian Schubert
34ce1920ca
Docs: Fix duplicate word typos (GH-135958) 2025-06-26 20:00:19 -04:00
Peter Bierma
ca87a47b3d
gh-135755: Docs: C API: Document missing PyFunction_GET* macros (GH-135762)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-06-25 08:44:55 +00:00
Petr Viktorin
6aa0826ed7
gh-89488: Add warning about Py_BuildValue("p") needing exact int (GH-135610) 2025-06-23 12:35:59 +02:00
Rafael Fontenelle
6a16b3c440
Docs: Remove unnecessary trailing backslashes (GH-135781)
This fixes Sphinx's gettext extraction for translations.
2025-06-21 09:01:14 -04:00