Commit Graph

32904 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Irit Katriel 3893a92d95
gh-100239: specialize long tail of binary operations (#128722) 2025-01-16 15:22:13 +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
Irit Katriel 5eee2fe2b0
gh-128891: add specialized opcodes to opcode.opname (#128892) 2025-01-15 21:02:32 +00:00
Umar Butler 8d8b854824
gh-128016: Improved invalid escape sequence warning message (#128020) 2025-01-15 18:00:54 +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
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
Serhiy Storchaka 859db49029
gh-71339: Use new assertion methods in test_typing (GH-128825) 2025-01-14 15:19:32 +02:00
Serhiy Storchaka 75bd42c737
gh-71339: Use new assertion methods in test_sqlite3 (GH-128830) 2025-01-14 15:18:25 +02:00
Victor Stinner 1153e66e20
gh-109959: Skip test_glob.test_selflink() flaky test (#128812) 2025-01-14 11:18:52 +01:00
Serhiy Storchaka 06cad77a5b
gh-71339: Add additional assertion methods for unittest (GH-128707)
Add the following methods:

* assertHasAttr() and assertNotHasAttr()
* assertIsSubclass() and assertNotIsSubclass()
* assertStartsWith() and assertNotStartsWith()
* assertEndsWith() and assertNotEndsWith()

Also improve error messages for assertIsInstance() and
assertNotIsInstance().
2025-01-14 10:02:38 +02:00
Bénédikt Tran b70a567575
gh-125997: Increase test coverage for `time.sleep()` (#128751)
- Add tests for durations of invalid types.
- Add tests for `int` and `float` durations, including signed zeroes durations.
- Add tests for nonzero very small durations and durations close to the clock resolution.

---------

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-13 17:58:11 +01:00
Zhikang Yan da8825ea95
gh-128562: Fix generation of the tkinter widget names (GH-128604)
There were possible conflicts if the widget class name ends with a digit.
2025-01-13 15:54:46 +00:00
Bénédikt Tran 402b91da87
gh-128078: Use `PyErr_SetRaisedException` in `_PyGen_SetStopIterationValue` (#128287)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-13 21:24:13 +05:30
Kumar Aditya 3efe28a40b
gh-128002: add more thread safety tests for asyncio (#128480) 2025-01-13 15:36:55 +00:00
Peter Bierma bf64a582f0
gh-128400: Only show the current thread in `Py_FatalError` on the free-threaded build (#128758) 2025-01-13 20:06:54 +05:30
Peter Bierma 8dfc743a1d
gh-128182: Add per-object memory access synchronization to `ctypes` (GH-128490) 2025-01-13 14:17:38 +01:00
Petr Viktorin aa6579cb60
gh-127773: Disable attribute cache on incompatible MRO entries (GH-127924) 2025-01-13 14:10:41 +01:00
Bénédikt Tran 76ffaef729
gh-128078: Clear exception in `anext` before calling `_PyGen_SetStopIterationValue` (#128780)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-13 18:25:09 +05:30
Mark Shannon 517dc65ffc
GH-128682: Stronger checking of `PyStackRef_CLOSE` and `DEAD`. (GH-128683) 2025-01-13 12:37:48 +00:00
Mark Shannon 39fc7ef4fe
GH-124483: Mark `Py_DECREF`, etc. as escaping for the JIT (GH-128678) 2025-01-13 11:42:45 +00:00
Hugo van Kemenade afb9dc887c
gh-128595: Add test class helper to force no terminal colour (#128687)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2025-01-13 11:05:02 +00:00
Mark Shannon ddd959987c
GH-128685: Specialize (rather than quicken) LOAD_CONST into LOAD_CONST_[IM]MORTAL (GH-128708) 2025-01-13 10:30:28 +00:00
Ned Deily b00e1254fc
gh-128690: temporarily do not use test_embed in PGO profile builds (#128771)
Temporarily do not use test_embed in PGO profile builds until the problem with test_init_pyvenv_cfg failing in some configurations is resolved.
2025-01-13 04:02:18 -05:00
Peter Bierma f6c61bf2d7
gh-128717: Stop-the-world when setting the recursion limit (#128741) 2025-01-12 18:34:30 +05:30
Serhiy Storchaka 5ace71713b
gh-128734: Fix ResourceWarning in urllib tests (GH-128735) 2025-01-12 12:53:17 +02:00
Serhiy Storchaka cb72feb8a3
gh-128729: Fix RuntimeWarning in test_unittest (GH-128730) 2025-01-12 12:22:43 +02:00
Yan Yanchii 30268b5d2f
gh-128377: Skip `test_cmd_line.test_non_interactive_output_buffering` when `PYTHONUNBUFFERED=1` (#128378)
The `test_cmd_line.test_non_interactive_output_buffering` test assumes a buffered `stdio`
without checking the `PYTHONUNBUFFERED` value. Instead of changing the environment
variable for the duration of the test, it is better to simply skip it.
2025-01-12 09:27:28 +01:00
Barney Gale 22a442181d
GH-128520: Divide pathlib ABCs into three classes (#128523)
In the private pathlib ABCs, rename `PurePathBase` to `JoinablePath`, and
split `PathBase` into `ReadablePath` and `WritablePath`. This improves the
API fit for read-only virtual filesystems.

The split of `PathBase` entails a similar split of `CopyWorker` (implements
copying) and the test cases in `test_pathlib_abc`.

In a later patch, we'll make `WritablePath` inherit directly from
`JoinablePath` rather than `ReadablePath`. For a couple of reasons,
this isn't quite possible yet.
2025-01-11 19:27:47 +00:00
Yan Yanchii 0946ed25b5
gh-128438: Add `EnvironmentVarGuard` for `test_pdb.py` (#128522) 2025-01-11 11:19:29 -05:00
9cel 3a570c6d58
Make the Python CLI error message style more consistent (GH-128129) 2025-01-11 11:17:35 +02:00