summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-124872: Refine contextvars documentation (#124773)Richard Hansen2024-10-095-52/+132
| | | | | | | | | | | | | * 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.
* gh-125196: Use PyUnicodeWriter for repr(contextvars.Token) (#125220)Victor Stinner2024-10-092-28/+19
| | | Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.
* gh-125196: PyUnicodeWriter_Discard(NULL) does nothing (#125222)Victor Stinner2024-10-093-3/+6
|
* gh-124969: Skip the test for ALT_DIGITS also on iOS (#125177)Serhiy Storchaka2024-10-091-2/+2
| | | Skip the locale.ALT_DIGITS test on all Apple platforms, not just macOS.
* gh-125140: Remove the current directory from sys.path when using pyrepl ↵Pablo Galindo Salgado2024-10-092-3/+9
| | | | | | | (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>
* gh-125196: Use PyUnicodeWriter for repr(structseq) (#125219)Victor Stinner2024-10-091-41/+24
| | | | | | | | Replace the private _PyUnicodeWriter with the public PyUnicodeWriter. * Avoid temporary PyUnicode_DecodeUTF8(): call PyUnicodeWriter_WriteUTF8() instead. * Avoid temporary PyObject_Repr(): call PyUnicodeWriter_WriteRepr() instead.
* gh-125196: Add fast-path for int in PyUnicodeWriter_WriteStr() (#125214)Victor Stinner2024-10-091-0/+8
| | | | PyUnicodeWriter_WriteStr() and PyUnicodeWriter_WriteRepr() now call directly _PyLong_FormatWriter() if the argument is an int.
* GH-124693: Support parsing negative scientific and complex numbers argparse ↵Savannah Ostrowski2024-10-093-8/+22
| | | | | (GH-124823) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-125196: Use PyUnicodeWriter for repr(list) (#125202)Victor Stinner2024-10-091-22/+23
| | | | | | Replace the private _PyUnicodeWriter with the public PyUnicodeWriter. Replace PyObject_Repr() + _PyUnicodeWriter_WriteStr() with PyUnicodeWriter_WriteRepr().
* gh-91818: Use default program name in the CLI of many modules (GH-124867)Serhiy Storchaka2024-10-0910-12/+14
| | | | | | 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 ...").
* GH-121970: Extract ``availability`` into a new extension (#125082)Adam Turner2024-10-093-76/+126
|
* gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-124865)Eric Snow2024-10-093-6/+91
| | | | | | | | | | 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.
* gh-119786: Move parser doc from devguide to InternalDocs (#125119)Irit Katriel2024-10-092-0/+896
| | | | | | | | | | | | | | | | | | | | 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>
* gh-125196: Use PyUnicodeWriter in symtable.c (#125199)Victor Stinner2024-10-091-19/+16
|
* gh-115999: Refactor `LOAD_GLOBAL` specializations to avoid reloading ↵mpage2024-10-099-155/+372
| | | | | | | | | | | | | | | | | | {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.
* gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125194)Victor Stinner2024-10-0922-35/+35
| | | | | Replace PyUnicode_New(0, 0), PyUnicode_FromString("") and PyUnicode_FromStringAndSize("", 0) with Py_GetConstant(Py_CONSTANT_EMPTY_STR).
* gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_BYTES) (#125195)Victor Stinner2024-10-096-9/+9
| | | | Replace PyBytes_FromString("") and PyBytes_FromStringAndSize("", 0) with Py_GetConstant(Py_CONSTANT_EMPTY_BYTES).
* gh-111178: Fix function signatures in codeobject.c (#125180)Victor Stinner2024-10-091-32/+48
|
* GH-120024: Tidy up pycore_stackref.h, splitting into GIL and free-threading ↵Mark Shannon2024-10-091-101/+65
| | | | sections (GH-125095)
* gh-111178: Fix function signatures in cellobject.c (#125182)Victor Stinner2024-10-091-16/+23
|
* gh-101100: Fix Sphinx warnings in `library/unittest.mock.rst` (#124106)Hugo van Kemenade2024-10-091-30/+30
|
* gh-125168: Fix typo in `__future__.rst` (#125183)JamesMcCarthy212024-10-091-1/+1
| | | | | | | | | * Update `__future__.rst` Fixed typo in the sentence :pep:`649`: *Deferred evaluation of annotations using descriptors* - James McCarthy * Update `__future__.rst` Fixed sphinx formatting
* gh-125039: Make `this_instr`/`prev_instr` const in cases generator (GH-125071)Tomas R.2024-10-094-78/+79
|
* gh-101100: Consolidate documentation on `ModuleType` attributes (#124709)Alex Waygood2024-10-0923-344/+379
| | | | | | 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>
* Fix importlib.resources issue reference in 3.13 What's New (#125175)Alyssa Coghlan2024-10-091-2/+2
| | | | | Previous link was to the PR that removed the mentioned importlib.resources APIs, rather than the issue that added back their improved forms.
* gh-107562: Update test certificates to expire far in the future (GH-125104)Petr Viktorin2024-10-0920-1157/+1163
| | | | | Generated with Lib/test/certdata/make_ssl_certs.py using openssl-3.2.2-3.fc40.x86_64 (Fedora 40).
* gh-107562: make_ssl_certs.py: produce test certificates that expire far in ↵Alexander Kanavin2024-10-093-2/+6
| | | | | | | | | 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>
* gh-124969: Fix locale.nl_langinfo(locale.ALT_DIGITS) (GH-124974)Serhiy Storchaka2024-10-094-6/+74
| | | | | 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.
* gh-125150: Skip test_fma_zero_result on NetBSD due to IEE 754-2008 ↵Furkan Onder2024-10-091-1/+1
| | | | | implementation issues (#125151) Skip test_fma_zero_result on NetBSD due to IEE 754-2008 implementation issues
* gh-124502: Remove _PyUnicode_EQ() function (#125114)Victor Stinner2024-10-094-39/+10
| | | | | | * 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().
* docs: in venv table use executable name (GH-124315)musvaage2024-10-091-1/+1
| | | Co-authored-by: musvaage <musvaage@users.noreply.github.com>
* gh-101552: Allow pydoc to display signatures in source format (#124669)Jelle Zijlstra2024-10-098-27/+126
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-124612: Use ghcr.io/python/autoconf instead of public image (#124657)Donghee Na2024-10-091-4/+2
| | | | | * gh-124612: Use ghcr.io/python/autoconf instead of public image * Update
* gh-123849: Fix test_sqlite3.test_table_dump when foreign keys are enabled by ↵Mariusz Felisiak2024-10-081-1/+2
| | | | default (#123859)
* GH-124478: Cleanup argparse documentation (#124877)Savannah Ostrowski2024-10-082-435/+196
| | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Tomas R <tomas.roun8@gmail.com>
* gh-116110: remove extra processing for the __signature__ attribute (GH-116234)Sergey B Kirpichev2024-10-084-48/+19
| | | This is an alternative to GH-100168.
* Misc improvements to the itertools docs (gh-125147)Raymond Hettinger2024-10-081-39/+97
|
* gh-124832: Add a note to indicate that `datetime.now` may return the same ↵spacemanspiff20072024-10-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | instant (#124834) * Update datetime.rst * Update datetime.rst replace warning with note * Update Doc/library/datetime.rst Co-authored-by: Victor Stinner <vstinner@python.org> * Update Doc/library/datetime.rst Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --------- Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-125063: Emit slices as constants in the bytecode compiler (#125064)Michael Droettboom2024-10-086-23/+122
| | | | | | | | | | | | | | | | | | | | | | | * Make slices marshallable * Emit slices as constants * Update Python/marshal.c Co-authored-by: Peter Bierma <zintensitydev@gmail.com> * Refactor codegen_slice into two functions so it always has the same net effect * Fix for free-threaded builds * Simplify marshal loading of slices * Only return SUCCESS/ERROR from codegen_slice --------- Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* gh-125084: Resolve paths in generator common code (GH-125085)Cody Maloney2024-10-081-3/+3
| | | | In out of tree builds, the paths can contain `../ which needs to be resolved for the relative path calculation to work.
* gh-117721: use PyMutex in `_thread.lock` (#125110)Kumar Aditya2024-10-081-45/+11
|
* gh-124502: Optimize unicode_eq() (#125105)Victor Stinner2024-10-081-7/+12
|
* gh-115999: Stop the world when invalidating function versions (#124997)mpage2024-10-084-38/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stop the world when invalidating function versions The tier1 interpreter specializes `CALL` instructions based on the values of certain function attributes (e.g. `__code__`, `__defaults__`). The tier1 interpreter uses function versions to verify that the attributes of a function during execution of a specialization match those seen during specialization. A function's version is initialized in `MAKE_FUNCTION` and is invalidated when any of the critical function attributes are changed. The tier1 interpreter stores the function version in the inline cache during specialization. A guard is used by the specialized instruction to verify that the version of the function on the operand stack matches the cached version (and therefore has all of the expected attributes). It is assumed that once the guard passes, all attributes will remain unchanged while executing the rest of the specialized instruction. Stopping the world when invalidating function versions ensures that all critical function attributes will remain unchanged after the function version guard passes in free-threaded builds. It's important to note that this is only true if the remainder of the specialized instruction does not enter and exit a stop-the-world point. We will stop the world the first time any of the following function attributes are mutated: - defaults - vectorcall - kwdefaults - closure - code This should happen rarely and only happens once per function, so the performance impact on majority of code should be minimal. Additionally, refactor the API for manipulating function versions to more clearly match the stated semantics.
* gh-125096: Don't import _pyrepl in site if PYTHON_BASIC_REPL (#125097)Victor Stinner2024-10-083-7/+36
| | | | | | | If the PYTHON_BASIC_REPL environment variable is set, the site module no longer imports the _pyrepl module. Moreover, the site module now respects -E and -I command line options: ignore PYTHON_BASIC_REPL in this case.
* gh-112433 add versionadded for `ctypes.Structure._align_` (#125087)monkeyman1922024-10-082-0/+6
| | | Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* Doc: Improve description of ``GET_LEN`` opcode (#114583)Kirill Podoprigora2024-10-081-1/+2
|
* gh-121404: typo fix in compile.c: MATADATA -> METADATA (#125101)Mikhail Efimov2024-10-081-5/+5
|
* gh-75898: make use of thread more explicit in the "Socket Programming HOWTO" ↵Jan Kaliszewski2024-10-081-2/+2
| | | | document (#125023)
* gh-90102: Fix pyio _isatty_open_only() (#125089)Cody Maloney2024-10-081-1/+1
| | | | | | | Spotted by @ngnpope. `isatty` returns False to indicate the file is not a TTY. The C implementation of _io does that (`Py_RETURN_FALSE`) but I got the bool backwards in the _pyio implementaiton.
* gh-123961: Convert _curses to a multi-phase init module (PEP-489) (#124965)Bénédikt Tran2024-10-083-82/+116
|