summaryrefslogtreecommitdiffstats
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
...
* GH-127381: pathlib ABCs: remove `PathBase.resolve()` and `absolute()` (#127707)Barney Gale2024-12-063-731/+599
| | | | | | | | | Remove our implementation of POSIX path resolution in `PathBase.resolve()`. This functionality is rather fragile and isn't necessary in most cases. It depends on `PathBase.stat()`, which we're looking to remove. Also remove `PathBase.absolute()`. Many legitimate virtual filesystems lack the notion of a 'current directory', so it's wrong to include in the basic interface.
* GH-127381: pathlib ABCs: remove `PathBase.rename()` and `replace()` (#127658)Barney Gale2024-12-063-38/+18
| | | | These methods are obviated by `PathBase.move()`, which can move directories and supports any `PathBase` object as a target.
* Fix typo in `Lib/_android_support.py` (#127699)Stan Ulbrych2024-12-061-1/+1
|
* gh-59705: Add _thread.set_name() function (#127338)Victor Stinner2024-12-062-0/+69
| | | | | | | | | | | On Linux, threading.Thread now sets the thread name to the operating system. * configure now checks if pthread_getname_np() and pthread_setname_np() functions are available. * Add PYTHREAD_NAME_MAXLEN macro. * Add _thread._NAME_MAXLEN constant for test_threading. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-127314: Don't mention the GIL when calling without a thread state on the ↵Peter Bierma2024-12-062-7/+19
| | | | | free-threaded build (#127315) Co-authored-by: Victor Stinner <vstinner@python.org>
* GH-126491: Lower heap size limit with faster marking (GH-127519)Mark Shannon2024-12-061-11/+3
| | | | | | | * Faster marking of reachable objects * Changes calculation of work to do and work done. * Merges transitive closure calculations
* gh-120010: Fix invalid (nan+nanj) results in _Py_c_prod() (GH-120287)Sergey B Kirpichev2024-12-061-0/+17
| | | | | | | | | | | | | | | | | | | | In some cases, previously computed as (nan+nanj), we could recover meaningful component values in the result, see e.g. the C11, Annex G.5.1, routine _Cmultd(): >>> z = 1e300+1j >>> z*(nan+infj) # was (nan+nanj) (-inf+infj) That also fix some complex powers for small integer exponents, computed with optimized algorithm (by squaring): >>> z**5 # was (nan+nanj) Traceback (most recent call last): File "<python-input-1>", line 1, in <module> z**5 ~^^~ OverflowError: complex exponentiation
* gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol ↵J. Nick Koston2024-12-062-0/+13
| | | | | | | if needed (#127656) Ensure `_SelectorSocketTransport.writelines` pauses the protocol if it reaches the high water mark as needed. Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* GH-125413: Revert addition of `pathlib.Path.scandir()` method (#127377)Barney Gale2024-12-053-49/+18
| | | | | | | | | | Remove documentation for `pathlib.Path.scandir()`, and rename the method to `_scandir()`. In the private pathlib ABCs, make `iterdir()` abstract and call it from `_scandir()`. It's not worthwhile to add this method at the moment - see discussion: https://discuss.python.org/t/ergonomics-of-new-pathlib-path-scandir/71721 Co-authored-by: Steve Dower <steve.dower@microsoft.com>
* gh-127221: Add colour to unittest output (#127223)Hugo van Kemenade2024-12-057-42/+110
| | | Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* GH-126727: Fix test_era_nl_langinfo with Japanese ERAs on Solaris (GH-127327)Jakub Kulík2024-12-051-0/+5
| | | Fix test_era_nl_langinfo with Japanese ERAs on Solaris
* gh-122431: Disallow negative values in `readline.append_history_file` (#122469)Peter Bierma2024-12-051-0/+8
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-127413: allow to show specialized bytecode via `dis` CLI (#127414)Bénédikt Tran2024-12-051-1/+4
|
* gh-127146: Emscripten: Skip segfaults in test suite (#127151)Hood Chatham2024-12-0519-8/+44
| | | | Added skips for tests known to cause problems when running on Emscripten. These mostly relate to the limited stack depth on Emscripten.
* gh-127552: Remove comment questioning 4-digit restriction for ‘Y’ in ↵Beomsoo Kim2024-12-041-2/+0
| | | | | datetime.strptime patterns (#127590) The code has required 4 digits for the year since its inclusion in the stdlib in 2002 (over 22 years ago as of this commit).
* gh-123378: Ensure results of `PyUnicode*Error_Get{Start,End}` are clamped ↵Bénédikt Tran2024-12-041-0/+150
| | | | | | (GH-123380) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
* gh-127572: Fix `test_structmembers` initialization (GH-127577)Sam Gross2024-12-041-1/+1
| | | | | | | | gh-127572: Fix `test_structmembers` initialization. The 'C' format code expects an `int` as a destination (not a `char`). This led to test failures on big-endian platforms like s390x. Use the 'c' format code, which expects a `char` as the destination (but requires a Python byte objects instead of a str).
* gh-127146: Resolve some minor problems in Emscripten tests (#127565)Hood Chatham2024-12-043-4/+4
| | | | Adjusts some Emscripten test exclusions regarding strftime, fma, and stack depth.
* gh-112192: Increase the trace module coverage precision to one decimal (#126972)RUANG (James Roy)2024-12-033-7/+6
|
* gh-115999: Enable specialization of `CALL` instructions in free-threaded ↵mpage2024-12-033-14/+44
| | | | | | | | | | | | | | | | | | | | | | builds (#127123) The CALL family of instructions were mostly thread-safe already and only required a small number of changes, which are documented below. A few changes were needed to make CALL_ALLOC_AND_ENTER_INIT thread-safe: Added _PyType_LookupRefAndVersion, which returns the type version corresponding to the returned ref. Added _PyType_CacheInitForSpecialization, which takes an init method and the corresponding type version and only populates the specialization cache if the current type version matches the supplied version. This prevents potentially caching a stale value in free-threaded builds if we race with an update to __init__. Only cache __init__ functions that are deferred in free-threaded builds. This ensures that the reference to __init__ that is stored in the specialization cache is valid if the type version guard in _CHECK_AND_ALLOCATE_OBJECT passes. Fix a bug in _CREATE_INIT_FRAME where the frame is pushed to the stack on failure. A few other miscellaneous changes were also needed: Use {LOCK,UNLOCK}_OBJECT in LIST_APPEND. This ensures that the list's per-object lock is held while we are appending to it. Add missing co_tlbc for _Py_InitCleanup. Stop/start the world around setting the eval frame hook. This allows us to read interp->eval_frame non-atomically and preserves the behavior of _CHECK_PEP_523 documented below.
* gh-127271: Replace use of PyCell_GET/SET (gh-127272)Neil Schemenauer2024-12-031-0/+134
| | | | | | | | | | | | | | | | | | * Replace uses of `PyCell_GET` and `PyCell_SET`. These macros are not safe to use in the free-threaded build. Use `PyCell_GetRef()` and `PyCell_SetTakeRef()` instead. * Since `PyCell_GetRef()` returns a strong rather than borrowed ref, some code restructuring was required, e.g. `frame_get_var()` returns a strong ref now. * Add critical sections to `PyCell_GET` and `PyCell_SET`. * Move critical_section.h earlier in the Python.h file. * Add `PyCell_GET` to the free-threading howto table of APIs that return borrowed refs. * Add additional unit tests for free-threading.
* gh-115999: Add free-threaded specialization for `SEND` (gh-127426)Neil Schemenauer2024-12-031-0/+42
| | | | | No additional thread safety changes are required. Note that sending to a generator that is shared between threads is currently not safe in the free-threaded build.
* gh-127421: Fix race in test_start_new_thread_failed (#127549)mpage2024-12-031-1/+2
| | | | | | | | | | | | | | Fix race in test_start_new_thread_failed When we succeed in starting a new thread, for example if setrlimit was ineffective, we must wait for the newly spawned thread to exit. Otherwise, we run the risk that the newly spawned thread will race with runtime finalization and access memory that has already been clobbered/freed. `_thread.start_new_thread()` only spawns daemon threads, which the runtime does not wait for at shutdown, and does not return a handle. Use `_thread.start_joinable_thread()` and join the resulting handle when the thread is started successfully.
* gh-115999: Specialize `LOAD_SUPER_ATTR` in free-threaded builds (gh-127128)Neil Schemenauer2024-12-031-0/+39
| | | | | | Use existing helpers to atomically modify the bytecode. Add unit tests to ensure specializing is happening as expected. Add test_specialize.py that can be used with ThreadSanitizer to detect data races. Fix thread safety issue with cell_set_contents().
* gh-127347: Document `traceback.print_list` (#127348)Tomas R.2024-12-032-3/+2
| | | Previously, `traceback.print_list` didn't have a documentation entry and was not exposed in `traceback.__all__`. Now it has a documentation entry and is exposed in `__all__`.
* gh-127255: Make `CopyComPointer` public and add to `ctypes` doc. (GH-127275)Jun Komoda2024-12-032-3/+2
|
* gh-117657: TSAN Fix races in `PyMember_Get` and `PyMember_Set` for C ↵Daniele Parmeggiani2024-12-033-0/+258
| | | | extensions (GH-123211)
* Speed-up lazy heapq import in collections (gh-127538)Raymond Hettinger2024-12-031-1/+6
|
* gh-126876: Fix test_socket.testLargeTimeout() for missing _testcapi (#127517)Victor Stinner2024-12-021-2/+8
|
* gh-109523: Raise a BlockingIOError if reading text from a non-blocking ↵Giovanni Siragusa2024-12-022-1/+20
| | | | stream cannot immediately return bytes. (GH-122933)
* gh-126618: fix repr(itertools.count(sys.maxsize)) (#127048)Sergey B Kirpichev2024-12-021-0/+23
| | | Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* GH-126491: GC: Mark objects reachable from roots before doing cycle ↵Mark Shannon2024-12-022-11/+15
| | | | | | | | | | | | | collection (GH-127110) * Mark almost all reachable objects before doing collection phase * Add stats for objects marked * Visit new frames before each increment * Update docs * Clearer calculation of work to do.
* add missing gc_collect() calls in sqlite3 tests (#127446)CF Bolz-Tereick2024-12-021-0/+2
|
* GH-127429: fix sysconfig data generation on cross-builds (#127430)Filipe Laíns 🇵🇸2024-12-022-14/+42
|
* gh-115999: Add partial free-thread specialization for BINARY_SUBSCR (gh-127227)Donghee Na2024-12-022-51/+77
|
* gh-126899: Add `**kw` to `tkinter.Misc.after` and `tkinter.Misc.after_idle` ↵Zhikang Yan2024-12-012-8/+20
| | | | | | | (#126900) --------- Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-127321: Avoid stopping at an opcode without an associated line number for ↵Tian Gao2024-12-012-0/+23
| | | | breakpoint() (#127457)
* Add the missing `f` on an f-string error message in multiprocessing. (GH-127462)Gregory P. Smith2024-12-011-1/+1
|
* gh-127165: Disallow embedded NULL characters in `_interpreters` (#127199)Peter Bierma2024-12-011-0/+4
|
* GH-127381: pathlib ABCs: remove `PathBase.cwd()` and `home()` (#127427)Barney Gale2024-11-303-17/+17
| | | | | These classmethods presume that the user has retained the original `__init__()` signature, which may not be the case. Also, many virtual filesystems don't provide current or home directories.
* GH-127381: pathlib ABCs: remove `PathBase.lstat()` (#127382)Barney Gale2024-11-294-29/+26
| | | | | | Remove the `PathBase.lstat()` method, which is a trivial variation of `stat()`. No user-facing changes because the pathlib ABCs are still private.
* gh-127316: fix incorrect assertion in setting `__class__` in free-threading ↵Kumar Aditya2024-11-291-0/+15
| | | | (#127399)
* gh-127208: Reject null character in _imp.create_dynamic() (#127400)Victor Stinner2024-11-291-0/+13
| | | | _imp.create_dynamic() now rejects embedded null characters in the path and in the module name.
* gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (#127358)Victor Stinner2024-11-291-1/+5
| | | Replace the sleep(2) with a task which is blocked forever.
* gh-127341: Argument Clinic: fix compiler warnings for getters with ↵Peter Bierma2024-11-291-8/+4
| | | | | docstrings (#127310) Co-authored-by: Erlend E. Aasland <erlend@python.org>
* gh-127303: Add docs for token.EXACT_TOKEN_TYPES (#127304)Илья Любавский2024-11-291-1/+2
| | | | | | | --------- Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Tomas R. <tomas.roun8@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-127190: Fix local_setattro() error handling (#127366)Victor Stinner2024-11-281-0/+15
| | | | Don't make the assumption that the 'name' argument is a string. Use repr() to format the 'name' argument instead.
* GH-127178: install a _sysconfig_vars_(...).json file in the stdlib directory ↵Filipe Laíns 🇵🇸2024-11-272-11/+59
| | | | (#127302)
* gh-122288: Improve performances of `fnmatch.translate` (#122289)Bénédikt Tran2024-11-273-49/+112
| | | | | Improve performance of this function by a factor of 1.7x. Co-authored-by: Barney Gale <barney.gale@gmail.com>
* gh-124008: Fix calculation of the number of written bytes for the Windows ↵Serhiy Storchaka2024-11-271-0/+23
| | | | | | | | | | | | console (GH-124059) Since MultiByteToWideChar()/WideCharToMultiByte() is not reversible if the data contains invalid UTF-8 sequences, use binary search to calculate the number of written bytes from the number of written characters. Also fix writing incomplete UTF-8 sequences. Also fix handling of memory allocation failures.