summaryrefslogtreecommitdiffstats
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* gh-111609: Test `end_offset` in SyntaxError subclass (#127830)Nice Zombies2024-12-111-0/+15
| | | Test `end_offset` in SyntaxError subclass
* GH-125174: Mark objects as statically allocated. (#127797)Mark Shannon2024-12-112-1/+17
| | | | | * Set a bit in the unused part of the refcount on 64 bit machines and the free-threaded build. * Use the top of the refcount range on 32 bit machines
* gh-127065: Make methodcaller thread-safe and re-entrant (GH-127746)Pieter Eendebak2024-12-112-0/+46
| | | | | | | | | | | The function `operator.methodcaller` was not thread-safe since the additional of the vectorcall method in gh-89013. In the free threading build the issue is easy to trigger, for the normal build harder. This makes the `methodcaller` safe by: * Replacing the lazy initialization with initialization in the constructor. * Using a stack allocated space for the vectorcall arguments and falling back to `tp_call` for calls with more than 8 arguments.
* GH-127058: Make `PySequence_Tuple` safer and probably faster. (#127758)Mark Shannon2024-12-111-0/+25
| | | | * Use a small buffer, then list when constructing a tuple from an arbitrary sequence.
* gh-123401: Fix http.cookies module to support obsolete RFC 850 date format ↵Nano2024-12-112-2/+50
| | | | | | | (#123405) Co-authored-by: Wulian <1055917385@qq.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-126992: Change pickle code to base 10 for load_long and load_int (GH-127042)Justin Applegate2024-12-113-2/+59
| | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-127740: For odd-length input to bytes.fromhex(...) change the error ↵Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)2024-12-111-0/+6
| | | | message to ValueError: fromhex() arg must be of even length (#127756)
* GH-127381: pathlib ABCs: remove `PathBase.samefile()` and rarer `is_*()` ↵Barney Gale2024-12-114-171/+141
| | | | | | | | | | (#127709) Remove `PathBase.samefile()`, which is fairly specific to the local FS, and relies on `stat()`, which we're aiming to remove from `PathBase`. Also remove `PathBase.is_mount()`, `is_junction()`, `is_block_device()`, `is_char_device()`, `is_fifo()` and `is_socket()`. These rely on POSIX file type numbers that we're aiming to remove from the `PathBase` API.
* gh-59705: Set OS thread name when Thread.name is changed (#127702)Victor Stinner2024-12-102-5/+30
| | | Co-authored-by: Petr Viktorin <encukou@gmail.com>
* gh-126937: ctypes: fix TypeError when a field's size is >65535 bytes (GH-126938)Melissa0x1f9922024-12-101-0/+23
| | | | | Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Petr Viktorin <encukou@gmail.com>
* gh-126491: Revert "GH-126491: Lower heap size limit with faster marking ↵Petr Viktorin2024-12-101-3/+11
| | | | | | | | (GH-127519)" (GH-127770) Revert "GH-126491: Lower heap size limit with faster marking (GH-127519)" This reverts commit 023b7d2141467017abc27de864f3f44677768cb3, which introduced a refleak.
* gh-125420: implement `Sequence.count` API on `memoryview` objects (#125443)Bénédikt Tran2024-12-101-0/+28
|
* add help blurb for "extralargefile" (#127710)Skip Montanaro2024-12-101-20/+22
|
* gh-127718: Add colour to `test.regrtest` output (#127719)Hugo van Kemenade2024-12-105-53/+163
|
* gh-126775: make linecache.checkcache threadsafe and GC re-entrency safe ↵Thomas Grainger2024-12-101-5/+8
| | | | | | | (#126776) Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Bartosz Sławecki <bartoszpiotrslawecki@gmail.com>
* gh-127651: Use __file__ in diagnostics if origin is missing (#127660)Shantanu2024-12-101-2/+46
| | | | | | | See the left hand side in https://github.com/python/cpython/pull/123929/files#diff-c22186367cbe20233e843261998dc027ae5f1f8c0d2e778abfa454ae74cc59deL2840-L2849 --------- Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-125420: implement `Sequence.index` API on `memoryview` objects (#125446)Bénédikt Tran2024-12-101-0/+26
|
* GH-127456: pathlib ABCs: add protocol for path parser (#127494)Barney Gale2024-12-093-107/+32
| | | | | | | | | | Change the default value of `PurePathBase.parser` from `ParserBase()` to `posixpath`. As a result, user subclasses of `PurePathBase` and `PathBase` use POSIX path syntax by default, which is very often desirable. Move `pathlib._abc.ParserBase` to `pathlib._types.Parser`, and convert it to a runtime-checkable protocol. Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-127637: add tests for `dis` command-line interface (#127759)Bénédikt Tran2024-12-092-4/+122
|
* gh-127732: Add Windows Server 2025 detection to platform module (GH-127733)Wulian2024-12-091-1/+2
|
* gh-126925: Modify how iOS test results are gathered (#127592)Russell Keith-Magee2024-12-094-0/+227
| | | | | | | Adds a `use_system_log` config item to enable stdout/stderr redirection for Apple platforms. This log streaming is then used by a new iOS test runner script, allowing the display of test suite output at runtime. The iOS test runner script can be used by any Python project, not just the CPython test suite.
* gh-127734: improve signature of ↵Stephen Morton2024-12-081-2/+2
| | | | | `urllib.request.HTTPPasswordMgrWithPriorAuth.__init__` (#127735) improve signature of urllib.request.HTTPPasswordMgrWithPriorAuth.__init__
* GH-127381: pathlib ABCs: remove `PathBase.unlink()` and `rmdir()` (#127736)Barney Gale2024-12-084-86/+48
| | | | | | | Virtual filesystems don't always make a distinction between deleting files and empty directories, and sometimes support deleting non-empty directories in a single operation. Here we remove `PathBase.unlink()` and `rmdir()`, leaving `_delete()` as the sole deletion method, now made abstract. I hope to drop the underscore prefix later on.
* gh-127610: Added validation for more than one var-positional and var-keyword ↵Apostol Fet2024-12-082-0/+19
| | | | parameters in inspect.Signature (GH-127657)
* GH-126789: fix some sysconfig data on late site initializations (#127729)Filipe Laíns 🇵🇸2024-12-082-5/+38
|
* GH-127090: Fix `urllib.response.addinfourl.url` value for opened `file:` ↵Barney Gale2024-12-074-28/+22
| | | | | URIs (#127091) The canonical `file:` URL (as generated by `pathname2url()`) is now used as the `url` attribute of the returned `addinfourl` object. The `addinfourl.url` attribute reflects the resolved URL for both `file:` or `http[s]:` URLs now.
* Give `poplib.POP3.rpop` a proper docstring (#127370)Stan Ulbrych2024-12-071-1/+1
| | | Previously `poplib.POP3.rpop` had a "Not sure what this does" docstring, now it has been fixed.
* 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.