Commit graph

33268 commits

Author SHA1 Message Date
Bénédikt Tran
59fcae793f
Remove duplicated dict keys in test_{embed,long}.py fixtures (#128727) 2025-01-20 13:50:10 +01:00
Serhiy Storchaka
a30277a06a
gh-71339: Use new assertion methods in test_capi (GH-129053) 2025-01-20 14:32:27 +02:00
Erlend E. Aasland
537296cdcd
gh-111178: Generate correct signature for most self converters (#128447) 2025-01-20 12:40:18 +01:00
Serhiy Storchaka
c6b570e5e3
gh-71339: Use new assertion methods in test_asyncio (#129051) 2025-01-20 17:02:39 +05:30
Hugo van Kemenade
6f167d7134
gh-128595: Default to stdout isatty for colour detection instead of stderr (#128498)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-20 12:52:42 +02: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
Serhiy Storchaka
c463270c73
gh-71339: Use new assertion methods in test_traceback (GH-128848) 2025-01-20 11:22:33 +02:00
Serhiy Storchaka
485d2e831e
gh-71339: Use assertIsSubclass() and assertNotIsSubclass() in test_decimal (GH-128827) 2025-01-20 11:20:49 +02:00
Serhiy Storchaka
36aaf4137d
gh-71339: Use new assertion methods in test_abc (GH-128826) 2025-01-20 11:19:43 +02:00
Serhiy Storchaka
da122b5fac
gh-71339: Improve error report for types in assertHasAttr() and assertNotHasAttr() (GH-128818) 2025-01-20 11:17:49 +02:00
Serhiy Storchaka
89c401fb9a
gh-71339: Use new assertion methods in test_functools (GH-128829) 2025-01-20 11:17:04 +02:00
Serhiy Storchaka
887f2bcf48
gh-71339: Use assertIsSubclass() and assertNotIsSubclass() in test_collections (GH-128824) 2025-01-20 11:16:32 +02:00
Kirill Podoprigora
6c52ada551
gh-100239: Handle NaN and zero division in guards for BINARY_OP_EXTEND (#128963)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-01-19 11:02:49 +00:00
Mike Edmunds
5aaf416858
gh-80222: Fix email address header folding with long quoted-string (#122753)
Email generators using email.policy.default could incorrectly omit the
quote ('"') characters from a quoted-string during header refolding,
leading to invalid address headers and enabling header spoofing. This
change restores the quote characters on a bare-quoted-string as the
header is refolded, and escapes backslash and quote chars in the string.
2025-01-18 19:50:52 -05: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
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