Commit Graph

124791 Commits

Author SHA1 Message Date
Md Rokibul Islam 39e69a7cd5
gh-112328: Document EnumDict in docs and release notes (GH-121720)
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-12-19 15:38:42 -08:00
Stephen Morton c14db20275
gh-128080: remove unnecessary `__init__` method from Enum (GH-128081)
remove unnecessary __init__ method from Enum

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-12-19 14:07:17 -08:00
mpage 255762c09f
gh-127274: Defer nested methods (#128012)
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.
2024-12-19 13:03:14 -08:00
Zhikang Yan e163e8d4e1
gh-128062: Fix the font size and shortcut display of the turtledemo menu (#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>
2024-12-19 15:24:47 -05:00
Neil Schemenauer 1b15c89a17
gh-115999: Specialize `STORE_ATTR` in free-threaded builds. (gh-127838)
* 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`.
2024-12-19 10:21:17 -08:00
Mark Shannon d2f1d917e8
GH-122548: Implement branch taken and not taken events for sys.monitoring (GH-122564) 2024-12-19 16:59:51 +00:00
Sam Gross 7b811d0562
gh-128008: Add `PyWeakref_IsDead()` (GH-128009)
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).
2024-12-19 16:17:15 +01:00
Pieter Eendebak b9b3e4a076
gh-127951: Add build option to enable pystats on Windows (GH-127952) 2024-12-19 14:45:34 +00:00
Peter Bierma b5d1e4552f
gh-128083: Fix macro redefinition warning in clinic. (GH-127950) 2024-12-19 15:00:30 +01:00
RUANG (James Roy) ea578fc6d3
gh-127688: Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to `os` module (GH-127689) 2024-12-19 14:51:21 +01:00
Kumar Aditya 19c5134d57
gh-122706: fix docs for asyncio ssl sockets (#128092) 2024-12-19 12:45:36 +00:00
Kumar Aditya 3c168f7f79
gh-128013: fix data race in `PyUnicode_AsUTF8AndSize` on free-threading (#128021) 2024-12-19 17:08:32 +05:30
Victor Stinner 46dc1ba9c6
gh-128069: brew link --overwrite tcl-tk@8 to prevent conflict with GitHub 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>
2024-12-19 10:27:29 +00:00
Donghee Na 48c70b8f7d
gh-115999: Enable BINARY_SUBSCR_GETITEM for free-threaded build (gh-127737) 2024-12-19 11:08:17 +09:00
Victor Stinner f802c8bf87
gh-128013: Convert unicodeobject.c macros to functions (#128061)
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.
2024-12-18 16:34:31 +01:00
Kumar Aditya 91c55085a9
gh-128033: change `PyMutex_LockFast` to take `PyMutex` as argument (#128054)
Change `PyMutex_LockFast` to take `PyMutex` as argument.
2024-12-18 20:49:00 +05:30
Kumar Aditya 8a433b683f
gh-121621: clear running loop early in asyncio (#128004) 2024-12-18 14:25:03 +00:00
Kumar Aditya dbd08fb60d
gh-127949: deprecate `asyncio.get_event_loop_policy` (#128053)
This deprecates `asyncio.get_event_loop_policy` and will be removed in Python 3.16.
2024-12-18 18:04:20 +05:30
Thomas Grainger bad3cdefa8
gh-126639: Add ResourceWarning to NamedTemporaryFile (#126677)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-12-18 10:12:24 +00:00
Bénédikt Tran 2610bccfdf
gh-126742: add NEWS entry for fix of localized error messages (GH-128025) 2024-12-18 09:59:37 +01:00
Bénédikt Tran 335e24fb0a
gh-126742: Avoid checking for library filename in test_ctypes (#128034)
Avoid checking for library filename in `dlerror()` error messages of test_ctypes.
2024-12-18 09:25:42 +01:00
Thomas Grainger 0581e3f52b
gh-127174: add docs for asyncio.get_event_loop replacements (#127640)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-12-18 13:50:05 +05:30
aeiouaeiouaeiouaeiouaeiouaeiou 329165639f
gh-127897: fix HACL* build on macOS/Catalina (GH-127932)
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
2024-12-17 22:14:16 -08:00
Kumar Aditya 5892853fb7
gh-127949: deprecate `asyncio.set_event_loop_policy` (#128024)
First step towards deprecating the asyncio policy system.
This deprecates `asyncio.set_event_loop_policy` and will be removed in Python 3.16.
2024-12-18 11:35:29 +05:30
Victor Stinner 559b0e7013
gh-127060: Disable traceback colors in IDLE (#128028)
Set TERM environment variable to "dumb" to disable traceback colors
in IDLE, since IDLE doesn't understand ANSI escape sequences.
2024-12-18 00:35:05 -05:00
Hood Chatham b92f101d0f
gh-127146: Emscripten Include compiler version in _PYTHON_HOST_PLATFORM (#127992)
Modifies _PYTHON_HOST_PLATFORM to include the compiler version under
Emscripten. The Emscripten compiler version is the platform version
compatibility identifier.
2024-12-18 07:17:09 +08:00
Hugo van Kemenade be8ae08687 Merge branch 'main' of https://github.com/python/cpython 2024-12-17 18:06:36 +02:00
Hugo van Kemenade d70e5c1fef Post 3.14.0a3 2024-12-17 17:52:43 +02:00
Bénédikt Tran 7303f06846
gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (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>
2024-12-17 12:12:45 +01:00
Hugo van Kemenade 401bfc69d1 Python 3.14.0a3 2024-12-17 11:50:39 +02:00
Russell Keith-Magee b9a492b809
gh-127085: Add a test skip if multiprocessing isn't available (#128019)
Add a test skip if multiprocessing isn't available.
2024-12-17 08:18:33 +00:00
Hood Chatham 1183e4ce2f
gh-127146: Emscripten clean up test suite (#127984)
Removed test skips that are no longer required as a result of Emscripten updates.
2024-12-17 07:48:23 +00:00
Berker Peksag cfeaa992ba
Free arena on _PyCompile_AstOptimize failure in Py_CompileStringObject (GH-127910)
After commit 10a91d7e9 introduced arena cleanup, commit 2dfbd4f36
removed the free call when _PyCompile_AstOptimize fails.
2024-12-16 22:59:36 +02:00
Peter Bierma 3b766824fe
gh-126907: make `atexit` thread safe in free-threading (#127935)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-12-16 19:31:44 +00:00
Edward Xu 4937ba54c0
gh-127085: fix some data races in memoryview in free-threading (#127412) 2024-12-17 00:42:19 +05:30
Hugo van Kemenade 1d276ec6f8
Revert "gh-127586: properly restore blocked signals in resource_tracker.py (GH-127587)" (#127983)
This reverts commit 46006a1b35.
2024-12-16 20:18:02 +02:00
Gugubo e4981e33b8
Fix typo in itertools docs (gh-127995) 2024-12-16 11:08:25 -06:00
Tomas R. 081673801e
gh-127864: Fix compiler warning (-Wstringop-truncation) (GH-127878) 2024-12-16 11:57:18 -05:00
Yuki Kobayashi 52d552cda7
gh-127896: Add missing documentation of `PySequence_In` (GH-127979)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-12-16 14:56:04 +01:00
Bénédikt Tran 0d8e7106c2
gh-111178: fix UBSan failures in `_elementtree.c` (#127982) 2024-12-16 14:40:26 +01:00
Pablo Galindo Salgado 47c5a0f307
gh-125588: Allow to regenerate the parser with Python < 3.12 (#127969)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-12-15 23:17:01 +00:00
Filipe Laíns 🇵🇸 b74c8f58e8
GH-126985: Don't override venv detection with PYTHONHOME (#127968) 2024-12-15 21:12:13 +00:00
Stephen Hansen 46006a1b35
gh-127586: properly restore blocked signals in resource_tracker.py (GH-127587)
* 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>
2024-12-15 11:53:22 -08:00
Stan Ulbrych 7b8bd3b2b8
gh-119786: Fix miscellaneous typos in `InternalDocs/interpreter_definition.md` (#127957) 2024-12-15 19:11:50 +02:00
Filipe Laíns 🇵🇸 3683b2f9e5
getpath: Add comments highlighing details of the pyvenv.cfg detection (#127966) 2024-12-15 15:40:19 +00:00
Ed Nutting ab05beb8ce
gh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (#127717)
Previously, `_Py_RefcntAdd` hasn't called 
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect. 

Now it has been fixed.
2024-12-15 15:51:03 +02:00
Steve C 7900a85019
Clarify ast docs to use a less confusing example for `ast.ParamSpec` (#127955)
Fix typo in ast docs: ParamSpec defaults
2024-12-15 12:28:43 +00:00
Andrey Efremov 0ac40acec0
gh-127353: Allow to force color output on Windows V2 (#127926) 2024-12-14 17:25:49 +02:00
Sergey B Kirpichev e2325c9db0
gh-127852: add remark about ',' separator (#127854)
Specify that it is valid for floats and ints with 'd' presentation and an error otherwise.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>

---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-12-14 08:28:26 -05:00
Totosuki 78e766f2e2
Fix typo in docstring: quadruple double quotes (#127913) 2024-12-13 23:38:54 -08:00