summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-112328: Make EnumDict usable on its own and document it (GH-123669)Petr Viktorin2024-12-205-16/+60
| | | | | 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-203-2/+67
| | | | ExceptionGroup split function (#128079)
* Python Tutorial typo fix (#128077)shallow-beach2024-12-201-1/+1
|
* GH-127705: Add debug mode for `_PyStackRef`s inspired by HPy debug mode ↵Mark Shannon2024-12-2012-33/+395
| | | | (GH-128121)
* gh-127295: ctypes: Switch field accessors to fixed-width integers (GH-127297)Petr Viktorin2024-12-204-652/+501
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should be a pure refactoring, without user-visible behaviour changes. Before this change, ctypes uses traditional native C types, usually identified by [`struct` format characters][struct-chars] when a short (and identifier-friendly) name is needed: - `signed char` (`b`) / `unsigned char` (`B`) - `short` (`h`) / `unsigned short` (`h`) - `int` (`i`) / `unsigned int` (`i`) - `long` (`l`) / `unsigned long` (`l`) - `long long` (`q`) / `unsigned long long` (`q`) These map to C99 fixed-width types, which this PR switches to: - - `int8_t`/`uint8_t` - `int16_t`/`uint16_t` - `int32_t`/`uint32_t` - `int64_t`/`uint64_t` The C standard doesn't guarantee that the “traditional” types must map to the fixints. But, [`ctypes` currently requires it][swapdefs], so the assumption won't break anything. By “map” I mean that the *size* of the types matches. The *alignment* requirements might not. This needs to be kept in mind but is not an issue in `ctypes` accessors, which [explicitly handle unaligned memory][memcpy] for the integer types. Note that there are 5 “traditional” C type sizes, but 4 fixed-width ones. Two of the former are functionally identical to one another; which ones they are is platform-specific (e.g. `int`==`long`==`int32_t`.) This means that one of the [current][current-impls-1] [implementations][current-impls-2] is redundant on any given platform. The fixint types are parametrized by the number of bytes/bits, and one bit for signedness. This makes it easier to autogenerate code for them or to write generic macros (though generic API like [`PyLong_AsNativeBytes`][PyLong_AsNativeBytes] is problematic for performance reasons -- especially compared to a `memcpy` with compile-time-constant size). When one has a *different* integer type, determining the corresponding fixint means a `sizeof` and signedness check. This is easier and more robust than the current implementations (see [`wchar_t`][sizeof-wchar_t] or [`_Bool`][sizeof-bool]). [swapdefs]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L420-L444 [struct-chars]: https://docs.python.org/3/library/struct.html#format-characters [current-impls-1]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L470-L653 [current-impls-2]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L703-L944 [memcpy]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L613 [PyLong_AsNativeBytes]: https://docs.python.org/3/c-api/long.html#c.PyLong_AsNativeBytes [sizeof-wchar_t]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L1547-L1555 [sizeof-bool]: https://github.com/python/cpython/blob/v3.13.0/Modules/_ctypes/cfield.c#L1562-L1572 Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* gh-127946: Use a critical section for `CFuncPtr` attributes (GH-128109)Peter Bierma2024-12-204-30/+266
|
* 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-122548: Correct magic number comment (GH-128115)Mark Shannon2024-12-201-1/+2
| | | Correct magic number comment
* gh-128030: Avoid error from PyModule_GetFilenameObject for non-module (#128047)Shantanu2024-12-203-1/+25
| | | | | 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-112328: Document EnumDict in docs and release notes (GH-121720)Md Rokibul Islam2024-12-192-1/+21
| | | | Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua> Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
* 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-1911-14/+37
| | | | | | | 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-192-10/+9
| | | | | | | | | (#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-1913-297/+716
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-1929-583/+998
| | | | (GH-122564)
* gh-128008: Add `PyWeakref_IsDead()` (GH-128009)Sam Gross2024-12-195-0/+41
| | | | | | | | | The `PyWeakref_IsDead()` function tests if a weak reference is dead without any side effects. Although you can also detect if a weak reference is dead using `PyWeakref_GetRef()`, that function returns a strong reference that must be `Py_DECREF()`'d, which can introduce side effects if the last reference is concurrently dropped (at least in the free threading build).
* gh-127951: Add build option to enable pystats on Windows (GH-127952)Pieter Eendebak2024-12-193-1/+7
|
* gh-128083: Fix macro redefinition warning in clinic. (GH-127950)Peter Bierma2024-12-194-2/+131
|
* gh-127688: Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to `os` module ↵RUANG (James Roy)2024-12-197-1/+38
| | | | (GH-127689)
* gh-122706: fix docs for asyncio ssl sockets (#128092)Kumar Aditya2024-12-191-2/+2
|
* gh-128013: fix data race in `PyUnicode_AsUTF8AndSize` on free-threading ↵Kumar Aditya2024-12-192-18/+51
| | | | (#128021)
* gh-128069: brew link --overwrite tcl-tk@8 to prevent conflict with GitHub ↵Victor Stinner2024-12-191-1/+1
| | | | | | | image's version (#128090) brew link --overwrite tcl-tk@8 to prevent conflict with GitHub image's version Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* gh-115999: Enable BINARY_SUBSCR_GETITEM for free-threaded build (gh-127737)Donghee Na2024-12-1912-62/+118
|
* gh-128013: Convert unicodeobject.c macros to functions (#128061)Victor Stinner2024-12-181-45/+78
| | | | | | | Convert unicodeobject.c macros to static inline functions. * Add _PyUnicode_SET_UTF8() and _PyUnicode_SET_UTF8_LENGTH() macros. * Add PyUnicode_HASH() and PyUnicode_SET_HASH() macros. * Remove unused _PyUnicode_KIND() and _PyUnicode_GET_LENGTH() macros.
* gh-128033: change `PyMutex_LockFast` to take `PyMutex` as argument (#128054)Kumar Aditya2024-12-183-5/+6
| | | Change `PyMutex_LockFast` to take `PyMutex` as argument.
* gh-121621: clear running loop early in asyncio (#128004)Kumar Aditya2024-12-181-0/+5
|
* gh-127949: deprecate `asyncio.get_event_loop_policy` (#128053)Kumar Aditya2024-12-189-26/+40
| | | 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-183-6/+30
| | | Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-126742: add NEWS entry for fix of localized error messages (GH-128025)Bénédikt Tran2024-12-181-0/+3
|
* 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-127174: add docs for asyncio.get_event_loop replacements (#127640)Thomas Grainger2024-12-181-0/+90
| | | Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* gh-127897: fix HACL* build on macOS/Catalina (GH-127932)aeiouaeiouaeiouaeiouaeiouaeiou2024-12-183-5/+27
| | | | | | | gh-127897: Update HACL* module from upstream sources to get: - Lib_Memzero0.c: don't use memset_s() on macOS <10.9 - Use _mm_malloc() for KRML_ALIGNED_MALLOC on macOS <10.15 - Add LEGACY_MACOS macros, use _mm_free() for KRML_ALIGNED_FREE on macOS <10.15
* gh-127949: deprecate `asyncio.set_event_loop_policy` (#128024)Kumar Aditya2024-12-1846-67/+81
| | | | 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-182-1/+5
| | | | | Set TERM environment variable to "dumb" to disable traceback colors in IDLE, since IDLE doesn't understand ANSI escape sequences.
* gh-127146: Emscripten Include compiler version in _PYTHON_HOST_PLATFORM ↵Hood Chatham2024-12-172-0/+6
| | | | | | | (#127992) Modifies _PYTHON_HOST_PLATFORM to include the compiler version under Emscripten. The Emscripten compiler version is the platform version compatibility identifier.
* Merge branch 'main' of https://github.com/python/cpythonHugo van Kemenade2024-12-1712-68/+175
|\
| * gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages ↵Bénédikt Tran2024-12-1712-68/+175
| | | | | | | | | | | | | | | | (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>
* | Post 3.14.0a3Hugo van Kemenade2024-12-171-1/+1
| |
* | Python 3.14.0a3v3.14.0a3Hugo van Kemenade2024-12-17120-279/+1200
|/
* 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.
* Free arena on _PyCompile_AstOptimize failure in Py_CompileStringObject ↵Berker Peksag2024-12-161-0/+1
| | | | | | (GH-127910) After commit 10a91d7e9 introduced arena cleanup, commit 2dfbd4f36 removed the free call when _PyCompile_AstOptimize fails.
* gh-126907: make `atexit` thread safe in free-threading (#127935)Peter Bierma2024-12-164-88/+126
| | | | 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-163-8/+52
|
* Revert "gh-127586: properly restore blocked signals in resource_tracker.py ↵Hugo van Kemenade2024-12-163-22/+3
| | | | | (GH-127587)" (#127983) This reverts commit 46006a1b355f75d06c10e7b8086912c483b34487.
* Fix typo in itertools docs (gh-127995)Gugubo2024-12-161-1/+1
|
* gh-127864: Fix compiler warning (-Wstringop-truncation) (GH-127878)Tomas R.2024-12-161-2/+3
|
* gh-127896: Add missing documentation of `PySequence_In` (GH-127979)Yuki Kobayashi2024-12-163-0/+15
| | | | Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>