Commit Graph

124176 Commits

Author SHA1 Message Date
Jan Kaliszewski 0135848059
gh-125058: update `_thread` docs regarding interruptibility of `lock.acquire()` (#125141) 2024-10-11 13:45:46 +05:30
Sam Gross b12e99261e
gh-125221: Fix free-threading data race in `object.__reduce_ex__` (#125267) 2024-10-11 13:26:01 +05:30
Savannah Ostrowski c1913effee
gh-125296: Fix strange fragment identifier for `name or flags` in argparse docs (#125297) 2024-10-11 09:30:27 +03:00
Richard Hansen 2f8301cbfb
gh-124872: Rename blurb file to reference the correct issue (#125285) 2024-10-11 03:39:17 +01:00
Alex Waygood a726ce73ca
Add some doctest cleanups for `turtle` and `configparser` (#125288)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-10-10 23:53:45 +00:00
Adam Turner dd0ee201da
Doc: Upgrade Sphinx to 8.1 (#125276) 2024-10-10 21:26:01 +01:00
Sam Gross 427dcf24de
gh-125268: Use static string for "1e309" in AST (#125272)
When formatting the AST as a string, infinite values are replaced by
1e309, which evaluates to infinity. The initialization of this string
replacement was not thread-safe in the free threading build.
2024-10-10 16:21:29 -04:00
Victor Stinner bb594e801b
gh-125196: Use PyUnicodeWriter for repr(dict) (#125270) 2024-10-10 20:41:14 +02:00
Justin Kunimune 3b87fb74c9
Note argparse exit code in documentation (GH-119568)
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
2024-10-10 20:56:05 +03:00
Mark Shannon c9014374c5
GH-125174: Make immortal objects more robust, following design from PEP 683 (GH-125251) 2024-10-10 18:19:08 +01:00
Petr Viktorin 01fc3b34cc
gh-124570: ctypes: Run some Structure tests on Union as well (GH-124976)
- Move some Structure tests to test_structunion; use a common base
  test class + two subclasses to run them on Union too
- Remove test_union for now as it's redundant

Note: `test_simple_structs` & `test_simple_unions` are in the common
file because they share `formats`.
2024-10-10 16:27:52 +02:00
Victor Stinner c914212474
gh-125196: Use PyUnicodeWriter for JSON encoder (#125249)
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.
2024-10-10 15:33:00 +02:00
neonene 120b891e4d
gh-124153: Simplify PyType_GetBaseByToken (GH-124488) 2024-10-10 12:57:13 +00:00
Sergey B Kirpichev 87d7315ac5
gh-125118: don't copy arbitrary values to _Bool in the struct module (GH-125169)
memcopy'ing arbitrary values to _Bool variable triggers undefined
behaviour. Avoid this.
We assume that `false` is represented by all zero bytes.

Credits to Alex Gaynor.

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-10 14:42:03 +02:00
Donghee Na e4cab488d4
gh-124471: Set name for unnamed reusable workflow (#124475)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
2024-10-10 12:39:53 +00:00
Irit Katriel f9ae5d1cee
gh-71784: [doc] add usage examples for traceback.TracebackException (#125189)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-10-10 11:21:12 +01:00
Victor Stinner 82dfdc3287
gh-125196: Use PyUnicodeWriter for repr(tuple) (#125242) 2024-10-10 10:20:53 +00:00
Victor Stinner 1639d934b9
gh-125196: Add a free list to PyUnicodeWriter (#125227) 2024-10-10 12:11:06 +02:00
Adam Turner 7a10cdec35
Pin the doctest workflow to Ubuntu 22.04 (#125236) 2024-10-10 10:34:55 +01:00
Richard Hansen 99400930ac
gh-124872: Refine contextvars documentation (#124773)
* Add definitions for "context", "current context", and "context
    management protocol".
  * Update related definitions to be consistent with the new
    definitions.
  * Restructure the documentation for the `contextvars.Context` class
    to prepare for adding context manager support, and for consistency
    with the definitions.
  * Use `testcode` and `testoutput` to test the `Context.run` example.
  * Expand the documentation for the `Py_CONTEXT_EVENT_ENTER` and
    `Py_CONTEXT_EVENT_EXIT` events to clarify and to prepare for
    planned changes.
2024-10-09 16:44:03 -07:00
Victor Stinner 942916378a
gh-125196: Use PyUnicodeWriter for repr(contextvars.Token) (#125220)
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.
2024-10-09 23:37:14 +00:00
Victor Stinner 1b2a5485f9
gh-125196: PyUnicodeWriter_Discard(NULL) does nothing (#125222) 2024-10-09 23:32:02 +00:00
Serhiy Storchaka 9ad55e85d7
gh-124969: Skip the test for ALT_DIGITS also on iOS (#125177)
Skip the locale.ALT_DIGITS test on all Apple platforms, not just macOS.
2024-10-10 07:30:14 +08:00
Pablo Galindo Salgado c7d5d1d93b
gh-125140: Remove the current directory from sys.path when using pyrepl (GH-125212)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-09 22:30:56 +00:00
Victor Stinner 1877543d03
gh-125196: Use PyUnicodeWriter for repr(structseq) (#125219)
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.

* Avoid temporary PyUnicode_DecodeUTF8(): call
  PyUnicodeWriter_WriteUTF8() instead.
* Avoid temporary PyObject_Repr(): call PyUnicodeWriter_WriteRepr()
  instead.
2024-10-09 22:04:50 +00:00
Victor Stinner ee3167b978
gh-125196: Add fast-path for int in PyUnicodeWriter_WriteStr() (#125214)
PyUnicodeWriter_WriteStr() and PyUnicodeWriter_WriteRepr() now call
directly _PyLong_FormatWriter() if the argument is an int.
2024-10-10 00:01:02 +02:00
Savannah Ostrowski 0c5a48c1c9
GH-124693: Support parsing negative scientific and complex numbers argparse (GH-124823)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-10-09 21:56:50 +00:00
Victor Stinner 52f70da19c
gh-125196: Use PyUnicodeWriter for repr(list) (#125202)
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.

Replace PyObject_Repr() + _PyUnicodeWriter_WriteStr()
with PyUnicodeWriter_WriteRepr().
2024-10-09 23:56:30 +02:00
Serhiy Storchaka 7d2c39752f
gh-91818: Use default program name in the CLI of many modules (GH-124867)
As argparse now detects by default when the code was run as a module.

This leads to using the actual executable name instead of simply "python"
to display in the usage message ("usage: python -m ...").
2024-10-10 00:20:53 +03:00
Adam Turner cbfd392479
GH-121970: Extract ``availability`` into a new extension (#125082) 2024-10-09 21:50:03 +01:00
Eric Snow f2cb399470
gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-124865)
Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init. In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it. For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.

This is an un-revert of gh-124646 that then addresses the Py_TRACE_REFS
failures identified by gh-124785.
2024-10-09 11:32:16 -06:00
Irit Katriel d501153aed
gh-119786: Move parser doc from devguide to InternalDocs (#125119)
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-Authored-By: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-Authored-By: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>
Co-Authored-By: Erlend E. Aasland <erlend@python.org>
Co-Authored-By: Ezio Melotti <ezio.melotti@gmail.com>
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-Authored-By: Irit Katriel <iritkatriel@yahoo.com>
Co-Authored-By: Itamar Ostricher <itamarost@gmail.com>
Co-Authored-By: Julien Palard <julien@palard.fr>
Co-Authored-By: Mana <potpath@users.noreply.github.com>
Co-Authored-By: Muhammad Mahad <mahadpy@gmail.com>
Co-Authored-By: Ned Batchelder <ned@nedbatchelder.com>
Co-Authored-By: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-Authored-By: slateny <46876382+slateny@users.noreply.github.com>
Co-Authored-By: wookie184 <wookie1840@gmail.com>
2024-10-09 18:21:35 +01:00
Victor Stinner 9bda7750c2
gh-125196: Use PyUnicodeWriter in symtable.c (#125199) 2024-10-09 17:54:54 +02:00
mpage f978fb4f8d
gh-115999: Refactor `LOAD_GLOBAL` specializations to avoid reloading {globals, builtins} keys (gh-124953)
Each of the `LOAD_GLOBAL` specializations is implemented roughly as:

1. Load keys version.
2. Load cached keys version.
3. Deopt if (1) and (2) don't match.
4. Load keys.
5. Load cached index into keys.
6. Load object from (4) at offset from (5).

This is not thread-safe in free-threaded builds; the keys object may be replaced
in between steps (3) and (4).

This change refactors the specializations to avoid reloading the keys object and
instead pass the keys object from guards to be consumed by downstream uops.
2024-10-09 15:18:25 +00:00
Victor Stinner b9a8ca0a6a
gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125194)
Replace PyUnicode_New(0, 0), PyUnicode_FromString("")
and PyUnicode_FromStringAndSize("", 0)
with Py_GetConstant(Py_CONSTANT_EMPTY_STR).
2024-10-09 17:15:23 +02:00
Victor Stinner 6a39e96ab8
gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_BYTES) (#125195)
Replace PyBytes_FromString("") and PyBytes_FromStringAndSize("", 0)
with Py_GetConstant(Py_CONSTANT_EMPTY_BYTES).
2024-10-09 17:12:11 +02:00
Victor Stinner 3ee474f568
gh-111178: Fix function signatures in codeobject.c (#125180) 2024-10-09 15:02:24 +00:00
Mark Shannon eb18574cc3
GH-120024: Tidy up pycore_stackref.h, splitting into GIL and free-threading sections (GH-125095) 2024-10-09 15:43:09 +01:00
Victor Stinner 440632adb2
gh-111178: Fix function signatures in cellobject.c (#125182) 2024-10-09 16:13:55 +02:00
Hugo van Kemenade a5716a3091
gh-101100: Fix Sphinx warnings in `library/unittest.mock.rst` (#124106) 2024-10-09 17:02:18 +03:00
JamesMcCarthy21 e0835aff2e
gh-125168: Fix typo in `__future__.rst` (#125183)
* Update `__future__.rst`

Fixed typo in the sentence :pep:`649`: *Deferred evaluation of annotations using descriptors* - James McCarthy

* Update `__future__.rst`

Fixed sphinx formatting
2024-10-09 16:17:18 +03:00
Tomas R. 6b533a659b
gh-125039: Make `this_instr`/`prev_instr` const in cases generator (GH-125071) 2024-10-09 13:54:39 +01:00
Alex Waygood 3024b16d51
gh-101100: Consolidate documentation on `ModuleType` attributes (#124709)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Barry Warsaw <barry@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-09 10:53:57 +00:00
Alyssa Coghlan 7a303fc78a
Fix importlib.resources issue reference in 3.13 What's New (#125175)
Previous link was to the PR that removed the
mentioned importlib.resources APIs, rather than
the issue that added back their improved forms.
2024-10-09 20:40:50 +10:00
Petr Viktorin d20c43d8e2
gh-107562: Update test certificates to expire far in the future (GH-125104)
Generated with Lib/test/certdata/make_ssl_certs.py
using openssl-3.2.2-3.fc40.x86_64 (Fedora 40).
2024-10-09 11:17:02 +02:00
Alexander Kanavin 53930cbe47
gh-107562: make_ssl_certs.py: produce test certificates that expire far in the future by default (GH-107594)
This allows testing Y2038 with system time set to after that,
so that actual Y2038 issues can be exposed, and not masked
by expired certificate errors.

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
2024-10-09 11:16:08 +02:00
Serhiy Storchaka 21c04e1a97
gh-124969: Fix locale.nl_langinfo(locale.ALT_DIGITS) (GH-124974)
Now it returns a tuple of up to 100 strings (an empty tuple on most locales).
Previously it returned the first item of that tuple or an empty string.
2024-10-09 11:42:08 +03:00
Furkan Onder 92760bd85b
gh-125150: Skip test_fma_zero_result on NetBSD due to IEE 754-2008 implementation issues (#125151)
Skip test_fma_zero_result on NetBSD due to IEE 754-2008 implementation issues
2024-10-09 10:40:06 +02:00
Victor Stinner e0c87c64b1
gh-124502: Remove _PyUnicode_EQ() function (#125114)
* Replace unicode_compare_eq() with unicode_eq().
* Use unicode_eq() in setobject.c.
* Replace _PyUnicode_EQ() with _PyUnicode_Equal().
* Remove unicode_compare_eq() and _PyUnicode_EQ().
2024-10-09 10:15:17 +02:00
musvaage 7f93dbf6fe
docs: in venv table use executable name (GH-124315)
Co-authored-by: musvaage <musvaage@users.noreply.github.com>
2024-10-09 09:04:35 +01:00