Commit graph

26892 commits

Author SHA1 Message Date
Mark Shannon
4296396db0
[3.9] bpo-45806: Fix recovery from stack overflow for 3.9. Again. (GH-29640)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-11-19 19:51:50 +01:00
Miss Islington (bot)
9450c751cc
bpo-45835: Fix race condition in test_queue (GH-29601)
Some of the tests in test_queue had a race condition in which a
non-sentinel value could be enqueued after the final sentinel value
leading to not all the inputs being processed (and test failures).

This changes feed() to enqueue a sentinel once the inputs are exhausted,
which guarantees that the final queued object is a sentinel. This
requires the number of feeder threads to match the number of consumer
threads, but that's already the case in the relevant tests.
(cherry picked from commit df3e53d86b)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2021-11-18 08:16:06 -08:00
Pablo Galindo Salgado
0ef308a289
bpo-45822: Respect PEP 263's coding cookies in the parser even if flags are not provided (GH-29582) (GH-29585)
(cherry picked from commit da20d7401d)
2021-11-18 00:18:16 +01:00
Sam Gross
87787c8774
[3.9] bpo-42540: reallocation of id_mutex should not force default allocator (GH-29564) (GH-29600)
Unlike the other locks reinitialized by _PyRuntimeState_ReInitThreads,
the "interpreters.main->id_mutex" is not freed by _PyRuntimeState_Fini
and should not force the default raw allocator..
(cherry picked from commit 736684b1bb)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2021-11-17 23:53:33 +01:00
Pablo Galindo Salgado
142fcb40b6
bpo-45738: Fix computation of error location for invalid continuation characters in the parser (GH-29550) (GH-29552)
(cherry picked from commit 25835c518a)
2021-11-14 01:47:27 +00:00
Miss Islington (bot)
587ff7f50b
bpo-45235: Revert an argparse bugfix that caused a regression (GH-29525) (GH-29531) 2021-11-12 12:44:25 -06:00
Miss Islington (bot)
a932631890
bpo-45644: Make json.tool read infile before writing to outfile (GH-29273) (GH-29446)
so that

$ python -m json.tool foo.json foo.json

doesn't result in an empty foo.json.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 815dad42d5)

Co-authored-by: Chris Wesseling <chris.wesseling@protonmail.com>
2021-11-06 19:01:44 +01:00
Łukasz Langa
f701237db2
[3.9] bpo-30570: Fix segfault on buildbots caused by stack overflow from recursion in tests (GH-29258) (GH-29415)
(cherry picked from commit d56375a0dd)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2021-11-04 21:52:26 +01:00
Miss Islington (bot)
1e29dce113
bpo-30570: Use Py_EnterRecursiveCall() in issubclass() (GH-29048) (GH-29178)
* Use Py_EnterRecursiveCall() in issubclass()

Reviewed-by: Gregory P. Smith <greg@krypto.org> [Google]
(cherry picked from commit 423fa1c181)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2021-11-04 21:20:21 +01:00
Alex Waygood
effb72fa0f
[3.9] bpo-45678: Fix singledispatchmethod classmethod/staticmethod bug (GH-29394)
This PR fixes a bug in the 3.9 branch where
``functools.singledispatchmethod`` did not properly wrap attributes such as
``__name__``, ``__doc__`` and ``__module__`` of the target method. It also
backports tests already merged into the 3.11 and 3.10 branches in #29328 and
#29390.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-11-04 20:34:14 +01:00
Łukasz Langa
8198617bcc
[3.9] bpo-45578: add tests for dis.distb (GH-29332) (#29386)
(cherry picked from commit e346f19681)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-11-03 17:47:04 +01:00
Serhiy Storchaka
bbcf06bf95
[3.9] bpo-45679: Fix caching of multi-value typing.Literal (GH-29334) (GH-29342)
Literal[True, 2] is no longer equal to Literal[1, 2]..
(cherry picked from commit 634984d7db)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-11-03 17:28:55 +08:00
Miss Islington (bot)
5f527caf15
bpo-45406: make inspect.getmodule() return None when getabsfile() raises FileNotFoundError (GH-28824)
(cherry picked from commit a459a81530)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2021-11-02 15:26:40 -07:00
Serhiy Storchaka
a043706f90
[3.9] [3.10] bpo-45502: Fix test_shelve (GH-29003) (GH-29305) (GH-29306)
Run test_shelve with all underlying dbm implementations and pickle protocols.
Also make test_shelve discoverable.
(cherry picked from commit b781cc3bfc).
(cherry picked from commit 6b867022d9)
2021-10-29 13:18:34 +03:00
Miss Islington (bot)
dd674ca96f
bpo-45577: test all pickle protocols in test_zoneinfo (GH-29167) (GH-29295)
(cherry picked from commit 66e6b3dcd3)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-10-29 00:00:34 +02:00
Miss Islington (bot)
67a1abb6aa
bpo-45624: make test_graphlib not depend on the iteration order of sets (GH-29233) (GH-29292)
the current test depended on integer sets being iterated on in a certain
fixed order. That order is different on PyPy (insertion based) and could
change in CPython in the future in theory. Make the test robust against
a different iteration order by sorting.
(cherry picked from commit 7401694807)

Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
2021-10-28 23:14:37 +02:00
Alex Waygood
97388c204b
[3.9] bpo-39679: Fix singledispatchmethod classmethod/staticmethod bug (GH-29087)
This commit fixes a bug in the 3.9 branch where stacking
`@functools.singledispatchmethod` on top of `@classmethod` or `@staticmethod`
caused an exception to be raised if the method was registered using
type-annotations rather than `@method.register(int)`. Tests for this scenario
were added to the 3.11 and 3.10 branches in #29034 and #29072; this commit
also backports those tests to the 3.9 branch.

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-28 18:02:04 +02:00
Miss Islington (bot)
8365a5b5ab
bpo-44904: Fix classmethod property bug in doctest module (GH-28838)
The doctest module raised an error if a docstring contained an example that
attempted to access a classmethod property. (Stacking '@classmethod' on top of
`@property` has been supported since Python 3.9; see
https://docs.python.org/3/howto/descriptor.htmlGH-class-methods.)

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

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2021-10-28 01:13:45 -07:00
Miss Islington (bot)
21150c6fa3
bpo-45438: format of inspect.Signature with generic builtins (GH-29212)
Use types.GenericAlias in inspect.formatannotation to correctly add
type arguments of builtin types to the string representation of
Signatures.

Co-authored-by: Martin Rückl <martin.rueckl@codecentric.de>
(cherry picked from commit d02ffd1b5c)

Co-authored-by: Martin Rueckl <enigma@nbubu.de>
2021-10-27 15:00:18 -07:00
Miss Islington (bot)
216c040bb1
bpo-43592: Raise RLIMIT_NOFILE in test.libregrtest (GH-29127)
Raise RLIMIT_NOFILE in test.libregrtest.

On macOS the default is often too low for our testsuite to succeed.

Co-authored by reviewer: Victor Stinner
(cherry picked from commit 843b890334)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2021-10-21 21:48:44 -07:00
Miss Islington (bot)
d33fae7105
bpo-45192: Fix a bug that infers the type of an os.PathLike[bytes] object as str (GH-28323) (GH-29112)
An object implementing the os.PathLike protocol can represent a file
system path as a str or bytes object.
Therefore, _infer_return_type function should infer os.PathLike[str]
object as str type and os.PathLike[bytes] object as bytes type.
(cherry picked from commit 6270d3eeaf)

Co-authored-by: Kyungmin Lee <rekyungmin@gmail.com>
2021-10-20 23:25:10 +02:00
Miss Islington (bot)
9192683165
bpo-45229: Make doctest tests discoverable (GH-28986) (GH-29096)
(cherry picked from commit 8d6740f489)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-20 18:52:41 +02:00
Łukasz Langa
88f4ec88e2
[3.9] bpo-45494: Fix parser crash when reporting errors involving invalid continuation characters (GH-28993) (#29071)
There are two errors that this commit fixes:

* The parser was not correctly computing the offset and the string
  source for E_LINECONT errors due to the incorrect usage of strtok().
* The parser was not correctly unwinding the call stack when a tokenizer
  exception happened in rules involving optionals ('?', [...]) as we
  always make them return valid results by using the comma operator. We
  need to check first if we don't have an error before continuing..
(cherry picked from commit a106343f63)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>

NOTE: unlike the cherry-picked original, this commit points at a crazy location
due to a bug in the tokenizer that required a big refactor in 3.10 to fix.
We are leaving as-is for 3.9.
2021-10-20 18:51:13 +02:00
Łukasz Langa
d46b2217d1
[3.9] bpo-45500: Rewrite test_dbm (GH-29002) (GH-29074)
* Generate test classes at import time. It allows to filter them when
  run with unittest. E.g: "./python -m unittest test.test_dbm.TestCase_gnu -v".
* Create a database class in a new directory which will be removed after
  test. It guarantees that all created files and directories be removed
  and will not conflict with other dbm tests.
* Restore dbm._defaultmod after tests. Previously it was set to the last
  dbm module (dbm.dumb) which affected other tests.
* Enable the whichdb test for dbm.dumb.
* Move test_keys to the correct test class. It does not test whichdb().
* Remove some outdated code and comments..
(cherry picked from commit 975b94b9de)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-20 17:06:38 +09:00
Miss Islington (bot)
1dbf9c86b2
bpo-45229: Make test_http_cookiejar discoverable (GH-29004)
(cherry picked from commit b3f0ceae91)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-17 09:46:55 -07:00
Serhiy Storchaka
6848602806
bpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" codec (GH-28944) (GH-28953)
They support now splitting escape sequences between input chunks.

Add the third parameter "final" in codecs.raw_unicode_escape_decode().
It is True by default to match the former behavior.

(cherry picked from commit 39aa98346d)
2021-10-14 21:23:52 +03:00
Serhiy Storchaka
7c722e32bf
[3.9] bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" codec (GH-28939) (GH-28945)
They support now splitting escape sequences between input chunks.

Add the third parameter "final" in codecs.unicode_escape_decode().
It is True by default to match the former behavior.
(cherry picked from commit c96d1546b1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-14 20:03:29 +03:00
Miss Islington (bot)
fb72034538
[3.9] bpo-24444: fix an error in argparse help when help for an option is blank (GH-28050) (GH-28932)
(cherry picked from commit 6fafc25aea)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-13 22:36:05 +02:00
Łukasz Langa
5d74713093
[3.9] bpo-45229: Make tkinter tests discoverable (GH-28637) (GH-28929)
(cherry picked from commit f59ed3c310)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-13 19:08:44 +02:00
Miss Islington (bot)
5638618845
bpo-45239: Fix parsedate_tz when time has more than 2 dots in it (GH-28452) (GH-28928)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit b9e687618d)

Co-authored-by: Ben Hoyt <benhoyt@gmail.com>
2021-10-13 18:58:37 +02:00
Miss Islington (bot)
faa87f7f3b
bpo-45401: Fix a resource warning in test_logging (GH-28864) (GH-28873)
(cherry picked from commit 15188b115a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-12 10:18:43 +03:00
Miss Islington (bot)
ac421c348b
bpo-45401: Change shouldRollover() methods to only rollover regular f… (GH-28822) (#28866)
…iles.

Also changed some historical return values from 1 -> True and 0 -> False.
(cherry picked from commit 62a667784b)

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2021-10-11 12:01:09 +02:00
Miss Islington (bot)
6f3bc5eee6
bpo-20028: Improve error message of csv.Dialect when initializing (GH-28705)
(cherry picked from commit 34bbc87b2d)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2021-10-09 08:30:54 -07:00
Miss Islington (bot)
06935bd68e
bpo-45337: Use the realpath of the new executable when creating a venv on Windows (GH-28663)
(cherry picked from commit 6811fdaec8)

Co-authored-by: Steve Dower <steve.dower@python.org>
2021-10-07 15:55:15 -07:00
Christian Clauss
4346b81cc6
[3.9] Fix typos in the Lib directory (GH-28775) (GH-28803)
Fix typos in the Lib directory as identified by codespell.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 745c9d9dfc)

Automerge-Triggered-By: GH:JulienPalard
2021-10-07 08:42:38 -07:00
Łukasz Langa
52d9d3b754
[3.9] bpo-44050: Extension modules can share state when they don't support sub-interpreters. (GH-27794) (GH-28741)
(cherry picked from commit b9bb74871b)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2021-10-05 22:30:25 +02:00
Miss Islington (bot)
63c9a6cc8b
bpo-45354: Skip obsolete device name tests on Windows 11 (GH-28712)
(cherry picked from commit de4052fe06)

Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
2021-10-05 05:39:18 -07:00
John Belmonte
7c2a040a10
[3.9] bpo-44594: fix (Async)ExitStack handling of __context__ (gh-27089) (GH-28731)
Make enter_context(foo()) / enter_async_context(foo()) equivalent to
`[async] with foo()` regarding __context__ when an exception is raised.

Previously exceptions would be caught and re-raised with the wrong
context when explicitly overriding __context__ with None..
(cherry picked from commit e6d1aa1ac6)

Co-authored-by: John Belmonte <john@neggie.net>

Automerge-Triggered-By: GH:njsmith
2021-10-04 23:37:24 -07:00
Serhiy Storchaka
4d5d161d2a
[3.9] bpo-45310: Fix parrallel shared memory tests (GH-28661) (GH-28670)
Add a PID to names of POSIX shared memory objects to allow
running multiprocessing tests (test_multiprocessing_fork,
test_multiprocessing_spawn, etc) in parallel.
(cherry picked from commit eb4495e8e2)
2021-10-01 12:38:23 +03:00
Serhiy Storchaka
e9d5cdda1f
Revert "Revert "bpo-45229: Make datetime tests discoverable (GH-28615). (GH-28645)" (GH-28660)" (GH-28666)
This reverts commit 2cf76cf4cc.
2021-10-01 10:58:59 +03:00
Łukasz Langa
2cf76cf4cc
Revert "bpo-45229: Make datetime tests discoverable (GH-28615). (GH-28645)" (GH-28660)
This reverts commit 993a130d3a.
2021-09-30 22:23:32 +02:00
Serhiy Storchaka
993a130d3a
[3.9] bpo-45229: Make datetime tests discoverable (GH-28615). (GH-28645)
(cherry picked from commit d441437ee7)
2021-09-30 19:58:34 +03:00
Serhiy Storchaka
f7e99c9813
[3.9] bpo-40173: Fix test.support.import_helper.import_fresh_module() (GH-28654) (GH-28658)
* Work correctly if an additional fresh module imports other
  additional fresh module which imports a blocked module.
* Raises ImportError if the specified module cannot be imported
  while all additional fresh modules are successfully imported.
* Support blocking packages.
* Always restore the import state of fresh and blocked modules
  and their submodules.
* Fix test_decimal and test_xml_etree which depended on an undesired
  side effect of import_fresh_module().
(cherry picked from commit ec4d917a6a)
2021-09-30 19:57:46 +03:00
Łukasz Langa
7bff4d396f
[3.9] bpo-39039: tarfile raises descriptive exception from zlib.error (GH-27766) (GH-28614)
* during tarfile parsing, a zlib error indicates invalid data
* tarfile.open now raises a descriptive exception from the zlib error
* this makes it clear to the user that they may be trying to open a
  corrupted tar file.
(cherry picked from commit b6fe857250)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
2021-09-29 12:56:14 +02:00
Miss Islington (bot)
c6b5ceae34
bpo-45269: test wrong markers type to c_make_encoder (GH-28540) (GH-28610)
(cherry picked from commit e046aabbe3)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-09-28 23:51:57 +02:00
Miss Islington (bot)
cd00fee8dd
bpo-35606: Fix math.prod tests using 'start' as keyword parameter (GH-28595) (GH-28604)
(cherry picked from commit 84975146a7)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-09-28 22:19:02 +02:00
Victor Stinner
94d19f606f
bpo-1596321: Fix threading._shutdown() for the main thread (GH-28549) (GH-28589)
Fix the threading._shutdown() function when the threading module was
imported first from a thread different than the main thread: no
longer log an error at Python exit.

(cherry picked from commit 95d3137082)
2021-09-27 23:40:22 +02:00
Miss Islington (bot)
08e387ab82
bpo-45280: Add test for empty NamedTuple in test_typing (GH-28559) (GH-28570)
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
(cherry picked from commit f56268a2cd)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-09-26 19:09:29 +02:00
Łukasz Langa
1f08d16c90
[3.9] bpo-45166: fixes get_type_hints failure on Final (GH-28279) (GH-28561)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>.
(cherry picked from commit 784905dbef)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-09-25 11:30:20 +02:00
Łukasz Langa
5482db5800
[3.9] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28512)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>.
(cherry picked from commit 8f943ca257)

Co-authored-by: Mohamad Mansour <66031317+mohamadmansourX@users.noreply.github.com>
2021-09-22 17:32:04 +02:00