summaryrefslogtreecommitdiffstats
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* gh-127949: deprecate asyncio policy classes (#128216)Kumar Aditya2024-12-247-34/+66
|
* gh-127949: fix `DeprecationWarning` in test_inspect.py (#128215)Thomas Grainger2024-12-241-15/+13
|
* pathlib tests: create test hierarchy without using class under test (#128200)Barney Gale2024-12-232-29/+55
| | | | | In the pathlib tests, avoid using the path class under test (`self.cls`) in test setup. Instead we use `os` functions in `test_pathlib`, and direct manipulation of `DummyPath` internal data in `test_pathlib_abc`.
* gh-115999: Update test_opcache to test with nested method (gh-128166)Donghee Na2024-12-231-10/+8
| | | gh-115999: Update test_opcace to test with nested method
* gh-127949: fix resource warnings in `test_tasks.py` (#128172)Thomas Grainger2024-12-221-8/+8
|
* GH-127807: pathlib ABCs: move private copying methods to dedicated class ↵Barney Gale2024-12-223-248/+261
| | | | | | | | | | | (#127810) Move 9 private `PathBase` attributes and methods into a new `CopyWorker` class. Change `PathBase.copy` from a method to a `CopyWorker` instance. The methods remain private in the `CopyWorker` class. In future we might make some/all of them public so that user subclasses of `PathBase` can customize the copying process (in particular reading/writing of metadata,) but we'd need to make `PathBase` public first.
* GH-127807: pathlib ABCs: remove a few private attributes (#127851)Barney Gale2024-12-222-56/+64
| | | | | From `PurePathBase` delete `_globber`, `_stack` and `_pattern_str`, and from `PathBase` delete `_glob_selector`. This helps avoid an unpleasant surprise for a users who try to use these names.
* GH-127807: pathlib ABCs: remove `PurePathBase._raw_paths` (#127883)Barney Gale2024-12-225-96/+92
| | | | | Remove the `PurePathBase` initializer, and make `with_segments()` and `__str__()` abstract. This allows us to drop the `_raw_paths` attribute, and also the `Parser.join()` protocol method.
* gh-112328: Make EnumDict usable on its own and document it (GH-123669)Petr Viktorin2024-12-202-6/+37
| | | | | Co-authored-by: Rafi <rafi.promit@gmail.com> Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua> Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
* gh-128049: Fix type confusion bug with the return value of a custom ↵Nico-Posada2024-12-201-0/+43
| | | | ExceptionGroup split function (#128079)
* gh-127946: Use a critical section for `CFuncPtr` attributes (GH-128109)Peter Bierma2024-12-201-1/+19
|
* gh-128116: Skip test_socket VSOCK testStream() on PermissionError (#128120)Victor Stinner2024-12-201-1/+4
|
* gh-109959: Log the current directory in test_glob.test_selflink() (#128122)Victor Stinner2024-12-201-0/+7
|
* gh-128030: Avoid error from PyModule_GetFilenameObject for non-module (#128047)Shantanu2024-12-201-0/+23
| | | | | I missed the extra `PyModule_Check` in #127660 because I was looking at 3.12 as the base implementation for import from. This meant that I missed the `PyModuleCheck` introduced in #112661.
* gh-128058: Fix test_builtin ImmortalTests (#128068)Victor Stinner2024-12-201-1/+4
| | | | | | On 32-bit Free Threading systems, immortal reference count is 5 << 28, instead of 7 << 28. Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* gh-128080: remove unnecessary `__init__` method from Enum (GH-128081)Stephen Morton2024-12-191-3/+0
| | | | | remove unnecessary __init__ method from Enum Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* gh-127274: Defer nested methods (#128012)mpage2024-12-194-13/+9
| | | | | | | Methods (functions defined in class scope) are likely to be cleaned up by the GC anyway. Add a new code flag, `CO_METHOD`, that is set for functions defined in a class scope. Use that when deciding to defer functions.
* gh-128062: Fix the font size and shortcut display of the turtledemo menu ↵Zhikang Yan2024-12-191-10/+7
| | | | | | | | | (#128063) Leave the font of the menu bar the default to keep it consistent with the rest of the world. Display the shortcut keys in the right way, using the 'accelerator' option. --------- Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* gh-115999: Specialize `STORE_ATTR` in free-threaded builds. (gh-127838)Neil Schemenauer2024-12-192-0/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add `_PyDictKeys_StringLookupSplit` which does locking on dict keys and use in place of `_PyDictKeys_StringLookup`. * Change `_PyObject_TryGetInstanceAttribute` to use that function in the case of split keys. * Add `unicodekeys_lookup_split` helper which allows code sharing between `_Py_dict_lookup` and `_PyDictKeys_StringLookupSplit`. * Fix locking for `STORE_ATTR_INSTANCE_VALUE`. Create `_GUARD_TYPE_VERSION_AND_LOCK` uop so that object stays locked and `tp_version_tag` cannot change. * Pass `tp_version_tag` to `specialize_dict_access()`, ensuring the version we store on the cache is the correct one (in case of it changing during the specalize analysis). * Split `analyze_descriptor` into `analyze_descriptor_load` and `analyze_descriptor_store` since those don't share much logic. Add `descriptor_is_class` helper function. * In `specialize_dict_access`, double check `_PyObject_GetManagedDict()` in case we race and dict was materialized before the lock. * Avoid borrowed references in `_Py_Specialize_StoreAttr()`. * Use `specialize()` and `unspecialize()` helpers. * Add unit tests to ensure specializing happens as expected in FT builds. * Add unit tests to attempt to trigger data races (useful for running under TSAN). * Add `has_split_table` function to `_testinternalcapi`.
* GH-122548: Implement branch taken and not taken events for sys.monitoring ↵Mark Shannon2024-12-194-296/+362
| | | | (GH-122564)
* gh-128083: Fix macro redefinition warning in clinic. (GH-127950)Peter Bierma2024-12-191-0/+69
|
* gh-128013: fix data race in `PyUnicode_AsUTF8AndSize` on free-threading ↵Kumar Aditya2024-12-191-1/+19
| | | | (#128021)
* gh-115999: Enable BINARY_SUBSCR_GETITEM for free-threaded build (gh-127737)Donghee Na2024-12-191-1/+18
|
* gh-127949: deprecate `asyncio.get_event_loop_policy` (#128053)Kumar Aditya2024-12-187-25/+35
| | | This deprecates `asyncio.get_event_loop_policy` and will be removed in Python 3.16.
* gh-126639: Add ResourceWarning to NamedTemporaryFile (#126677)Thomas Grainger2024-12-182-6/+29
| | | Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-126742: Avoid checking for library filename in test_ctypes (#128034)Bénédikt Tran2024-12-181-12/+5
| | | Avoid checking for library filename in `dlerror()` error messages of test_ctypes.
* gh-127949: deprecate `asyncio.set_event_loop_policy` (#128024)Kumar Aditya2024-12-1845-67/+77
| | | | First step towards deprecating the asyncio policy system. This deprecates `asyncio.set_event_loop_policy` and will be removed in Python 3.16.
* gh-127060: Disable traceback colors in IDLE (#128028)Victor Stinner2024-12-181-1/+3
| | | | | Set TERM environment variable to "dumb" to disable traceback colors in IDLE, since IDLE doesn't understand ANSI escape sequences.
* Merge branch 'main' of https://github.com/python/cpythonHugo van Kemenade2024-12-172-15/+86
|\
| * gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages ↵Bénédikt Tran2024-12-172-15/+86
| | | | | | | | | | | | | | | | (GH-126746) - Add a helper to set an error from locale-encoded `char*` - Use the helper for gdbm & dlerror messages Co-authored-by: Victor Stinner <vstinner@python.org>
* | Python 3.14.0a3v3.14.0a3Hugo van Kemenade2024-12-171-20/+37
|/
* gh-127085: Add a test skip if multiprocessing isn't available (#128019)Russell Keith-Magee2024-12-171-1/+4
| | | Add a test skip if multiprocessing isn't available.
* gh-127146: Emscripten clean up test suite (#127984)Hood Chatham2024-12-1712-82/+19
| | | Removed test skips that are no longer required as a result of Emscripten updates.
* gh-126907: make `atexit` thread safe in free-threading (#127935)Peter Bierma2024-12-161-1/+34
| | | | Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-127085: fix some data races in memoryview in free-threading (#127412)Edward Xu2024-12-161-1/+25
|
* Revert "gh-127586: properly restore blocked signals in resource_tracker.py ↵Hugo van Kemenade2024-12-162-19/+3
| | | | | (GH-127587)" (#127983) This reverts commit 46006a1b355f75d06c10e7b8086912c483b34487.
* GH-126985: Don't override venv detection with PYTHONHOME (#127968)Filipe Laíns 🇵🇸2024-12-151-0/+31
|
* gh-127586: properly restore blocked signals in resource_tracker.py (GH-127587)Stephen Hansen2024-12-152-3/+19
| | | | | | | | | | | | | | * Correct pthread_sigmask in resource_tracker to restore old signals Using SIG_UNBLOCK to remove blocked "ignored signals" may accidentally cause side effects if the calling parent already had said signals blocked to begin with and did not intend to unblock them when creating a pool. Use SIG_SETMASK instead with the previous mask of blocked signals to restore the original blocked set. * Adding resource_tracker blocked signals test Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-127353: Allow to force color output on Windows V2 (#127926)Andrey Efremov2024-12-142-38/+49
|
* Fix typo in docstring: quadruple double quotes (#127913)Totosuki2024-12-141-1/+1
|
* gh-127747: Resolve BytesWarning in test.support.strace_helper (#127849)Cody Maloney2024-12-141-4/+5
| | | | | | | | | | | | | | | | | | | | | The strace_helper code has a _make_error function to simplify making StraceResult objects in error cases. That takes a details parameter which is either a caught OSError or `bytes`. If it's bytes, _make_error would implicitly coerce that to a str inside of a f-string, resulting in a BytesWarning. It's useful to see if it's an OSError or bytes when debugging, resolve by changing to format with repr(). This is an error message on an internal helper. A non-zero exit code occurs if the strace binary isn't found, and no events will be parsed in that case (there is no output). Handle that case by checking exit code before checking for events. Still asserting around events rather than returning false, so that hopefully if there's some change to `strace` that breaks the parsing, will see that as a test failure rather than silently loosing strace tests because they are auto-disabled.
* gh-115999: Specialize loading attributes from modules in free-threaded ↵mpage2024-12-133-10/+113
| | | | | | | | | builds (#127711) We use the same approach that was used for specialization of LOAD_GLOBAL in free-threaded builds: _CHECK_ATTR_MODULE is renamed to _CHECK_ATTR_MODULE_PUSH_KEYS; it pushes the keys object for the following _LOAD_ATTR_MODULE_FROM_KEYS (nee _LOAD_ATTR_MODULE). This arrangement avoids having to recheck the keys version. _LOAD_ATTR_MODULE is renamed to _LOAD_ATTR_MODULE_FROM_KEYS; it loads the value from the keys object pushed by the preceding _CHECK_ATTR_MODULE_PUSH_KEYS at the cached index.
* gh-102471, PEP 757: Add PyLong import and export API (#121339)Victor Stinner2024-12-131-0/+91
| | | | | Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Steve Dower <steve.dower@microsoft.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-127906: Test the limited C API in test_cppext (#127916)Victor Stinner2024-12-133-3/+25
|
* gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (#127872)Victor Stinner2024-12-131-2/+10
|
* GH-127724: don't use sysconfig to calculate the venv local include path ↵Filipe Laíns 🇵🇸2024-12-121-3/+12
| | | | (#127731)
* Revert "gh-127353: Allow to force color output on Windows (#127354)" (#127889)Hugo van Kemenade2024-12-122-46/+8
| | | This reverts commit 365451e28368db46ae89a3a990d85c10c2284aa2.
* Fix typos in `Lib/_pydecimal.py` (#127700)Stan Ulbrych2024-12-121-2/+2
|
* gh-127353: Allow to force color output on Windows (#127354)Andrey Efremov2024-12-122-8/+46
|
* GH-127807: pathlib ABCs: remove `PathBase._unsupported_msg()` (#127855)Barney Gale2024-12-125-44/+52
| | | | | This method helped us customise the `UnsupportedOperation` message depending on the type. But we're aiming to make `PathBase` a proper ABC soon, so `NotImplementedError` is the right exception to raise there.