Commit Graph

27484 Commits

Author SHA1 Message Date
Brandt Bucher a89bbde83f
[3.10] bpo-45773: Stop "optimizing" certain jump patterns (GH-29526) 2021-11-11 13:52:43 -08:00
Irit Katriel c5bfb88eb6
[3.10] bpo-45757: Fix bug where dis produced an incorrect oparg on EXTENDED_ARG before a no-arg opcode (GH-29480) (GH-29506) 2021-11-09 22:05:30 +00:00
Miss Islington (bot) 6603f6b5bd
bpo-45644: Make json.tool read infile before writing to outfile (GH-29273) (GH-29445)
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:17 +01:00
Miss Islington (bot) bcb236c19e
bpo-45678: Add more ``singledispatchmethod`` tests (GH-29412) (GH-29424)
In order to fix a bug in the 3.9 branch in GH-29394, more tests were added to
``test_functools.py`` to ensure that ``singledispatchmethod`` still correctly
wrapped a target method, even if the target method had already been wrapped by
 multiple other decorators. This PR brings the new tests into the 3.11 and 3.10
branches as well.
(cherry picked from commit 32f55d1a5d)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2021-11-05 16:27:22 +01:00
Miss Islington (bot) 1f3ae5c1ca
bpo-30570: Fix segfault on buildbots caused by stack overflow from recursion in tests (GH-29258)
* Don't stackoveflow on debug builds

* Also catch the pickletester case
(cherry picked from commit d56375a0dd)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2021-11-04 13:45:05 -07:00
Miss Islington (bot) f1918385cc
bpo-45678: Add ``functools.singledispatchmethod`` tests (GH-29328) (GH-29390)
(cherry picked from commit 5a14929a6e)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2021-11-03 17:45:20 +01:00
Łukasz Langa fd6b70d6b7
[3.10] bpo-45578: add tests for `dis.distb` (GH-29332) (GH-29385)
(cherry picked from commit e346f19681)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-11-03 16:53:36 +01:00
Miss Islington (bot) cfdd7d26a7
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:23:43 -07:00
Miss Islington (bot) 3997f3ce8a
bpo-45679: Fix caching of multi-value typing.Literal (GH-29334)
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-10-31 01:43:40 -07:00
Serhiy Storchaka 6b867022d9
[3.10] bpo-45502: Fix test_shelve (GH-29003) (GH-29305)
Run test_shelve with all underlying dbm implementations and pickle protocols.
Also make test_shelve discoverable.
(cherry picked from commit b781cc3bfc)
2021-10-29 12:40:22 +03:00
Miss Islington (bot) 7203ecd332
bpo-45577: test all pickle protocols in `test_zoneinfo` (GH-29167) (GH-29296)
(cherry picked from commit 66e6b3dcd3)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-10-29 00:00:49 +02:00
Miss Islington (bot) eccb753ae6
bpo-45624: make test_graphlib not depend on the iteration order of sets (GH-29233) (GH-29293)
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:15:01 +02:00
Miss Islington (bot) 1f45cc0dfa
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:09:41 -07:00
Miss Islington (bot) ce7a6afb79
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 14:57:07 -07:00
Miss Islington (bot) 36971fd1f4
bpo-45566: `test_frozen_pickle` checks all `pickle` protocols (GH-29150)
Refs https://github.com/python/cpython/pull/29147

Automerge-Triggered-By: GH:ericvsmith
(cherry picked from commit 07236d562e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-10-24 06:29:37 -07:00
Miss Islington (bot) f812fef2f8
bpo-30570: Use Py_EnterRecursiveCall() in issubclass() (GH-29048)
* 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-10-22 14:46:56 -07:00
Miss Islington (bot) 8f6aa48cb2
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:47:07 -07:00
Ethan Furman 2a9ab75af3
bpo-44559: [Enum] restore fixes lost in 3.9 reversion (GH-29114)
- fix exception leaks
- re-add deprecation warnings
2021-10-20 19:48:37 -07:00
Miss Islington (bot) 64e83c711e
bpo-45192: Fix a bug that infers the type of an os.PathLike[bytes] object as str (GH-28323) (GH-29111)
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:27:30 +02:00
Miss Islington (bot) 65de808811
bpo-45229: Make doctest tests discoverable (GH-28986) (GH-29095)
(cherry picked from commit 8d6740f489)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-20 18:52:22 +02:00
Miss Islington (bot) c15ba304f3
bpo-39679: Add tests for classmethod/staticmethod singledispatchmethods (GH-29034) (GH-29072)
In Python 3.8 and 3.9, 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)`. This was not caught by unit tests, however, as the
tests only tested the `@method.register(int)` way of registering additional
implementations. The bug is no longer present in Python 3.10+, but
`test_functools.py` is still lacking regression tests for these cases. This
commit adds these test cases.
(cherry picked from commit ad6d162e51)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2021-10-20 00:07:13 +02:00
Łukasz Langa 5c9cab595e
[3.10] bpo-45494: Fix parser crash when reporting errors involving invalid continuation characters (GH-28993) (GH-29070)
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>
2021-10-19 22:31:18 +02:00
Łukasz Langa 325b2c2234
[3.10] bpo-45500: Rewrite test_dbm (GH-29002) (GH-29069)
* 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>
2021-10-19 22:21:03 +02:00
Miss Islington (bot) 65c1db794e
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:47:03 -07:00
Miss Islington (bot) 5df35faf36
bpo-45249: Fix caret location when end_offset is set to 0 (GH-28855)
(cherry picked from commit fe0d9e22a5)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-10-16 10:51:05 -07:00
Serhiy Storchaka 4641afef66
[3.10] bpo-45467: Fix IncrementalDecoder and StreamReader in the "raw-unicode-escape" codec (GH-28944) (GH-28952)
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)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-14 21:23:39 +03:00
Miss Islington (bot) 0bff4ccbfd
[3.10] bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" codec (GH-28939) (GH-28943)
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:02:20 +03:00
Miss Islington (bot) fd2be6da2f
bpo-24444: fix an error in argparse help when help for an option is blank (GH-28050) (GH-28931)
(cherry picked from commit 6fafc25aea)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
2021-10-13 19:15:43 +02:00
Łukasz Langa f8473f6f76
[3.10] bpo-45239: Fix parsedate_tz when time has more than 2 dots in it (GH-28452) (GH-28930)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit b9e687618d)

Co-authored-by: Ben Hoyt <benhoyt@gmail.com>
2021-10-13 19:12:22 +02:00
Miss Islington (bot) 151234f5da
bpo-45229: Make tkinter tests discoverable (GH-28637) (GH-28927)
(cherry picked from commit f59ed3c310)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-13 18:59:04 +02:00
Miss Islington (bot) 7e74d99c53
bpo-45453: Fix test_embed.StdPrinterTests (GH-28916) (GH-28917)
test_embed.StdPrinterTests now always use the file descriptor 1 for
stdout, rather than using sys.__stdout__.fileno().
PyFile_NewStdPrinter() does crash if the argument is not 1 or 2.

Fix also a few pyflakes warnings: remove unused import and variables.
(cherry picked from commit 678433f25e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-10-13 12:24:47 +02:00
Miss Islington (bot) 47a50fe16f
bpo-45401: Fix a resource warning in test_logging (GH-28864) (GH-28872)
(cherry picked from commit 15188b115a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-12 10:19:09 +03:00
Miss Islington (bot) 5aca34f17c
bpo-45401: Change shouldRollover() methods to only rollover regular f… (GH-28822) (#28867)
…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:12 +02:00
Miss Islington (bot) 164dddf5f8
bpo-45416: Fix use of asyncio.Condition() with explicit Lock objects (GH-28850)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 1a7892414e)

Co-authored-by: Joongi Kim <joongi@lablup.com>
2021-10-10 09:25:14 -07:00
Miss Islington (bot) e086bfee03
Fix dataclassses spelling (GH-28837) (GH-28841)
(cherry picked from commit 5b4a7675bc)

Co-authored-by: Landon Yarrington <33426811+jly36963@users.noreply.github.com>

Co-authored-by: Landon Yarrington <33426811+jly36963@users.noreply.github.com>
2021-10-09 15:50:45 -04:00
Miss Islington (bot) 8772935765
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:35:33 -07:00
Pablo Galindo Salgado 4ce55a2353
[3.10] bpo-45408: Don't override previous tokenizer errors in the second parser pass (GH-28812). (GH-28813)
(cherry picked from commit 0219017df7)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-10-08 00:50:10 +01:00
Miss Islington (bot) eabca6e593
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:05 -07:00
Christian Clauss cfca4a6774
[3.10] Fix typos in the Lib directory (GH-28775) (GH-28804)
Fix typos in the Lib directory as identified by codespell.

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-07 11:49:47 -04:00
Miss Islington (bot) d55bf81c4e
bpo-45400: Fix suggestion test of test_exceptions (GH-28783)
Fix test_name_error_suggestions_do_not_trigger_for_too_many_locals()
of test_exceptions if a directory name contains "a1" (like
"Python-3.11.0a1"): use a stricter regular expression.
(cherry picked from commit 4e605666b0)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-10-07 05:11:38 -07:00
Miss Islington (bot) d0d29655ff
bpo-44050: Extension modules can share state when they don't support sub-interpreters. (GH-27794) (GH-28738)
Automerge-Triggered-By: GH:encukou
(cherry picked from commit b9bb74871b)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2021-10-05 18:34:59 +02:00
Miss Islington (bot) d0d0909a3a
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 13:38:50 +01:00
John Belmonte 872b1e537e
[3.10] bpo-44594: fix (Async)ExitStack handling of __context__ (gh-27089) (GH-28730)
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:21:34 -07:00
Serhiy Storchaka 93242d7a2a
[3.10] Remove trailing spaces (GH-28709) 2021-10-03 20:03:49 +03:00
Miss Islington (bot) 72089f33c0
bpo-45346: Keep docs consistent regarding true and false values (GH-28697) (GH-28698) 2021-10-02 14:32:56 -05:00
Miss Islington (bot) fc3511f18e
bpo-45125: Improves pickling docs and tests for `shared_memory` (GH-28294)
(cherry picked from commit 746d648d47)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-10-01 06:09:15 -07:00
Miss Islington (bot) 4e6681d0cf
bpo-45310: Fix parrallel shared memory tests (GH-28661)
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)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-01 02:41:20 -07:00
Miss Islington (bot) ef7c7294e8
bpo-45229: Make datetime tests discoverable (GH-28615)
(cherry picked from commit d441437ee7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-01 00:36:17 -07:00
Serhiy Storchaka 7873884d47
[3.10] bpo-40173: Fix test.support.import_helper.import_fresh_module() (GH-28654) (GH-28657)
* 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:56:41 +03:00
Łukasz Langa d6b69f21d8
[3.10] bpo-39039: tarfile raises descriptive exception from zlib.error (GH-27766) (GH-28613)
* 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:19:37 +02:00