gh-151019: Fix test_os on 32-bit FreeBSD (GH-151087)
Remove references to server.handler_instance. This attribute has been
removed in 2022 by commit 3ae975f1ac.
(cherry picked from commit a9002349cb)
Co-authored-by: Victor Stinner <vstinner@python.org>
Docs: Fix missing colon in `bisect` example function (GH-151061)
(cherry picked from commit 16ede813eb)
Co-authored-by: Sergio López Gómez <sergiolopezgmz.dam@gmail.com>
This was added in 3.15; let's use a real sentinel instead of an ad-hoc list object.
(cherry picked from commit 884ac3e3ec)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
gh-150207: Raise MemoryError on tokenizer allocation failure instead of crashing (GH-150275)
(cherry picked from commit 262625fa30)
Co-authored-by: Grant Herman <grantlouisherman041@gmail.com>
Use `time.monotonic` in OrderedDict LRU cache example (GH-150986)
(cherry picked from commit ea4c85552b)
Co-authored-by: Ilya Nikolaev <65247719+ilya-nikolaev@users.noreply.github.com>
gh-149977: Fix extra output of `-m test test_lazy_import`, again (GH-150965)
(cherry picked from commit 9b4090c48e)
Co-authored-by: sobolevn <mail@sobolevn.me>
Defer to the codecs module for all aliases.
Use MIME/IANA names for all IANA registered charsets.
Fix email.contentmanager.set_text_content().
(cherry picked from commit c195a046f8)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Support all aliases officially registered in IANA, except
Extended_UNIX_Code_Packed_Format_for_Japanese.
New names:
KSC_5601, KS_C_5601-1989, iso-ir-149, GB_2312-80, windows-936, mac,
CCSID00858, CCSID01140, and a number of "cs"-prefixed names.
Fix csHPRoman8, which was not normalized.
(cherry picked from commit 49f4ecfb08)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-150907: Fix dynamic_annotations.h when built with C++ and Valgrind (GH-150914)
Add extern "C++" scope for the C++ template.
Fix test_cppext when Python is built with --with-valgrind.
(cherry picked from commit c32501261a)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-129011: Update docs for Raw I/O read, readinto, and write (GH-135328)
Update `RawIOBase` and `FileIO` documentation to match implementation
behavior around `.read`, `.readinto`, `.readall` and `.write`.
In particular:
- They may make more than one system call (PEP-475)
- Add warnings if `.write()` requires a wrapping retry loop (see: gh-126606)
- "Raw I/O" `.write`` may not write all bytes
- `buffering=0` example results in a "Raw I/O"
(cherry picked from commit e4db68b9c9)
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
ass_subscript_slice() returned early when the computed slice length
was zero, bypassing validation performed for non-empty slices.
(cherry picked from commit fc9c4db130)
Co-authored-by: Jiseok CHOI <jiseok.dev@gmail.com>
gh-150750: Fix a race condition in `deque.index` with free-threading (GH-150779)
(cherry picked from commit d83d50b5b7)
Co-authored-by: sobolevn <mail@sobolevn.me>
The current documentation says:
>
> METH_FASTCALL
> Part of the Stable ABI since version 3.7.
>
> [...]
>
> Added in version 3.7.
>
> Changed in version 3.10: METH_FASTCALL is now part of the stable ABI.
so is contradictory about when it was added to the Stable ABI. Looking at the header it seems like 3.10 is right.
(cherry picked from commit 58beae7319)
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
gh-150436: Skip subprocess test on STATUS_DLL_INIT_FAILED (GH-150704)
If a subprocess spawned with CREATE_NEW_CONSOLE creation flag fails
with STATUS_DLL_INIT_FAILED return code, skip the test. It's likely a
memory allocation failure in the desktop heap memory which caused the
DLL init failure.
(cherry picked from commit e8034dd841)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-148613: Fix race in `gc_set_threshold` and `gc_get_threshold` (GH-150356)
(cherry picked from commit 41eb8ee2bb)
Co-authored-by: Edward Xu <xuxiangad@gmail.com>
gh-132467: Document and test that generic aliases are not classes (GH-133504)
(cherry picked from commit 5915a1fb9d)
Co-authored-by: Abduaziz π <mail@ziyodov.uz>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Charlie Lin <tuug@gmx.us>
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* bpo-46943: fix[imaplib]: call Exception with string instance
Adjust the behavior of 'login' to be similar to `authenticate()`,
where self.error is called with a str() instance.
(cherry picked from commit 29805f00a1)
Co-authored-by: Florian Best <spaceone@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
gh-150723: Fix perf jitdump files on macOS (GH-150728)
The perf jitdump format defines the thread id field of the JR_CODE_LOAD
record as a 32-bit value, but on macOS it was declared as a uint64_t
(since pthread_threadid_np() returns a uint64_t). Those extra 8 bytes
plus alignment padding shifted every following field, so parsers reading
the file by the spec misread code_size as the code address and failed to
resolve any Python frames.
Declare thread_id as uint32_t on all platforms and truncate the macOS
thread id when writing the record. The value is only informational.
Symbols are resolved by address, and not thread ids so truncation is
safe here.
* Use mach_absolute_time for macOS jitdump timestamps
On macOS the jitdump file is consumed by profilers such as samply, which
timestamp their samples using mach_absolute_time(). The jitdump events were
stamped with clock_gettime(CLOCK_MONOTONIC), a different clock domain that
keeps advancing while the system is asleep, so the JIT code mappings could be
off by days relative to the samples and no Python frame would resolve. Stamp
jitdump events with mach_absolute_time() on macOS so they share the sampler's
clock domain. Linux continues to use CLOCK_MONOTONIC to stay aligned with perf.
Exercise the -Xperf_jit (jitdump) backend through samply and assert that
Python frames resolve, exercising the binary jitdump path end to end.
Skipped when samply is not installed.
(cherry picked from commit 494f2e3c92)
Co-authored-by: Nazım Can Altınova <canaltinova@gmail.com>