End-of-file errors are now handled according to the HTML5 specs --
comments and declarations are automatically closed, tags are ignored.
(cherry picked from commit 6eb6c5dbfb)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-132969: Fix error/hang when shutdown(wait=False) and task exited abnormally (GH-133222)
When shutdown is called with wait=False, the executor thread keeps running
even after the ProcessPoolExecutor's state is reset. The executor then tries
to replenish the worker processes pool resulting in an error and a potential hang
when it comes across a worker that has died. Fixed the issue by having
_adjust_process_count() return without doing anything if the ProcessPoolExecutor's
state has been reset.
Added unit tests to validate two scenarios:
max_workers < num_tasks (exception)
max_workers > num_tasks (exception + hang)
(cherry picked from commit 598aa7cc98)
Co-authored-by: Ajay Kamdar <140011370+ogbiggles@users.noreply.github.com>
gh-106318: Add example for `str.endswith()` (GH-134523)
(cherry picked from commit eed827ed09)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Revert "gh-135410: use a critical section around `StringIO.__next__` (GH-135412)" (GH-135439)
This reverts commit e6c3039cb3.
(cherry picked from commit 73431356d3)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
PEP-734 has been accepted (for 3.14).
(FTR, I'm opposed to putting this under the concurrent package, but
doing so is the SC condition under which the module can land in 3.14.)
(cherry picked from commit 62143736b, AKA gh-133958)
gh-135410: use a critical section around `StringIO.__next__` (GH-135412)
(cherry picked from commit e6c3039cb3)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
On some iPad versions, Safari reports as "macOS". Modifies the GC trampoline detection
to add a feature-based check to detect this case.
(cherry picked from commit d447129758)
Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
Fix presentation of dataclasses' `unsafe_hash` default value (GH-116532)
(cherry picked from commit 71f5fafdfb)
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-133264: Correct documentation of how Py_Main and Py_RunMain handle SystemExit (GH-135337)
(cherry picked from commit b706ff003c)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
gh-135326: Test support of __index__ in random.getrandbits() (GH-135356)
(cherry picked from commit 5ae669fc4e)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-91048: Reorder result tuple of parse_code_object (GH-134898)
Reorder result tuple of parse_code_object
The standard followed by APIs like pstat.Stats is to take a file, line,
function triplet. The parse_code_object function (and callers exposing
this in Python like RemoteUnwinder.get_stack_trace) return function,
file, line triplets which requires the caller to reorder these when
using it in classes like pstat.Stats.
(cherry picked from commit 8e8786f898)
Co-authored-by: László Kiss Kollár <kiss.kollar.laszlo@gmail.com>
* Reorder asyncio
---------
Co-authored-by: László Kiss Kollár <kiss.kollar.laszlo@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
gh-130077: Properly match full soft keywords in the parser (GH-135317)
(cherry picked from commit ff2b5f40c2)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Apply Intel Control-flow Technology for x86-64 on asm_trampoline.S.
Required for mitigation against return-oriented programming (ROP)
and Call or Jump Oriented Programming (COP/JOP) attacks.
Manual application is required for the assembly files.
See also: https://sourceware.org/annobin/annobin.html/Test-cf-protection.html
Docs: fix docstring of `email.message.Message.add_header` (GH-134355)
(cherry picked from commit c23eec2960)
Co-authored-by: Alexander Shadchin <shadchin@yandex-team.com>
Fix warnings `set but not used [-Wunused-but-set-variable]` in remote_debug.h (GH-135290)
(cherry picked from commit 49fc1f215a)
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
Fix definition of `_Py_RemoteDebug_` symbols for static linking (GH-135146)
(cherry picked from commit 2e1ad6eb26)
Co-authored-by: Zanie Blue <contact@zanie.dev>
Prepare the docs for using the notation used in the `python.gram`
file. If we want to sync the two, the meta-syntax should be the same.
Link the Full Grammar docs here; keep only a few extras.
Also, remove the distinction between lexical and syntactic rules,
except for whitespace handling.
With f- and t-strings, the line between the two is blurry.
(cherry picked from commit 28d91d06f1)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Colin Marquardt <cmarqu42@gmail.com>
bpo-45210: Document that error indicator may be set in tp_dealloc (GH-28358)
(cherry picked from commit 8441b263af)
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Signed-off-by: Edward Z. Yang <ezyang@meta.com>
Co-authored-by: Edward Z. Yang <ezyang@mit.edu>
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973)
Replace most PyUnicodeWriter_WriteUTF8() calls with
PyUnicodeWriter_WriteASCII().
(cherry picked from commit f49a07b531)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
GH-135287: clang-cl PGO builds on Windows fail with `could not open '/GENPROFILE'` (GH-135289)
(cherry picked from commit 0045100ccb)
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
* gh-135276: Refresh `zipfile.Path` from zipp 3.23 (GH-135277)
Apply changes from zipp 3.23
(cherry picked from commit 8d6eb0c262)
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* Removed features slated for Python 3.15 only.
---------
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
gh-134976: document the exception type that can be raised by `s[i]` (GH-134977)
(cherry picked from commit 158e5162bf)
Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
gh-135244: generate UUID random Node ID with a CSPRNG as per RFC 9562, §6.10.3 (GH-135226)
This aligns with the recommendations of RFC 9562, Section 6.10, paragraph 3 [1].
[1]: https://www.rfc-editor.org/rfc/rfc9562.html#section-6.10-3.
---------
(cherry picked from commit 1cb7163872)
Co-authored-by: LamentXU <108666168+LamentXU123@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
gh-134876: Add fallback for when process_vm_readv fails with ENOSYS (GH-134878)
(cherry picked from commit ac9c3431cc)
Co-authored-by: Daniel Golding <goldingd89@gmail.com>
gh-134155: fix AttributeError in email._header_value_parser.get_address (GH-134194)
Append the defect to defects instead of to the parse tree.
(cherry picked from commit d9cad074d5)
Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
gh-134160: Use PyModuleDef.m_free in the example module xxlimited (GH-135174)
(cherry picked from commit 1adca08d65)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
feat(docs): type fix - apply pep8 by using docstring instead of comment in the doc. (GH-135181)
Giving the right example incitates the tutorial readers to do the same in the future.
(cherry picked from commit 343182853f)
Co-authored-by: Jean-Louis GUENEGO <jlguenego@gmail.com>
gh-134993: Add os.lstat() to os.supports_dir_fd (GH-135188)
(cherry picked from commit e004cf8fd5)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-135155: Added dependencies required for compiling the _zstd module (GH-135156)
(cherry picked from commit a7d41e8aab)
Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>