Commit Graph

28991 Commits

Author SHA1 Message Date
Miss Islington (bot) 0076ca48e9
gh-96192: fix os.ismount() to use a path that is str or bytes (GH-96194)
(cherry picked from commit 367f552129)

Co-authored-by: Christoph Anton Mitterer <calestyo@scientia.org>
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Co-authored-by: Eryk Sun <eryksun@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-11-30 15:31:49 -08:00
Miss Islington (bot) 8dafefcace
gh-82836: fix private network check (GH-97733)
Fixes private checks for network objects. The previous method would incorrectly return True for a private check in cases such as "0.0.0.0/0".
(cherry picked from commit ed391090cc)

Co-authored-by: Pete Wicken <2273100+JamoBox@users.noreply.github.com>
2022-11-29 14:12:57 -08:00
Miss Islington (bot) 74920aa27d
gh-99344, gh-99379, gh-99382: Fix issues in substitution of ParamSpec and TypeVarTuple (GH-99412)
* Fix substitution of TypeVarTuple and ParamSpec together in user generics.

* Fix substitution of ParamSpec followed by TypeVarTuple in generic aliases.

* Check the number of arguments in substitution in user generics containing a
  TypeVarTuple and one or more TypeVar.
(cherry picked from commit 8f2fb7dfe7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-11-29 06:46:53 -08:00
Kumar Aditya 6f658dd60d
[3.11] bpo-31718: Fix io.IncrementalNewlineDecoder SystemErrors and segfaults (GH-18640) (#99841)
Co-authored-by: Oren Milman <orenmn@gmail.com>
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

(cherry picked from commit 53eef27133)
2022-11-28 16:47:33 +05:30
Miss Islington (bot) fce9516a0f
gh-51524: Fix bug when calling trace.CoverageResults with valid infile (GH-99629)
(cherry picked from commit 594de165bf)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2022-11-27 23:15:00 -08:00
Miss Islington (bot) e4cfdaa45b
GH-87235: Make sure "python /dev/fd/9 9</path/to/script.py" works on macOS (GH-99768)
On macOS all file descriptors for a particular file in /dev/fd
share the same file offset, that is ``open("/dev/fd/9", "r")`` behaves
more like ``dup(9)`` than a regular open.

This causes problems when a user tries to run "/dev/fd/9" as a script
because zipimport changes the file offset to try to read a zipfile
directory. Therefore change zipimport to reset the file offset after
trying to read the zipfile directory.
(cherry picked from commit d08fb25769)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2022-11-27 03:19:02 -08:00
Miss Islington (bot) 193a25e89c
gh-91078: Return None from TarFile.next when the tarfile is empty (GH-91850)
(cherry picked from commit 78365b8e28)

Co-authored-by: Sam Ezeh <sam.z.ezeh@gmail.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-11-26 11:01:20 -08:00
Miss Islington (bot) 45ffab40e8
gh-97966: Restore prior expectation that uname_result._fields and ._asdict would include the processor. (gh-98343)
(cherry picked from commit dc063a25d2)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2022-11-26 05:53:00 -08:00
Miss Islington (bot) c06f74f1d6
bpo-38031: Fix a possible assertion failure in _io.FileIO() (GH-GH-5688)
(cherry picked from commit d386115039)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2022-11-25 05:20:00 -08:00
Miss Islington (bot) 85dbd2d767
gh-99341: Cover type ignore nodes when incrementing line numbers (GH-99422)
(cherry picked from commit 1acdfec359)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2022-11-22 03:03:26 -08:00
Miss Islington (bot) e26aa24b47
gh-99659: Use correct exceptions in sqlite3 bigmem tests (GH-99660)
The tests in question were added in 0eec6276fd by Serhiy. Apparently,
sqlite3 changed exceptions raised in those cases in the mean time but
the tests never ran because they require a high `-M` setting in the
test runner.
(cherry picked from commit 2781ec9b0e)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-11-22 00:51:59 -08:00
Batuhan Taskaya a3480ec795
[3.11] gh-99103: Normalize specialized traceback anchors against the current line (#99423)
[3.11] gh-99103: Normalize specialized traceback anchors against the current line (GH-99145)

Automerge-Triggered-By: GH:isidentical.
(cherry picked from commit 57be545959)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2022-11-21 22:16:12 +00:00
Miss Islington (bot) 9dda9020ab
gh-99578: Fix refleak in _imp.create_builtin() (GH-99642)
Fix a reference bug in _imp.create_builtin() after the creation of
the first sub-interpreter for modules "builtins" and "sys".
(cherry picked from commit cb2ef8b2ac)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-11-21 03:43:23 -08:00
Miss Islington (bot) f381644819
gh-99581: Fix a buffer overflow in the tokenizer when copying lines that fill the available buffer (GH-99605)
(cherry picked from commit e13d1d9dda)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-11-20 12:53:02 -08:00
Lysandros Nikolaou 152a437b8d
[3.11] gh-99211: Point to except/except* on syntax errors when mixing them (GH-99215) (GH-99622)
gh-99211: Point to except/except* on syntax errors when mixing them (GH-99215)

(cherry picked from commit 9c4232ae89)
2022-11-20 19:29:05 +01:00
Serhiy Storchaka 56a517e9e8
[3.11] gh-78453: Move Unicode C API tests from test_unicode to test_capi.test_unicode (GH-99431). (GH-99614)
(cherry picked from commit 06d4e02c3b)
2022-11-20 11:24:45 +02:00
Miss Islington (bot) d5e6f9b0ab
gh-99442: Fix handling in py.exe launcher when argv[0] does not include a file extension (GH-99542)
(cherry picked from commit a220c6d1ee)
2022-11-18 17:49:14 +00:00
Miss Islington (bot) 82ab9e6b79
gh-99553: fix bug where an ExceptionGroup subclass can wrap a BaseException (GH-99572)
(cherry picked from commit c8c6113398)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-11-18 08:10:55 -08:00
Miss Islington (bot) 0014ce7d0d
gh-99370: Prefer LIBDIR from sysconfig when locating libpython for test (GH-99523)
(cherry picked from commit 7c57857340)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-11-16 15:41:18 -08:00
Miss Islington (bot) f4cb8285ba
gh-87604: Avoid publishing list of active per-interpreter audit hooks via the gc module (GH-99373)
(cherry picked from commit 4e4b13e8f6)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-11-15 13:10:27 -08:00
Miss Islington (bot) e1e8a15abf
GH-98219: reduce sleep time in `asyncio` subprocess test (GH-99464)
(cherry picked from commit 619cadcda6)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-11-15 07:52:38 -08:00
Miss Islington (bot) b189f429b2
gh-99370: fix test_zippath_from_non_installed_posix (GH-99483)
When build with shared enabled, we need to set `LD_LIBRARY_PATH`
for the non-installed python environment in
test_zippath_from_non_installed_posix so that the python binary
and find and link the libpython.so.
(cherry picked from commit 1df0752b4d)

Co-authored-by: Kai Zhang <kylerzhang11@gmail.com>
2022-11-14 17:27:42 -08:00
Miss Islington (bot) 90de4b76b9
[3.11] gh-99357: Close the event loop when it is no longer used in test_uncancel_structured_blocks (GH-99414) (#99424)
(cherry picked from commit 99972dc745)

Co-authored-by: Xiao Chen <chenxiao_7@163.com>
2022-11-14 10:52:10 -08:00
Miss Islington (bot) 5971a65d07
gh-99370: Calculate zip path from prefix when in a venv (GH-99371)
Before python3.11, when in a venv the zip path is calculated
from prefix on POSIX platforms. In python3.11 the behavior is
accidentally changed to calculating from default prefix. This
change will break venv created from a non-installed python
with a stdlib zip file. This commit restores the behavior back
to before python3.11.
(cherry picked from commit e3d4fed074)

Co-authored-by: Kai Zhang <kylerzhang11@gmail.com>
2022-11-14 07:31:46 -08:00
Miss Islington (bot) 72d356e358
gh-99418: Make urllib.parse.urlparse enforce that a scheme must begin with an alphabetical ASCII character. (GH-99421)
Prevent urllib.parse.urlparse from accepting schemes that don't begin with an alphabetical ASCII character.

RFC 3986 defines a scheme like this: `scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )`
RFC 2234 defines an ALPHA like this: `ALPHA = %x41-5A / %x61-7A`

The WHATWG URL spec defines a scheme like this:
`"A URL-scheme string must be one ASCII alpha, followed by zero or more of ASCII alphanumeric, U+002B (+), U+002D (-), and U+002E (.)."`
(cherry picked from commit 439b9cfaf4)

Co-authored-by: Ben Kallus <49924171+kenballus@users.noreply.github.com>
2022-11-13 11:00:25 -08:00
Miss Islington (bot) ecc164f350
bpo-34272: Reorganize C API tests. (GH-8551)
Move some C API tests into Lib/test/test_capi/.
(cherry picked from commit f883b7f8ee)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-11-12 09:36:42 -08:00
Miss Islington (bot) 92b531b858
gh-80448: argparse: Fix IndexError on store_true action (GH-15656)
(cherry picked from commit e02cc6d42a)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-11-11 18:30:38 -08:00
Miss Islington (bot) c9f2177d13
gh-99204: Calculate base_executable by alternate names in POSIX venvs (GH-99206)
Check to see if `base_executable` exists. If it does not, attempt
to use known alternative names of the python binary to find an
executable in the path specified by `home`.

If no alternative is found, previous behavior is preserved.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>

(cherry picked from commit c41b13d39c)

Co-authored-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
2022-11-10 08:53:51 -08:00
Miss Islington (bot) f9a68be673
[3.11] GH-99257: Check the owner's type when specializing slots (GH-99324)
(cherry picked from commit 9d69284169)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-11-10 08:44:49 -08:00
Miss Islington (bot) 1de088ca95
gh-74044: inspect.signature for wrappers around decorated bound methods (GH-736)
(cherry picked from commit dbf2faf579)

Co-authored-by: Anton Ryzhov <anton@ryzhov.me>
2022-11-10 04:58:06 -08:00
Miss Islington (bot) 921f235367
gh-99320: remove tests for old-style class from `test_complex` (GH-99321)
(cherry picked from commit 26726c7649)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-10 03:22:00 -08:00
Miss Islington (bot) 1565db7020
gh-94445: add compiler test for another case of excessive stack use (GH-99237)
(cherry picked from commit 027bc7e6bb)

Co-authored-by: Carl Meyer <carl@oddbird.net>
2022-11-08 13:16:28 -08:00
Miss Islington (bot) 4f31171e3f
gh-99248: [Enum] fix negative number infinite loop (GH-99256)
[Enum] fix negative number infinite loop

- _iter_bits_lsb() now raises a ValueError if a negative number
  is passed in

- verify() now skips checking negative numbers for named flags
(cherry picked from commit 0b4ffb08cc)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2022-11-08 12:33:21 -08:00
Miss Islington (bot) 47f4a18be0
gh-99181: fix except* on unhashable exceptions (GH-99192)
(cherry picked from commit c43714fbcd)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-11-08 01:58:45 -08:00
Miss Islington (bot) a6f6c3a3d6
[3.11] gh-98433: Fix quadratic time idna decoding. (GH-99092) (#99222)
There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit d315722564)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-11-07 18:57:10 -08:00
Miss Islington (bot) 1add2393a8
[3.11] gh-98513: Test abstract methods of some `collections` types (GH-98516) (#99226)
(cherry picked from commit a309ad9f76)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-07 18:45:08 -08:00
Miss Islington (bot) 42fb233c52
gh-99124: use concrete exception types in `test_builtin` (GH-99125)
(cherry picked from commit c32bc1bffd)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-07 18:12:48 -08:00
Miss Islington (bot) 5f83209d89
bpo-38523: ignore_dangling_symlinks does not apply recursively (GH-22937)
(cherry picked from commit 5ff81da6d3)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2022-11-07 04:11:11 -08:00
Irit Katriel d8a42bcaf0
[3.11] gh-99153: set location on SyntaxError for try with both except and except* (GH-99160) (#99168) 2022-11-07 09:41:20 +00:00
Nikita Sobolev 263e9830aa
[3.11] GH-99155: Fix `NormalDist` pickle with `0` and `1` protocols (GH-99156). (GH-99188)
(cherry picked from commit d7a00f1e8e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Automerge-Triggered-By: GH:rhettinger
2022-11-07 01:41:08 -08:00
Miss Islington (bot) 6fadca308c
gh-99051: remove duplicated test from `test_weakref` (GH-99052)
(cherry picked from commit 8463cb55da)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-06 12:03:15 -08:00
Miss Islington (bot) be4bab8c2b
gh-93464: [Enum] fix auto() failure during multiple assignment (GH-99148)
* fix auto() failure during multiple assignment

i.e. `ONE = auto(), 'text'` will now have `ONE' with the value of `(1,
'text')`.  Before it would have been `(<an auto instance>, 'text')`
(cherry picked from commit 8feb7ab77c)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2022-11-06 06:30:32 -08:00
Miss Islington (bot) d025046ef5
`test_typing`: use all pickle protocols (GH-99154)
(cherry picked from commit a0bc75e2fd)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-06 04:15:45 -08:00
Miss Islington (bot) d8c11b75e2
gh-94808: add tests covering `PySequence_{Set,Del}Slice` (GH-99123)
(cherry picked from commit c5c40773cb)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-05 10:32:46 -07:00
Jason R. Coombs 07734a42db
[3.11] gh-98706: Sync with importlib_metadata 4.13.0. (GH-98875)
These changes are already applied to main but have been selected from importlib_metadata 4.x for their bug fixes.
2022-11-05 06:55:04 -07:00
Miss Islington (bot) 46a493e2db
gh-94808: add tests covering `PyEval_GetFuncDesc` function (GH-98300)
(cherry picked from commit b5f711185b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-05 06:32:46 -07:00
Victor Stinner a9a8c87126
[3.11] gh-90867: test.support.wait_process() uses LONG_TIMEOUT (#99071) (#99098)
The test.support.wait_process() function now uses a timeout of
LONG_TIMEOUT seconds by default, instead of SHORT_TIMEOUT.  It
doesn't matter if a Python buildbot is slower, it only matters that
the process completes. The timeout should just be shorter than
"forever".

(cherry picked from commit f09da28768)
2022-11-04 15:50:51 +01:00
Miss Islington (bot) 2b79f4e469
[3.11] gh-94808: Cover `LOAD_GLOBAL` for custom dict subtypes (GH-96767) (GH-99091) 2022-11-04 11:12:42 +00:00
Miss Islington (bot) eb023a84d9
gh-98740: Fix validation of conditional expressions in RE (GH-98764)
In very rare circumstances the JUMP opcode could be confused with the
argument of the opcode in the "then" part which doesn't end with the
JUMP opcode. This led to incorrect detection of the final JUMP opcode
and incorrect calculation of the size of the subexpression.

NOTE: Changed return value of functions _validate_inner() and
_validate_charset() in Modules/_sre/sre.c.  Now they return 0 on success,
-1 on failure, and 1 if the last op is JUMP (which usually is a failure).
Previously they returned 1 on success and 0 on failure.
(cherry picked from commit e9ac890c02)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-11-03 00:47:39 -07:00
Miss Islington (bot) a02979fa48
gh-98512: Add more tests for `ValuesView` (GH-98515)
(cherry picked from commit 29e027c3e6)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-02 19:35:39 -07:00
Steve Dower 3ff659aea2
gh-98790: When DLLs directory is missing on Windows, assume executable_dir contains PYD files instead (GH-98936) 2022-11-02 20:04:06 +00:00
Miss Islington (bot) 39e0627b77
[3.11] gh-98925: Lower marshal recursion depth for WASI (GH-98938) (GH-98979)
* gh-98925: Lower marshal recursion depth for WASI (GH-98938)

For wasmtime 2.0, the stack depth cost is 6% higher. This causes the default max `marshal` recursion depth to blow the stack.

As the default marshal depth is 2000 and Windows is set to 1000, split the difference and choose 1500 for WASI to be safe.
(cherry picked from commit 9711265182)

Co-authored-by: Brett Cannon <brett@python.org>
2022-11-01 16:18:55 -07:00
Miss Islington (bot) 20c258c692
gh-98852: Fix subscription of type aliases (GH-98920)
Fix subscription of type aliases containing bare generic types or types
like TypeVar: for example tuple[A, T][int] and tuple[TypeVar, T][int],
where A is a generic type, and T is a type variable.
(cherry picked from commit 0e15c31c7e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-11-01 01:01:28 -07:00
Miss Islington (bot) 8495af8963
GH-98897: fix memory leak if `math.dist` raises exception (GH-98898)
(cherry picked from commit ab57505070)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-31 19:40:30 -07:00
Miss Islington (bot) 46a3cf4fe3
gh-98692: Enable treating shebang lines as executables in py.exe launcher (GH-98732)
(cherry picked from commit 88297e2a8a)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-10-31 14:31:26 -07:00
Charlie Zhao 2b0cbb90c3
[3.11] gh-98793: Fix typecheck in `overlapped.c` (GH-98835) (#98889)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 3ac8c0ab6e)
2022-10-31 11:21:01 -07:00
Miss Islington (bot) ca24e496ba
[3.11] gh-96151: Use a private name for passing builtins to dataclass. This now allows for a field named BUILTIN (gh-98143) (gh-98900)
gh-96151: Use a private name for passing builtins to dataclass. This now allows for a field named BUILTIN (gh-98143)
(cherry picked from commit 29f98b46b7)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-10-31 10:59:00 -04:00
Miss Islington (bot) 57dd11038f
[3.11] gh-96853: Restore test coverage for Py_Initialize(Ex) (GH-98874)
* As most of `test_embed` now uses `Py_InitializeFromConfig`, add
  a specific test case to cover `Py_Initialize` (and `Py_InitializeEx`)
* Rename `_testembed` init helper to clarify the API used
* Add a `PyConfig_Clear` call in `Py_InitializeEx` to make
  the code more obviously correct (it already didn't leak as
  none of the dynamically allocated config fields were being
  populated, but it's clearer if the wrappers follow the
  documented API usage guidelines)
(cherry picked from commit 05e48865be)

Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
2022-10-31 09:15:12 +10:00
Dennis Sweeney 5efe2eead3
[3.11] gh-98783: Fix crashes when `str` subclasses are used in `_PyUnicode_Equal` (GH-98806) (#98871)
* gh-98783: Fix crashes when `str` subclasses are used in `_PyUnicode_Equal` (GH-98806)
(cherry picked from commit 76f989dc3e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-30 14:30:08 -04:00
Batuhan Taskaya 751da28feb
[3.11] gh-98744: Prevent column-level decoding crashes on traceback module (#98850)
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2022-10-29 15:12:15 +01:00
Miss Islington (bot) 8e475adf30
gh-98703: Add tests for closing `_ProactorSocketTransport` with proactor event loop (GH-98730)
(cherry picked from commit 96ae80f1d0)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-26 20:33:19 -07:00
Miss Islington (bot) 3bad567d08
[3.11] gh-98741: Remove useless check_home usage from is_python_build usage (GH-98743) (GH-98746)
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2022-10-26 23:35:54 +01:00
Miss Islington (bot) ce2b56e280
gh-98713: Use `@cpython_only` for a test that fails on PyPy (GH-98714)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit 9495360c72)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-26 06:41:42 -07:00
Miss Islington (bot) db14a9d594
gh-94808: cover `PyMapping_HasKeyString` and `PyMapping_HasKey` (GH-98486)
(cherry picked from commit 5d30544485)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-25 21:57:49 -07:00
Jelle Zijlstra 83c8df29dd
[3.11] GH-87390: Add remaining tests for PEP 646 (GH-98267) (#98667)
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>.
Co-authored-by: Matthew Rahtz <matthew.rahtz@gmail.com>

(cherry picked from commit cb95cc24ef)
2022-10-25 18:46:57 -07:00
Miss Islington (bot) 18b788c63a
gh-94808: Improve coverage of `unicode_find` and `unicode_rfind` (GH-98648)
(cherry picked from commit b1783bc124)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-25 17:04:01 -07:00
Miss Islington (bot) abc1a8c61c
Use more precise exception types in `assertRaises` in typing tests (GH-98650)
(cherry picked from commit 45c89358b7)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-25 07:19:37 -07:00
Miss Islington (bot) 65f9c8e6dd
gh-93696: Locate frozen module source with __file__ (GH-93697)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit d91de288e7)

Co-authored-by: James Gerity <snoopjedi@gmail.com>
2022-10-25 06:49:34 -07:00
Miss Islington (bot) 8950689dce
[3.11] GH-89237: fix hang in proactor `subprocess.wait_closed()` (GH-98572) (#98620)
GH-89237: fix hang in proactor `subprocess.wait_closed()` (GH-98572)
(cherry picked from commit ad1dc3ebb6)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-24 20:34:08 -07:00
Pablo Galindo Salgado b3cafb60af
[3.11] Fix v3.11.0 release merge problems (GH-98622)
When merging the v3.11.0 tag into 3.11, some files were incorrectly updated and some others were not properly deleted.

Automerge-Triggered-By: GH:pablogsal
2022-10-24 16:30:06 -07:00
Miss Islington (bot) 3a1eb81abf
GH-98407: fix `test_kill_issue43884` to not leak child processes (GH-98491)
(cherry picked from commit 3b2724abcf)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-24 12:41:10 -07:00
Pablo Galindo 69b6b56d85 Python 3.11.0
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEz9yiRbEEPPKl+Xhl/+h0BBaL2EcFAmNWzOwACgkQ/+h0BBaL
 2EcepxAAmZLGMrL4D7Zxzo6N2ezkuiuoQH4JvxIUaB7cjU5h0GSUFlmcJQCHhCwk
 AvToQrmH/7uuuEZKST1fomtUE83wudfHhX2t+CMBdbLG1hIwhTfLNMTqFhONturF
 XlkVUcva1i9XrYZPLl1pIcBf1Sjm6pPW5QZ4BP1ZHJ5C2pHEzaBRFX/q0lU5aF9O
 z5nBBpnga2gShUTqM1VkXucU4lKXsi4blbn/Z8giganMXY1SXIsEOoCaDZYN1Hh/
 xQiOpSrjy/uSz4vGSNuPwp9J2lRlw8n4RBd/P7om01CrJMAKotH+62OqwhlQ8ydB
 ywp0kygtPtMdSK7F1WKMWkYX4CXfLpYwN0+x3Z3iYFBFiuzOFrUCQYgqqfEPNq+o
 bQxxnhAvYcOVINUub6oL23hgFZIoM6l54L66qujQVFM0usCY2f23Ikqd0Z7K8+6e
 uDRAvGiCHkbbfhdnfXzc/Wgj4zLaPnNs8S2s8ojK32NPV8gyWVBumcsRvlocfl6K
 hoA5wqeAXsOv+pFjkGtk90Yg+8R9n+n47//o6uYW/vvZtksm2wPm3hnuCA0WqPzN
 IM7SJE5VrtSRqQpXT9j4G3zyHDNT/Qhrh+cyBM5kgoPSdbU0ugZN8P7GWVtsFhmK
 rrHRns85gNZJ6qTN1pU22MybYCPIsg5Dt6+jZ8hJWIzOOy9apIk=
 =Ryd2
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEz9yiRbEEPPKl+Xhl/+h0BBaL2EcFAmNW55YACgkQ/+h0BBaL
 2EfCLg//bMWtb/X3D+IM+9BIrpEscj/vw22zH9j8PIRd8iWfW80TNEIBh4uPEc0j
 SDTkA5bqN6CB7xqIxDlWQcJpGiImVZ2LzOw8HHye1QCfVZk741CF78UhEnb+hTbO
 gr7nIznytv+VdMSDRHTSgpnkRNQ9FjFEHLu7YQTMof5i/YmTxWZcsru6dTLlEutg
 F3+PfxbKwPgJkfare91X62XSQwyTL6k0mvl5+Sdq2WEQdgMqv4I8V9dHbnk9K3VI
 B+K2xsfIyWHrLDwQa3LBZj4YOKTwnwqlr1sEqO47NfasWaMYa1vBsktLVtPVQ3xS
 Hz0lLhJXJLzf5hmf2r4Tw1S5spn5ijsZ7CwK2Zl+1+dbJMpRoK4VeSSYy/OfEpwy
 8Hx1YitMyORF3HkGWa+pPYPNaIOw4S/EQQPYd5osg3NnknYjkkKZZaliq7EZra7c
 GANPJamXhHREQyhux9KeiYZer3SU3CSXopyxm8ClcBZJAiAOjhAdeOk+Q4Ta9T6+
 gRWBOrelroyFTWHsOd8V7gSz3XJNuAzlNZ/+1Oj/7Em+5DGLFcxJrZGLxn+hruZ5
 GPK9IQXbURAuxqVrqCzw2tzf/NzJr0fs4QDYEVI95pfLjzk1tuJ5WR6zFNC0COK2
 qw8TTvXglsvHqVMnK8u73GVSTv1UGYqbQH9uAeEikAQYr3TTdZo=
 =dsZm
 -----END PGP SIGNATURE-----

Merge tag 'v3.11.0' into 3.11

Python 3.11.0
2022-10-24 20:29:24 +01:00
Miss Islington (bot) 981b509784
GH-90985: Revert "Deprecate passing a message into cancel()" (GH-97999)
Reason: we were too hasty in deprecating this.
We shouldn't deprecate it before we have a replacement.
(cherry picked from commit 09de8d7aaf)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-10-24 17:09:41 +01:00
Miss Islington (bot) f0083923fa
gh-90908: Document asyncio.Task.cancelling() and asyncio.Task.uncancel() (GH-95253)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
(cherry picked from commit f00645d5db)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-10-24 17:09:37 +01:00
Miss Islington (bot) 965ce0d8f1
gh-95027: Fix regrtest stdout encoding on Windows (GH-98492)
On Windows, when the Python test suite is run with the -jN option,
the ANSI code page is now used as the encoding for the stdout
temporary file, rather than using UTF-8 which can lead to decoding
errors.
(cherry picked from commit ec1f6f5f13)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-24 16:45:42 +01:00
Miss Islington (bot) 38ade0d2ac
gh-97616: list_resize() checks for integer overflow (GH-97617)
Fix multiplying a list by an integer (list *= int): detect the
integer overflow when the new allocated length is close to the
maximum size.  Issue reported by Jordan Limor.

list_resize() now checks for integer overflow before multiplying the
new allocated length by the list item size (sizeof(PyObject*)).
(cherry picked from commit a5f092f3c4)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-24 16:45:40 +01:00
Miss Islington (bot) 9c80b55ad6
gh-97545: Make Semaphore run faster. (GH-97549)
(cherry picked from commit 68c46ae68b)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-10-24 16:45:39 +01:00
Miss Islington (bot) 56145c6963
gh-90155: Fix bug in asyncio.Semaphore and strengthen FIFO guarantee (GH-93222)
The main problem was that an unluckily timed task cancellation could cause
the semaphore to be stuck. There were also doubts about strict FIFO ordering
of tasks allowed to pass.

The Semaphore implementation was rewritten to be more similar to Lock.
Many tests for edge cases (including cancellation) were added.
(cherry picked from commit 24e0379624)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-10-24 16:45:38 +01:00
Miss Islington (bot) 67f5d24e44
gh-96848: Fix -X int_max_str_digits option parsing (GH-96988)
Fix command line parsing: reject "-X int_max_str_digits" option with
no value (invalid) when the PYTHONINTMAXSTRDIGITS environment
variable is set to a valid limit.
(cherry picked from commit 41351662bc)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-22 20:55:26 +01:00
Nikita Sobolev 9cb7324e8f
[3.11] gh-96587: Raise `SyntaxError` for PEP654 on older `feature_version` (GH-96588) (#96591)
(cherry picked from commit 2c7d2e8d46)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-22 20:53:46 +01:00
Miss Islington (bot) 84fd4a54a6
[3.11] gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK (GH-97944) (#97969)
The macOS 13 SDK includes support for the `mkfifoat` and `mknodat` system calls.
 Using the `dir_fd` option with either `os.mkfifo` or `os.mknod` could result in a
 segfault if cpython is built with the macOS 13 SDK but run on an earlier
 version of macOS. Prevent this by adding runtime support for detection of
 these system calls ("weaklinking") as is done for other newer syscalls on
 macOS.
(cherry picked from commit 6d0a0191a4)

Co-authored-by: Ned Deily <nad@python.org>
2022-10-22 20:49:42 +01:00
Miss Islington (bot) 1a788914ca
gh-96865: [Enum] fix Flag to use CONFORM boundary (GH-97528)
(cherry picked from commit b44372e03c)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2022-10-22 20:48:32 +01:00
Miss Islington (bot) fc127628d5
gh-98414: py.exe launcher does not use defaults for -V:company/ option (GH-98460)
(cherry picked from commit 4bd63f66cd)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-10-22 20:15:49 +01:00
Miss Islington (bot) 585c95df95
[3.11] GH-97752: Clear the previous member of newly-created generator/coroutine frames (GH-97812)
(cherry picked from commit 93fcc1f413)
2022-10-22 20:10:18 +01:00
Miss Islington (bot) 4e0fda59f1
gh-98360: multiprocessing now spawns children on Windows with correct argv[0] in virtual environments (GH-98462)
(cherry picked from commit e48f9b2b7e)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-10-22 20:10:11 +01:00
Miss Islington (bot) d0ab10f6f0
[3.11] GH-97002: Prevent _PyInterpreterFrames from backing more than one PyFrameObject (GH-98002)
(cherry picked from commit 21a2d9ff55)
2022-10-22 20:09:08 +01:00
Miss Islington (bot) 154b3cd751
GH-96975: Skip incomplete frames in PyEval_GetFrame (GH-97018)
(cherry picked from commit 8fd2c3b75b)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-10-22 20:09:00 +01:00
Miss Islington (bot) c835b97c5f
gh-51511: Note that codecs.open()'s encoding parameter affects automatic conversion to binary mode (GH-94370)
(cherry picked from commit d9407b174c)

Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
2022-10-21 16:27:41 -07:00
Miss Islington (bot) b2aa28eec5
gh-95027: Fix regrtest stdout encoding on Windows (GH-98492)
On Windows, when the Python test suite is run with the -jN option,
the ANSI code page is now used as the encoding for the stdout
temporary file, rather than using UTF-8 which can lead to decoding
errors.
(cherry picked from commit ec1f6f5f13)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-21 07:52:17 -07:00
Miss Islington (bot) 1520f4e45b
gh-96035: Make urllib.parse.urlparse reject non-numeric ports (GH-98273)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 6f15ca8c7a)

Co-authored-by: Ben Kallus <49924171+kenballus@users.noreply.github.com>
2022-10-20 14:28:36 -07:00
Miss Islington (bot) ace6611de6
gh-98360: multiprocessing now spawns children on Windows with correct argv[0] in virtual environments (GH-98462)
(cherry picked from commit e48f9b2b7e)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-10-20 07:33:12 -07:00
Miss Islington (bot) 5f5fa4ca4b
typing tests: `_overload_dummy` raises `NotImplementedError`, not `RuntimeError` (GH-98351)
(cherry picked from commit 1ca6647f22)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-19 18:23:40 -07:00
Miss Islington (bot) df4aaff0e6
[3.11] gh-94808: Cover `str.rsplit` for UCS1, UCS2 or UCS4 (GH-98228) (#98291)
gh-94808: Cover `str.rsplit` for UCS1, UCS2 or UCS4 (GH-98228)
(cherry picked from commit b7dd2cad18)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-19 17:53:50 -07:00
Miss Islington (bot) 0b71dad9b8
gh-98414: py.exe launcher does not use defaults for -V:company/ option (GH-98460)
(cherry picked from commit 4bd63f66cd)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-10-19 15:41:28 -07:00
Jelle Zijlstra 39eaca884f
[3.11] gh-94808: Cover `PyFunction_GetCode`, `PyFunction_GetGlobals`,… (#98317)
[3.11] gh-94808: Cover `PyFunction_GetCode`, `PyFunction_GetGlobals`, `PyFunction_GetModule` (GH-98158).
(cherry picked from commit 7b48d02933)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-18 17:37:16 -07:00
Miss Islington (bot) 0bba980c5f
[3.11] gh-98174: Handle EPROTOTYPE under macOS in test_sendfile_fallback_close_peer_in_the_middle_of_receiving (GH-98316) (#98357)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
(cherry picked from commit 3e82ad05b1)

Co-authored-by: fancidev <fancidev@gmail.com>
2022-10-18 08:21:58 -07:00
Miss Islington (bot) b5874fae0a
[3.11] gh-95731: Fix module docstring extraction in pygettext (GH-95732) (#98281)
gh-95731: Fix module docstring extraction in pygettext (GH-95732)
(cherry picked from commit 120b4ab2b6)

Co-authored-by: Jakub Kuczys <me@jacken.men>
2022-10-15 21:15:17 -07:00
Jelle Zijlstra 93d0d9cfdd
[3.11] gh-94808: Cover `PyEval_GetFuncName` (GH-98246). (#98283)
(cherry picked from commit f01b56c7bd)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-15 11:48:48 -07:00
Miss Islington (bot) 4e78d9482a
gh-95971: Turn @writes_bytecode_files to skip when not running (GH-95972)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 07b5c4699e)

Co-authored-by: Jeong YunWon <69878+youknowone@users.noreply.github.com>
2022-10-15 08:22:38 -07:00
Miss Islington (bot) 22ad9e5f3e
gh-98251: Allow venv to pass along PYTHON* variables to pip and ensurepip when they do not impact path resolution (GH-98259)
(cherry picked from commit 2fe44f728a)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-10-14 09:24:23 -07:00
Miss Islington (bot) 595ef03c7c
bpo-46364: Use sockets for stdin of asyncio only on AIX (GH-30596)
Signed-off-by: Christoph Hamsen <hamsen.christoph@posteo.de>
Co-authored-by: July Tikhonov <july.tikh@gmail.com>
(cherry picked from commit c9ed0327a9)

Co-authored-by: Christoph Hamsen <37963496+xopham@users.noreply.github.com>
2022-10-13 10:27:31 -07:00
Serhiy Storchaka f6e50b82f6
[3.11] Add more syslog tests (GH-97953). (GH-98096)
(cherry picked from commit cae7d1d7a7)
2022-10-08 22:22:26 +03:00
Miss Islington (bot) e493792612
gh-92886: make test_ast pass with -O (assertions off) (GH-98058)
-O does not strip docstrings.

Automerge-Triggered-By: GH:iritkatriel
(cherry picked from commit 27ce45d8e1)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-10-07 22:02:38 -07:00
Miss Islington (bot) 72a23d8f06
gh-92886: make test_coroutines pass with -O (assertions off) (GH-98060)
Automerge-Triggered-By: GH:iritkatriel
(cherry picked from commit 45f21472da)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-10-07 21:24:02 -07:00
Miss Islington (bot) 46aa5d2c2d
[3.11] gh-94808: Cover `%p` in `PyUnicode_FromFormat` (GH-96677) (#98033)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

(cherry picked from commit 72c166add8)
2022-10-07 17:09:53 -07:00
Miss Islington (bot) c2f21af42a
gh-65496: Correct wording on csv's skipinitialspace argument (GH-96170)
(cherry picked from commit 676d8ef380)

Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
2022-10-07 16:45:53 -07:00
Miss Islington (bot) 107ba927cf
GH-96073: Fix wild replacement in inspect.formatannotation (GH-96074)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit d5fea01d9d)

Co-authored-by: Anh71me <iyumelive@gmail.com>
2022-10-07 12:56:16 -07:00
Miss Islington (bot) d163d5976d
GH-90985: Revert "Deprecate passing a message into cancel()" (GH-97999)
Reason: we were too hasty in deprecating this.
We shouldn't deprecate it before we have a replacement.
(cherry picked from commit 09de8d7aaf)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-10-06 18:50:25 -07:00
Miss Islington (bot) 89e9474327
[3.11] GH-97002: Prevent _PyInterpreterFrames from backing more than one PyFrameObject (GH-98002)
(cherry picked from commit 21a2d9ff55)
2022-10-06 17:36:39 -07:00
Miss Islington (bot) 60570303e4
[3.11] gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK (GH-97944) (#97969)
The macOS 13 SDK includes support for the `mkfifoat` and `mknodat` system calls.
 Using the `dir_fd` option with either `os.mkfifo` or `os.mknod` could result in a
 segfault if cpython is built with the macOS 13 SDK but run on an earlier
 version of macOS. Prevent this by adding runtime support for detection of
 these system calls ("weaklinking") as is done for other newer syscalls on
 macOS.
(cherry picked from commit 6d0a0191a4)

Co-authored-by: Ned Deily <nad@python.org>
2022-10-06 12:13:46 -07:00
Miss Islington (bot) 1cd19f7ebf
[3.11] gh-94808: Coverage: Test that maximum indentation level is handled (GH-95926) (#97979)
gh-94808: Coverage: Test that maximum indentation level is handled (GH-95926)

* gh-94808: Coverage: Test that maximum indentation level is handled

* Use "compile" rather than "exec"
(cherry picked from commit 23e83a8465)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-10-06 12:06:49 -07:00
Miss Islington (bot) 4aa93afd6e
gh-94808: Cover `PyObject_PyBytes` case with custom `__bytes__` method (GH-96610)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit e39ae6bef2)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-06 05:44:05 -07:00
Miss Islington (bot) c9480d5ad5
gh-96865: [Enum] fix Flag to use CONFORM boundary (GH-97528)
(cherry picked from commit b44372e03c)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2022-10-05 16:32:16 -07:00
Shantanu c9eacc8d02
[3.11] gh-95987: Fix `repr` of `Any` type subclasses (GH-96412) (#96451)
(cherry picked from commit 4217393)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-05 15:02:06 -07:00
Nikita Sobolev 8c6ced36ab
[3.11] gh-96587: Raise `SyntaxError` for PEP654 on older `feature_version` (GH-96588) (#96591)
(cherry picked from commit 2c7d2e8d46)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-05 15:00:13 -07:00
Miss Islington (bot) aec133347e
gh-88050: Fix asyncio subprocess to kill process cleanly when process is blocked (GH-32073)
(cherry picked from commit 7015e13797)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-05 10:48:48 -07:00
Miss Islington (bot) 2b248b0ab5
gh-95196: Disable incorrect pickling of the C implemented classmethod descriptors (GH-96383)
(cherry picked from commit 77f0249308)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-10-05 04:59:09 -07:00
Miss Islington (bot) 015b49ac05
[3.11] GH-97779: Ensure that *all* frame objects are backed by "complete" frames (GH-97886)
(cherry picked from commit 0ff8fd6583)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-10-04 22:46:34 -07:00
Miss Islington (bot) 9133aabc70
gh-97825: fix AttributeError when calling subprocess.check_output(input=None) with encoding or errors args (GH-97826)
* fix AttributeError, add unit test
(cherry picked from commit db64fb9bbe)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
2022-10-04 20:29:40 -07:00
Miss Islington (bot) 4591dae421
[3.11] GH-97752: Clear the previous member of newly-created generator/coroutine frames (GH-97812)
(cherry picked from commit 93fcc1f413)
2022-10-03 21:03:26 -07:00
Miss Islington (bot) fe99b64bef
gh-94808: Coverage: Check picklablability of calliter (GH-95923)
(cherry picked from commit cfbc7dd910)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-10-03 14:25:48 -07:00
Serhiy Storchaka f07ee41479
[3.11] gh-97728: Argument Clinic: Fix uninitialized variable in the Py_UNICODE converter (GH-97729) (GH-97757)
It affects function os.system() on Windows and Windows-specific modules
winreg, _winapi, _overlapped, and _msi.
(cherry picked from commit 0ee9619a4c)
2022-10-03 15:01:54 +03:00
Miss Islington (bot) f59506780a
gh-96819: multiprocessing.resource_tracker: check if length of pipe write <= 512 (GH-96890)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 19ca114645)

Co-authored-by: Koki Saito <49419225+saito828koki@users.noreply.github.com>
2022-10-02 18:09:58 -07:00
Miss Islington (bot) dbde686a49
gh-97591: In `Exception.__setstate__()` acquire strong references before calling `tp_hash` slot (GH-97700)
(cherry picked from commit d639438609)

Co-authored-by: Ofey Chan <ofey206@gmail.com>
2022-10-01 21:19:57 -07:00
Miss Islington (bot) 3614bbb8eb
gh-90908: Document asyncio.Task.cancelling() and asyncio.Task.uncancel() (GH-95253)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
(cherry picked from commit f00645d5db)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-10-01 11:10:04 -07:00
Miss Islington (bot) 3124618fd5
GH-97592: Fix crash in C remove_done_callback due to evil code (GH-97660)
Evil code could cause fut_callbacks to be cleared when PyObject_RichCompareBool is called.
(cherry picked from commit 63780f4599)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-09-30 13:22:48 -07:00
Miss Islington (bot) f418842a5c
[3.11] gh-96357: Improve `typing.get_overloads` coverage (GH-96358) (#96371)
gh-96357: Improve `typing.get_overloads` coverage (GH-96358)
(cherry picked from commit 675e3470cc)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-28 18:06:21 -07:00
Miss Islington (bot) 7d60d10b63
gh-97616: list_resize() checks for integer overflow (GH-97617)
Fix multiplying a list by an integer (list *= int): detect the
integer overflow when the new allocated length is close to the
maximum size.  Issue reported by Jordan Limor.

list_resize() now checks for integer overflow before multiplying the
new allocated length by the list item size (sizeof(PyObject*)).
(cherry picked from commit a5f092f3c4)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-09-28 15:28:38 -07:00
Miss Islington (bot) f391b3c6ab
gh-96478: Fix new test when run in refleak mode (GH-96615)
./python.exe -m test -R : test.test_typing would fail, apparently
because the dictionary used in the @patch decorator was modified.
(cherry picked from commit f0d9136c69)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-09-27 07:50:36 -07:00
Miss Islington (bot) 9a9bf88898
gh-97545: Make Semaphore run faster. (GH-97549)
(cherry picked from commit 68c46ae68b)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-09-26 17:00:53 -07:00
Miss Islington (bot) a4ff0eaaf0
gh-96848: Fix -X int_max_str_digits option parsing (GH-96988)
Fix command line parsing: reject "-X int_max_str_digits" option with
no value (invalid) when the PYTHONINTMAXSTRDIGITS environment
variable is set to a valid limit.
(cherry picked from commit 41351662bc)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-09-26 08:43:26 -07:00
Miss Islington (bot) 6daff06fc2
gh-94808: Coverage: Test uppercase string literal prefixes (GH-95925)
(cherry picked from commit f00383ec9b)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-09-25 01:21:58 -07:00
Miss Islington (bot) a386d1341c
gh-96052: codeop: fix handling compiler warnings in incomplete input (GH-96132)
Previously codeop.compile_command() emitted compiler warnings (SyntaxWarning or
DeprecationWarning) and raised a SyntaxError for incomplete input containing
a potentially incorrect code. Now it always returns None for incomplete input
without emitting any warnings.
(cherry picked from commit 426d72e7dd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-09-25 01:21:00 -07:00
Miss Islington (bot) 4d1de87042
gh-96959: Update HTTP links which are redirected to HTTPS (GH-96961)
(cherry picked from commit db39050396)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-09-25 01:20:45 -07:00
Miss Islington (bot) 6a646dd1ff
GH-96975: Skip incomplete frames in PyEval_GetFrame (GH-97018)
(cherry picked from commit 8fd2c3b75b)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-09-22 10:17:53 -07:00
Miss Islington (bot) 773dbb9e3a
gh-90155: Fix bug in asyncio.Semaphore and strengthen FIFO guarantee (GH-93222)
The main problem was that an unluckily timed task cancellation could cause
the semaphore to be stuck. There were also doubts about strict FIFO ordering
of tasks allowed to pass.

The Semaphore implementation was rewritten to be more similar to Lock.
Many tests for edge cases (including cancellation) were added.
(cherry picked from commit 24e0379624)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-09-22 09:58:35 -07:00
Łukasz Langa d35b9d0a60
[3.11] gh-96954: Add tests for unicodedata.name/lookup (GH-96955) (GH-96991)
They were undertested, and since GH-96954 might involve a
rewrite of this part of the code we want to ensure that
there won't be any behavioral change.

Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
(cherry picked from commit 5a32eeced2)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2022-09-21 16:07:07 +02:00
Miss Islington (bot) 46f791d263
gh-90808: add more examples to `test_sched.test_priority` (GH-31144)
(cherry picked from commit 57463d43dc)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-20 19:03:13 -07:00
Miss Islington (bot) e066c6a56b
gh-95950: Add a test for both `csv.Dialect` and `kwargs` (GH-95951)
(cherry picked from commit 1c01bd28a0)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-20 18:37:10 -07:00
Miss Islington (bot) 2a5e333736
gh-96478: Test `@overload` on C functions (GH-96479)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit f177f6f29b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-20 18:36:23 -07:00
Miss Islington (bot) fd118a0850
gh-95591: [Enum] use `_FlagTests` base class (GH-96475)
(cherry picked from commit 9b58eaf98c)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-20 16:34:14 -07:00
Brandt Bucher 0e61d2b557
[3.11] GH-95921: Fix positions for some chained comparisons (GH-96968) (GH-96973)
(cherry picked from commit dfc73b5724)

Automerge-Triggered-By: GH:brandtbucher
2022-09-20 14:56:38 -07:00
Miss Islington (bot) 32d80decbf
GH-96864: Check for error between line and opcode events (GH-96880)
(cherry picked from commit c10e33ac11)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-09-20 10:49:01 -07:00
Miss Islington (bot) d39fce0f03
Fix ResourceWarning in test.test_frame (GH-96831)
(cherry picked from commit 303bd88047)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2022-09-16 17:03:57 -07:00
Christian Heimes bc337a7766
[3.11] gh-96005: Handle WASI ENOTCAPABLE in getpath (GH-96006) (GH-96034) (GH-96038)
- On WASI `ENOTCAPABLE` is now mapped to `PermissionError`.
- The `errno` modules exposes the new error number.
- `getpath.py` now ignores `PermissionError` when it cannot open landmark
  files `pybuilddir.txt` and `pyenv.cfg`.
2022-09-13 13:00:45 +02:00
Christian Heimes 4958820032
[3.11] gh-95853: Add script to automate WASM build (GH-95828, GH-95985, GH-96045, GH-96389, GH-96744) (GH-96749)
Automate WASM build with a new Python script. The script provides
several build profiles with configure flags for Emscripten flavors
and WASI. The script can detect and use Emscripten SDK and WASI SDK from
default locations or env vars.

``configure`` now detects Node arguments and creates HOSTRUNNER
arguments for Node 16. It also sets correct arguments for
``wasm64-emscripten``.
2022-09-13 12:06:39 +02:00
Miss Islington (bot) fecda02eb6
gh-96710: Make the test timing more lenient for the int/str DoS regression test. (GH-96717)
A regression would still absolutely fail and even a flaky pass isn't
harmful as it'd fail most of the time across our N system test runs.

Windows has a low resolution timer and CI systems are prone to odd
timing so this just gives more leeway to avoid flakiness.
(cherry picked from commit 11e3548fd1)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-09-09 13:17:04 -07:00
Mark Shannon 5586da65e2
[3.11] GH-96636: Remove all uses of NOTRACE_DISPATCH (GH-96643) (#96688)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
(cherry picked from commit aa3b4cf779)
2022-09-09 09:24:44 -07:00
Miss Islington (bot) 99919d4e8a
gh-96352: Set AttributeError context in _PyObject_GenericGetAttrWithDict (GH-96353)
(cherry picked from commit b9634ac776)

Co-authored-by: philg314 <110174000+philg314@users.noreply.github.com>
2022-09-08 04:43:52 -07:00
Miss Islington (bot) 0c443c2315
GH-94808: Test __build_class__ inside non-dict __builtins__ (GH-95932) (#96004)
(cherry picked from commit 3adb4d864b)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-09-08 12:17:18 +01:00
Miss Islington (bot) ae819ca6fd
[3.11] gh-68163: Correct conversion of Rational instances to float (GH-25619) (#96556)
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2022-09-08 12:03:53 +01:00
Miss Islington (bot) ffafa9b91d
gh-96268: Fix loading invalid UTF-8 (GH-96270)
This makes tokenizer.c:valid_utf8 match stringlib/codecs.h:decode_utf8.

It also fixes an off-by-one error introduced in 3.10 for the line number when the tokenizer reports bad UTF8.
(cherry picked from commit 8bc356a7dd)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-09-07 14:49:17 -07:00
Miss Islington (bot) 295f510f5a
gh-94808: Improve coverage of _PyBytes_FormatEx (GH-95895)
There were two specific areas not covered:

- %(name) syntax
- %*s syntax

Automerge-Triggered-By: GH:iritkatriel
(cherry picked from commit dde15f5879)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-09-07 05:18:33 -07:00
Miss Islington (bot) bb0dab5c48
gh-96611: Fix error message for invalid UTF-8 in mid-multiline string (GH-96623)
(cherry picked from commit 05692c67c5)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-09-06 16:40:17 -07:00
Mark Shannon 26dc4dfac3
[3.11] GH-96612: Skip incomplete frames in tracemalloc traces. (GH-96613) (#96617)
(cherry picked from commit 95e271b226)

Co-authored-by: Mark Shannon <mark@hotpy.org>
2022-09-06 18:42:41 +01:00
Batuhan Taskaya a0848d169b
[3.11] gh-92986: Fix ast.unparse when ImportFrom.level is None (GH-92992) (GH-96593)
This doesn't happen naturally, but is allowed by the ASDL and compiler.
We don't want to change ASDL for backward compatibility reasons
(GH-57645, GH-92987)
(cherry picked from commit 200c9a8da0)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-09-06 13:23:26 +03:00
Miss Islington (bot) 08d8058b79
gh-96559: Fixes Windows launcher handling of defaults using old-style tags, and adds What's New section (GH-96595)
(cherry picked from commit 80a9bd2e94)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-09-05 15:13:24 -07:00
Miss Islington (bot) 8a776d1d51
gh-95778: Correctly pre-check for int-to-str conversion (GH-96537)
Converting a large enough `int` to a decimal string raises `ValueError` as expected. However, the raise comes _after_ the quadratic-time base-conversion algorithm has run to completion. For effective DOS prevention, we need some kind of check before entering the quadratic-time loop. Oops! =)

The quick fix: essentially we catch _most_ values that exceed the threshold up front. Those that slip through will still be on the small side (read: sufficiently fast), and will get caught by the existing check so that the limit remains exact.

The justification for the current check. The C code check is:
```c
max_str_digits / (3 * PyLong_SHIFT) <= (size_a - 11) / 10
```

In GitHub markdown math-speak, writing $M$ for `max_str_digits`, $L$ for `PyLong_SHIFT` and $s$ for `size_a`, that check is:
$$\left\lfloor\frac{M}{3L}\right\rfloor \le \left\lfloor\frac{s - 11}{10}\right\rfloor$$

From this it follows that
$$\frac{M}{3L} < \frac{s-1}{10}$$
hence that
$$\frac{L(s-1)}{M} > \frac{10}{3} > \log_2(10).$$
So
$$2^{L(s-1)} > 10^M.$$
But our input integer $a$ satisfies $|a| \ge 2^{L(s-1)}$, so $|a|$ is larger than $10^M$. This shows that we don't accidentally capture anything _below_ the intended limit in the check.

<!-- gh-issue-number: gh-95778 -->
* Issue: gh-95778
<!-- /gh-issue-number -->

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
(cherry picked from commit b126196838)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2022-09-04 09:45:02 -07:00
Vinay Sajip f255820626
[3.11] gh-90195: Unset logger disabled flag when configuring it. (GH-96530) (GH-96532) 2022-09-03 15:10:50 +01:00
Gregory P. Smith f8b71da9aa
[3.11] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96500)
Integer to and from text conversions via CPython's bignum `int` type is not safe against denial of service attacks due to malicious input. Very large input strings with hundred thousands of digits can consume several CPU seconds.

This PR comes fresh from a pile of work done in our private PSRT security response team repo.

This backports https://github.com/python/cpython/pull/96499 aka 511ca94520

Signed-off-by: Christian Heimes [Red Hat] <christian@python.org>
Tons-of-polishing-up-by: Gregory P. Smith [Google] <greg@krypto.org>
Reviews via the private PSRT repo via many others (see the NEWS entry in the PR).

<!-- gh-issue-number: gh-95778 -->
* Issue: gh-95778
<!-- /gh-issue-number -->

I wrote up [a one pager for the release managers](https://docs.google.com/document/d/1KjuF_aXlzPUxTK4BMgezGJ2Pn7uevfX7g0_mvgHlL7Y/edit#).
2022-09-02 09:48:57 -07:00
Ethan Furman 8f58db2279
[3.11] [Enum] fix check in _test_simple_enum (GH-96435)
The builtin `property` is not a callable, so was failing the check in
`_test_simple_enum` causing a match failure; this adds `property` to the
bypass list.

Co-authored-by: Alexandru Mărășteanu <alexei@users.noreply.github.com>
2022-08-30 12:39:03 -07:00
Miss Islington (bot) 2e9f29e6a6
GH-74116: Allow multiple drain waiters for asyncio.StreamWriter (GH-94705) (#96395)
(cherry picked from commit e5b2453e61)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-30 12:00:21 +01:00
Miss Islington (bot) 16d8948c31
gh-96385: Correctly raise error on `[*T, *V]` substitution (GH-96386) (#96407)
(cherry picked from commit 75177358a6)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-08-30 11:58:54 +01:00
Miss Islington (bot) 103f26f282
[3.11] gh-89047: Fix msecs computation so you never end up with 1000 msecs. (GH-96340) (GH-96341) 2022-08-27 15:09:54 +01:00
Miss Islington (bot) acd7841aa4
Port regression test for issue GH-93592 (GH-96208) (GH-96313) 2022-08-26 16:02:36 +01:00
Miss Islington (bot) 915ee9ed43
gh-95243: Mitigate the race condition in testSockName (GH-96173)
find_unused_port() has an inherent race condition, but we can't use
bind_port() as that uses .getsockname() which this test is exercising.

Try binding to unused ports a few times before failing.

Signed-off-by: Ross Burton <ross.burton@arm.com>
(cherry picked from commit df11012697)

Co-authored-by: Ross Burton <ross.burton@arm.com>
2022-08-24 19:03:29 -07:00
Miss Islington (bot) c01fc9d30a
[3.11] gh-96189: Fix test_invalid_utf8 on a number of build bots (GH-96190) (#96218)
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-08-23 23:28:44 +01:00
Miss Islington (bot) d7eea0f1ca
gh-96175: add missing self._localName assignment in `xml.dom.minidom.Attr` (GH-96176)
X-Ref: https://github.com/python/typeshed/pull/8590GH-discussion_r951473977

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 58f6953d6d)

Co-authored-by: Kevin Kirsche <Kev.Kirsche+GitHub@gmail.com>
2022-08-23 10:18:19 -07:00
Miss Islington (bot) 0aed1e71f3
GH-96071: add regression test for GH-96071 (GH-96137)
Automerge-Triggered-By: GH:ericsnowcurrently
(cherry picked from commit 079baee196)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-23 08:37:19 -07:00
Miss Islington (bot) 4f7f83b5bd
gh-96076: Change test_launcher to use non-admin location for py.ini (GH-96091)
Patch authored by Eryksun.
(cherry picked from commit 216ccacda1)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2022-08-22 09:49:34 -07:00
Miss Islington (bot) 27f390bc30
gh-96125: Fix sys.thread_info.name on pthread platforms (GH-96126) (#96128)
Automerge-Triggered-By: GH:tiran
(cherry picked from commit 822955c166)

Co-authored-by: Christian Heimes <christian@python.org>

Co-authored-by: Christian Heimes <christian@python.org>
2022-08-21 17:37:15 +01:00
Miss Islington (bot) 1b9b4856c8
[3.11] gh-95913: make the new internal classes pdb.ModuleTarget/ScriptTarget private (GH-96053) (#96063)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-08-18 14:39:16 +01:00
Miss Islington (bot) 36c114ab11
GH-95704: Don't suppress errors from tasks when TG is cancelled (GH-95761)
When a task catches CancelledError and raises some other error,
the other error should not silently be suppressed.

Any scenario where a task crashes in cleanup upon cancellation
will now result in an ExceptionGroup wrapping the crash(es)
instead of propagating CancelledError and ignoring the side errors.

NOTE: This represents a change in behavior (hence the need to
change several tests).  But it is only an edge case.

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
(cherry picked from commit f51f54f39d)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-08-17 10:04:59 -07:00
Miss Islington (bot) 2bb363cfcd
[3.11] gh-94823: Improve coverage in tokenizer.c:valid_utf8 (GH-94856) (#96029)
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-08-16 17:26:40 +01:00
Miss Islington (bot) 8bd7a0b581
GH-95899: fix asyncio.Runner to call set_event_loop only once (GH-95900) (#96003)
(cherry picked from commit 914f6367a0)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-15 15:01:23 -07:00
Shantanu 7fc8221794
[3.11] gh-94996: Disallow lambda pos only params with feature_version < (3, 8) (GH-95934) (GH-95936)
(cherry picked from commit a965db37f2)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

Automerge-Triggered-By: GH:lysnikolaou
2022-08-12 12:41:09 -07:00
Miss Islington (bot) 6fc90c1183
GH-95818: Skip incomplete frames in `PyThreadState_GetFrame` (GH-95886) (#95890)
(cherry picked from commit 1b46d118e6)

Co-authored-by: Mark Shannon <mark@hotpy.org>

Co-authored-by: Mark Shannon <mark@hotpy.org>
2022-08-12 19:40:49 +01:00
Miss Islington (bot) 4abf84602f
gh-94996: Disallow parsing pos only params with feature_version < (3, 8) (GH-94997)
(cherry picked from commit b5e3ea2862)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-08-12 10:53:09 -07:00
Miss Islington (bot) 24dd1429e5
gh-95724: Clarify taskgroups.py license. (GH-95847)
(cherry picked from commit 7da4937748)

Co-authored-by: Yury Selivanov <yury@edgedb.com>
2022-08-11 16:45:30 -07:00
Miss Islington (bot) 3ea9ba6478
gh-95605: Fix `float(s)` error message when `s` contains only whitespace (GH-95665) (GH-95858)
This PR fixes the error message from float(s) in the case where s contains only whitespace.
(cherry picked from commit 97e9cfa75a)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2022-08-11 17:16:53 +01:00
Miss Islington (bot) 2c4bd21630
gh-95349: Hide a Distutils Warning Filter for test_check_c_globals (GH-95837) (GH-95843)
Under certain build conditions, test_check_c_globals fails.  This fix takes the same approach as we took for gh-84236 (via gh-20095).  We'll be removing use of distutils in the c-analyzer at some point.  Until then we'll hide the warning filter.
(cherry picked from commit 3ff6d9affb)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2022-08-10 12:57:32 +02:00
Miss Islington (bot) a42215c7e1
gh-91838: Resolve more HTTP links which redirect to HTTPS (GH-95650) (GH-95780)
(cherry picked from commit cc9160a29b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-08-10 12:55:50 +02:00
Miss Islington (bot) 514ec82031
Fix typo in test_dataclasses.py (gh-95735) (gh-95740)
`dataclass` was called as a function when it was almost certainly intended to be a decorator.
(cherry picked from commit 59e09efe88)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
2022-08-09 07:46:20 -04:00
Miss Islington (bot) 6dffb5f1cf
gh-95376: Add test for names containing null (GH-GH-5394) (#GH-5746)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
(cherry picked from commit a17cd47b61)

Co-authored-by: Sion Kang <31057849+Yaminyam@users.noreply.github.com>
2022-08-06 19:31:58 +02:00
Miss Islington (bot) 08510324db
gh-95395: Add argument type error test (GH-95412) (GH-95744)
(cherry picked from commit 4703c15811)

Co-authored-by: Sion Kang <31057849+Yaminyam@users.noreply.github.com>
2022-08-06 19:30:46 +02:00
Miss Islington (bot) d6cf9e4a3e
[3.11] Update the magic number in test_util.py (GH-95714) (#95716)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-08-05 15:43:10 +01:00
Miss Islington (bot) 954b8875a0
gh-95573: Reduce test data size in test_asyncio/test_ssl.py (GH-95668) (GH-95705)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 3a9e1fda7a)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2022-08-05 11:23:57 +02:00
Miss Islington (bot) 0e636e4e7b
gh-95573: Fix a mistake in asyncio ssl tests suppressing all logs (GH-95687) (GH-95699)
(cherry picked from commit e1d68b3ce7)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2022-08-05 10:07:15 +02:00
Miss Islington (bot) 5ac3d0f573
gh-91323: Revert "Allow overriding a future compliance check in asyncio.Task (GH-32197)" (GH-95442) (GH-95652)
This reverts commit d4bb38f82b.
(cherry picked from commit 0342c93a6b)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-08-04 18:07:39 +02:00
Miss Islington (bot) 2d84fe59c0
GH-95289: Always call uncancel() when parent cancellation is requested (GH-95602)
Co-authored-by: Guido van Rossum <guido@python.org>
(cherry picked from commit 2fef27589e)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-04 07:50:54 -07:00
Miss Islington (bot) c521c5cdc3
gh-91838: Resolve HTTP links which redirect to HTTPS (GH-95642)
It updates links which redirect to HTTPS with different authority or
path.
(cherry picked from commit d0d0154443)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-08-04 06:15:11 -07:00
Mark Shannon 312dab29a3
Revert "[3.11] GH-92678: Expose managed dict clear and visit functions (GH-95246). (#95256)" (#95647)
This reverts commit 7f73194339.
2022-08-04 13:03:07 +01:00
Mark Shannon 2ab560105b
GH-92678: Fix tp_dictoffset inheritance. (GH-95596) (GH-95604)
* Add test for inheriting explicit __dict__ and weakref.

* Restore 3.10 behavior for multiple inheritance of C extension classes that store their dictionary at the end of the struct.
2022-08-04 12:21:38 +01:00
Miss Islington (bot) 1bd1e379de
gh-94675: Add a regression test for rjsmin re slowdown (GH-94685)
Adds a regression test for an re slowdown observed by rjsmin.
Uses multiprocessing to kill the test after SHORT_TIMEOUT.

Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
Co-authored-by: Christian Heimes <christian@python.org>
(cherry picked from commit fe23c0061d)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2022-08-03 16:45:19 -07:00
Miss Islington (bot) 2c0017b5e6
gh-94399: Restore PATH search behaviour of py.exe launcher for '/usr/bin/env' shebang lines (GH-95582)
(cherry picked from commit 67840edb28)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-08-03 15:00:46 -07:00
Miss Islington (bot) 1ed023b7c0
gh-95597: Fix typo in Lib directory files (GH-95599)
(cherry picked from commit b53aed76d2)

Co-authored-by: Jo, Yunjin <black33jo@gmail.com>
2022-08-03 14:43:01 -07:00
Miss Islington (bot) b12dba40ff
gh-91447: Fix findtext to only give an empty string on None (GH-91486)
The API documentation for [findtext](https://docs.python.org/3/library/xml.etree.elementtree.htmlGH-xml.etree.ElementTree.Element.findtext) states that this function gives back an empty string on "no text content." With the previous implementation, this would give back a empty string even on text content values such as 0 or False. This patch attempts to resolve that by only giving back an empty string if the text attribute is set to `None`. Resolves GH-91447.

Automerge-Triggered-By: GH:gvanrossum
(cherry picked from commit a95e60db74)

Co-authored-by: Eugene Triguba <eugenetriguba@gmail.com>
2022-08-01 14:22:33 -07:00
Miss Islington (bot) 7baca3c05e
GH-95150: Use position and exception tables for code hashing and equality (GH-95509)
(cherry picked from commit c7e5bbaee8)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2022-08-01 11:33:49 -07:00
Miss Islington (bot) 76d83b1dfe
gh-95173: Add a regression test for sorting tuples containing None (GH-95464)
(cherry picked from commit c0cd790219)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2022-08-01 09:29:57 -07:00
Christian Heimes e62a0dfab2
[3.11] gh-95174: Add pthread stubs for WASI (GH-95234) (#95503)
Co-authored-by: Brett Cannon <brett@python.org>.
(cherry picked from commit 0fe645d6fd)

Co-authored-by: Christian Heimes <christian@python.org>
2022-08-01 15:37:45 +01:00
Christian Heimes 06b5f78d64
[3.11] gh-95174: WASI: skip missing sockets functions (GH-95179) (GH-95308)
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-07-31 18:19:32 +02:00
Miss Islington (bot) 147a9a8be7
bpo-45445: Revert "bpo-45445: Fail if an invalid X-option is provided in the command line (GH-28823)" (GH-94745)
(cherry picked from commit aa37ffda29)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-07-31 08:58:02 -07:00
Miss Islington (bot) bd6452a3a8
gh-94938: Fix test (GH-95396)
(cherry picked from commit 0956b6d9c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-07-29 23:39:54 -07:00
Miss Islington (bot) efeda8b4a1
GH-95097: fix `asyncio.run` for tasks without `uncancel` method (GH-95211) (GH-95387)
(cherry picked from commit 54f48844d1)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-29 14:38:02 +02:00
Miss Islington (bot) 1368a1f724
gh-95359: Fix py.exe launcher handling of per-user py.ini and command names (GH-95399)
(cherry picked from commit 38bb2068fe)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-07-28 13:52:13 -07:00
Miss Islington (bot) 763801aae2
gh-95166: cancel map waited on future on timeout (GH-95169) (GH-95364)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit e16d4ed590)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-28 12:56:21 +02:00
Serhiy Storchaka 33efd7f7a3
[3.11] gh-94938: Fix errror detection of unexpected keyword arguments (GH-94999) (GH-95353)
When keyword argument name is an instance of a str subclass with
overloaded methods __eq__ and __hash__, the former code could not find
the name of an extraneous keyword argument to report an error, and
_PyArg_UnpackKeywords() returned success without setting the
corresponding cell in the linearized arguments array. But since the number
of expected initialized cells is determined as the total number of passed
arguments, this lead to reading NULL as a keyword parameter value, that
caused SystemError or crash or other undesired behavior.
(cherry picked from commit ebad53a4dc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-07-28 09:51:45 +03:00
Miss Islington (bot) 131fc72700
[3.11] gh-95280: Fix test_get_ciphers on systems without RSA key exchange (GH-95282) (GH-95310)
Co-authored-by: Christian Heimes <christian@python.org>
2022-07-27 11:15:29 +02:00
Miss Islington (bot) c72940a609
gh-95291: Use import helper to improve sqlite3 audit tests (GH-95292) (GH-95293)
Now the tests are correctly reported as skipped if sqlite3 is not available.
(cherry picked from commit 152eb90311)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-07-27 10:07:32 +02:00
Miss Islington (bot) 7df3a1ce4b
gh-95285: py.exe launcher fails with short argv0 (GH-95295) (GH-95298)
(cherry picked from commit 7ac5bb3e6a)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-07-27 10:06:59 +02:00
Miss Islington (bot) 6fe7e0264f
gh-91810: Fix regression with writing an XML declaration with encoding='unicode' (GH-93426) (GH-93793)
Suppress writing an XML declaration in open files in ElementTree.write()
with encoding='unicode' and xml_declaration=None.

If file patch is passed to ElementTree.write() with encoding='unicode',
always open a new file in UTF-8.
(cherry picked from commit d7db9dc3cc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-07-26 12:20:33 +02:00
Miss Islington (bot) 86eb500068
[3.11] gh-95185: Check recursion depth in the AST constructor (GH-95186) (GH-95208)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 0047447294)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-07-26 12:19:22 +02:00
Miss Islington (bot) 19d953682e
gh-95051: ensure that timeouts scheduled with `asyncio.Timeout` that have already expired are deliverered promptly (GH-95109) (GH-95216)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 0c6f898005)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-26 12:16:12 +02:00
Pablo Galindo Salgado 7f73194339
[3.11] GH-92678: Expose managed dict clear and visit functions (GH-95246). (#95256)
Co-authored-by: Mark Shannon <mark@hotpy.org>
2022-07-25 23:05:27 +01:00
Mark Shannon e5ff5ec3ff
[3.11] GH-94739: Backport GH-94958 to 3.11 (#94965) 2022-07-25 12:11:06 +01:00
Miss Islington (bot) 3ec139fa4d
gh-95087: Fix IndexError in parsing invalid date in the email module (GH-95201)
Co-authored-by: wouter bolsterlee <wouter@bolsterl.ee>
(cherry picked from commit ea5ed0ba51)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-07-24 23:40:17 -07:00
Miss Islington (bot) 49d038496e
gh-95212: make multiprocessing test case parallel-safe (GH-95213)
(cherry picked from commit 5956de16cd)

Co-authored-by: Christian Heimes <christian@python.org>
2022-07-24 22:11:30 -07:00
Miss Islington (bot) 22f06d6ce3
gh-93157: Fix fileinput didn't support `errors` in `inplace` mode (GH-95128)
(cherry picked from commit 5c7f3bcdaf)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2022-07-23 20:05:10 -07:00
Miss Islington (bot) 0d688bd2b6
gh-90473: Fix more tests on platforms without umask (GH-95164)
(cherry picked from commit 6839324894)

Co-authored-by: Christian Heimes <christian@python.org>
2022-07-23 03:51:29 -07:00
Erlend Egeberg Aasland 5d3f2fbf37
[3.11] gh-95132: Correctly relay *args and **kwds from sqlite3.connect to factory (GH-95146) (#95158)
This PR partially reverts gh-24421 (PR) and fixes the remaining concerns
given in gh-93044 (issue):

- keyword arguments are passed as positional arguments to factory()
- if an argument is not passed to sqlite3.connect(), its default value
  is passed to factory()

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>.
(cherry picked from commit a3d4d15f53)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2022-07-23 10:23:19 +02:00
Brandt Bucher 064462a719
[3.11] GH-94036: Fix more attribute location quirks (GH-95028) (GH-95156)
(cherry picked from commit 900bfc53cb)
2022-07-22 17:31:06 -07:00
Miss Islington (bot) bbdacb402b
GH-94438: Handle extended arguments and conditional pops in mark_stacks (GH-95110)
(cherry picked from commit e4d3a96a11)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-07-22 16:48:53 -07:00
Brandt Bucher 5a48ab01e9
[3.11] GH-95113: Don't use EXTENDED_ARG_QUICK in unquickened code (GH-95121) (GH-95143)
(cherry picked from commit e402b26b7f)
2022-07-22 11:56:10 -07:00
Miss Islington (bot) d19b5d8533
gh-95010: Fix asyncio GenericWatcherTests.test_create_subprocess_fails_with_inactive_watcher (GH-95009)
The test was never run, because it was missing the TestCase class.
The test failed because the wrong attribute was patched.
(cherry picked from commit 834bd5dd76)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-21 06:01:05 -07:00
Brandt Bucher e2fce3a8e7
[3.11] GH-91409: Don't overwrite valid locations with NOP locations (GH-95067) (GH-95068)
(cherry picked from commit 742d4614e1)
2022-07-20 15:01:42 -07:00
Miss Islington (bot) 2ac1096423
gh-94998: Remove redundant condition in test_sqlite3/__main__.py (GH-95052)
(cherry picked from commit 9d09e7b026)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-07-20 10:01:58 -07:00
Miss Islington (bot) 9487e8d250
GH-91153: Handle mutating __index__ methods in bytearray item assignment (GH-94891)
(cherry picked from commit f36589510b)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-07-19 10:12:39 -07:00
Miss Islington (bot) fbd24068c2
test_concurrent_futures: Fix unneeded/confusing format call (GH-93119)
Added in 339fd46cb7 - but as noted in a comment, the test only tests ThreadPoolExecutor.
(cherry picked from commit 3f2dd0a7c0)

Co-authored-by: Florian Bruhin <me@the-compiler.org>
2022-07-18 19:42:19 -07:00
Miss Islington (bot) 7733aa048e
gh-94949: Disallow parsing parenthesised ctx mgr with old feature_version (GH-94950)
* gh-94949: Disallow parsing parenthesised ctx manager with old feature_version

* 📜🤖 Added by blurb_it.

* Allow it with feature_version=(3, 9) as well

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 0daba82221)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-07-18 14:57:45 -07:00
Ethan Furman be84daf52a
Revert "gh-93910: [Enum] restore member.member restriction while keeping performance boost (GH-94913)" (#94981)
This reverts commit 30f28ac296.
2022-07-18 13:56:21 -07:00
Brandt Bucher eda2f90094
[3.11] GH-94822: Don't specialize when metaclasses are involved (GH-94892) (GH-94980)
(cherry picked from commit daf68ba92f)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-07-18 11:55:07 -07:00
Miss Islington (bot) ec6ed6681d
gh-94930: skipitem() in getargs.c should return non-NULL on error (GH-94931)
(cherry picked from commit 067f0da335)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-07-18 08:41:22 -07:00
Miss Islington (bot) 7dc236d116
gh-94947: Disallow parsing walrus with feature_version < (3, 8) (GH-94948)
* gh-94947: Disallow parsing walrus with feature_version < (3, 8)

* oops, commit the parser

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit ae0be5a53b)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-07-18 02:46:21 -07:00
Miss Islington (bot) e747562345
gh-94601: [Enum] fix inheritance for __str__ and friends (GH-94942)
(cherry picked from commit c961d14f85)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2022-07-17 19:18:41 -07:00
Miss Islington (bot) 8d0249e345
gh-72889: Remove redundant mock.Mock()._is_coroutine = False workarounds (GH-94926)
(cherry picked from commit 07aeb7405e)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-17 10:49:01 -07:00
Miss Islington (bot) 1c63734217
gh-91348: Restore frame argument to sys._getframe audit event (GH-94928)
(cherry picked from commit 044a593cbb)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-07-17 08:49:57 -07:00
Miss Islington (bot) 65d87a2cb8
gh-94821: Fix autobind of empty unix domain address (GH-94826)
When binding a unix socket to an empty address on Linux, the socket is
automatically bound to an available address in the abstract namespace.

    >>> s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    >>> s.bind("")
    >>> s.getsockname()
    b'\x0075499'

Since python 3.9, the socket is bound to the one address:

    >>> s.getsockname()
    b'\x00'

And trying to bind multiple sockets will fail with:

    Traceback (most recent call last):
      File "/home/nsoffer/src/cpython/Lib/test/test_socket.py", line 5553, in testAutobind
        s2.bind("")
    OSError: [Errno 98] Address already in use

Added 2 tests:
- Auto binding empty address on Linux
- Failing to bind an empty address on other platforms

Fixes f6b3a07b7d (bpo-44493: Add missing terminated NUL in sockaddr_un's length (GH-26866)
(cherry picked from commit c22f134211)

Co-authored-by: Nir Soffer <nsoffer@redhat.com>
2022-07-17 08:39:22 -07:00
Serhiy Storchaka 107c21c5d5
gh-94864: Fix PyArg_Parse* with deprecated format units "u" and "Z" (GH-94902)
It returned 1 (success) when warnings are turned into exceptions.
2022-07-17 08:23:37 +03:00
Miss Islington (bot) 30f28ac296
gh-93910: [Enum] restore member.member restriction while keeping performance boost (GH-94913)
(cherry picked from commit c20186c397)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2022-07-16 21:53:41 -07:00
Miss Islington (bot) ccbf85382c
gh-91181: drop support for bytes on sys.path (GH-31934)
Support for bytes broke sometime between Python 3.2 and 3.6 and has been broken ever since. Trying to bring back supports is surprisingly difficult in the face of -b and checking for keys in sys.path_importer_cache. Since the support was broken for so long, trying to overcome the difficulty of bringing back the support has been deemed not worth it.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
Co-authored-by: Brett Cannon <brett@python.org>
(cherry picked from commit 6da988a46c)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-16 18:31:25 -07:00
Miss Islington (bot) e121cb5814
gh-94869: Fix the location in some expressions for multi-line f-string ast nodes (GH-94895)
(cherry picked from commit 2e9da8e352)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-07-16 12:16:51 -07:00
Miss Islington (bot) b040617195
gh-94772: Fix off-by-one error in Windows launcher (GH-94779)
(cherry picked from commit 407ff6556c)

Co-authored-by: Paul Moore <p.f.moore@gmail.com>

Co-authored-by: Paul Moore <p.f.moore@gmail.com>
2022-07-16 10:42:08 +01:00
Miss Islington (bot) 8dc4de3aaf
gh-94808: Add coverage for boolobject.c:bool_new (GH-94859) (GH-94883)
`bool_new` had no coverage.

Automerge-Triggered-By: GH:brandtbucher
(cherry picked from commit df4d53a09a)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-07-15 10:37:13 -07:00
Miss Islington (bot) e55f60db8f
[3.11] GH-94808: Cover handling non-finite numbers from round when ndigits is provided (GH-94860) (GH-94882)
(cherry picked from commit 625ba9bdff)


Co-authored-by: Michael Droettboom <mdboom@gmail.com>

Automerge-Triggered-By: GH:brandtbucher
2022-07-15 10:34:18 -07:00
Miss Islington (bot) 8f92ebbde7
gh-94814: Improve coverage of _PyCode_CreateLineArray (GH-94852)
The case where there are more than (1 << 15) lines was not covered.

I don't know if increasing test coverage requires a blurb -- let me know if it does.

Automerge-Triggered-By: GH:brandtbucher
(cherry picked from commit 582ae86b3f)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2022-07-15 10:28:47 -07:00
Miss Islington (bot) d9107aa015
gh-94731: Revert to C-style casts for _Py_CAST (GH-94782) (#94849)
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
(cherry picked from commit 6cbb57f62d)
2022-07-15 09:35:23 +02:00
Miss Islington (bot) 91f7914003
GH-89988: Fix memory leak in pickle.Pickler dispatch_table lookup (GH-94298)
(cherry picked from commit 01ef1f95da)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-14 09:47:17 -07:00
Miss Islington (bot) ffbd6ae37c
gh-94751: Install, import and run the test C++ extension (MVP) (GH-94754) (#94780)
This is a quick-and-dirty way to run the C++ tests.
It can definitely be improved in the future, but it should fail when things go wrong.

- Run test functions on import (yes, this can definitely be improved)
- Fudge setuptools metadata (name & version) to make the extension installable
- Install and import the extension in test_cppext
(cherry picked from commit ec5db539b9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2022-07-13 11:09:06 +02:00
Miss Islington (bot) a276833a7d
[3.11] GH-94736: mark SemLock test as linux only (GH-94750) (#94752)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-11 16:24:12 +01:00
Miss Islington (bot) 91176d3883
[3.11] bpo-45924: Fix asyncio incorrect traceback when future's exception is raised multiple times (GH-30274) (#94747)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-11 14:17:32 +01:00