gh-120633: Move scrollbar and remove tear-off menus in turtledemo (GH-120634)
(cherry picked from commit 89f7208f67)
Co-authored-by: Wulian233 <71213467+Wulian233@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This exposes `PyUnstable_Object_ClearWeakRefsNoCallbacks` as an unstable
C-API function to provide a thread-safe mechanism for clearing weakrefs
without executing callbacks.
Some C-API extensions need to clear weakrefs without calling callbacks,
such as after running finalizers like we do in subtype_dealloc.
Previously they could use `_PyWeakref_ClearRef` on each weakref, but
that's not thread-safe in the free-threaded build.
(cherry picked from commit e8752d7b80)
Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
gh-120659: Skip `test_freethreading` with GIL (GH-120660)
(cherry picked from commit 360f14a493)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
gh-119897: Add test for lambda generator invocation (GH-120658)
(cherry picked from commit 73dc1c678e)
gh-120467: Add test for lambda generator invocation
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Mocking only works if sys.modules['pydoc'] and pydoc are the same,
but some pydoc functions reload the module and change sys.modules.
Ensure that sys.modules['pydoc'] is always restored after the corresponding
tests.
(cherry picked from commit 2cf47389e2)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-120182 added new global state (interp_count), but didn't add thread-safety for it. This change eliminates the possible race.
(cherry picked from commit 2c66318cdc, AKA gh-120529)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Fix a race in `PyMember_GetOne` and `PyMember_SetOne` for `Py_T_OBJECT_EX`.
These functions implement `__slots__` accesses for Python objects.
(cherry picked from commit 362cd2680b)
Co-authored-by: Daniele Parmeggiani <8658291+dpdani@users.noreply.github.com>
gh-115649: Copy the filename into main interpreter before intern in import.c (GH-120315)
(cherry picked from commit 28140d1f2d)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
gh-120433: Mention ``chocolatey`` for installing llvm on Windows as an alternative option (GH-120434)
(cherry picked from commit 95737bbf18)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
gh-112346: Document the OS byte in `gzip.compress` output change in 3.11 (GH-120480)
(cherry picked from commit bac4edad69)
gh-112346: Describe the "os" byte in gzip output change.
Co-authored-by: Gregory P. Smith <greg@krypto.org>
gh-120567: Clarify weekday return in calendar.monthrange docstring (GH-120570)
(cherry picked from commit bd4516d9ef)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
gh-118596: Add thread-safety clarifications to the SSLContext documentation (GH-118597)
Add thread-safety clarifications to the SSLContext documentation. Per the issue:
This issue has also come up [here](https://github.com/psf/requests/pull/6667) where the matter was clarified by @tiran in [this comment](https://github.com/psf/requests/pull/6667):
> `SSLContext` is designed to be shared and used for multiple connections. It is thread safe as long as you don't reconfigure it once it is used by a connection. Adding new certs to the internal trust store is fine, but changing ciphers, verification settings, or mTLS certs can lead to surprising behavior. The problem is unrelated to threads and can even occur in a single-threaded program.
(cherry picked from commit 4f59f86382)
Co-authored-by: mm-matthias <43849132+mm-matthias@users.noreply.github.com>
gh-120360: Add self as IDLE doc owner (GH-120571)
Add self as IDLE doc owner
(cherry picked from commit cf49ef78f8)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-112346: Always set OS byte to 255, simpler gzip.compress function. (GH-120486)
This matches the output behavior in 3.10 and earlier; the optimization in 3.11 allowed the zlib library's "os" value to be filled in instead in the circumstance when mtime was 0. this keeps things consistent.
(cherry picked from commit 08d09cf5ba)
Co-authored-by: Ruben Vorderman <r.h.p.vorderman@lumc.nl>
When help() is called with non-string argument, use __qualname__ or
__name__ if available, otherwise use "{typename} object".
(cherry picked from commit 31d1d72d7e)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This behavior is rather surprising and it was not clearly specified.
(cherry picked from commit 9e0b11eb21)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-117657: Make PyType_HasFeature (exported version) atomic (GH-120484)
Make PyType_HasFeature (exported version) atomic
(cherry picked from commit 6f63dfff6f)
Co-authored-by: Ken Jin <kenjin@python.org>
gh-120544: Add `else: fail()` to tests where exception is expected (GH-120545)
(cherry picked from commit 42ebdd83bb)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
map() requires at least one iterable arg.
(cherry picked from commit d4039d3f6f)
Signed-off-by: Adam Williamson <awilliam@redhat.com>
Co-authored-by: Adam Williamson <adam@blueradius.ca>
gh-119819: Conditional skip of logging tests that require multiprocessing subprocess support (GH-120476)
Skip tests that require multiprocessing subprocess support.
(cherry picked from commit 92f6d400f7)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
In gh-120009 I used an atexit hook to finalize the _datetime module's static types at interpreter shutdown. However, atexit hooks are executed very early in finalization, which is a problem in the few cases where a subclass of one of those static types is still alive until the final GC collection. The static builtin types don't have this probably because they are finalized toward the end, after the final GC collection. To avoid the problem for _datetime, I have applied a similar approach here.
Also, credit goes to @mgorny and @neonene for the new tests.
FYI, I would have liked to take a slightly cleaner approach with managed static types, but wanted to get a smaller fix in first for the sake of backporting. I'll circle back to the cleaner approach with a future change on the main branch.
(cherry picked from commit b2e71ff4f8, AKA gh-120182)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
gh-120361: Add `nonmember` test with enum flags inside to `test_enum` (GH-120364)
* gh-120361: Add `nonmember` test with enum flags inside to `test_enum`
(cherry picked from commit 7fadfd82eb)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
gh-117657: Add TSAN suppression for set_default_allocator_unlocked (GH-120500)
Add TSAN suppression for set_default_allocator_unlocked
(cherry picked from commit 2bacc2343c)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
gh-120400 :Support Linux perf profile to see Python calls on RISC-V architecture (GH-120089)
(cherry picked from commit 4b1e85bafc)
Co-authored-by: ixgbe00 <yangwang@iscas.ac.cn>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
gh-114053: Fix bad interaction of PEP 695, PEP 563 and `inspect.get_annotations` (GH-120270)
(cherry picked from commit 42351c3b9a)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
GH-119054: Add "Renaming and deleting" section to pathlib docs. (GH-120465)
Add dedicated subsection for `pathlib.Path.rename()`, `replace()`,
`unlink()` and `rmdir()`.
(cherry picked from commit d88a1f2e15)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
Check if the DateTime C-API type matches the datetime.date type on main and shared/isolated subinterpreters.
(cherry picked from commit 50a389565a, AKA gh-119604)
Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
GH-119054: Add "Creating files and directories" section to pathlib docs. (GH-120186)
Add dedicated subsection for `pathlib.Path.touch()`, `mkdir()`,
`symlink_to()` and `hardlink_to()`. Also note that `open()`, `write_text()`
and `write_bytes()` are often used to create files.
(cherry picked from commit c2d810b6d4)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
gh-117657: Fix some simple races in instrumentation.c (GH-120118)
* stop the world when setting local events
(cherry picked from commit b1b61dc4ce)
Co-authored-by: Ken Jin <kenjin@python.org>
gh-117657: Make PyType_HasFeature atomic (GH-120210)
Make PyType_HasFeature atomic
(cherry picked from commit eebae2c460)
Co-authored-by: Ken Jin <kenjin@python.org>