125179 Commits

Author SHA1 Message Date
Rafael Fontenelle
e8092e5cdc
gh-128998: Fix indentation of numbered list and literal block (#128999)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-01-18 20:52:30 +00:00
Peter Bierma
fba475ae6f
gh-121542: Document trailing newline behavior in set_content() (#121543)
Co-authored-by: Yizheng Meng <dev@rapidcow.org>
2025-01-18 20:34:40 +02:00
Peter Bierma
3de7cc15c2
Pre-commit: Drop specific language version and bump hooks (#128801) 2025-01-18 19:53:17 +02:00
Victor Stinner
9bc19643ed
gh-128679: Skip test_tracemalloc_track_race() on debug build (#128988)
There is a race condition between PyMem_SetAllocator() and
PyMem_RawMalloc()/PyMem_RawFree(). While PyMem_SetAllocator() write
is protected by a lock, PyMem_RawMalloc()/PyMem_RawFree() reads are
not protected by a lock. PyMem_RawMalloc()/PyMem_RawFree() can be
called with an old context and the new function pointer.

On a release build, it's not an issue since the context is not used.
On a debug build, the debug hooks use the context and so can crash.
2025-01-18 15:13:54 +00:00
Victor Stinner
81159fce36
gh-59705: Make PYTHREAD_NAME_MAXLEN macro private (#128945)
Rename PYTHREAD_NAME_MAXLEN to _PYTHREAD_NAME_MAXLEN.
2025-01-18 15:10:29 +00:00
Bénédikt Tran
f4afaa6f11
gh-125997: suggest efficient alternatives for time.sleep(0) (#128752) 2025-01-18 12:02:43 +01:00
Bénédikt Tran
d5e9aa690a
gh-118761: Improve import time for csv (#128858)
This reduces the import time of the `csv` module by up to five times,
by importing `re` on demand.

In particular, the `re` module is no more implicitly exposed as `csv.re`.
2025-01-18 11:45:18 +01:00
Marie Roald
d3adf02c90
gh-126349: Add 'fill', 'poly', and 'no_animation' context managers to turtle (#126350)
Co-authored-by: Marie Roald <roald.marie@gmail.com>
Co-authored-by: Yngve Mardal Moe <yngve.m.moe@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Daniel Hollas <danekhollas@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-01-18 11:27:22 +01:00
Tomasz Pytel
4dade055f4
gh-128961: Fix exhausted array iterator crash in __setstate__() (#128962) 2025-01-18 10:55:29 +01:00
Zanie Blue
9ed7bf2cd7
gh-128515: Add BOLT build to CI (gh-128845) 2025-01-18 07:32:23 +00:00
Michał Górny
3829104ab4
gh-128916: Do not set SO_REUSEPORT on non-AF_INET* sockets (GH-128933)
* gh-128916: Do not set `SO_REUSEPORT` on non-`AF_INET*` sockets

Do not attempt to set ``SO_REUSEPORT`` on sockets of address familifies other
than ``AF_INET`` and ``AF_INET6``, as it is meaningless with these address
families, and the call with fail with Linux kernel 6.12.9 and newer.

* Apply suggestions from code review

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>

---------

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-01-17 16:49:16 -08:00
Daniel F Moisset
8174770d31
Fix definition of a generator iterator in glossary.rst (GH-128952)
Fix possible typo/grammar in glossary.rst

As discussed in https://discuss.python.org/t/typo-in-glossary-entry-for-generator-iterator/77163
2025-01-17 16:46:19 -08:00
T. Wouters
d4544cb232
gh-128923: fix test_pydoc for object subclasses without __module__ (#128951)
Fix pydoc's docclass() for classes inheriting from object without the `__module__` attribute, like `_testcapi.HeapType`.
2025-01-17 23:43:17 +01:00
mpage
13c4def692
gh-128955: Fix goto if tlbc creation fails when throwing into a generator (#128957)
We don't have the correct copy of the bytecode and can't update next_instr
appropriately, so just unwind.
2025-01-17 12:53:29 -08:00
Victor Stinner
d95ba9fa11
gh-128911: Add tests on the PyImport C API (#128915)
* Add Modules/_testlimitedcapi/import.c
* Add Lib/test/test_capi/test_import.py
* Remove _testcapi.check_pyimport_addmodule(): tests already covered
  by newly added tests.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-01-17 17:52:18 +00:00
Mark Shannon
b5558cd63c
Refactor code generators a bit (GH-128920)
Refactor code generators a bit to avoid passing stack property around all over the place
2025-01-17 16:59:30 +00:00
Sam Gross
d66c08aa75
gh-128923: Use zero to indicate unassigned unique id (#128925)
In the free threading build, the per thread reference counting uses a
unique id for some objects to index into the local reference count
table. Use 0 instead of -1 to indicate that the id is not assigned. This
avoids bugs where zero-initialized heap type objects look like they have
a unique id assigned.
2025-01-17 16:42:27 +01:00
Tian Gao
767c89ba7c
gh-58956: Fix a frame refleak in bdb (#128190) 2025-01-17 10:33:04 -05:00
Victor Stinner
d7f703d54d
gh-59705: Implement _thread.set_name() on Windows (#128675)
Implement set_name() with SetThreadDescription() and _get_name() with
GetThreadDescription(). If SetThreadDescription() or
GetThreadDescription() is not available in kernelbase.dll, delete the
method when the _thread module is imported.

Truncate the thread name to 32766 characters.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
2025-01-17 14:55:43 +01:00
Hugo van Kemenade
76856ae165
Revert "gh-128770: raise warnings as errors in test suite - except for test_socket which still logs warnings (#128726)" (#128936) 2025-01-17 15:16:10 +02:00
Victor Stinner
939df0f9f6
gh-58689: Fix os.kill() error handling on Windows (#128932) 2025-01-17 13:30:40 +01:00
Thomas Grainger
7807b40730
gh-128770: raise warnings as errors in test suite - except for test_socket which still logs warnings (#128726)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Brett Cannon <brett@python.org>
2025-01-17 13:39:16 +02:00
Taneli Hukkinen
ea6cc26e75
gh-118761: Improve import time of tomllib (#128907)
Improve import time of `tomllib`  (in sync with upstream)
2025-01-16 18:48:42 -08:00
Stan Ulbrych
c879de71eb
ACKS: Add myself (#128924) 2025-01-17 02:45:46 +00:00
Xuanteng Huang
b44ff6d0df
GH-126599: Remove the "counter" optimizer/executor (GH-126853) 2025-01-16 15:57:04 -08:00
Thomas Grainger
27494dd9ad
gh-121604: fix warnings in test_importlib.test_abc and test_importlib.test_windows (GH-128904) 2025-01-16 13:29:16 -08:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
211f41316b
Fix typo in doc (#128917) 2025-01-16 16:32:17 +00:00
sobolevn
f48702dade
gh-128910: Remove _PyTrash_begin and _PyTrash_end C-API functions (#128919) 2025-01-16 15:41:40 +00:00
Irit Katriel
3893a92d95
gh-100239: specialize long tail of binary operations (#128722) 2025-01-16 15:22:13 +00:00
Irit Katriel
e81fe940c9
gh-119786: added InternalDocs/generators.md (#128524) 2025-01-16 13:15:52 +00:00
Victor Stinner
3193cb5ef8
gh-128679: Fix tracemalloc.stop() race conditions (#128893)
tracemalloc_alloc(), tracemalloc_realloc(), tracemalloc_free(),
_PyTraceMalloc_TraceRef() and _PyTraceMalloc_GetMemory() now check
'tracemalloc_config.tracing' after calling TABLES_LOCK().

_PyTraceMalloc_TraceRef() now always returns 0.
2025-01-16 13:53:18 +01:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
313b96eb8b
gh-128017: Make a note that sys variables are read-only (#128887) 2025-01-16 11:17:03 +01:00
Thomas Grainger
d05140f9f7
gh-121604: fix ResourceLoader deprecation warning message (GH-128859) 2025-01-15 21:13:59 +00:00
Irit Katriel
5eee2fe2b0
gh-128891: add specialized opcodes to opcode.opname (#128892) 2025-01-15 21:02:32 +00:00
Tomas R.
256d6d2131
gh-97850: Suggest TraversableResources as the alternative for ResourceLoader (GH-128601)
Suggest TraversableResources as the alternative for ResourceLoader.

Previously, ResourceReader was the suggested alternative, but it
is itself deprecated in favour of TraversableResources.
2025-01-15 12:47:36 -08:00
Victor Stinner
36c5e3bcc2
gh-128679: Redesign tracemalloc locking (#128888)
* Use TABLES_LOCK() to protect 'tracemalloc_config.tracing'.
* Hold TABLES_LOCK() longer while accessing tables.
* tracemalloc_realloc() and tracemalloc_free() no longer
  remove the trace on reentrant call.
* _PyTraceMalloc_Stop() unregisters _PyTraceMalloc_TraceRef().
* _PyTraceMalloc_GetTraces() sets the reentrant flag.
* tracemalloc_clear_traces_unlocked() sets the reentrant flag.
2025-01-15 20:22:44 +00:00
Neil Schemenauer
080f444a58
gh-128807: Add marking phase for free-threaded cyclic GC (gh-128808) 2025-01-15 11:27:28 -08:00
Umar Butler
8d8b854824
gh-128016: Improved invalid escape sequence warning message (#128020) 2025-01-15 18:00:54 +01:00
Victor Stinner
40a4d88a14
gh-128874: Fix the documentation for blurb 2.0 (#128875) 2025-01-15 15:12:40 +01:00
Thomas Grainger
599be687ec
gh-128816: Fix warnings in test_doctest (GH-128817)
* Fix a deprecation warning for using importlib.resources.abc.ResourceReader.
* Fix an import warning when importing readline (if it has not yet been imported).
2025-01-15 15:05:59 +02:00
Wang Ran (汪然)
1a1056d394
Fix typo in Lib/asyncio/futures.py (#128819) 2025-01-15 17:54:31 +05:30
Yan Yanchii
ae7f621c33
gh-128438: Use EnvironmentVarGuard for test_{builtin,io,locale}.py (#128476)
Modifying locale-related environment variables in `Lib/test/test_builtin.py`,
`Lib/test/test_io.py` and `Lib/test/test_locale.py` is now achieved by using
an `EnvironmentVarGuard` context instead of an explicit `try-finally` block.
2025-01-15 10:38:43 +01:00
Zanie Blue
6e4f64109b
gh-128473: Skip segfaulting test_embed tests when BOLT instrumented (gh-128474)
* Skip segfaulting `test_embed` tests when BOLT instrumented

Co-authored-by: Gregory Szorc <gregory.szorc@gmail.com>

* NEWS

---------

Co-authored-by: Gregory Szorc <gregory.szorc@gmail.com>
2025-01-15 10:49:02 +09:00
Tomas R.
bd3baa8b1a
gh-121604: Make sure all deprecated items in importlib raise DeprecationWarning (#128007)
Co-authored-by: rashansmith <smith.rashan@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2025-01-14 16:48:46 -08:00
Serhiy Storchaka
b52de22ac3
gh-71339: Use new assertion methods in the multiprocessing tests (GH-128847) 2025-01-15 01:17:11 +02:00
Serhiy Storchaka
f7ceb317ae
gh-71339: Use new assertion methods in test_logging (GH-128828) 2025-01-14 22:40:45 +02:00
mpage
b5ee0258bf
gh-115999: Specialize LOAD_ATTR for instance and class receivers in free-threaded builds (#128164)
Finish specialization for LOAD_ATTR in the free-threaded build by adding support for class and instance receivers.
2025-01-14 11:56:11 -08:00
Neil Schemenauer
1c13c56a34
gh-128384: Add locking to warnings.py. (gh-128386)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-14 11:43:42 -08:00
Bénédikt Tran
d906bde250
gh-67206: Document that string.printable is not printable in the POSIX sense (#128820) 2025-01-14 17:07:37 +01:00
Victor Stinner
d786ac7f58
gh-59705: Document OS thread name change (#128800) 2025-01-14 16:31:13 +01:00