Commit graph

1739 commits

Author SHA1 Message Date
RUANG (James Roy)
9f25c1f012
gh-46236: Add docs for PyUnicode_GetDefaultEncoding() doc (GH-130335)
* Clarify sys.getdefaultencoding() documentation

* Add missing documentation for PyUnicode_GetDefaultEncoding,
  the C equivalent of sys.getdefaultencoding
2025-02-24 15:37:21 +01:00
Petr Viktorin
fc8d2cba54
gh-129405: Fix doc for Py_mod_multiple_interpreters default, and add test (GH-129406) 2025-02-24 14:59:19 +01:00
Petr Viktorin
ef29104f7d
GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now (GH130413)
Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now

Unfortunatlely, the change broke some buildbots.

This reverts commit 2498c22fa0.
2025-02-24 11:16:08 +01:00
Marc Mueller
0f5b82169e
gh-46236: Document PyUnicode_RSplit, PyUnicode_Partition and PyUnicode_RPartition (#130191)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-02-20 16:41:41 +01:00
Mark Shannon
2498c22fa0
GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)
* Implement C recursion protection with limit pointers

* Remove calls to PyOS_CheckStack

* Add stack protection to parser

* Make tests more robust to low stacks

* Improve error messages for stack overflow
2025-02-19 11:44:57 +00:00
Pablo Galindo Salgado
51d4bf1e0e
bpo-45325: Add a new 'p' parameter to Py_BuildValue to convert an integer into a Python bool (#28634) 2025-02-18 17:14:11 +00:00
Yuki Kobayashi
fc8c99a8ce
gh-130214: Document PyEllipsis_Type (GH-130215) 2025-02-17 13:56:33 +01:00
Stan Ulbrych
9837c2a214
gh-130169: Fix broken list markup in Doc/c-api/function.rst (#130174) 2025-02-16 13:55:31 +03:00
Stan Ulbrych
3402e133ef
gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130118)
We had the definition of what makes a character "printable" documented in three places, giving two different definitions.
The definition in the comment on `_PyUnicode_IsPrintable` was inverted; correct that.

With that correction, the two definitions turn out to be equivalent -- but to confirm that, you have to go look up, or happen to know, that those are the only five "Other" categories and only three "Separator" categories in the Unicode character database.  That makes it hard for the reader to tell whether they really are the same, or if there's some subtle difference in the intended semantics.

Fix that by cutting the C API docs' and the C comment's copies of the subtle details, in favor of referring to the Python-level docs. That ensures it's explicit that these are all meant to agree, and also lets us concentrate improvements to the wording in one place.

Speaking of which, borrow some ideas from the C comment, along with other tweaks, to hopefully add a bit more clarity to that one newly-centralized copy in the docs.

Also add a thorough test that the implementation agrees with this definition.

Author:    Greg Price <gnprice@gmail.com>

Co-authored-by: Greg Price <gnprice@gmail.com>
2025-02-14 18:16:47 +01:00
Satyam Kumar
791cdfe141
gh-129912: Fix references to Py_TPFLAGS_MANAGED_DICT (gh-130044) 2025-02-12 17:48:14 -05:00
Hugo van Kemenade
3ae9101482 Python 3.14.0a5 2025-02-11 19:16:29 +02:00
Yuki Kobayashi
1da412e574
gh-101100: Docs: Fix some typos in the document (#129988)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-02-11 13:06:32 +02:00
Yuki Kobayashi
8d9d3e4ecb
gh-46236: Document PyUnicode_DecodeCodePageStateful (GH-127934)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-02-10 17:17:37 +01:00
Miro Hrončok
779d06945c
gh-118915: Fix bad link in documentation (GH-129691) 2025-02-06 13:34:06 +01:00
Cody Maloney
5fb019fc29
gh-129559: Add bytearray.resize() (GH-129560)
Add bytearray.resize() which wraps PyByteArray_Resize.

Make negative size passed to resize exception/error rather than crash in optimized builds.
2025-02-05 11:33:17 -08:00
Victor Stinner
04264a286e
gh-101944: Clarify PyModule_AddObjectRef() documentation (#129433) 2025-02-03 12:55:22 +01:00
Victor Stinner
632ca56821
gh-129342: Explain how to replace Py_GetProgramName() in C (#129361) 2025-02-03 12:36:41 +01:00
Victor Stinner
3bebe46d34
gh-128911: Add PyImport_ImportModuleAttr() function (#128912)
Add PyImport_ImportModuleAttr() and
PyImport_ImportModuleAttrString() functions.

* Add unit tests.
* Replace _PyImport_GetModuleAttr()
  with PyImport_ImportModuleAttr().
* Replace _PyImport_GetModuleAttrString()
  with PyImport_ImportModuleAttrString().
* Remove "pycore_import.h" includes, no longer needed.
2025-01-30 11:17:29 +00:00
Sam Gross
d23f5701ad
gh-128844: Make _Py_TryIncref public as an unstable API. (#128926)
This exposes `_Py_TryIncref` as `PyUnstable_TryIncref()` and the helper
function `_PyObject_SetMaybeWeakref` as `PyUnstable_EnableTryIncRef`.

These are helpers for dealing with unowned references in a safe way,
particularly in the free threading build.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-01-28 19:32:27 +00:00
Peter Bierma
3fb5f6eb9b
gh-128509: Add PyUnstable_IsImmortal for finding immortal objects (GH-129182)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-01-27 14:36:33 +01:00
Victor Stinner
7ec17429d4
gh-102471: Change PyLongWriter_Discard(NULL) to do nothing (#129339)
It's convenient to be able to call PyLongWriter_Discard(NULL) in
error handling code.
2025-01-27 10:51:16 +00:00
Peter Bierma
6e02096e2f
gh-118915: C API: Document compiler flag macros (GH-129028) 2025-01-20 17:45:08 +01:00
Peter Bierma
e792f4bc2e
Docs C API: Clarify what happens when null bytes are passed to PyUnicode_AsUTF8 (#127458)
Co-authored-by: Stan U. <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-20 16:54:29 +01:00
Victor Stinner
573c181502
Add Configuration Options table to PyInitConfig API doc (#129062)
Document PyConfig members:

* dump_refs_file
* stdlib_dir
* use_frozen_modules
* _pystats
2025-01-20 15:46:45 +01:00
Victor Stinner
a429159797
Reorganize the PyInitConfig documentation (#129047)
Document the new PyInitConfig API before the old PyConfig API.
2025-01-20 11:42:04 +01:00
Victor Stinner
07c3518ffb
gh-129033: Remove _Py_InitializeMain() function (#129034)
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2025-01-20 10:03:22 +00:00
Victor Stinner
bbeb219354
Complete doc of pending C API removals in Python 3.15 (#129032) 2025-01-19 22:47:05 +01:00
Hugo van Kemenade
f26daa9470 Python 3.14.0a4 2025-01-14 13:52:58 +02:00
Peter Bierma
ea39c8b08d
gh-118915: Document PyUnstable_InterpreterState_GetMainModule (GH-128483) 2025-01-09 14:54:44 +01:00
Petr Viktorin
1439b81928
gh-128629: Add Py_PACK_VERSION and Py_PACK_FULL_VERSION (GH-128630) 2025-01-09 11:10:28 +01:00
Victor Stinner
f89e5e20cb
gh-127350: Add Py_fopen() and Py_fclose() functions (#127821) 2025-01-06 12:43:09 +00:00
Serhiy Storchaka
657d7b77e5
gh-90241: Clarify documentation for PyUnicode_FSConverter and PyUnicode_FSDecoder (GH-128451)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2025-01-06 13:28:50 +01:00
Serhiy Storchaka
8d15058d61
gh-77214: Update outdated documentation for numeric PyArg_Parse formats (GH-128454) 2025-01-06 12:50:28 +02:00
RUANG (James Roy)
8ade15343d
gh-127954: Document PyObject_DelItemString (#127986) 2025-01-04 21:48:20 +01:00
Damien
08a0728d6c
gh-125887: Update PyObject_HasAttr exception behavior (#125907)
Update PyObject_HasAttr exception behavior

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-12-26 17:57:55 -08:00
Yuki Kobayashi
8a26c7b2af
Docs: Fix comment out in c-api/typeobj.rst (#128266) 2024-12-26 20:09:44 +05:30
Mark Shannon
d2f1d917e8
GH-122548: Implement branch taken and not taken events for sys.monitoring (GH-122564) 2024-12-19 16:59:51 +00:00
Sam Gross
7b811d0562
gh-128008: Add PyWeakref_IsDead() (GH-128009)
The `PyWeakref_IsDead()` function tests if a weak reference is dead
without any side effects. Although you can also detect if a weak
reference is dead using `PyWeakref_GetRef()`, that function returns a
strong reference that must be `Py_DECREF()`'d, which can introduce side
effects if the last reference is concurrently dropped (at least in the
free threading build).
2024-12-19 16:17:15 +01:00
Hugo van Kemenade
401bfc69d1 Python 3.14.0a3 2024-12-17 11:50:39 +02:00
Yuki Kobayashi
52d552cda7
gh-127896: Add missing documentation of PySequence_In (GH-127979)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-12-16 14:56:04 +01:00
Victor Stinner
6446408d42
gh-102471, PEP 757: Add PyLong import and export API (#121339)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-13 14:24:48 +01:00
Miro Hrončok
58942a07df
Document PyObject_SelfIter (#127861) 2024-12-13 14:56:22 +05:30
Peter Bierma
dd9da738ad
gh-118915: C API: Document frame locals proxies. (#127720)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-12-11 17:28:44 +01:00
Peter Bierma
d5d84c3f13
gh-127791: Fix, document, and test PyUnstable_AtExit (#127793) 2024-12-11 12:14:04 +01:00
Russell Keith-Magee
51216857ca
gh-126821: Add versionadded annotation to use_system_logger feature. (#127755)
Add versionadded annotation to use_system_logger feature.
2024-12-11 05:32:04 +08:00
Russell Keith-Magee
2041a95e68
gh-126925: Modify how iOS test results are gathered (#127592)
Adds a `use_system_log` config item to enable stdout/stderr redirection for
Apple platforms. This log streaming is then used by a new iOS test runner
script, allowing the display of test suite output at runtime. The iOS test
runner script can be used by any Python project, not just the CPython test
suite.
2024-12-09 13:28:57 +08:00
Victor Stinner
1ef6e8ca3f
gh-119182: Complete PyUnicodeWriter documentation (#127607) 2024-12-05 10:37:14 +01:00
Bénédikt Tran
bc0f2e9459
gh-123378: Ensure results of PyUnicode*Error_Get{Start,End} are clamped (GH-123380)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-12-04 14:13:52 +01:00
Petr Viktorin
35d37d6592
gh-127253: Note that Stable ABI is about ABI stability (GH-127254) 2024-12-03 13:30:27 +01:00
Yuki Kobayashi
33ce8dcf79
Docs: Fix incorrect indents in c-api/type.rst (#127449) 2024-11-30 15:01:15 +00:00