Commit graph

26974 commits

Author SHA1 Message Date
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
Miss Islington (bot)
09390c837a
bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421) (GH-28507)
This was a regression from fixing BPO-43219.
(cherry picked from commit b7eac52b46)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
2021-09-22 00:21:10 +02:00
Miss Islington (bot)
65268ab849
bpo-45209: fix UserWarning: resource_tracker in test_multiprocessing (GH-28377) (GH-28500)
(cherry picked from commit f604cf1c37)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-09-21 20:37:04 +02:00
Miss Islington (bot)
b06c3b3647
[3.9] bpo-45021: Fix a hang in forked children (GH-28007) (GH-28481)
_global_shutdown_lock should be reinitialized in forked children
(cherry picked from commit 0bfa1106ac)


Co-authored-by: nullptr <3621629+0x0L@users.noreply.github.com>

Automerge-Triggered-By: GH:gpshead
2021-09-20 11:54:24 -07:00
Miss Islington (bot)
04dea46dde
bpo-45229: Make pickle tests discoverable (GH-28467) (GH-28479)
(cherry picked from commit e6ba992288)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-20 18:19:49 +02:00
Miss Islington (bot)
29e431419a
bpo-40413: test_embed tests calling Py_RunMain() multiple times (GH-28466) (GH-28471)
Calling Py_InitializeFromConfig()+Py_RunMain() multiple times must
not crash.

Cleanup also test_get_argc_argv().
(cherry picked from commit 5e2c32e08e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-09-20 17:51:32 +02:00
Serhiy Storchaka
5822ab672a
[3.9] bpo-45229: Remove test_main in many tests (GH-28405) (GH-28456)
Instead of explicitly enumerate test classes for run_unittest()
use the unittest ability to discover tests. This also makes these
tests discoverable and runnable with unittest.

load_tests() can be used for dynamic generating tests and adding
doctests. setUpModule(), tearDownModule() and addModuleCleanup()
can be used for running code before and after all module tests..
(cherry picked from commit 40348acc18)
2021-09-20 09:34:52 +03:00
Miss Islington (bot)
a18d52269a
bpo-45235: Fix argparse overrides namespace with subparser defaults (GH-28420) (GH-28443) 2021-09-18 01:47:41 -05:00
Miss Islington (bot)
6c50f23ae0
bpo-45187: Fix dangling threads in test_socket.CreateServerFunctionalTest (GH-28422) (GH-28424)
(cherry picked from commit 51ebb7f4f5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-17 22:40:33 +03:00
Łukasz Langa
0f4449ecb0
[3.9] bpo-45187: Collect test_socket tests using unittest (GH-28317) (GH-28413)
Previously, test classes ISOTPTest, J1939Test, BasicUDPLITETest and
UDPLITETimeoutTest were not included in the list of tests and
were not run by regrtest..
(cherry picked from commit 0361335b80)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-17 14:48:54 +03:00
Serhiy Storchaka
10c3cf7851
[3.9] bpo-45212: Fix dangling threads in skipped tests in test_socket (GH-28361) (GH-28408)
tearDown() is not called if setUp() raises an exception
(including SkipTest). addCleanup() should be used for guaranteed
execution of the cleanup code.
(cherry picked from commit 7dacb70485)
2021-09-17 13:11:50 +03:00
Victor Stinner
471b3811fe
bpo-45208: Make test_pdb.test_checkline_is_not_executable() quiet (GH-28354) (GH-28381)
test_pdb.test_checkline_is_not_executable() no longer writes output
to stdout.

Remove also unused variables 'f'.

(cherry picked from commit e08e491a6c)
2021-09-16 09:53:02 +02:00
Miss Islington (bot)
9443ce4eed
bpo-45205: Make test_compileall quiet (GH-28356) (GH-28364)
Make test_compileall quiet: test_year_2038_mtime_compilation() and
test_larger_than_32_bit_times() of test_compileall no longer log
"Compiling ..." messages to stdout.
(cherry picked from commit cc057ff522)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-09-15 21:33:52 +02:00
Miss Islington (bot)
2746045a37
bpo-45167: Fix deepcopying of GenericAlias (GH-28324) (GH-28368)
(cherry picked from commit 5dce51a887)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-15 21:31:14 +02:00
Miss Islington (bot)
1c70efcbb5
bpo-45207: Make test_gdb.test_pycfunction() quiet (GH-28355) (GH-28366)
test_gdb.test_pycfunction() now ignores gdb stderr, it no longer logs
messages like:

    Function "meth_varargs" not defined.
(cherry picked from commit 84a6061e29)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-09-15 21:11:21 +02:00
Miss Islington (bot)
4ce55cceb2
bpo-45195: Fix test_readline.test_nonascii() (GH-28329) (GH-28334)
Fix test_readline.test_nonascii(): sometimes, the newline character
is not written at the end, so don't expect it in the output.
(cherry picked from commit 797c8eb9ef)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-09-15 14:38:57 +02:00
Miss Islington (bot)
9ccdc90488
bpo-45196: prevent unittest crash on address sanitizer builds (GH-28331)
(cherry picked from commit b668cdfa09)

Co-authored-by: junyixie <xiejunyi.arch@bytedance.com>
2021-09-14 11:54:27 -07:00
Miss Islington (bot)
9cd8fb8d63
bpo-35474: Fix mimetypes.guess_all_extensions() potentially mutating list (GH-28286) (GH-28290)
* Calling guess_all_extensions() with strict=False potentially
  mutated types_map_inv.
* Mutating the result of guess_all_extensions() mutated types_map_inv.
(cherry picked from commit 97ea18eced)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-13 19:24:08 +02:00
Serhiy Storchaka
a328a13b70
[3.9] bpo-45097: Fix deprecation warnings in test_asyncio (GH-28236) 2021-09-08 17:59:40 +02:00