Commit graph

25520 commits

Author SHA1 Message Date
Carl Meyer
ebe8d23407
[3.10] gh-90104: avoid RecursionError on recursive dataclass field repr (gh-100756) (GH-100785)
Avoid RecursionError on recursive dataclass field repr

(cherry picked from commit 0a7936a38f)

Automerge-Triggered-By: GH:ericvsmith
2023-01-05 18:15:27 -08:00
Miss Islington (bot)
f49cc3c805
gh-100739: Respect mock spec when checking for unsafe prefixes (GH-100740)
(cherry picked from commit 7f1eefc6f4)

Co-authored-by: Christian Klein <167265+cklein@users.noreply.github.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-01-04 15:11:46 -08:00
Miss Islington (bot)
35a010f1f9
GH-86508: skip binding to local addresses of different family in asyncio.open_connection (GH-100615)
(cherry picked from commit ba8dcdbcab)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-04 00:24:36 -08:00
Miss Islington (bot)
3ab7b61b41
gh-100616: Document 'attr' parameter for window.vline() in curses module (GH-24961)
(cherry picked from commit f4fcfdf8c5)

Co-authored-by: mathieui <mathieui@users.noreply.github.com>
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
2022-12-30 09:05:40 -08:00
Shantanu
9975d4e7ba
[3.10] gh-100287: Fix unittest.mock.seal with AsyncMock (GH-100496) (#100508)
(cherry picked from commit e4b43ebb3a)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-24 14:39:27 -06:00
Miss Islington (bot)
ad8d2ef54f
gh-100472: Fix docs claim that compileall parameters could be bytes (GH-100473)
(cherry picked from commit 046cbc2080)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-24 12:29:41 -08:00
Miss Islington (bot)
ecbf136702
[3.10] gh-100474: Fix handling of dirs named index.html in http.server (GH-100504)
Co-authored-by: James Frost <git@frost.cx>
2022-12-24 15:29:21 -05:00
Miss Islington (bot)
9c4b8cca09
bpo-40447: accept all path-like objects in compileall.compile_file (GH-19883)
(cherry picked from commit 1ecfd1ebf1)

Co-authored-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@archlinux.org>
Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-23 12:39:55 -08:00
Miss Islington (bot)
95c55a69b3
[3.10] gh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-5576) (#100451)
gh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-5576)

The itemsize returned in a memoryview of a ctypes array is now computed from the item type, instead of dividing the total size by the length and assuming that the length is not zero.
(cherry picked from commit 84bc6a4f25)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
2022-12-23 08:55:55 +00:00
Miss Islington (bot)
7f24056dfb
gh-100374: Fixed a bug in socket.getfqdn() (gh-100375)
(cherry picked from commit 12be23cf3c)

Co-authored-by: Dominic Socular <BBH@awsl.rip>
2022-12-21 06:06:27 -08:00
colorfulappl
591365cd49
[3.10] gh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing (GH-99890) (#100386)
(cherry picked from commit efbb1eb9f5)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-12-21 15:33:21 +05:30
Shantanu
919045cb73
[3.10] gh-85267: Improvements to inspect.signature __text_signature__ handling (GH-98796) (#100393)
This makes a couple related changes to inspect.signature's behaviour
when parsing a signature from `__text_signature__`.

First, `inspect.signature` is documented as only raising ValueError or
TypeError. However, in some cases, we could raise RuntimeError.  This PR
changes that, thereby fixing GH-83685.

(Note that the new ValueErrors in RewriteSymbolics are caught and then
reraised with a message)

Second, `inspect.signature` could randomly drop parameters that it
didn't understand (corresponding to `return None` in the `p` function).
This is the core issue in GH-85267. I think this is very surprising
behaviour and it seems better to fail outright.

Third, adding this new failure broke a couple tests. To fix them (and to
e.g. allow `inspect.signature(select.epoll.register)` as in GH-85267), I
add constant folding of a couple binary operations to RewriteSymbolics.

(There's some discussion of making signature expression evaluation
arbitrary powerful in GH-68155. I think that's out of scope. The
additional constant folding here is pretty straightforward, useful, and
not much of a slippery slope)

Fourth, while GH-85267 is incorrect about the cause of the issue, it turns
out if you had consecutive newlines in __text_signature__, you'd get
`tokenize.TokenError`.

Finally, the `if name is invalid:` code path was dead, since
`parse_name` never returned `invalid`..
(cherry picked from commit 79311cbfe7)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-20 21:25:18 -08:00
colorfulappl
53063b7ffa
[3.10] gh-99240: Fix double-free bug in Argument Clinic str_converter generated code (GH-99241) (#100353)
(cherry picked from commit 8dbe08eb7c)

Fix double-free bug mentioned at GH-99240, by moving memory clean up out of "exit" label.
2022-12-20 15:50:42 +05:30
colorfulappl
3144aca3da
[3.10] gh-96002: Add functional test for Argument Clinic (GH-96178) (#100232)
(cherry picked from commit c450c8c9ed)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-12-17 12:06:06 +05:30
Miss Islington (bot)
580165d01c
bpo-43984: Allow winreg.SetValueEx to set -1 without treating it as an error (GH-25775)
(cherry picked from commit a29a7b9b78)

Co-authored-by: Shreyan Avigyan <shreyan.avigyan@gmail.com>
2022-12-09 05:17:25 -08:00
Miss Islington (bot)
0e2c7839bd
[3.10] bpo-44817: Ignore additional errors in ntpath.realpath (GH-27574) (GH-100023)
(cherry picked from commit 124ecd6576)

Co-authored-by: Michael Förderer <michael.foerderer@gmx.de>
2022-12-08 01:02:28 -08:00
Miss Islington (bot)
85be25827b
gh-98778: Update HTTPError to initialize properly even if fp is None (gh-99966)
(cherry picked from commit dc8a86893d)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2022-12-07 20:17:35 -08:00
Miss Islington (bot)
fe7c309a8c
gh-83035: handle decorator with nested parens in inspect.getsource (GH-99654)
(cherry picked from commit 68e41295b8)

Co-authored-by: Carl Meyer <carl@oddbird.net>
2022-12-07 09:24:41 -08:00
Pablo Galindo Salgado
72cfe5b1b9
[3.10] gh-100050: Fix an assertion error when raising unclosed parenthesis errors in the tokenizer (GH-100065) (#100073)
Automerge-Triggered-By: GH:pablogsal.
(cherry picked from commit 97e7004cfe)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-12-07 13:52:05 +00:00
Pablo Galindo
1dd9be6584 Python 3.10.9 2022-12-06 18:31:21 +00:00
Łukasz Langa
300d812fd1
[3.10] gh-93453: Only emit deprecation warning in asyncio.get_event_loop when a new event loop is created (#100059)
It no longer emits a deprecation warning if the current event loop was set.

(cherry picked from commit 3fae04b10e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-12-06 18:40:30 +01:00
Miss Islington (bot)
aae7b43ca3
gh-100001: Also escape \s in http.server log messages. (GH-100038)
Also \ escape \s in the http.server BaseHTTPRequestHandler.log_message so
that it is technically possible to parse the line and reconstruct what the
original data was.  Without this a \xHH is ambiguious as to if it is a hex
replacement we put in or the characters r"\x" came through in the original
request line.
(cherry picked from commit 7e29398407)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-12-05 14:47:57 -08:00
Miss Islington (bot)
ec8c06bc28
gh-100001: Omit control characters in http.server stderr logs. (GH-100002)
Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4dfa)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-12-05 13:16:14 -08:00
Miss Islington (bot)
c067023d87
gh-99892: test_unicodedata: skip test on download failure (GH-100011)
Skip test_normalization() of test_unicodedata if it fails to download
NormalizationTest.txt file from pythontest.net.
(cherry picked from commit 2488c1e1b6)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-12-05 08:05:17 -08:00
Miss Islington (bot)
e699e5c20f
gh-98458: unittest: bugfix for infinite loop while handling chained exceptions that contain cycles (GH-98459)
* Bugfix addressing infinite loop while handling self-referencing chained exception in TestResult._clean_tracebacks()
* Bugfix extended to properly handle exception cycles in _clean_tracebacks. The "seen" set follows the approach used in the TracebackException class (thank you @iritkatriel for pointing it out)
* adds a test for a single chained exception that holds a self-loop in its __cause__ and __context__ attributes
(cherry picked from commit 72ec518203)

Co-authored-by: AlexTate <0xalextate@gmail.com>
2022-12-04 11:58:31 -08:00
Luke Garland
b027dd78bb
bpo-40882: Fix a memory leak in SharedMemory on Windows (GH-20684)
In multiprocessing.shared_memory.SharedMemory(), the temporary view
returned by MapViewOfFile() should be unmapped when it is no longer
needed.
(cherry picked from commit 85c128e34d)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2022-12-02 10:13:33 +00:00
Sam James
807b103bdd
[3.10] GH-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declara… (#99920)
[3.10] gh-99086: Fix -Wstrict-prototypes, -Wimplicit-function-declaration warnings in configure.ac (GH-99406)

Follow up to 12078e78f6.
(cherry picked from commit e35ca417fe)

Co-authored-by: Sam James <sam@gentoo.org>
2022-12-01 16:32:49 +05:30
Kumar Aditya
a851797863
[3.10] bpo-31718: Fix io.IncrementalNewlineDecoder SystemErrors and s… (#99842)
[3.10] bpo-31718: Fix io.IncrementalNewlineDecoder SystemErrors and segfaults (GH-18640)

Co-authored-by: Oren Milman <orenmn@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>.
(cherry picked from commit 53eef27133)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2022-11-28 16:57:37 +05:30
Miss Islington (bot)
345aaa4176
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:08:12 -08:00
Miss Islington (bot)
289411d8ef
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:52:12 -08:00
Miss Islington (bot)
c42681546a
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:18:41 -08:00
Miss Islington (bot)
612834e8c2
Use faster APIs to calculate paths at startup for Store packaged Python on Windows (GH-99345)
(cherry picked from commit 71a4a2da98)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-11-23 12:15:16 -08:00
Dong Uk, Kang
b191bc35f5
[3.10] gh-88863: Clear ref cycles to resolve leak when asyncio.open_connection raises (GH-95739) (#99722)
Break reference cycles to resolve memory leak, by
removing local exception and future instances from the frame.
(cherry picked from commit 995f6170c7)

Co-authored-by: Dong Uk, Kang <nailbrainz@gmail.com>
2022-11-23 10:39:04 -08:00
Miss Islington (bot)
5252ad2b64
GH-92892: Add section about variadic functions to ctypes documentation (GH-99529)
On some platforms, and in particular macOS/arm64, the calling
convention for variadic arguments is different from the regular
calling convention. Add a section to the documentation to document
this.
(cherry picked from commit bc3a11d21d)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2022-11-22 10:57:45 -08:00
Serhiy Storchaka
400d41b8ea
[3.10] gh-99645: Fix a bug in handling class cleanups in unittest.TestCase (GH-99646) (GH-99699)
Now addClassCleanup() uses separate lists for different TestCase subclasses,
and doClassCleanups() only cleans up the particular class.

(cherry picked from commit c2102136be)
2022-11-22 19:11:57 +02:00
Ronald Oussoren
1c5e860292
[3.10] GH-97001: Release GIL in termios extension (GH-99503) (#99680)
Without releasing the GIL calls to termios APIs might block the entire interpreter..
(cherry picked from commit 959ba45d75)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2022-11-22 12:33:32 +01:00
Miss Islington (bot)
99e852c28f
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:06:26 -08:00
Miss Islington (bot)
37dbbb208f
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:44:56 -08:00
Pablo Galindo Salgado
ad47c7d926
[3.10] gh-99581: Fix a buffer overflow in the tokenizer when copying lines that fill the available buffer (GH-99605). (#99630) 2022-11-20 22:30:15 +00:00
Miss Islington (bot)
88b101ff52
[3.10] gh-98086: Now `patch.dict` can decorate async functions (GH-98095) (GH-99366)
gh-98086: Now ``patch.dict`` can decorate async functions (GH-98095)
(cherry picked from commit 67b4d2772c)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Chris Withers <chris@withers.org>
2022-11-20 21:36:57 +05:30
Stanley
90850faa01
[3.10] Remove trailing space to fix azure failures (#99611) 2022-11-19 21:01:35 -08:00
Miss Islington (bot)
e470803295
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 12:52:14 -08:00
Kamil Turek
bc2cdfc815
[3.10] gh-92119: ctypes: Print exception class name instead of its representation (GH-98302) (#99452)
gh-92119: ctypes: Print exception class name instead of its representation (#98302)

(cherry picked from commit b9dedfe61d)
2022-11-13 15:55:58 -08:00
Miss Islington (bot)
14c13955c5
gh-99275: Fix SystemError in ctypes during __initsubclass__ (GH-99283)
(cherry picked from commit 343eb0f94b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-13 11:40:18 -08:00
Miss Islington (bot)
535027f470
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:49 -08:00
Miss Islington (bot)
8d27e6294b
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:16:18 -08:00
Jason R. Coombs
9a5ca31af0
[3.10] gh-99130: Apply bugfixes from importlib_metadata 4.11.4. (#99132) 2022-11-10 16:59:38 +01:00
Miss Islington (bot)
e6f066af2e
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:59:25 -08:00
Miss Islington (bot)
9bb8e18ca4
[3.11] gh-98433: Fix quadratic time idna decoding. (GH-99092) (GH-99222)
There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit d315722564)

(cherry picked from commit a6f6c3a3d6)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-11-07 19:23:16 -08:00
Miss Islington (bot)
eb0e942ca8
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:08:39 -08:00