Commit Graph

32619 Commits

Author SHA1 Message Date
Miss Islington (bot) c7022230d2
[3.13] gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500) (#131060)
gh-117174: Add a new route in linecache to fetch interactive source code (GH-117500)
(cherry picked from commit a931a8b324)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-03-10 23:11:24 +00:00
Miss Islington (bot) ebd2ed7ad8
[3.13] gh-125331: Allow the parser to activate future imports on the fly (GH-125482) (#131062)
gh-125331: Allow the parser to activate future imports on the fly (GH-125482)
(cherry picked from commit 3bd3e09588)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-03-10 22:20:38 +00:00
Miss Islington (bot) 977af3a6a2
[3.13] gh-124927: Fix conversion issue between coordinates and position in REPL (GH-125001) (#131061)
gh-124927: Fix conversion issue between coordinates and position in REPL (GH-125001)
(cherry picked from commit 6ab5c4aa05)

Co-authored-by: FeH2 <i@feh2.im>
2025-03-10 22:18:13 +00:00
Miss Islington (bot) cf829f49de
[3.13] gh-131020: py.exe launcher does not correctly detect a BOM when searching for the shebang (GH-131021) (#131047)
gh-131020: py.exe launcher does not correctly detect a BOM when searching for the shebang (GH-131021)
(cherry picked from commit 36ef3bfe39)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2025-03-10 19:54:10 +00:00
Miss Islington (bot) fead51d808
[3.13] gh-130954: Fix multiprocessing test_notify_n (GH-130955) (#130981)
The test could deadlock trying join on the worker processes.
Apply the same technique as gh-130933.

Join the process before the test ends in `test_notify` as well.
(cherry picked from commit edd1eca336)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-08 18:28:07 +00:00
Miss Islington (bot) 597a953484
[3.13] gh-130917: update timer and workload in test_signal (GH-130918) (#130969)
The workload to advance the virtual timeout is too lightweight for some
platforms. As result the test goes in timeout as it never reaches the
end of the timer. By having a heavier workload, the virtual timer
advances rapidly and the SIGVTALRM is sent before the timeout.
(cherry picked from commit 7879081198)

Co-authored-by: Diego Russo <diego.russo@arm.com>
2025-03-08 01:05:29 +00:00
Miss Islington (bot) 94b94d0b12
[3.13] gh-110206: Fix multiprocessing test_notify_all (GH-130933) (#130950)
The test could deadlock trying join on the worker processes due to a
combination of behaviors:

* The use of `assertReachesEventually` did not ensure that workers
  actually woken.release() because the SyncManager's Semaphore does not
  implement get_value.

* This mean that the test could finish and the variable "sleeping" would
  got out of scope and be collected. This unregisters the proxy leading
  to failures in the worker or possibly the manager.

* The subsequent call to `p.join()` during cleanUp therefore never
  finished.

This takes two approaches to fix this:

1) Use woken.acquire() to ensure that the workers actually finish
   calling woken.release()

2) At the end of the test, wait until the workers are finished, while `cond`,
   `sleeping`, and `woken` are still valid.
(cherry picked from commit c476410dc5)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-07 12:22:51 -05:00
Miss Islington (bot) d5eb490846
[3.13] gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing (GH-130934) (#130939)
gh-130932: Fix incorrect exception handling in _PyModule_IsPossiblyShadowing (GH-130934)

I chose to not raise an exception here because I think it would be
confusing for module attribute access to start raising something other
than AttributeError if e.g. the cwd goes away

Without the change in moduleobject.c
```
./python.exe -m unittest test.test_import.ImportTests.test_script_shadowing_stdlib_cwd_failure
...
Assertion failed: (PyErr_Occurred()), function _PyObject_SetAttributeErrorContext, file object.c, line 1253.
```
(cherry picked from commit 0a9ae5ed48)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2025-03-07 09:28:47 +00:00
Sam Gross 0c088e4442
[3.13] gh-128364: Fix flaky `test_concurrent_futures.test_wait` tests (gh-130742) (#130922)
Use events instead of relying on `time.sleep()`. The tests are also now about
four times faster.
(cherry picked from commit c4d37eefb7)
2025-03-06 13:49:03 -05:00
Miss Islington (bot) e285232c76
[3.13] gh-130851: Don't crash when deduping unusual code constants (GH-130853) (#130880)
The bytecode compiler only generates a few different types of constants,
like str, int, tuple, slices, etc. Users can construct code objects with
various unusual constants, including ones that are not hashable or not
even constant.

The free threaded build previously crashed with a fatal error when
confronted with these constants. Instead, treat distinct objects of
otherwise unhandled types as not equal for the purposes of deduplication.
(cherry picked from commit 2905690a91)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-05 15:22:57 -05:00
Miss Islington (bot) 39f7b06d35
[3.13] gh-127371 Avoid unbounded growth SpooledTempfile.writelines (GH-127372) (#130886)
gh-127371 Avoid unbounded growth SpooledTempfile.writelines (GH-127372)
(cherry picked from commit cb67b44ca9)

Co-authored-by: Bert Peters <bert@bertptrs.nl>
2025-03-05 18:42:55 +01:00
Miss Islington (bot) aa2c4e4417
[3.13] gh-116742: Fix subprocess test_check_output_timeout() (GH-130836) (#130873)
gh-116742: Fix subprocess test_check_output_timeout() (GH-130836)

Fix a race condition in test_check_output_timeout() of
test_subprocess. Don't write into stdout anymore, since there is no
reliable way to synchronize the parent and the child processes.

Change the timeout from 3 seconds to 0.1 seconds, and remove
@requires_resource('walltime') decorator.
(cherry picked from commit 67a942d427)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-05 13:01:06 +01:00
Miss Islington (bot) 6321e1ab4b
[3.13] gh-130824: Add tests for `NULL` in `PyLong_*AndOverflow` functions (GH-130828) (GH-130869)
(cherry picked from commit 90130807d9)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-03-05 13:51:52 +02:00
Miss Islington (bot) 22d729cf5d
[3.13] gh-130730: Fix multiprocessing test_active_children() (GH-130837) (#130845)
gh-130730: Fix multiprocessing test_active_children() (GH-130837)

Replace a sleep with an event: sleep is not a reliable
synchronization primitive.
(cherry picked from commit 3dd3675492)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-04 17:28:33 +00:00
Miss Islington (bot) a115480f71
[3.13] gh-130727: Retry test_wmi on TimeoutError (GH-130832) (#130839)
gh-130727: Retry test_wmi on TimeoutError (GH-130832)

Use sleeping_retry() in test_wmi to retry multiple times on
TimeoutError. Wait up to LONG_TIMEOUT seconds (5 minutes by default).
(cherry picked from commit f67ff9e820)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-04 15:31:22 +00:00
Miss Islington (bot) 39dc7a1af2
[3.13] gh-130736: Fix asyncio test_shutdown_default_executor_timeout() (GH-130800) (#130825)
gh-130736: Fix asyncio test_shutdown_default_executor_timeout() (GH-130800)

Replace time.sleep() with threading.Event.
(cherry picked from commit 6c48ed7d62)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-04 17:41:31 +05:30
Miss Islington (bot) d00e92bc04
[3.13] gh-130737: Fix multiprocessing test_notify() (GH-130797) (#130802)
gh-130737: Fix multiprocessing test_notify() (GH-130797)

Replace hardcoded delay (100 ms) with a loop awaiting until a
condition is true: replace assertReturnsIfImplemented() with
assertReachesEventually().

Use sleeping_retry() in assertReachesEventually() to tolerate slow
buildbots and raise an exception on timeout (30 seconds).
(cherry picked from commit 8a64a62002)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-03 19:09:34 +00:00
Miss Islington (bot) bc5c2b8573
[3.13] gh-130379: Fix incorrect zipapp logic to avoid including the target in itself (gh-130509) (gh-130791)
gh-130379: Fix incorrect zipapp logic to avoid including the target in itself (gh-130509)
(cherry picked from commit 64ccbbbf36)

Co-authored-by: Paul Moore <p.f.moore@gmail.com>
2025-03-03 15:20:05 +00:00
Miss Islington (bot) e6dfa9d601
[3.13] gh-130637: Add validation for numeric response data in `stat()` method (GH-130646) (#130763)
gh-130637: Add validation for numeric response data in `stat()` method (GH-130646)
(cherry picked from commit a42168d316)

Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com>
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2025-03-02 20:28:56 +00:00
Pablo Galindo Salgado 2d7145decb
[3.13] gh-130618: Fix parser error when using lambdas inside f-strings (GH-130638) (#130642)
(cherry picked from commit e06bebb87e)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2025-03-01 18:10:03 +00:00
Miss Islington (bot) a0ea87c0c3
[3.13] Revert "gh-128364: Fix flaky `test_timeout` test (gh-130724)" (gh-130732) (#130734)
Revert "gh-128364: Fix flaky `test_timeout` test (gh-130724)" (gh-130732)

Change broke Android and iOS buildbots that do not have multiprocessing.

This reverts commit cfa0b1dc37.
(cherry picked from commit 5221d9ce0e)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-01 17:44:50 +00:00
Miss Islington (bot) 5070864e16
[3.13] gh-128364: Fix flaky `test_timeout` test (gh-130724) (gh-130728)
gh-128364: Fix flaky `test_timeout` test (gh-130724)
(cherry picked from commit cfa0b1dc37)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-03-01 16:46:58 +00:00
Miss Islington (bot) 9d825d4281
[3.13] gh-130607: Extend and cleanup IPv6 tests (GH-121518) (GH-130679)
Extend IPv6 tests and made little syntax refactoring
(cherry picked from commit 9f0879baf1)

Co-authored-by: Ilya Bazhenov <31971067+bazhil@users.noreply.github.com>
2025-02-28 12:41:41 +01:00
Miss Islington (bot) b223dc70cd
[3.13] gh-130655: Increase test coverage of gettext._expand_lang() (GH-130656) (GH-130671)
(cherry picked from commit 24c52cb14c)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-02-28 09:02:18 +00:00
Miss Islington (bot) ad97027e9b
[3.13] gh-129726: Break `gzip.GzipFile` reference loop (GH-130055) (#130669)
gh-129726: Break `gzip.GzipFile` reference loop (GH-130055)

A reference loop was resulting in the `fileobj` held by the `GzipFile`
being closed before the `GzipFile`.

The issue started with gh-89550 in 3.12, but was hidden in most cases
until 3.13 when gh-62948 made it more visible.
(cherry picked from commit 7f39137662)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-02-28 08:32:44 +00:00
Hugo van Kemenade 4100fb0537
[3.13] GH-92897: schedule the check_home deprecation to 3.15 (GH-129102) (#130583)
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2025-02-27 18:16:33 +00:00
Sam Gross 9966daee60
[3.13] gh-117657: Enable test_opcache under TSAN (GH-129831) (GH-130597)
Fix a few thread-safety bugs to enable test_opcache when run with TSAN:

 * Use relaxed atomics when clearing `ht->_spec_cache.getitem`
   (gh-115999)
 * Add temporary suppression for type slot modifications (gh-127266)
 * Use atomic load when reading `*dictptr`

(cherry picked from commit f151d27159)
2025-02-26 13:59:59 -05:00
Miss Islington (bot) 43a2a372ba
[3.13] GH-130396: Treat clang -Og as optimized for gdb tests (GH-130550) (#130572)
GH-130396: Treat clang -Og as optimized for gdb tests (GH-130550)
(cherry picked from commit 129db32d6f)

Co-authored-by: Mark Shannon <mark@hotpy.org>
2025-02-26 11:37:43 +00:00
Serhiy Storchaka 7c1b76fce8
[3.13] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) (GH-130556)
The use of PySys_GetObject() and _PySys_GetAttr(), which return a borrowed
reference, has been replaced by using one of the following functions, which
return a strong reference and distinguish a missing attribute from an error:
_PySys_GetOptionalAttr(), _PySys_GetOptionalAttrString(),
_PySys_GetRequiredAttr(), and _PySys_GetRequiredAttrString().
(cherry picked from commit 0ef4ffeefd)
2025-02-25 22:50:26 +00:00
Miss Islington (bot) b0d3f49195
[3.13] Fix a typo in code module test (GH-130530) (#130534)
Fix a typo in code module test (GH-130530)
(cherry picked from commit 56e337d32b)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-02-25 17:38:40 +00:00
Miss Islington (bot) d71b167c5c
[3.13] gh-129405: Fix doc for Py_mod_multiple_interpreters default, and add test (GH-129406) (GH-130507)
(cherry picked from commit fc8d2cba54)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-02-24 16:49:35 +01:00
Xuanteng Huang bb6f3c3769
[3.13] gh-128714: Fix function object races in `__annotate__`, `__annotations__` and `__type_params__` in free-threading build (GH-129016) (#129729)
* gh-128714: Fix function object races in `__annotate__`, `__annotations__` and `__type_params__` in  free-threading build (#129016)

(cherry picked from commit 55f17b77c3)

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-23 21:49:55 -05:00
Miss Islington (bot) 6abec03aef
[3.13] Add test checking value of a TypedDict's __total__ attribute when there is an assignment in the class body. (GH-130460) (#130462)
Add test checking value of a TypedDict's __total__ attribute when there is an assignment in the class body. (GH-130460)

In relation to GH-109544 which changed this behavior.
(cherry picked from commit d8ce092fe4)

Signed-off-by: Daniel Sperber <github.blurry@9ox.net>
Co-authored-by: Daraan <github.blurry@9ox.net>
2025-02-22 18:33:20 +00:00
Miss Islington (bot) 8ef89474b9
[3.13] gh-130285: Fix handling of zero or empty counts in random.sample() (gh-130291) (gh-130416) 2025-02-21 17:56:51 +00:00
Miss Islington (bot) 3d88c18303
[3.13] gh-126332: Add tests for _pyrepl.utils (GH-129325) (#130414)
gh-126332: Add tests for _pyrepl.utils (GH-129325)
(cherry picked from commit 0c4248f88e)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2025-02-21 17:22:42 +00:00
Miss Islington (bot) cb8d89d2e4
[3.13] gh-111609: Test `end_offset` in SyntaxError subclass (GH-127830) (#130407)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2025-02-21 16:56:39 +02:00
Miss Islington (bot) 8ce48c8ebc
[3.13] gh-129363: Change regrtest sequential mode output (GH-129476) (#130405)
gh-129363: Change regrtest sequential mode output (GH-129476)

First, write the test name without color. Then, write the test name
and the result with color. Each test is displayed twice.
(cherry picked from commit f1b81c408f)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-21 14:18:32 +00:00
Sam Gross ef66394677
[3.13] gh-129269: Exclude everything in sys.path in `test_coverage_ignore` (gh-130133) (gh-130357)
The `test_trace.test_coverage_ignore` test would fail if you had
`setuptools` installed, such as in `~/.local/lib/python3.xxx/site-packages/`.
Ignore everything in `sys.path` when running the test.
(cherry picked from commit 35925e9529)
2025-02-20 15:42:47 +00:00
Miss Islington (bot) d103357785
[3.13] gh-130250: use support.swap_attr() in test and don't assume we're beginning with a clean system state (GH-130342) (#130344)
gh-130250: use support.swap_attr() in test and don't assume we're beginning with a clean system state (GH-130342)
(cherry picked from commit 048ee2d5ec)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-02-20 11:52:06 +00:00
Serhiy Storchaka 68c57d6f33
[3.13] gh-127750: Backport some tests for singledispatchmethod (GH-130309) (GH-130340)
(cherry picked from commit 395335d0ff)
(cherry picked from commit 10b32054ad)
2025-02-20 09:49:23 +00:00
Miss Islington (bot) 439cba75d9
[3.13] gh-130293: Ensure test__colorize will pass on dumb terminals. (GH-130333) (#130334)
Ensure colorize tests will run on dumb terminals (or environment with TERM=dumb set)

(cherry picked from commit 1b070060c0)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2025-02-20 07:12:56 +00:00
Miss Islington (bot) 46237d19d9
[3.13] gh-130250: fix cleanup in test (impacts refleaks runs) (GH-130329) (#130330)
gh-130250: fix cleanup in test (impacts refleaks runs) (GH-130329)
(cherry picked from commit c718c6be0f)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-02-20 02:00:49 +00:00
Miss Islington (bot) d172415a4e
[3.13] gh-130250: fix regression in traceback.print_last (GH-130318) (#130325)
gh-130250: fix regression in traceback.print_last (GH-130318)
(cherry picked from commit 6c982aeb54)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-02-19 22:06:43 +00:00
Tian Gao 094394a380
[3.13] gh-128396: Fix a crash when inline comprehension has the same … (#130311)
[3.13] gh-128396: Fix a crash when inline comprehension has the same local variable as the outside scope (GH-130235)
(cherry picked from commit ccf17323c2)
2025-02-19 17:40:03 +00:00
Miss Islington (bot) 5d83b6c160
[3.13] gh-130230: Fix crash in pow() with only Decimal third argument (GH-130237) (GH-130246)
(cherry picked from commit b93b7e566e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-02-18 13:18:37 +02:00
Stan Ulbrych 320316ef7e
[3.13] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130127)
We had the definition of what makes a character "printable" documented in three places, giving two different definitions.
The definition in the comment on `_PyUnicode_IsPrintable` was inverted; correct that.

With that correction, the two definitions turn out to be equivalent -- but to confirm that, you have to go look up, or happen to know, that those are the only five "Other" categories and only three "Separator" categories in the Unicode character database.  That makes it hard for the reader to tell whether they really are the same, or if there's some subtle difference in the intended semantics.

Fix that by cutting the C API docs' and the C comment's copies of the subtle details, in favor of referring to the Python-level docs. That ensures it's explicit that these are all meant to agree, and also lets us concentrate improvements to the wording in one place.

Speaking of which, borrow some ideas from the C comment, along with other tweaks, to hopefully add a bit more clarity to that one newly-centralized copy in the docs.

Also add a thorough test that the implementation agrees with this definition.

Author:    Greg Price <gnprice@gmail.com>

Co-authored-by: Greg Price <gnprice@gmail.com>
(cherry picked from commit 3402e133ef)
2025-02-17 15:02:39 +01:00
Miss Islington (bot) 1b2cfb73f9
[3.13] gh-130193: Increase test coverage of gettext.c2py (GH-130208) (GH-130217)
(cherry picked from commit fb2d325725)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-02-17 09:21:00 +00:00
Miss Islington (bot) 30ed4523c0
[3.13] gh-86069: Add more PyNumber_InPlacePower() tests (GH-130111) (GH-130211)
Test it with the third argument.
(cherry picked from commit cfe41037eb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-02-17 10:24:59 +02:00
Miss Islington (bot) ff92f6b228
[3.13] gh-130185: Fix unintentionally skipped tests in `test_functools` (GH-130186) (#130188)
gh-130185: Fix unintentionally skipped tests in `test_functools` (GH-130186)
(cherry picked from commit 73d03005b0)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-02-16 13:57:27 +00:00
Miss Islington (bot) 945dcb05ce
[3.13] gh-127488: Add tests for Tools/i18n/msgfmt.py (GH-127540) (GH-130182)
(cherry picked from commit 361083b84b)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-02-16 13:20:49 +00:00
Miss Islington (bot) 5d240c7bb8
[3.13] gh-130177: Fix unintentionally skipped tests in test_gettext (GH-130178) (GH-130183)
(cherry picked from commit 2e8044a4f7)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-02-16 12:36:23 +00:00
Miss Islington (bot) 1a7b8c0f4d
[3.13] gh-130145: fix `loop.run_forever` when loop is already running (GH-130146) (#130147)
gh-130145: fix `loop.run_forever` when loop is already running (GH-130146)
(cherry picked from commit a545749b0e)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-02-15 09:55:08 +00:00
Andrew Svetlov 7b0543ebe6
[3.13] gh-128308: pass `**kwargs` to asyncio task_factory (GH-128768) (#130084)
* [3.13] gh-128308: pass `**kwargs` to asyncio task_factory (GH-128768)
(cherry picked from commit 38a9956876)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>


---------

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-02-14 22:04:17 +05:30
Miss Islington (bot) a76aff6ea4
[3.13] gh-129693: Suppress `SyntaxWarning` in test_fstring (GH-129830) (#130068)
gh-129693: Suppress `SyntaxWarning` in test_fstring (GH-129830)

Suppress SyntaxWarning in test_fstring
(cherry picked from commit 2dd018848c)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-02-13 02:03:00 +00:00
Pablo Galindo Salgado 8d1d36b742
[3.13] gh-116042: Fix location for SyntaxErrors of invalid escapes in the tokenizer (GH-116049) (#130066)
(cherry picked from commit 56eda25633)
(cherry picked from commit 369704b428)
2025-02-13 01:49:25 +00:00
Sam Gross ee12a3482d
[3.13] gh-129967: Fix race condition in `repr(set)` (gh-129978) (gh-130020)
The call to `PySequence_List()` could temporarily unlock and relock the
set, allowing the items to be cleared and return the incorrect
notation `{}` for a empty set (it should be `set()`).

(cherry picked from commit a7427f2db9)

Co-authored-by: T. Wouters <thomas@python.org>
2025-02-11 18:18:12 -05:00
Miss Islington (bot) cef406bbc3
[3.13] gh-126554: correct detection of `gcc` for `TestNullDlsym.test_null_dlsym` (GH-129872) (#129944)
gh-126554: correct detection of `gcc` for `TestNullDlsym.test_null_dlsym` (GH-129872)

In case gcc is not available, the test will fail with FileNotFoundError.
So catch the exception to skip the test correctly.
(cherry picked from commit 978211c8a8)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Co-authored-by: Peter Marko <peter.marko@siemens.com>
2025-02-10 10:16:28 +00:00
Erlend E. Aasland d6daeeeb2f
[3.13] gh-129603: Don't segfault if sqlite3.Row description is None (#129604) (#129923)
(cherry picked from commit 7e6ee50b6b)
2025-02-10 00:21:33 +00:00
Miss Islington (bot) d26c2fe7a2
[3.13] gh-129870: Skip test_dump_virtual_tables if SQLite lacks FTS4 support (GH-129913) (#129918)
(cherry picked from commit cda83cade0)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-02-09 21:06:16 +00:00
Miss Islington (bot) 7eba097137
[3.13] gh-128772: Fix pydoc for methods with __module__ is None (GH-129177) (GH-129653)
(cherry picked from commit 979d766209)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-02-05 14:42:51 +00:00
neonene 19ceb342b5
[3.13] gh-129660: Do not use test_embed in PGO profile builds (#129662) 2025-02-05 12:22:30 +01:00
Miss Islington (bot) 7935c0fd5f
[3.13] gh-129350: Make tests for glob with trailing slash more strict (GH-129376) (GH-129651)
Test that the trailing pathname separator is preserved.

Multiple trailing pathname separators are only preserved if the pattern
does not contain metacharacters, otherwise only one trailing pathname
separator is preserved. This is rather an implementation detail.
(cherry picked from commit 8b5c8508c7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-02-04 14:49:14 +00:00
donBarbos 08b045c438
[3.13] gh-127349: Add check for correct resizing in REPL (GH-127387) (#129485)
(cherry picked from commit 510fefdc62)
2025-02-04 15:18:22 +01:00
Miss Islington (bot) 9120330354
[3.13] gh-128078: Use `PyErr_SetRaisedException` in `_PyGen_SetStopIterationValue` (GH-128287) (#128789)
gh-128078: Use `PyErr_SetRaisedException` in `_PyGen_SetStopIterationValue` (GH-128287)
(cherry picked from commit 402b91da87)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-02-04 00:34:02 +01:00
Miss Islington (bot) b13b76f98a
[3.13] gh-127975: Avoid reusing quote types in ast.unparse if not needed (GH-127980) (#129600)
gh-127975: Avoid reusing quote types in ast.unparse if not needed (GH-127980)
(cherry picked from commit 8df5193d37)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2025-02-03 00:38:44 +00:00
Jason R. Coombs 6aa09a5898
[3.13] gh-127096: Do not recreate unnamed section on every read in ConfigParser (GH-127228) (#129593)
* Do not recreate unnamed section on every read in ConfigParser

* Remove duplicate section creation code
(cherry picked from commit 914c232e93)

Co-authored-by: Andrey Efremov <duxus@yandex.ru>
2025-02-02 18:53:23 +00:00
Miss Islington (bot) e9febe51af
[3.13] gh-115514: Fix incomplete writes after close while using ssl in asyncio(GH-128037) (#129581)
gh-115514: Fix incomplete writes after close while using ssl in asyncio(GH-128037)

(cherry picked from commit 4e38eeafe2)

Co-authored-by: Vojtěch Boček <vbocek@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-02-02 16:12:12 +00:00
Miss Islington (bot) 90e526ae67
[3.13] gh-105704: Disallow square brackets (`[` and `]`) in domain names for parsed URLs (GH-129418) (GH-129526)
gh-105704: Disallow square brackets (`[` and `]`) in domain names for parsed URLs (GH-129418)

* gh-105704: Disallow square brackets ( and ) in domain names for parsed URLs

* Use Sphinx references



* Add mismatched bracket test cases, fix news format

* Add more test coverage for ports

---------

(cherry picked from commit d89a5f6a6e)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-02-02 00:12:51 -08:00
Miss Islington (bot) 1459d08b56
[3.13] gh-119461: Restore the testSocket VSOCK skipUnless removed by PR GH-119465 (GH-129561) (#129564)
gh-119461: Restore the testSocket VSOCK skipUnless removed by PR GH-119465 (GH-129561)

Restore the skipUnless removed by GH-119465.

This test can only pass on virtual machines, not actual machines.

actual machines see:

```
    self.cli.connect((cid, VSOCKPORT))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
OSError: [Errno 19] No such device
```

Reproduced on (Linux) Ubuntu 24.04.1 running 6.8.0-52-generic.
(cherry picked from commit e1006ce1de)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-02-02 05:11:30 +00:00
Victor Stinner 9a59a51733
[3.13] gh-111495: Add PyFile tests (#129449) (#129477)
gh-111495: Add PyFile tests (#129449)

Add tests for the following functions in test_capi.test_file:

* PyFile_FromFd()
* PyFile_GetLine()
* PyFile_NewStdPrinter()
* PyFile_WriteObject()
* PyFile_WriteString()
* PyObject_AsFileDescriptor()

Add Modules/_testlimitedcapi/file.c file.

Remove test_embed.StdPrinterTests which became redundant.

(cherry picked from commit 4ca9fc08f8)
2025-01-30 20:29:27 +01:00
Irit Katriel a853e2f076
[3.13] gh-128799: Add frame of except* to traceback when wrapping a naked exception (#128971) (#129299) 2025-01-30 12:20:13 +00:00
Miss Islington (bot) 8b4a0d641c
[3.13] gh-125522: Fix bare except in `test_uuid` (GH-129018) (#129455)
gh-125522: Fix bare except in `test_uuid` (GH-129018)
(cherry picked from commit a1a4e9f39a)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-29 21:23:10 +00:00
Miss Islington (bot) bf6c256a64
[3.13] gh-112064: Fix incorrect handling of negative read sizes in `HTTPResponse.read()` (GH-128270) (#129395)
gh-112064: Fix incorrect handling of negative read sizes in `HTTPResponse.read()` (GH-128270)

The parameter `amt` of `HTTPResponse.read()`, which could be a negative integer,
has not been handled before and led to waiting for the connection to close
for `keep-alive connections`. Now, this has been fixed, and passing negative values
to `HTTPResponse().read()` works the same as passing `None` value.
(cherry picked from commit 4d0d24f6e3)

Co-authored-by: Yury Manushkin <manushkin@gmail.com>
2025-01-28 12:00:54 +00:00
Miss Islington (bot) 5829f7bf70
[3.13] gh-119511: Fix a potential denial of service in imaplib (GH-119514) (GH-129355)
gh-119511: Fix a potential denial of service in imaplib (GH-119514)

The IMAP4 client could consume an arbitrary amount of memory when trying
to connect to a malicious server, because it read a "literal" data with a
single read(size) call, and BufferedReader.read() allocates the bytes
object of the specified size before reading. Now the IMAP4 client reads data
by chunks, therefore the amount of used memory is limited by the
amount of the data actually been sent by the server.
(cherry picked from commit 735f25c5e3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-01-27 14:05:59 -08:00
Miss Islington (bot) c7f9e7446c
[3.13] gh-129061: Fix `FORCE_COLOR` and `NO_COLOR` when empty strings (GH-129140) (#129360)
gh-129061: Fix `FORCE_COLOR` and `NO_COLOR` when empty strings (GH-129140)
(cherry picked from commit 9546fe2ef2)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-01-27 14:48:05 +00:00
Miss Islington (bot) 6e887411b6
[3.13] gh-123987: Fix NotADirectoryError in NamespaceReader when sentinel present (GH-124018) (#129319)
gh-123987: Fix NotADirectoryError in NamespaceReader when sentinel present (GH-124018)
(cherry picked from commit b543b32eff)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2025-01-26 12:04:09 -05:00
Miss Islington (bot) e07a6fe7c3
[3.13] Improve tests for _colorize.can_colorize() (GH-129234) (GH-129265)
(cherry picked from commit 7907203bc0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-01-24 17:00:54 +00:00
Miss Islington (bot) 75ec6caa48
[3.13] gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (GH-128475) (#129227)
gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (GH-128475)
(cherry picked from commit ec91e1c276)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-23 22:16:02 +01:00
Miss Islington (bot) 5c102a12a1
[3.13] gh-118878: Pyrepl: show completions menu below the current line (GH-118939) (#129161)
gh-118878: Pyrepl: show completions menu below the current line (GH-118939)

(cherry picked from commit 29caec62ee)

Co-authored-by: Daniel Hollas <daniel.hollas@bristol.ac.uk>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-01-23 22:15:27 +01:00
Victor Stinner e3b3e01d6a
[3.13] gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191) (#129217)
gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191)

Support calling PyTraceMalloc_Track() and PyTraceMalloc_Untrack()
during late Python finalization.

* Call _PyTraceMalloc_Fini() later in Python finalization.
* Test also PyTraceMalloc_Untrack() without the GIL
* PyTraceMalloc_Untrack() now gets the GIL.
* Test also PyTraceMalloc_Untrack() in test_tracemalloc_track_race().

(cherry picked from commit 46c7e13c05)
2025-01-23 13:59:19 +01:00
Hugo van Kemenade cc3dc8ab24
[3.13] gh-127873: Only check `sys.flags.ignore_environment` for `PYTHON*` env vars (GH-127877) (#129138) 2025-01-22 21:09:51 +02:00
Miss Islington (bot) f7f8b8b758
[3.13] gh-124363: Treat debug expressions in f-string as raw strings (GH-128399) (#129187)
gh-124363: Treat debug expressions in f-string as raw strings (GH-128399)

(cherry picked from commit 60a3a0dd6f)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-01-22 17:19:07 +00:00
Miss Islington (bot) 0b90dc8e89
[3.13] gh-128636: Fix crash in PyREPL when `os.environ` is overwritten with an invalid value (GH-128653) (#129186)
gh-128636: Fix crash in PyREPL when `os.environ` is overwritten with an invalid value (GH-128653)
(cherry picked from commit ba9a4b6215)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-22 16:38:13 +00:00
Miss Islington (bot) 67971cd605
[3.13] gh-128770: fix ResourceWarning in test_pyrepl (GH-128906) (#129179) 2025-01-22 13:13:08 +00:00
Miss Islington (bot) 7f6e80a03e
[3.13] gh-128894: Fix `TracebackException._format_syntax_error` on custom `SyntaxError` metadata (GH-128946) (#129178) 2025-01-22 13:12:39 +00:00
Miss Islington (bot) a379749217
[3.13] gh-129093: Fix f-string debug text sometimes getting cut off when expression contains `!` (GH-129159) (#129163)
gh-129093: Fix f-string debug text sometimes getting cut off when expression contains `!` (GH-129159)
(cherry picked from commit 767cf70844)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-22 00:50:22 +00:00
Miss Islington (bot) 0ddcb61ffe
[3.13] gh-123024: Correctly prepare/restore around help and show-history commands (GH-124485) (#129155)
gh-123024: Correctly prepare/restore around help and show-history commands (GH-124485)
(cherry picked from commit 5a9afe2362)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Emily Morehouse <emily@cuttlesoft.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-01-21 22:15:57 +00:00
Miss Islington (bot) 3048dcd15a
[3.13] gh-125553: Fix backslash continuation in `untokenize` (GH-126010) (#129153)
gh-125553: Fix backslash continuation in `untokenize` (GH-126010)
(cherry picked from commit 7ad793e5db)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-21 21:04:55 +00:00
Miss Islington (bot) 0c7045378f
[3.13] gh-126332: Fix pyrepl crash for double ctrl-z in line overflow (GH-126650) (#129154)
gh-126332: Fix pyrepl crash for double ctrl-z in line overflow (GH-126650)

(cherry picked from commit d147e5e52c)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-01-21 21:04:41 +00:00
Hugo van Kemenade 383af395af
[3.13] gh-128595: Default to stdout isatty for colour detection instead of stderr (GH-128498) (#129057)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Fix `test__colorize` unexpected keyword argument 'file' on buildbots (#129070)
2025-01-21 18:14:24 +02:00
Miss Islington (bot) 03b2ecf41c
[3.13] GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (GH-128143) (#129091)
GH-128131: Completely support random read access of uncompressed unencrypted files in ZipFile (GH-128143)
(cherry picked from commit dda02eb7be)

Co-authored-by: 5ec1cff <56485584+5ec1cff@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-20 18:28:52 +00:00
Miss Islington (bot) a1c48a750c
[3.13] gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (GH-129063) (#129089)
gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (GH-129063)
(cherry picked from commit ed6934e71e)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-20 17:36:50 +00:00
Serhiy Storchaka c6a566e47b
[3.13] gh-71339: Add additional assertion methods in test.support (GH-128707) (GH-128815)
Add a mix-in class ExtraAssertions containing the following methods:

* assertHasAttr() and assertNotHasAttr()
* assertIsSubclass() and assertNotIsSubclass()
* assertStartsWith() and assertNotStartsWith()
* assertEndsWith() and assertNotEndsWith()

(cherry picked from commit 06cad77a5b)
2025-01-20 11:19:00 +02:00
Miss Islington (bot) 2120089547
[3.13] gh-80222: Fix email address header folding with long quoted-string (GH-122753) (#129007)
gh-80222: Fix email address header folding with long quoted-string (GH-122753)

Email generators using email.policy.default could incorrectly omit the
quote ('"') characters from a quoted-string during header refolding,
leading to invalid address headers and enabling header spoofing. This
change restores the quote characters on a bare-quoted-string as the
header is refolded, and escapes backslash and quote chars in the string.
(cherry picked from commit 5aaf416858)

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
2025-01-19 16:06:28 -05:00
Victor Stinner 6b47499510
[3.13] gh-128679: Fix tracemalloc.stop() race conditions (#128897)
tracemalloc_alloc(), tracemalloc_realloc(), PyTraceMalloc_Track(),
PyTraceMalloc_Untrack() and _PyTraceMalloc_TraceRef() now check
tracemalloc_config.tracing after calling TABLES_LOCK().

_PyTraceMalloc_Stop() now protects more code with TABLES_LOCK(),
especially setting tracemalloc_config.tracing to 1.

Add a test using PyTraceMalloc_Track() to test tracemalloc.stop()
race condition.

Call _PyTraceMalloc_Init() at Python startup.
2025-01-18 23:39:07 +00:00
Victor Stinner 430ccbc009
[3.13] gh-111495: Add more tests on PyEval C APIs (#122789) (#128987)
* gh-111495: Add more tests on PyEval C APIs (#122789)

* Add Lib/test/test_capi/test_eval.py
* Add Modules/_testlimitedcapi/eval.c

(cherry picked from commit bf8b374639)

* gh-111495: Fix refleaks in test_capi.test_eval tests (#122851)

(cherry picked from commit b4a316087c)
2025-01-18 14:49:55 +00:00
Miss Islington (bot) c75894a36b
[3.13] gh-128961: Fix exhausted array iterator crash in __setstate__() (GH-128962) (#128976)
(cherry picked from commit 4dade055f4)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
2025-01-18 10:17:42 +00:00
Victor Stinner 34ded1a1a1
[3.13] gh-128911: Add tests on the PyImport C API (#128915) (#128960)
gh-128911: Add tests on the PyImport C API (#128915)

* Add Modules/_testlimitedcapi/import.c
* Add Lib/test/test_capi/test_import.py
* Remove _testcapi.check_pyimport_addmodule(): tests already covered
  by newly added tests.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit d95ba9fa11)
2025-01-17 22:44:51 +01:00
Miss Islington (bot) dc77f1914d
[3.13] gh-58956: Fix a frame refleak in bdb (GH-128190) (#128947)
* gh-58956: Fix a frame refleak in bdb (GH-128190)
(cherry picked from commit 767c89ba7c)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-01-17 12:49:15 -05:00
Miss Islington (bot) c927fd9d25
[3.13] gh-128816: Fix warnings in test_doctest (GH-128817) (GH-128870)
* Fix a deprecation warning for using importlib.resources.abc.ResourceReader.
* Fix an import warning when importing readline (if it has not yet been imported).
(cherry picked from commit 599be687ec)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2025-01-16 08:57:14 +00:00
Miss Islington (bot) 88b4b435fa
[3.13] gh-109959: Skip test_glob.test_selflink() flaky test (GH-128812) (#128821)
gh-109959: Skip test_glob.test_selflink() flaky test (GH-128812)
(cherry picked from commit 1153e66e20)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-14 10:55:33 +00:00
Peter Bierma 1ec36a62eb
[3.13] gh-128717: Stop-the-world when setting the recursion limit (GH-128741) (#128757)
[3.13] gh-128717: Stop-the-world when setting the recursion limit (GH-128741)
(cherry picked from commit f6c61bf2d7)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-14 13:33:52 +05:30
Miss Islington (bot) f2a2809683
[3.13] gh-125997: Increase test coverage for `time.sleep()` (GH-128751) (#128796)
gh-125997: Increase test coverage for `time.sleep()` (GH-128751)

- Add tests for durations of invalid types.
- Add tests for `int` and `float` durations, including signed zeroes durations.
- Add tests for nonzero very small durations and durations close to the clock resolution.

---------
(cherry picked from commit b70a567575)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-13 17:23:27 +00:00
Miss Islington (bot) b1065767b4
[3.13] gh-128562: Fix generation of the tkinter widget names (GH-128604) (GH-128791)
There were possible conflicts if the widget class name ends with a digit.
(cherry picked from commit da8825ea95)

Co-authored-by: Zhikang Yan <2951256653@qq.com>
2025-01-13 18:23:33 +02:00
Miss Islington (bot) 66d0636025
[3.13] gh-128078: Clear exception in `anext` before calling `_PyGen_SetStopIterationValue` (GH-128780) (#128785)
gh-128078: Clear exception in `anext` before calling `_PyGen_SetStopIterationValue` (GH-128780)
(cherry picked from commit 76ffaef729)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-13 13:20:49 +00:00
Hugo van Kemenade afcf238ed4
[3.13] gh-128595: Add test class helper to force no terminal colour (GH-128687) (#128778)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2025-01-13 13:57:44 +02:00
Serhiy Storchaka 6116e1ba90
[3.13] gh-128734: Explicitly close sockets in urllib tests (GH-128735) (GH-128748)
(cherry picked from commit 5ace71713b)
2025-01-12 11:30:29 +00:00
Miss Islington (bot) 3714fd07c5
[3.13] gh-128302: Fix bugs in xml.dom.xmlbuilder (GH-128284) (#128582)
gh-128302: Fix bugs in xml.dom.xmlbuilder (GH-128284)

* Allow DOMParser.parse() to correctly handle DOMInputSource instances
  that only have a systemId attribute set.
* Fix DOMEntityResolver.resolveEntity(), which was broken by the
  Python 3.0 transition.
* Add Lib/test/test_xml_dom_xmlbuilder.py with few tests.
(cherry picked from commit 6ea04da270)

Co-authored-by: Stephen Morton <git@tungol.org>
2025-01-11 13:31:04 +02:00
Miss Islington (bot) 0d2b9abd18
[3.13] gh-127196: Fix crash in `_interpreters`, when `shared` had invalid encodings (GH-127220) (#128689)
gh-127196: Fix crash in `_interpreters`, when `shared` had invalid encodings (GH-127220)
(cherry picked from commit 087bb48aca)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-01-09 20:10:08 +00:00
Thomas Grainger 13835888e6
[3.13] gh-128552: fix refcycles in eager task creation (#128553) (#128585)
gh-128552: fix refcycles in eager task creation (#128553)

(cherry picked from commit 61b9811ac6)
2025-01-08 18:16:43 +05:30
Miss Islington (bot) 7e099c51b6
[3.13] gh-128615: Cover pickling of `ParamSpecArgs` and `ParamSpecKwargs` (GH-128616) (#128625)
gh-128615: Cover pickling of `ParamSpecArgs` and `ParamSpecKwargs` (GH-128616)
(cherry picked from commit 74a517181a)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-01-08 12:32:32 +00:00
Miss Islington (bot) 77b411bd90
[3.13] gh-128613: Increase `typing.Concatenate` coverage (GH-128614) (#128623)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-01-08 12:26:01 +00:00
Miss Islington (bot) dda55ccf1a
[3.13] gh-41872: Fix quick extraction of module docstrings from a file in pydoc (GH-127520) (GH-128620)
It now supports docstrings with single quotes, escape sequences,
raw string literals, and other Python syntax.

(cherry picked from commit 474e419792)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-01-08 14:21:15 +02:00
Miss Islington (bot) c0ba0bc547
[3.13] gh-128617: Fix `test_typing.test_readonly_inheritance` (GH-128618) (#128622)
gh-128617: Fix `test_typing.test_readonly_inheritance` (GH-128618)
(cherry picked from commit 971a52b549)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-01-08 11:43:16 +00:00
Miss Islington (bot) 32012ed3bc
[3.13] gh-109413: Add more type hints to `libregrtest` (GH-126352) (#126388)
gh-109413: Add more type hints to `libregrtest` (GH-126352)
(cherry picked from commit bfc1d2504c)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-01-08 09:00:46 +00:00
Miss Islington (bot) ad3bbb6b0d
[3.13] gh-98188: Fix EmailMessage.get_payload to decode data when CTE value has extra text (GH-127547) (#128528)
gh-98188: Fix EmailMessage.get_payload to decode data when CTE value has extra text (GH-127547)

Up to this point message handling has been very strict with regards to content encoding values: mixed case was accepted, but trailing blanks or other text would cause decoding failure, even if the first token was a valid encoding.  By Postel's Rule we should go ahead and decode as long as we can recognize that first token.  We have not thought of any security or backward compatibility concerns with this fix.

This fix does introduce a new technique/pattern to the Message code: we look to see if the header has a 'cte' attribute, and if so we use that.  This effectively promotes the header API exposed by HeaderRegistry to an API that any header parser "should" support.  This seems like a reasonable thing to do.  It is not, however, a requirement, as the string value of the header is still used if there is no cte attribute.

The full fix (ignore any trailing blanks or blank-separated trailing text) applies only to the non-compat32 API.  compat32 is only fixed to the extent that it now ignores trailing spaces.  Note that the HeaderRegistry parsing still records a HeaderDefect if there is extra text.

(cherry picked from commit a62ba52f14)

Co-authored-by: RanKKI <hliu86.me@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-07 12:43:04 -05:00
Miss Islington (bot) 883cb23dd1
[3.13] gh-128152: Argument Clinic: ignore pre-processor directives inside C comments (GH-128464) (#128478)
(cherry picked from commit a4e773c540)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-01-04 11:09:25 +00:00
Miss Islington (bot) b875917e21
[3.13] gh-127903: Fix a crash on debug builds when calling `Objects/unicodeobject::_copy_characters` (GH-127876) (#128458)
gh-127903: Fix a crash on debug builds when calling `Objects/unicodeobject::_copy_characters`` (GH-127876)
(cherry picked from commit 46cb6340d7)

Co-authored-by: Alexander Shadchin <shadchin@yandex-team.com>
2025-01-03 21:20:30 +02:00
Miss Islington (bot) ebadfd1039
[3.13] gh-128400: Stop-the-world when manually calling `faulthandler` (GH-128422) (GH-128423)
(cherry picked from commit c9356feef2)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-02 19:21:16 +00:00
Kumar Aditya fa6c48e4b3
[3.13] gh-128013: fix data race in PyUnicode_AsUTF8AndSize on free-threading (#128021) (#128417) 2025-01-02 22:10:17 +05:30
Miss Islington (bot) 24cddab4a2
[3.13] gh-128014: Fix passing default='' to the tkinter method wm_iconbitmap() (GH-128015) (GH-128418)
(cherry picked from commit 58e9f95c4a)

Co-authored-by: Zhikang Yan <2951256653@qq.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-01-02 16:14:18 +00:00
Miss Islington (bot) 08ae06fe46
[3.13] gh-88834: Unify the instance check for typing.Union and types.UnionType (GH-128363) (GH-128370)
Union now uses the instance checks against its parameters instead of
the subclass checks.
(cherry picked from commit b2ac70a62a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-12-31 18:45:03 +00:00
Miss Islington (bot) 16fde763e5
[3.13] gh-127586: multiprocessing.Pool does not properly restore blocked signals (try 2) (GH-128011) (#128298)
gh-127586: multiprocessing.Pool does not properly restore blocked signals (try 2) (GH-128011)

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.
(cherry picked from commit aeb9b65aa2)

Co-authored-by: Stephen Hansen <stephen.paul.hansen@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-12-29 11:02:53 -08:00
Miss Islington (bot) 1781525422
[3.13] gh-127537: Add __class_getitem__ to the python implementation of functools.partial (GH-127537) (#128281)
gh-127537: Add __class_getitem__ to the python implementation of functools.partial (GH-127537)
(cherry picked from commit 401bba6b58)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
2024-12-27 01:25:56 +00:00
Ethan Furman 875e49fb63
[3.13] gh-112328: Make EnumDict usable on its own and document it (GH-123669) (GH-128142)
Co-authored-by: Petr Viktorin <pviktori@redhat.com>
2024-12-24 10:50:23 -08:00
Miss Islington (bot) e1a0c40658
[3.13] gh-127847: Fix position in the special-cased zipfile seek (GH-127856) (#128225)
gh-127847: Fix position in the special-cased zipfile seek (GH-127856)

---------
(cherry picked from commit 7ed6c5c696)

Co-authored-by: Dima Ryazanov <dima@bucket.xxx>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-12-24 16:20:58 +00:00
Miss Islington (bot) 09d15aa9a8
[3.13] gh-128049: Fix type confusion bug with the return value of a custom ExceptionGroup split function (GH-128079) (#128139)
gh-128049: Fix type confusion bug with the return value of a custom ExceptionGroup split function (GH-128079)
(cherry picked from commit 3879ca0100)

Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
2024-12-20 20:18:44 +00:00
Miss Islington (bot) 43586a4804
[3.13] gh-128116: Skip test_socket VSOCK testStream() on PermissionError (GH-128120) (#128123)
gh-128116: Skip test_socket VSOCK testStream() on PermissionError (GH-128120)
(cherry picked from commit cbfe3023e4)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-20 13:32:58 +00:00
Miss Islington (bot) f320f747da
[3.13] gh-128030: Avoid error from PyModule_GetFilenameObject for non-module (GH-128047) (#128114)
gh-128030: Avoid error from PyModule_GetFilenameObject for non-module (GH-128047)

I missed the extra `PyModule_Check` in GH-127660 because I was looking at
3.12 as the base implementation for import from. This meant that I
missed the `PyModuleCheck` introduced in GH-112661.
(cherry picked from commit 45e6dd63b8)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-12-20 08:46:54 +00:00
Peter Bierma 3a8bdaf698
[3.13] gh-128083: Fix macro redefinition warning in clinic. (GH-127950) (#128102)
(cherry picked from commit b5d1e4552f)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-12-19 21:29:14 +00:00
Miss Islington (bot) 2ff3e95ad5
[3.13] gh-126742: Avoid checking for library filename in test_ctypes (GH-128034) (#128056)
gh-126742: Avoid checking for library filename in test_ctypes (GH-128034)

Avoid checking for library filename in `dlerror()` error messages of test_ctypes.
(cherry picked from commit 335e24fb0a)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-18 08:49:13 +00:00
Miss Islington (bot) fe08cdf265
[3.13] gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror messages (GH-126746) (GH-128023)
- Add a helper to set an error from locale-encoded `char*`
- Use the helper for gdbm & dlerror messages
(cherry picked from commit 7303f06846)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-17 11:45:29 +00:00
Miss Islington (bot) 90ae4b6f5a
[3.13] gh-127353: Allow to force color output on Windows V2 (GH-127926) (#127944)
gh-127353: Allow to force color output on Windows V2 (GH-127926)
(cherry picked from commit 0ac40acec0)

Co-authored-by: Andrey Efremov <duxus@yandex.ru>
2024-12-15 10:41:11 +02:00
Victor Stinner 2996a2bed3
[3.13] gh-127906: Backport test_cext changes from the main branch (#127923) 2024-12-13 15:04:08 +00:00
Miss Islington (bot) 78095c9052
[3.13] gh-127906: Test the limited C API in test_cppext (GH-127916) (#127919)
gh-127906: Test the limited C API in test_cppext (GH-127916)
(cherry picked from commit d05a4e6a0d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-13 14:12:07 +00:00
Miss Islington (bot) 0f38b897f9
[3.13] gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (GH-127872) (#127917)
gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (GH-127872)
(cherry picked from commit 6ff38fc4e2)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-13 13:19:41 +00:00
Victor Stinner b620e503eb
[3.13] gh-127906: Backport test_cppext changes from the main branch (#127914) 2024-12-13 12:51:48 +00:00
Petr Viktorin d51c1444e3
[3.13] gh-126937: ctypes: add test for maximum size of a struct field (GH-126938) (GH-127825)
This backports the *test* from GH-126938, with changed limit and exception class.

Co-authored-by: Melissa0x1f992 <70096546+Melissa0x1f992@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-12-12 13:02:57 +01:00
Miss Islington (bot) a94e20e4f1
[3.13] gh-123401: Fix http.cookies module to support obsolete RFC 850 date format (GH-123405) (#127828)
gh-123401: Fix http.cookies module to support obsolete RFC 850 date format (GH-123405)
(cherry picked from commit 359389ed51)

Co-authored-by: Nano <nanoapezlk@gmail.com>
Co-authored-by: Wulian <1055917385@qq.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-11 15:38:09 +00:00
Bénédikt Tran 8bf5b89212
[3.13] gh-127637: add tests for `dis` command-line interface (#127759) (#127781) 2024-12-10 12:32:32 +00:00
Shantanu 6441d42f92
[3.13] gh-127651: Use __file__ in diagnostics if origin is missing (#127660) (#127775)
gh-127651: Use __file__ in diagnostics if origin is missing (#127660)

See the left hand side in https://github.com/python/cpython/pull/123929/files#diff-c22186367cbe20233e843261998dc027ae5f1f8c0d2e778abfa454ae74cc59deL2840-L2849

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 3983527c3a)
2024-12-10 05:21:55 +00:00
Russell Keith-Magee 075c41d5f5
[3.13] gh-126925: Modify how iOS test results are gathered (GH-127592) (#127754)
Adds a `use_system_log` config item to enable stdout/stderr redirection for
Apple platforms. This log streaming is then used by a new iOS test runner
script, allowing the display of test suite output at runtime. The iOS test
runner script can be used by any Python project, not just the CPython test
suite.
(cherry picked from commit 2041a95e68)
2024-12-09 14:39:11 +08:00
Miss Islington (bot) 71e8429ac8
[3.13] gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol if needed (GH-127656) (#127663)
gh-127655: Ensure `_SelectorSocketTransport.writelines` pauses the protocol if needed (GH-127656)

Ensure `_SelectorSocketTransport.writelines` pauses the protocol if it reaches the high water mark as needed.
(cherry picked from commit e991ac8f20)

Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-12-06 10:42:23 +05:30
Miss Islington (bot) 2da829ba97
[3.13] GH-126727: Fix test_era_nl_langinfo with Japanese ERAs on Solaris (GH-127327) (GH-127645)
(cherry picked from commit d958d9f4a1)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2024-12-05 19:08:12 +00:00
Miss Islington (bot) 468e8dad7e
[3.13] gh-122431: Disallow negative values in `readline.append_history_file` (GH-122469) (#127641)
gh-122431: Disallow negative values in `readline.append_history_file` (GH-122469)
(cherry picked from commit 208b0fb645)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-05 18:15:44 +01:00
Miss Islington (bot) 0b266aaa39
[3.13] gh-127421: Fix race in test_start_new_thread_failed (GH-127549) (#127574)
gh-127421: Fix race in test_start_new_thread_failed (GH-127549)

Fix race in test_start_new_thread_failed

When we succeed in starting a new thread, for example if setrlimit
was ineffective, we must wait for the newly spawned thread to exit.
Otherwise, we run the risk that the newly spawned thread will race
with runtime finalization and access memory that has already been
clobbered/freed.

`_thread.start_new_thread()` only spawns daemon threads, which the runtime
does not wait for at shutdown, and does not return a handle. Use
`_thread.start_joinable_thread()` and join the resulting handle when
the thread is started successfully.
(cherry picked from commit 13b68e1a61)

Co-authored-by: mpage <mpage@meta.com>
2024-12-03 10:30:08 -08:00
Miss Islington (bot) ae3f347dc0
[3.13] gh-123935: Fix typo in `_get_slots` in `dataclasses.py` (GH-123941) (#123991)
gh-123935: Fix typo in `_get_slots` in `dataclasses.py` (GH-123941)
(cherry picked from commit ac918ccad7)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-12-03 17:17:25 +01:00
Miss Islington (bot) a63e06d95b
[3.13] gh-122792: Make IPv4-mapped IPv6 address properties consistent with IPv4 (GH-122793) (GH-123815)
Make IPv4-mapped IPv6 address properties consistent with IPv4.
(cherry picked from commit 76a1c5d183)

Co-authored-by: Seth Michael Larson <seth@python.org>
2024-12-03 17:12:36 +01:00
Miss Islington (bot) a853610282
gh-119826: Improved fallback for ntpath.abspath() on Windows (GH-119938)
(cherry picked from commit 4b00aba42e)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-12-02 20:11:16 +00:00
Eric Snow 219b8266db
[3.13] gh-126914: Store the Preallocated Thread State's Pointer in a PyInterpreterState Field (gh-127114)
This approach eliminates the originally reported race.  It also gets rid of the deadlock reported in gh-96071, so we can remove the workaround added then.

This is mostly a cherry-pick of 1c0a104 (AKA gh-126989).  The difference is we add PyInterpreterState.threads_preallocated at the end of PyInterpreterState, instead of adding PyInterpreterState.threads.preallocated.  That avoids ABI disruption.
2024-12-02 18:41:57 +00:00
Miss Islington (bot) 059114c0a0
[3.13] gh-126876: Fix socket internal_select() for large timeout (GH-126968) (#127002)
gh-126876: Fix socket internal_select() for large timeout (GH-126968)

If the timeout is larger than INT_MAX, replace it with INT_MAX, in
the poll() code path.

Add an unit test.
(cherry picked from commit b3687ad454)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-02 16:25:55 +00:00
Miss Islington (bot) f41d8d89e7
[3.13] gh-113841: fix possible undefined division by 0 in _Py_c_pow() (GH-127211) (#127216)
Note, that transformed expression is not an equivalent for original one (1/exp(-x) != exp(x) in general for floating-point numbers). Though, the difference seems to be ~1ULP for good libm implementations.

It's more interesting why division was used from beginning. Closest algorithm I've found (no error checks, of course;)) - it's Algorithm 190 from ACM: https://dl.acm.org/doi/10.1145/366663.366679. It uses subtraction in the exponent.

(cherry picked from commit f7bb658124)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-12-02 15:42:02 +01:00
Miss Islington (bot) 511c588f5d
[3.13] add missing gc_collect() calls in sqlite3 tests (GH-127446) (#127500)
add missing gc_collect() calls in sqlite3 tests (GH-127446)
(cherry picked from commit 2a373da770)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
2024-12-02 15:19:21 +01:00
Miss Islington (bot) a5672bec68
[3.13] gh-126699: allow AsyncIterator to be used as a base for Protocols (GH-126702) (#126762)
gh-126699: allow AsyncIterator to be used as a base for Protocols (GH-126702)
(cherry picked from commit feb3e0b19c)

Co-authored-by: Stephen Morton <github@tungol.org>
2024-12-02 15:10:25 +01:00
Miss Islington (bot) fd48d98df9
[3.13] gh-125666: Avoid PyREPL exiting when a null byte is in input (GH-125732) (#126023)
gh-125666: Avoid PyREPL exiting when a null byte is in input (GH-125732)
(cherry picked from commit 44becb8cba)

Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
2024-12-02 15:04:51 +01:00
Peter Bierma b1051577de
[3.13] gh-124984: Enhance `ssl` thread safety (GH-124993) (#125780)
Make SSL objects thread safe in Free Theaded build by
using critical sections.

(cherry picked from commit 4c53b25775)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-02 15:03:44 +01:00
Miss Islington (bot) 4bafce0912
[3.13] gh-126618: fix repr(itertools.count(sys.maxsize)) (GH-127048) (#127508)
gh-126618: fix repr(itertools.count(sys.maxsize)) (GH-127048)
(cherry picked from commit 930ba0ce60)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-02 13:38:13 +00:00
Tian Gao dd2ad70b29
[3.13] gh-127321: Avoid stopping at an opcode without an associated line number for breakpoint() (GH-127457) (#127487)
(cherry picked from commit 1bc4f076d1)
2024-12-01 17:58:08 -05:00
Miss Islington (bot) 2813a61675
[3.13] gh-127165: Disallow embedded NULL characters in `_interpreters` (GH-127199) (#127463)
gh-127165: Disallow embedded NULL characters in `_interpreters` (GH-127199)
(cherry picked from commit 46bfd26fb2)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-12-01 06:55:55 +00:00
Miss Islington (bot) 5017c81824
[3.13] gh-127190: Fix local_setattro() error handling (GH-127366) (#127367)
gh-127190: Fix local_setattro() error handling (GH-127366)

Don't make the assumption that the 'name' argument is a string. Use
repr() to format the 'name' argument instead.
(cherry picked from commit 20657fbdb1)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-01 06:48:04 +00:00
Peter Bierma a442c87c4c
[3.13] gh-127341: Argument Clinic: fix compiler warnings for getters with docstrings (GH-127310) (#127431)
(cherry picked from commit 99490913a0)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-11-30 23:25:51 +01:00
Miss Islington (bot) 82d199d307
[3.13] gh-109746: Fix race condition in test_start_new_thread_failed (GH-127299) (GH-127323)
(cherry picked from commit 83926d3b4c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-30 09:19:13 +00:00
Miss Islington (bot) d2d1055129
[3.13] gh-124008: Fix calculation of the number of written bytes for the Windows console (GH-124059) (GH-127325)
Since MultiByteToWideChar()/WideCharToMultiByte() is not reversible if
the data contains invalid UTF-8 sequences, use binary search to
calculate the number of written bytes from the number of written
characters.

Also fix writing incomplete UTF-8 sequences.

Also fix handling of memory allocation failures.
(cherry picked from commit 3cf83d91a5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-30 09:16:45 +00:00
Miss Islington (bot) c711deb803
[3.13] gh-127217: Fix pathname2url() for paths starting with multiple slashes on Posix (GH-127218) (GH-127230)
(cherry picked from commit 97b2ceaaaf)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-30 09:11:24 +00:00
Miss Islington (bot) 2f56c68dec
[3.13] gh-127316: fix incorrect assertion in setting `__class__` in free-threading (GH-127399) (#127422)
gh-127316: fix incorrect assertion in setting `__class__` in free-threading (GH-127399)
(cherry picked from commit 45c5cba318)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-11-29 16:36:44 +00:00
Miss Islington (bot) c4a359dc42
[3.13] gh-127208: Reject null character in _imp.create_dynamic() (GH-127400) (#127418)
gh-127208: Reject null character in _imp.create_dynamic() (GH-127400)

_imp.create_dynamic() now rejects embedded null characters in the
path and in the module name.
(cherry picked from commit b14fdadc6c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-29 15:45:21 +00:00
Miss Islington (bot) 6a0663404b
[3.13] gh-124873: Skip timerfd tests on Android (GH-127279) (#127290)
gh-124873: Skip timerfd tests on Android (GH-127279)

* Revert "[3.13] gh-124873: Tolerate 100 ms in TimerfdTests on Android (GH-127101) (GH-127105)"

This reverts commit c09366b1fe.

* Skip timerfd tests on Android.

(cherry picked from commit 4ca2c82862)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-29 11:46:47 +00:00
Miss Islington (bot) 1056f38b3a
[3.13] gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358) (#127401)
gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358)

Replace the sleep(2) with a task which is blocked forever.
(cherry picked from commit bfabf96b50)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-29 11:01:59 +00:00
Miss Islington (bot) 0f77357905
[3.13] gh-127183: Add `_ctypes.CopyComPointer` tests (GH-127184) (GH-127251)
gh-127183: Add `_ctypes.CopyComPointer` tests (GH-127184)

* Make `create_shelllink_persist` top level function.

* Add `CopyComPointerTests`.

* Add more tests.

* Update tests.

* Add assertions for `Release`'s return value.
(cherry picked from commit c7f1e3e150)

Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
2024-11-26 11:13:08 +01:00
Miss Islington (bot) a1b9663c41
[3.13] gh-127182: Fix `io.StringIO.__setstate__` crash when `None` is the first value (GH-127219) (#127262)
gh-127182: Fix `io.StringIO.__setstate__` crash when `None` is the first value (GH-127219)
(cherry picked from commit a2ee899682)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-25 17:56:42 +00:00
Miss Islington (bot) f0c47ea22e
[3.13] gh-126384: Add tests to verify the behavior of basic COM methods. (GH-126610) (GH-127159)
(cherry picked from commit 7725c0371a)

Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
2024-11-25 13:18:27 +01:00
Miss Islington (bot) 24b86308f9
[3.13] gh-109413: Enable mypy's `disallow_any_generics` setting when checking `libregrtest` (GH-127033) (#127034)
gh-109413: Enable mypy's `disallow_any_generics` setting when checking `libregrtest` (GH-127033)
(cherry picked from commit 824afbf548)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-11-24 08:40:14 +00:00
Miss Islington (bot) 69472a5760
[3.13] gh-126991: Add tests for unpickling bad object state (GH-127031) (GH-127063)
This catches a memory leak in loading the BUILD opcode.
(cherry picked from commit addb225f38)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-24 03:16:54 +00:00
Serhiy Storchaka 75ef92da29
[3.13] gh-109746: Make _thread.start_new_thread delete state of new thread on its startup failure (GH-109761) (GH-127171)
If Python fails to start newly created thread
due to failure of underlying PyThread_start_new_thread() call,
its state should be removed from interpreter' thread states list
to avoid its double cleanup.

(cherry picked from commit ca3ea9ad05)

Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
2024-11-22 19:55:44 +00:00
Miss Islington (bot) 329865b883
[3.13] gh-88110: Clear concurrent.futures.thread._threads_queues after fork to avoid joining parent process' threads (GH-126098) (GH-127163)
Threads are gone after fork, so clear the queues too. Otherwise the
child process (here created via multiprocessing.Process) crashes on
interpreter exit.

(cherry picked from commit 1848ce61f3)

Co-authored-by: Andrei Bodrov <Drino@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-22 17:08:18 +00:00
Miss Islington (bot) f0d1a20b77
[3.13] gh-109413: Fix libregrtest get_running() (GH-127153) (#127157)
gh-109413: Fix libregrtest get_running() (GH-127153)

Skip threads which are not running.
(cherry picked from commit 0cb20177d6)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-22 16:34:07 +00:00
Miss Islington (bot) 7f22b87d35
[3.13] gh-127001: Fix PATHEXT issues in shutil.which() on Windows (GH-127035) (GH-127156)
* Name without a PATHEXT extension is only searched if the mode does not
  include X_OK.
* Support multi-component PATHEXT extensions (e.g. ".foo.bar").
* Support files without extensions in PATHEXT contains dot-only extension
  (".", "..", etc).
* Support PATHEXT extensions that end with a dot (e.g. ".foo.").
(cherry picked from commit 8899e85de1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-22 16:18:44 +00:00
Miss Islington (bot) 7bbcd32e59
[3.13] GH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path (GH-127132) (#127135)
GH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path (GH-127132)

Decode a file URI like `file://///server/share` as a UNC path like
`\\server\share`. This form of file URI is created by software the simply
prepends `file:///` to any absolute Windows path.
(cherry picked from commit 8c98ed846a)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-22 04:37:30 +00:00
Miss Islington (bot) 4b9068eeea
[3.13] GH-126766: `url2pathname()`: handle 'localhost' authority (GH-127129) (#127130)
GH-126766: `url2pathname()`: handle 'localhost' authority (GH-127129)

Discard any 'localhost' authority from the beginning of a `file:` URI. As a
result, file URIs like `//localhost/etc/hosts` are correctly decoded as
`/etc/hosts`.
(cherry picked from commit ebf564a1d3)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-22 03:42:26 +00:00
Miss Islington (bot) c74331413e
[3.13] gh-127020: Make `PyCode_GetCode` thread-safe for free threading (GH-127043) (GH-127107)
Some fields in PyCodeObject are lazily initialized. Use atomics and
critical sections to make their initializations and accesses thread-safe.
(cherry picked from commit 3926842117)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-11-21 16:27:36 +00:00
Miss Islington (bot) c09366b1fe
[3.13] gh-124873: Tolerate 100 ms in TimerfdTests on Android (GH-127101) (#127105)
gh-124873: Tolerate 100 ms in TimerfdTests on Android (GH-127101)

On Android, TimerfdTests of test_os now uses 100 ms accuracy instead
of 10 ms.
(cherry picked from commit bab4b0462e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-21 15:29:01 +00:00
Miss Islington (bot) 48eb5c978e
gh-126780: Fix `ntpath.normpath()` for drive-relative paths (GH-126801)
(cherry picked from commit 60ec854bc2)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-11-21 15:10:12 +00:00
Serhiy Storchaka 6e5e7bc5f8
[3.13] gh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730) (GH-127097)
It now returns multiple era description segments separated by semicolons.
Previously it only returned the first segment on platforms with Glibc.
(cherry picked from commit 4803cd0244)
2024-11-21 11:49:19 +00:00
Miss Islington (bot) eaafc7857f
[3.13] gh-126997: Fix support of non-ASCII strings in pickletools (GH-127062) (GH-127094)
* Fix support of STRING and GLOBAL opcodes with non-ASCII arguments.
* dis() now outputs non-ASCII bytes in STRING, BINSTRING and
  SHORT_BINSTRING arguments as escaped (\xXX).
(cherry picked from commit eaf2171082)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-21 11:40:52 +00:00
Miss Islington (bot) 746a0c5bc8
[3.13] GH-85168: Use filesystem encoding when converting to/from `file` URIs (GH-126852) (#127039)
GH-85168: Use filesystem encoding when converting to/from `file` URIs (GH-126852)

Adjust `urllib.request.url2pathname()` and `pathname2url()` to use the
filesystem encoding when quoting and unquoting file URIs, rather than
forcing use of UTF-8.

No changes are needed in the `nturl2path` module because Windows always
uses UTF-8, per PEP 529.
(cherry picked from commit c9b399fbdb)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-20 20:10:29 +00:00
sobolevn 3fae84fe58
[3.13] gh-126980: Fix `bytearray.__buffer__` crash on `PyBUF_{READ,WRITE}` (GH-126981) (#127023)
(cherry picked from commit 3932e1db53)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-19 20:37:53 +03:00
Miss Islington (bot) fd276ad328
[3.13] gh-126594: Fix typeobject.c wrap_buffer() cast (GH-126754) (#127004)
gh-126594: Fix typeobject.c wrap_buffer() cast (GH-126754)

Reject flags smaller than INT_MIN.

(cherry picked from commit 84f07c3a4c)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-11-19 08:38:06 +00:00
Miss Islington (bot) a7b44d6321
[3.13] gh-109413: Enable `strict_optional = true` for `libregrtest/run_workers` (GH-126855) (#126967)
gh-109413: Enable `strict_optional = true` for `libregrtest/run_workers` (GH-126855)
(cherry picked from commit a1d9c8aa80)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-11-18 14:50:31 +00:00
Petr Viktorin da7e93de95
[3.13] gh-126789: Correct sysconfig test exclusions for iOS and Android. (GH-126941) (GH-126950)
(cherry picked from commit 3938fd60c0)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2024-11-18 14:57:58 +01:00
Miss Islington (bot) 1fbd84bf68
[3.13] gh-126909: Fix running xattr tests on systems with lower limits (GH-126930) (#126965)
gh-126909: Fix running xattr tests on systems with lower limits (GH-126930)

Modify the extended attribute tests to write fewer and smaller extended
attributes, in order to fit within filesystems with total xattr limit
of 1 KiB (e.g. ext4 with 1 KiB blocks).  Previously, the test would
write over 2 KiB, making it fail with ENOSPC on such systems.
(cherry picked from commit 2c0a21c1aa)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
2024-11-18 13:33:53 +00:00
Miss Islington (bot) c2c18acc3d
[3.13] gh-101955: Fix SystemError in possesive quantifier with alternative and group (GH-111362) (GH-126962)
(cherry picked from commit f9c5573ded)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-18 12:13:08 +00:00
Serhiy Storchaka 885386b4a2
[3.13] gh-67877: Fix memory leaks in terminated RE matching (GH-126840) (GH-126960)
If SRE(match) function terminates abruptly, either because of a signal
or because memory allocation fails, allocated SRE_REPEAT blocks might
be never released.

Co-authored-by: <wjssz@users.noreply.github.com>
(cherry picked from commit 7538e7f569)
2024-11-18 11:26:45 +00:00
Miss Islington (bot) af35aa2880
[3.13] gh-124452: Fix header mismatches when folding/unfolding with email message (GH-125919) (#126917)
gh-124452: Fix header mismatches when folding/unfolding with email message (GH-125919)

The header-folder of the new email API has a long standing known buglet where
if the first token is longer than max_line_length, it puts that token on the next
line.  It turns out there is also a *parsing* bug when parsing such a header:
the space prefixing that first, non-empty line gets preserved and tacked on to
the start of the header value, which is not the expected behavior per the RFCs.
The bug arises from the fact that the parser assumed that there would be at
least one token on the line with the header, which is going to be true for
probably every email producer other than the python email library with its
folding buglet.  Clearly, though, this is a case that needs to be handled
correctly.  The fix is simple: strip the blanks off the start of the whole
value, not just the first physical line of the value.

(cherry picked from commit ed81971e6b)

Co-authored-by: RanKKI <hliu86.me@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-17 15:06:18 -05:00
Miss Islington (bot) 52efb95b45
[3.13] gh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555) (#126861)
For dlsym(), a return value of NULL does not necessarily indicate
an error [1].

Therefore, to avoid using stale (or NULL) dlerror() values, we must:

 1. clear the previous error state by calling dlerror()
 2. call dlsym()
 3. call dlerror()

If the return value of dlerror() is not NULL, an error occured.

In ctypes we choose to treat a NULL return value from dlsym()
as a "not found" error. This is the same as the fallback
message we use on Windows, Cygwin or when getting/formatting
the error reason fails.

[1]: https://man7.org/linux/man-pages/man3/dlsym.3.html

(cherry picked from commit 8717f792f7)

Signed-off-by: Georgios Alexopoulos <grgalex@ba.uoa.gr>
Co-authored-by: George Alexopoulos <giorgosalexo0@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-11-17 18:59:13 +01:00
Miss Islington (bot) ec9cbcb86b
[3.13] GH-126789: fix some sysconfig data on late site initializations
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2024-11-17 00:32:22 +00:00
Miss Islington (bot) d74f1f477a
[3.13] gh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input month is not correct (GH-126484) (GH-126879)
gh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input month is not correct (GH-126484)
(cherry picked from commit 3be7498d24)

Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-11-15 15:20:25 -08:00
Peter Bierma ecda3ae2a5
[3.13] gh-126312: Don't traverse frozen objects on the free-threaded build (GH-126338) (#126866)
* Fix merge conflicts.

* [3.13] gh-126312: Don't traverse frozen objects on the free-threaded build (GH-126338)

Also, _PyGC_Freeze() no longer freezes unreachable objects.

(cherry picked from commit d4c72fed8c)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>

---------

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-11-15 14:46:00 +01:00
Tomas R. 1c158705f1
[3.13] gh-126413: Add translation tests for getopt and optparse (GH-126698) (GH-126755)
(cherry picked from commit dff074d144)
2024-11-15 13:06:54 +02:00
Miss Islington (bot) cb07c44e19
[3.13] GH-126766: `url2pathname()`: handle empty authority section. (GH-126767) (#126836)
GH-126766: `url2pathname()`: handle empty authority section. (GH-126767)

Discard two leading slashes from the beginning of a `file:` URI if they
introduce an empty authority section. As a result, file URIs like
`///etc/hosts` are correctly parsed as `/etc/hosts`.
(cherry picked from commit cae9d9d20f)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-14 23:52:36 +00:00
Miss Islington (bot) bf40fdbff1
[3.13] gh-126807: pygettext: Do not attempt to extract messages from function definitions. (GH-126808) (GH-126846)
Fixes a bug where pygettext would attempt
to extract a message from a code like this:

def _(x): pass

This is because pygettext only looks at one
token at a time and '_(x)' looks like a
function call.

However, since 'x' is not a string literal,
it would erroneously issue a warning.
(cherry picked from commit 9a456383be)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2024-11-14 22:43:33 +00:00
sobolevn effedb5ff0
[3.13] gh-109413: Enable `strict_optional` for `libregrtest/main.py` (GH-126394) (#126802)
(cherry picked from commit 12ca7e622f)
2024-11-14 13:51:34 +03:00
Barney Gale b66728da05
[3.13] GH-118289: Fix handling of non-directories in `posixpath.realpath()` (GH-120127) (#126815)
In strict mode, raise `NotADirectoryError` if we encounter a non-directory
while we still have path parts left to process.

We use a `part_count` variable rather than `len(rest)` because the `rest`
stack also contains markers for unresolved symlinks.
(cherry picked from commit fd4b5453df)
2024-11-13 23:32:56 +00:00
Miss Islington (bot) ad1b23bf29
[3.13] GH-126606: don't write incomplete pyc files (GH-126627) (GH-126809)
GH-126606: don't write incomplete pyc files (GH-126627)
(cherry picked from commit c695e37a3f)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Brett Cannon <brett@python.org>
2024-11-13 14:49:09 -08:00
Miss Islington (bot) 3fe062c98d
[3.13] gh-126341: add release check to `__iter__` method of `memoryview` (GH-126759) (#126778)
gh-126341: add release check to `__iter__` method of `memoryview` (GH-126759)
(cherry picked from commit a12690ef49)

Co-authored-by: Ritvik Pasham <ritvikpasham@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: sobolevn <mail@sobolevn.me>
2024-11-13 19:05:59 +00:00
Miss Islington (bot) e8dbe7ec57
[3.13] gh-104745: Limit starting a patcher more than once without stopping it (GH-126649) (#126772)
gh-104745: Limit starting a patcher more than once without stopping it (GH-126649)

Previously, this would cause an `AttributeError` if the patch stopped more than once after this, and would also disrupt the original patched object.

---------

(cherry picked from commit 1e40c5ba47)

Co-authored-by: Red4Ru <39802734+Red4Ru@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-13 08:46:12 +00:00
Miss Islington (bot) 3dab1cebf7
[3.13] GH-120423: `pathname2url()`: handle forward slashes in Windows paths (GH-126593) (#126764)
GH-120423: `pathname2url()`: handle forward slashes in Windows paths (GH-126593)

Adjust `urllib.request.pathname2url()` so that forward slashes in Windows
paths are handled identically to backward slashes.
(cherry picked from commit bf224bd7ce)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-12 21:57:41 +00:00
Miss Islington (bot) 865f096f51
[3.13] gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (GH-126617) (#126739)
gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (GH-126617)
(cherry picked from commit 6e3bb8a913)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-12 14:14:21 +00:00
Alex Waygood 4f1440fd89
[3.13] gh-126451: Revert backports of ABC registrations for `contextvars.Context` and multiprocessing proxies (#126734) 2024-11-12 12:29:13 +00:00
Miss Islington (bot) 7db6d4282f
[3.13] gh-126505: Fix bugs in compiling case-insensitive character classes (GH-126557) (GH-126689)
* upper-case non-BMP character was ignored
* the ASCII flag was ignored when matching a character range whose
  upper bound is beyond the BMP region
(cherry picked from commit 819830f34a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-11 16:54:57 +00:00
Miss Islington (bot) fc10908f7d
[3.13] gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503) (GH-126571)
gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503)

If `read()` in the ConnectionHandler thread raises `OSError` (except `ConnectionError`),
the ConnectionHandler shuts down the entire ThreadedEchoServer,
preventing further connections.
It also does that for `EPROTOTYPE` in `wrap_conn`.

As far as I can see, this is done to avoid the server thread getting stuck,
forgotten, in its accept loop. However, since 2011 (5b95eb90a7)
the server is used as a context manager, and its `__exit__` does `stop()` and `join()`.
(I'm not sure if we *always* used `with` since that commit, but currently we do.)

Make sure that the context manager *is* used, and remove the `server.stop()`
calls from ConnectionHandler.
(cherry picked from commit c9cda1608e)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-11-11 15:25:58 +01:00
Miss Islington (bot) 1e4b9c7fae
[3.13] gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501) (GH-126574)
gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501)

The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.
(cherry picked from commit 78ad7e6322)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-11-11 13:56:01 +01:00
Miss Islington (bot) e194b21753
[3.13] gh-126654: Fix crash in several functions in `_interpreters` module (GH-126678) (#126681)
gh-126654: Fix crash in several functions in `_interpreters` module (GH-126678)
(cherry picked from commit 9fc2808eaf)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-11-11 12:01:22 +00:00
Miss Islington (bot) 79ad4bddfc
[3.13] gh-117378: Only run the new multiprocessing SysPath test when appropriate (GH-126635) (GH-126652)
gh-117378: Only run the new multiprocessing SysPath test when appropriate (GH-126635)

The first version had it running two forkserver and one spawn tests underneath each of the _fork, _forkserver, and _spawn test suites that build off the generic one.

This adds to the existing complexity of the multiprocessing test suite by offering BaseTestCase classes another attribute to control which suites they are invoked under. Practicality vs purity here. :/

Net result: we don't over-run the new test and their internal logic is simplified.
(cherry picked from commit ca878b6e45)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-11-10 21:40:33 +00:00
Miss Islington (bot) 9473ae9b51
[3.13] Skip test in test_socket.py if `sys.getrefcount` isn't available (GH-126640) (#126645)
Skip test in test_socket.py if `sys.getrefcount` isn't available (GH-126640)

Skip `testMakefileCloseSocketDestroy` test if `sys.getrefcount` isn't available. This is necessary for  PyPy and other Python implementations that do not have `sys.getrefcount`.
(cherry picked from commit 0f6bb28ff3)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
2024-11-10 15:41:42 +00:00
Miss Islington (bot) 4e036d376e
[3.13] gh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH-126538) (GH-126632)
gh-117378: Fix multiprocessing forkserver preload sys.path inheritance. (GH-126538)

`sys.path` was not properly being sent from the parent process when launching
the multiprocessing forkserver process to preload imports.  This bug has been
there since the forkserver start method was introduced in Python 3.4.  It was
always _supposed_ to inherit `sys.path` the same way the spawn method does.

Observable behavior change: A `''` value in `sys.path` will now be replaced in
the forkserver's `sys.path` with an absolute pathname
`os.path.abspath(os.getcwd())` saved at the time that `multiprocessing` was
imported in the parent process as it already was when using the spawn start
method. **This will only be observable during forkserver preload imports**.

The code invoked before calling things in another process already correctly sets `sys.path`.
Which is likely why this went unnoticed for so long as a mere performance issue in
some configurations.

A workaround for the bug on impacted Pythons is to set PYTHONPATH in the
environment before multiprocessing's forkserver process was started. Not perfect
as that is then inherited by other children, etc, but likely good enough for many
people's purposes.

(cherry picked from commit 9d08423b6e)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-09 15:47:58 -08:00
Miss Islington (bot) 20043d5cf4
[3.13] GH-126212: Fix removal of slashes in file URIs on Windows (GH-126214) (#126590)
GH-126212: Fix removal of slashes in file URIs on Windows (GH-126214)

Adjust `urllib.request.pathname2url()` and `url2pathname()` so that they
don't remove slashes from Windows DOS drive paths and URLs. There was no
basis for this behaviour, and it conflicts with how UNC and POSIX paths are
handled.
(cherry picked from commit 54c63a32d0)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-08 17:31:44 +00:00
Miss Islington (bot) 3b05ef10c1
[3.13] gh-125679: multiprocessing Lock and RLock - fix invalid representation string on MacOSX. (GH-125680) (#126533)
gh-125679: multiprocessing Lock and RLock - fix invalid representation string on MacOSX. (GH-125680)
(cherry picked from commit 75f7cf91ec)

Co-authored-by: Duprat <yduprat@gmail.com>
2024-11-07 01:49:31 -08:00
Miss Islington (bot) 07a6aa3f8f
[3.13] gh-125631: Enable setting persistent_id and persistent_load of pickler and unpickler (GH-125752) (GH-126528)
pickle.Pickler.persistent_id and pickle.Unpickler.persistent_load can
again be overridden as instance attributes.
(cherry picked from commit 223d3dc554)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-07 07:21:23 +00:00
Miss Islington (bot) 59316a668e
[3.13] gh-126451: Register contextvars.Context to collections.abc.Mapping (GH-126452) (#126518)
gh-126451: Register contextvars.Context to collections.abc.Mapping (GH-126452)
(cherry picked from commit 5dc36dc565)

Co-authored-by: Stephen Morton <git@tungol.org>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-11-06 22:41:48 +00:00
Miss Islington (bot) 9e115b1015
[3.13] gh-126489: Do not call persistent_id() for a persistent id in Python pickle (GH-126490) (GH-126514)
(cherry picked from commit 8fa4dc4ba8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-06 22:54:48 +02:00
Miss Islington (bot) ba86632f7e
[3.13] gh-70764: inspect.getclosurevars now identifies global variables with LOAD_GLOBAL (GH-120143) (#126459)
gh-70764: inspect.getclosurevars now identifies global variables with LOAD_GLOBAL (GH-120143)
(cherry picked from commit 83ba8c2bba)

Co-authored-by: blhsing <blhsing@gmail.com>
2024-11-06 00:18:32 +00:00
Alex Waygood c1e708ab07
[3.13] gh-126417: Register multiprocessing proxy types to an appropriate collections.abc class (#126419) (#126435)
Co-authored-by: Stephen Morton <github@tungol.org>
2024-11-05 11:22:44 +00:00
Miss Islington (bot) ce1a1a6021
[3.13] gh-126303: Fix pickling and copying of os.sched_param objects (GH-126336) (GH-126423)
(cherry picked from commit d3840503b0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-05 06:50:33 +00:00
Miss Islington (bot) cddecf228a
[3.13] gh-125783: Add more tests to prevent regressions with the combination of ctypes and metaclasses. (GH-126126) (GH-126275)
gh-125783: Add more tests to prevent regressions with the combination of ctypes and metaclasses. (GH-126126)
(cherry picked from commit 6c67446a6e)

Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
2024-11-04 11:58:20 +01:00
Miss Islington (bot) 86d6c68d43
[3.13] gh-104400: Add more tests to pygettext (GH-108173) (GH-126361)
(cherry picked from commit dcae5cd6ab)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2024-11-03 14:30:16 +00:00
Miss Islington (bot) 79ec946c16
[3.13] gh-125522: Remove bare except in test_zlib.test_flushes (gh-126321) (gh-126327)
gh-125522: Remove bare except in test_zlib.test_flushes (gh-126321)
(cherry picked from commit cfb1b2f0cb)

Co-authored-by: simple-is-great <103080930+simple-is-great@users.noreply.github.com>
2024-11-02 08:51:28 +00:00
Miss Islington (bot) 1b9710c571
[3.13] gh-126220: Fix crash on calls to `_lsprof.Profiler` methods with 0 args (backportable) (GH-126271) (#126310)
gh-126220: Fix crash on calls to `_lsprof.Profiler` methods with 0 args (backportable) (GH-126271)
(cherry picked from commit 28b148fb32)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-11-01 22:24:06 +00:00
Miss Islington (bot) 588da2e26a
[3.13] GH-126205: Fix conversion of UNC paths to file URIs (GH-126208) (#126249)
GH-126205: Fix conversion of UNC paths to file URIs (GH-126208)

File URIs for Windows UNC paths should begin with two slashes, not four.
(cherry picked from commit 951cb2c369)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-10-31 16:58:56 +00:00
Miss Islington (bot) 89664d4d48
[3.13] gh-126223: Propagate unicode errors in `_interpreters.create()` (GH-126224) (#126242)
gh-126223: Propagate unicode errors in `_interpreters.create()` (GH-126224)
(cherry picked from commit 01415213d7)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-31 14:46:36 +00:00
Miss Islington (bot) ac00bf0e96
[3.13] gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (GH-126103) (#126229)
gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (GH-126103)
(cherry picked from commit d07dcce693)

Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
2024-10-31 08:14:00 +00:00
Miss Islington (bot) 00ff23f06d
[3.13] gh-60712: Include the "object" type in the lists of documented types (GH-103036) (GH-126197)
gh-60712: Include the "object" type in the lists of documented types (GH-103036)

* add test for the predefined object's attributes

* Include the "object" type in the lists of documented types

* remove 'or' from augment tuple

* 📜🤖 Added by blurb_it.

* Add cross-reference to news



* Fix format for the function parameter



* Add space



* add reference for the 'object'



* add reference for NotImplemented



* Change ref:`string <textseq>`  as class:`str`



* remove hyphen from `newly-created`

* Update Doc/reference/datamodel.rst

'dictionaries' to 'dict'



* Update predefined attribute types in testPredefinedAttrs

* Change `universal type` as `top type`

* Don't mention about the top type

* Update the description of richcmpfuncs

* Update Doc/library/stdtypes.rst



* Revert: Hierarchy Section in Data Model Documentation

* Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity.

* Update Doc/reference/datamodel.rst



* Remove blank line



* Use ref:`str <textseq>` instead of :class:`str



* Revert changes the description of Other Built-in Types in stdtypes.rst

* Update Doc/reference/datamodel.rst



---------

(cherry picked from commit 4f826214b3)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-30 13:16:38 -07:00
Miss Islington (bot) b9cbc58e13
[3.13] gh-126139: Improve error message location for future statement with unknown feature (GH-126140) (#126155)
gh-126139: Improve error message location for future statement with unknown feature (GH-126140)
(cherry picked from commit 224c370a36)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2024-10-30 00:36:06 +00:00
Miss Islington (bot) 35108c1871
[3.13] GH-125866: Improve tests for `pathname2url()` and `url2pathname()` (GH-125993) (#126144)
GH-125866: Improve tests for `pathname2url()` and `url2pathname()` (GH-125993)

Merge `URL2PathNameTests` and `PathName2URLTests` test cases (which test
only the Windows-specific implementations from `nturl2path`) into the main
`Pathname_Tests` test case for these functions.

Copy/port some test cases for `pathlib.Path.as_uri()` and `from_uri()`.
(cherry picked from commit 6742f14dfd)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-10-29 21:08:17 +00:00
Miss Islington (bot) 8dc0575047
gh-126084: Fix venvwlauncher.exe to run pythonw.exe (GH-126088)
(cherry picked from commit 802d405ff1)

Co-authored-by: Christian Ullrich <chris@chrullrich.net>
2024-10-29 20:20:05 +00:00
Miss Islington (bot) 265bc19b84
[3.13] gh-126105: Fix crash in `ast` module, when `._fields` is deleted (GH-126115) (#126130)
gh-126105: Fix crash in `ast` module, when `._fields` is deleted (GH-126115)

Previously, if the `ast.AST._fields` attribute was deleted, attempts to create a new `as`t node would crash due to the assumption that `_fields` always had a non-NULL value. Now it has been fixed by adding an extra check to ensure that `_fields` does not have a NULL value (this can happen when you manually remove `_fields` attribute).
(cherry picked from commit b2eaa75b17)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-10-29 16:07:32 +00:00
Miss Islington (bot) 36f8184d29
[3.13] gh-126014: Ignore `__pycache__`-only folders in makefile tests (GH-126066) (#126109)
gh-126014: Ignore `__pycache__`-only folders in makefile tests (GH-126066)
(cherry picked from commit aeafaf4cda)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2024-10-29 08:11:47 +00:00
Miss Islington (bot) 86ec8aa7ed
[3.13] gh-125783: Add tests to prevent regressions with the combination of `ctypes` and metaclasses. (GH-125881) (#125987)
gh-125783: Add tests to prevent regressions with the combination of `ctypes` and metaclasses. (GH-125881)
(cherry picked from commit 1384409460)

Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
2024-10-28 13:49:45 +01:00
Serhiy Storchaka ff044ed800
[3.13] gh-124295: Add translation tests for argparse (GH-124803) (GH-126046)
(cherry picked from commit 0922a4ae0d)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2024-10-27 18:35:30 +00:00
Miss Islington (bot) ac31a2607f
[3.13] gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (GH-125967) (#126047)
gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (GH-125967)
(cherry picked from commit ed5059eeb1)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-27 17:36:10 +00:00
Miss Islington (bot) 25421c715d
[3.13] gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (GH-126003) (#126043)
gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (GH-126003)
(cherry picked from commit f819d4301d)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-27 15:28:02 +00:00
Miss Islington (bot) e4157f0fd7
[3.13] gh-126018: Avoid aborting due to unnecessary assert in `sys.audit` (GH-126020) (#126042)
(cherry picked from commit 80eec52fc8)

Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-27 15:07:33 +00:00
Miss Islington (bot) 9e37bfae5a
[3.13] gh-125593: Use colors to highlight error locations in tracebacks from exception group (GH-125681) (#126021)
gh-125593: Use colors to highlight error locations in tracebacks from exception group (GH-125681)
(cherry picked from commit 51b012b2a8)

Co-authored-by: Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com>
2024-10-27 01:23:00 +00:00
Miss Islington (bot) 95bcbcb7c8
[3.13] gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (GH-118960) (#125931)
gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (GH-118960)

(cherry picked from commit 3f24bde0b6)

Co-authored-by: Javad Shafique <javadshafique@hotmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-10-26 22:01:47 +05:30
Miss Islington (bot) 9c6cda5ccb
[3.13] gh-125969: fix OOB in `future_schedule_callbacks` due to an evil `call_soon` (GH-125970) (#125991)
gh-125969: fix OOB in `future_schedule_callbacks` due to an evil `call_soon` (GH-125970)
(cherry picked from commit c5b99f5c2c)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2024-10-25 18:43:07 +00:00
Miss Islington (bot) 7b46ae92ad
[3.13] gh-125608: Trigger dictionary watchers when inline values change (GH-125611) (GH-125982)
Dictionary watchers on an object's attributes dictionary
(`object.__dict__`) were not triggered when the managed dictionary used
the object's inline values.
(cherry picked from commit 5989eb7446)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-10-25 14:35:04 +00:00
Kumar Aditya f54e1a2d64
[3.13] GH-125789: fix `fut._callbacks` to always return a copy of callbacks (#125922) (#125976)
GH-125789: fix `fut._callbacks` to always return a copy of callbacks (#125922)

Fix `asyncio.Future._callbacks` to always return a copy of the internal list of callbacks to avoid mutation from user code affecting the internal state.

(cherry picked from commit cae853e3b4)
2024-10-25 13:19:31 +00:00
Miss Islington (bot) b67358125c
[3.13] gh-123930: Correct test of attribute failure to account for iOS (GH-125959) (#125960)
gh-123930: Correct test of attribute failure to account for iOS (GH-125959)

Update a test of importing attributes from binary modules to account for iOS conditions.
(cherry picked from commit 75401febc9)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2024-10-25 07:42:20 +00:00
Miss Islington (bot) 32830cf703
[3.13] gh-125259: Fix error notes removal in enum initialization (GH-125647) (GH-125858)
gh-125259: Fix error notes removal in enum initialization (GH-125647)
(cherry picked from commit 34653bba64)

Co-authored-by: Mario Šaško <mariosasko777@gmail.com>
2024-10-24 20:24:23 -07:00
Miss Islington (bot) 083c5814c8
[3.13] gh-125942: Android: set stdout to `errors="backslashreplace"` (GH-125943) (#125950)
gh-125942: Android: set stdout to `errors="backslashreplace"` (GH-125943)

Android stdout/err streams now use `backslashreplace` encoding to ensure readability of the Android log.
(cherry picked from commit b08570c90e)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2024-10-25 00:59:23 +00:00
Shantanu 3d8b6f0977
[3.13] gh-123930: Better error for "from imports" when script shadows module (GH-123929) (#125937)
gh-123930: Better error for "from imports" when script shadows module (#123929)

(cherry picked from commit 500f5338a8)
2024-10-24 19:37:31 +00:00