Commit Graph

27790 Commits

Author SHA1 Message Date
Serhiy Storchaka 080781cd49
[3.10] gh-91700: Validate the group number in conditional expression in RE (GH-91702) (GH-91831)
In expression (?(group)...) an appropriate re.error is now
raised if the group number refers to not defined group.

Previously it raised RuntimeError: invalid SRE code.
(cherry picked from commit 48ec61a89a)
2022-04-22 21:09:30 +03:00
Serhiy Storchaka 9c18d783c3
[3.10] gh-90568: Fix exception type for \N with a named sequence in RE (GH-91665) (GH-91830)
re.error is now raised instead of TypeError.
(cherry picked from commit 6ccfa31421)
2022-04-22 21:08:49 +03:00
Ken Jin 942ea19cf9
Fix whitespace/indentation issues in test_sys (GH-32369) (GH-32372) 2022-04-20 13:57:30 +08:00
Miss Islington (bot) e08d32381d
gh-87497: Document that urllib.request sends headers in camel case (GH-24661) (#91517)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 325d6f5035)

Co-authored-by: Alix Lourme <alix.lourme@gmail.com>
2022-04-19 18:20:03 -07:00
Miss Islington (bot) c213cccc9b
Add more tests for group names and refs in RE (GH-91695)
(cherry picked from commit 74070085da)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-04-19 07:33:09 -07:00
Gregory P. Smith 9a458934f7
[3.10] gh-91607: Fix several test_concurrent_futures tests to actually test what they claim (GH-91600) (#91612)
* Fix test_concurrent_futures to actually test what it says.

Many ProcessPoolExecutor based tests were ignoring the mp_context
and using the default instead.  This meant we lacked proper test
coverage of all of them.

Also removes the old _prime_executor() worker delay seeding code
as it appears to have no point and causes 20-30 seconds extra
latency on this already long test.  It also interfered with some
of the refactoring to fix the above to not needlessly create their
own executor when setUp has already created an appropriate one.

* Don't import the name from multiprocessing directly to avoid confusion.

(cherry picked from commit 7fa3a5a219)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-04-16 13:48:11 -07:00
Steve Dower b0ec17b6d9
bpo-47103: Copy pgort140.dll into output directory when building PGInstrument on Windows (GH-32083) 2022-04-07 23:21:03 +01:00
Matthieu Dartiailh 94609e3192
[3.10] Backport bpo-47212 (GH-32302) to Python 3.10 (GH-32334)
(cherry picked from commit aa0f056a00)

# Conflicts:
#	Grammar/python.gram
#	Parser/action_helpers.c

Automerge-Triggered-By: GH:pablogsal
2022-04-05 09:21:49 -07:00
Miss Islington (bot) 6b4b892e09
bpo-46484:Add test for Calendar.iterweekdays (GH-30825)
(cherry picked from commit 48269ea9fd)

Co-authored-by: 180909 <734461790@qq.com>
2022-04-04 10:43:38 -07:00
Miss Islington (bot) 470dfe20cb
bpo-47205: Skip error check of sched_get/setaffinity on FreeBSD (GH-32285)
(cherry picked from commit b82cdd1dac)

Co-authored-by: Christian Heimes <christian@python.org>
2022-04-03 12:27:32 -07:00
Miss Islington (bot) 1069d52959
bpo-47089: Avoid test_compileall failures on Windows (GH-32037)
(cherry picked from commit 76b8a075b8)

Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
2022-04-01 13:38:35 -07:00
Miss Islington (bot) 9e1bfd8ce7
bpo-47104: Rewrite asyncio.to_thread tests to use IsolatedAsyncioTestCase (GH-32086)
(cherry picked from commit ff619c7dfe)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-23 14:43:32 -07:00
Christian Heimes 1b6acaad9a
[3.10] bpo-47101: list only activated algorithms in hashlib.algorithms_available (GH-32076) (GH-32085)
Co-authored-by: Christian Heimes <christian@python.org>
2022-03-23 22:15:25 +01:00
Miss Islington (bot) f163ad22d3
bpo-2604: Make doctest.DocTestCase reset globs in teardown (GH-31932)
Co-authored-by: Piet Delport
Co-authored-by: Hugo Lopes Tavares
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 7ba7eae508)

Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
2022-03-22 14:31:44 -07:00
Jeremy Kloth 8146e6b636
bpo-44336: Prevent tests hanging on child process handles on Windows (GH-26578)
Replace the child process `typeperf.exe` with a daemon thread that reads the performance counters directly.  This prevents the issues that arise from inherited handles in grandchild processes (see issue37531 for discussion).

We only use the load tracker when running tests in multiprocess mode. This prevents inadvertent interactions with tests expecting a single threaded environment.  Displaying load is really only helpful for buildbots running in multiprocess mode anyway.

Co-authored-by: Jeremy Kloth <jeremy.kloth@gmail.com>
2022-03-22 17:21:24 +00:00
Miss Islington (bot) 9d59381a5d
[3.10] bpo-45997: Fix asyncio.Semaphore re-acquiring order (GH-31910) (#32047)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 32e77154dd)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-22 17:15:24 +02:00
Gregory P. Smith 4c989e19c8
[3.10] bpo-38256: Fix binascii.crc32 large input. (GH-32000) (GH-32013)
Inputs >= 4GiB to `binascii.crc32(...)` when compiled to use the zlib
crc32 implementation (the norm on POSIX) no longer return the wrong
result.
2022-03-20 14:46:52 -07:00
Miss Islington (bot) 906f1a4a95
bpo-39394: Improve warning message in the re module (GH-31988)
A warning about inline flags not at the start of the regular
expression now contains the position of the flag.
(cherry picked from commit 4142961b9f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-03-19 07:09:45 -07:00
Serhiy Storchaka a5b7678a67
[3.10] bpo-40296: Fix supporting generic aliases in pydoc (GH-30253). (GH-31976)
(cherry picked from commit cd44afc573)
2022-03-18 20:46:31 +02:00
Miss Islington (bot) 0b5f99ad1a
bpo-46421: Fix unittest filename evaluation when called as a module (GH-30654)
(cherry picked from commit a0db11b10f)

Co-authored-by: Bader Zaidan <bader@zaidan.pw>
2022-03-17 17:00:52 -07:00
Miss Islington (bot) ba76f90192
bpo-47038: Increase a test timeout for slow CI machines (GH-31951)
(cherry picked from commit a7c5414832)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-16 18:20:02 -07:00
Miss Islington (bot) 36f62c5575
bpo-47038: Rewrite missed asyncio.wait_for test to use IsolatedAnsyncioTestCase (GH-31946) (#31948)
(cherry picked from commit 3dd9bfac04)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-17 02:19:51 +02:00
Miss Islington (bot) 4186dd662c
bpo-47038: Rewrite asyncio.wait_for test to use IsolatedAsyncioTestCase (GH-31942) (GH-31943)
(cherry picked from commit dd0082c627)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-16 22:15:08 +02:00
Miss Islington (bot) 88c243fd8d
bpo-43253: Don't call shutdown() for invalid socket handles (GH-31892)
(cherry picked from commit 70155412f1)

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2022-03-15 08:22:01 -07:00
Miss Islington (bot) 3c4f24face
bpo-20392: Fix inconsistency with uppercase file extensions in mimetypes.guess_type (GH-30229)
(cherry picked from commit 5dd7ec52b8)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-03-15 08:14:19 -07:00
Jason R. Coombs d929aa70e2
[3.10] bpo-47004: Sync with importlib_metadata 4.11.3. (GH-31854). (GH-31857)
(cherry picked from commit b1e2868607)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2022-03-13 17:29:50 -04:00
Matt Bogosian 3bc8019606
[3.10] bpo-46581: Propagate private vars via _GenericAlias.copy_with (GH-31061) (GH-31821)
(Cherry-picked from 32bf3597922ac3f613989582afa2bff43bea8a2f.)

GH-26091 added the _typevar_types and _paramspec_tvars instance
variables to _GenericAlias. However, they were not propagated
consistently. This commit addresses the most prominent deficiency
identified in bpo-46581 (namely their absence from
_GenericAlias.copy_with), but there could be others.

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-03-11 16:57:52 +02:00
Jelle Zijlstra 4199b7ffbb
[3.10] bpo-46198: rename duplicate tests and remove unused code (GH-30297) (GH-31796)
(cherry picked from commit 6c83c8e6b5)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-03-10 13:53:50 -08:00
Miss Islington (bot) 21c5b3f73f
bpo-44439: _ZipWriteFile.write() handle buffer protocol correctly (GH-29468)
Co-authored-by: Marco Ribeiro <marcoffee@users.noreply.github.com>
(cherry picked from commit 36dd7396fc)

Co-authored-by: Ma Lin <animalize@users.noreply.github.com>
2022-03-08 02:03:12 -08:00
Pablo Galindo Salgado 3594ebca2c
[3.10] bpo-46940: Don't override existing AttributeError suggestion information (GH-31710) (GH-31724)
When an exception is created in a nested call to PyObject_GetAttr, any
external calls will override the context information of the
AttributeError that we have already placed in the most internal call.
This will cause the suggestions we create to nor work properly as the
attribute name and object that we will be using are the incorrect ones.

To avoid this, we need to check first if these attributes are already
set and bail out if that's the case..
(cherry picked from commit 3b3be05a16)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-03-07 13:18:36 +00:00
Miss Islington (bot) 8acbb93c07
bpo-43292: Fix file leak in `ET.iterparse()` when not exhausted (GH-31696)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 496c428de3)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2022-03-07 02:31:52 -08:00
Miss Islington (bot) ee18df4252
bpo-14156: Make argparse.FileType work correctly for binary file modes when argument is '-' (GH-13165)
Also made modes containing 'a' or 'x' act the same as a mode containing 'w' when argument is '-'
(so 'a'/'x' return sys.stdout like 'w', and 'ab'/'xb' return sys.stdout.buffer like 'wb').
(cherry picked from commit eafec26ae5)

Co-authored-by: MojoVampire <shadowranger+github@gmail.com>
2022-03-06 04:12:06 -08:00
Victor Stinner 7b5b429ada
[3.10] bpo-46913: Fix test_ctypes, test_hashlib, test_faulthandler on UBSan (GH-31675)
* bpo-46913: Fix test_faulthandler.test_sigfpe() on UBSAN (GH-31662)

Disable undefined behavior sanitizer (UBSAN) on
faulthandler_sigfpe().

(cherry picked from commit 4173d677a1)

* bpo-46913: Fix test_faulthandler.test_read_null() on UBSan (GH31672)

Disable undefined behavior sanitizer (UBSan) on
faulthandler._read_null().

(cherry picked from commit 65b92ccdec)

* bpo-46913: test_hashlib skips _sha3 tests on UBSan (GH-31673)

If Python is built with UBSan, test_hashlib skips tests on the _sha3
extension which currently has undefined behaviors.

This change allows to run test_hashlib to check for new UBSan regression,
but the known _sha3 undefined behavior must be fixed.

(cherry picked from commit 6d0d7d2b8c)

* bpo-46913: Skip test_ctypes.test_shorts() on UBSan (GH-31674)

If Python is built with UBSan, test_ctypes now skips test_shorts().
This change allows to run test_ctypes to check for new UBSan regression,
but the known test_shorts() undefined behavior must be fixed.

(cherry picked from commit ad1b04451d)
2022-03-04 01:12:06 +01:00
Miss Islington (bot) 257f5be7f7
bpo-46643: Fix stringized P.args/P.kwargs with get_type_hints (GH-31238)
(cherry picked from commit 75d2d945b4)

Co-authored-by: Gregory Beauregard <greg@greg.red>
2022-03-02 18:26:50 -08:00
Victor Stinner 93264452d9
[3.10] bpo-46633: Skip tests on ASAN and/or MSAN builds (GH-31632) (GH-31634)
* Refactor sanitiser skip tests into test.support (GH-30889)

* Refactor sanitizer skip tests into test.support

(cherry picked from commit b1cb843050)

* Add skips to crashing tests under sanitizers instead of manually skipping them (GH-30897)

(cherry picked from commit a27505345e)

* bpo-46633: Skip tests on ASAN and/or MSAN builds (GH-31632)

Skip tests on ASAN and/or MSAN builds:

* multiprocessing tests
* test___all__
* test_concurrent_futures
* test_decimal
* test_peg_generator
* test_tools

(cherry picked from commit 9204bb72a2)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-03-02 17:05:14 +01:00
Miss Islington (bot) 2b7e04d612
bpo-46756: Fix authorization check in urllib.request (GH-31353)
Fix a bug in urllib.request.HTTPPasswordMgr.find_user_password() and
urllib.request.HTTPPasswordMgrWithPriorAuth.is_authenticated() which
allowed to bypass authorization. For example, access to URI "example.org/foobar"
was allowed if the user was authorized for URI "example.org/foo".
(cherry picked from commit e2e72567a1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-02-25 03:57:30 -08:00
Miss Islington (bot) c7a0fd2d3f
bpo-46820: Refactor tests for ambiguous end of numerical literal (GH-31494)
(cherry picked from commit 98c3bea4d1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-02-25 00:49:55 -08:00
Miss Islington (bot) 6717edcf84
Inherit asyncio proactor datagram transport from asyncio.DatagramTransport (GH-31512) (GH-31514)
(cherry picked from commit cff4d5c5d2)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-23 14:04:49 +02:00
Miss Islington (bot) d327517b54
bpo-46827: pass sock.type to getaddrinfo in sock_connect (GH-31499)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
(cherry picked from commit 8fb94893e4)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-02-22 13:09:35 -08:00
Miss Islington (bot) f20ac2ed07
bpo-46820: Fix a SyntaxError in a numeric literal followed by "not in" (GH-31479) (GH-31493)
Fix parsing a numeric literal immediately (without spaces) followed by
"not in" keywords, like in "1not in x". Now the parser only emits
a warning, not a syntax error.
(cherry picked from commit 090e5c4b94)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-02-22 12:00:50 +02:00
Miss Islington (bot) 7da97f6181
bpo-46811: Make test suite support Expat >=2.4.5 (GH-31453) (GH-31472)
Curly brackets were never allowed in namespace URIs
according to RFC 3986, and so-called namespace-validating
XML parsers have the right to reject them a invalid URIs.

libexpat >=2.4.5 has become strcter in that regard due to
related security issues; with ET.XML instantiating a
namespace-aware parser under the hood, this test has no
future in CPython.

References:
- https://datatracker.ietf.org/doc/html/rfc3968
- https://www.w3.org/TR/xml-names/

Also, test_minidom.py: Support Expat >=2.4.5
(cherry picked from commit 2cae93832f)

Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2022-02-21 17:16:09 +01:00
Miss Islington (bot) f1916cde24
bpo-46672: fix `NameError` in `asyncio.gather` if type check fails (GH-31187) (GH-31440)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit 4ab8167b9c)

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

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-20 17:28:42 +02:00
Miss Islington (bot) 103f3ca806
bpo-46603: improve coverage of `typing._strip_annotations` (GH-31063)
(cherry picked from commit 25c0b9d243)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-18 18:15:56 -08:00
Miss Islington (bot) 095ffe715e
Fix mistake in barry_as_FLUFL test (GH-31392)
Use assertEqual(), not assertTrue(lineno, 2)
(cherry picked from commit 5f1c205dce)

Co-authored-by: Patrick Reader <_@pxeger.com>
2022-02-17 18:11:34 -08:00
Miss Islington (bot) a17d59a6df
[3.10] bpo-46333: Honor `module` parameter in ForwardRef (GH-30536) (GH-31379)
The `module` parameter carries semantic information about the forward ref.
Forward refs are different if they refer to different module even if they
have the same name. This affects the `__eq__`, `__repr__` and `__hash__` methods.

Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 6e7b813195)


Co-authored-by: aha79 <34090357+aha79@users.noreply.github.com>

Automerge-Triggered-By: GH:JelleZijlstra
2022-02-16 19:53:03 -08:00
Mark Shannon d4e4ef107a
[3.10] bpo-46724: Use `JUMP_ABSOLUTE` for all backward jumps. (GH-31326) (GH-31354) 2022-02-16 11:26:02 +00:00
Miss Islington (bot) 3d407b9311
bpo-46762: Fix an assert failure in f-strings where > or < is the last character if the f-string is missing a trailing right brace. (GH-31365)
(cherry picked from commit ffd9f8ff84)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2022-02-16 03:16:05 -08:00
Miss Islington (bot) b7a65c939c
bpo-45948: Remove constructor discrepancy in C version of ElementTree.XMLParser (GH-31152)
Both implementations accept target=None now.
(cherry picked from commit 168fd6453b)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2022-02-12 00:50:11 -08:00
Miss Islington (bot) 1f5fe9962f
bpo-46615: Don't crash when set operations mutate the sets (GH-31120)
Ensure strong references are acquired whenever using `set_next()`. Added randomized test cases for `__eq__` methods that sometimes mutate sets when called.
(cherry picked from commit 4a66615ba7)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2022-02-11 12:44:17 -08:00
Petr Viktorin 8b8673fe94
[3.10] bpo-46433: _PyType_GetModuleByDef: handle static types in MRO (GH-30696) (GH-31262)
(cherry picked from commit 0ef0853012)
2022-02-11 12:25:25 +01:00
Miss Islington (bot) 1124ab6d1d
bpo-46246: add missing __slots__ to importlib.metadata.DeprecatedList (GH-30452)
Confirmed with @jaraco that this indeed needs a fix.

A question that came up while I was digging into the code: I think `SelectableGroups` could similarly use `__slots__ = ()`, since its purpose seems only for convenience around `dict`, not to have attributes of its own.

Automerge-Triggered-By: GH:jaraco
(cherry picked from commit dd76b3f7d3)

Co-authored-by: Arie Bovenberg <a.c.bovenberg@gmail.com>
2022-02-10 17:18:23 -08:00
Pablo Galindo Salgado 14284b0e71
[3.10] Allow the parser to avoid nested processing of invalid rules (GH-31252). (GH-31257)
(cherry picked from commit 390459de6d)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-02-10 14:38:31 +00:00
Andrew Svetlov 9f5145403b
[3.10] Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) (GH-31255)
(cherry picked from commit 012e77eb5c)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-10 15:27:15 +02:00
Pablo Galindo Salgado 9b23f8f78f
[3.10] bpo-46707: Avoid potential exponential backtracking in some syntax errors (GH-31241). (GH-31242)
(cherry picked from commit b71dc71905)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-02-10 03:54:47 +00:00
Miss Islington (bot) 42f87d435e
bpo-45863: tarfile: don't zero out header fields unnecessarily (GH-29693)
Numeric fields of type float, notably mtime, can't be represented
exactly in the ustar header, so the pax header is used. But it is
helpful to set them to the nearest int (i.e. second rather than
nanosecond precision mtimes) in the ustar header as well, for the
benefit of unarchivers that don't understand the pax header.

Add test for tarfile.TarInfo.create_pax_header to confirm correct
behaviour.
(cherry picked from commit bf2d44ffb0)

Co-authored-by: Joshua Root <jmr@macports.org>
2022-02-09 09:31:12 -08:00
Miss Islington (bot) d29bbc22b0
bpo-46685: cover `TypeError` of `ForwardRef(1)` in `test_typing` (GH-31223)
(cherry picked from commit d2d1d49eac)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-09 07:12:17 -08:00
Miss Islington (bot) c2735b75af
bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py (GH-31204) (GH-31207)
In `Lib/test/support/import_helper.py`, the function `make_legacy_pyc` makes a call to `os.rename` which can fail when the source and target live on different devices. This happens (for example) when `PYTHONPYCACHEPREFIX` is set to a directory anywhere on disk, while a ramdisk is mounted on `/tmp` (the latter of which is the default on various Linux distros). Replacing `os.rename` with `shutil.move` fixes this.

Automerge-Triggered-By: GH:brettcannon
(cherry picked from commit da576e0829)

Co-authored-by: Jason Wilkes <notarealdeveloper@gmail.com>
2022-02-08 13:04:05 -08:00
Gregory Beauregard cbdcae5ab9
[3.10] bpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203) (GH-31210)
(cherry picked from commit c8b62bbe46)

Co-authored-by: Gregory Beauregard <greg@greg.red>
2022-02-08 10:41:13 +02:00
Miss Islington (bot) 9539400390
[3.10] bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186) (GH-31189)
Re-enable test_issue16464() of test_urllib2, move it to urllib2_localnet
and use the local HTTP server rather than an external HTTP server.
(cherry picked from commit 8e98175a03)


Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-07 12:15:22 -08:00
Gregory Beauregard e2eeffefed
[3.10] bpo-46655: allow stringized TypeAlias with get_type_hints (GH-31156). (#31175)
(cherry picked from commit 77b025be4a)

Co-authored-by: Gregory Beauregard <greg@greg.red>
2022-02-07 08:21:56 -08:00
Nikita Sobolev c1ff4cb98b
[3.10] bpo-46611: add coverage to instance and class checks in `typing.py` (GH-31078) (GH-31182)
(cherry picked from commit 067c03bf40)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-07 10:48:20 +02:00
Miss Islington (bot) cb789944b2
Add more tests for variable substitution in generics (GH-31170)
(cherry picked from commit 3da5526136)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-02-06 12:15:29 -08:00
Miss Islington (bot) c88407ccf5
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)
POST requests to http://www.example.com/ fail randomly.
(cherry picked from commit 1578de2fcd)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-02-06 06:33:01 -08:00
Miss Islington (bot) 34895f694c
Optimize images by IMGbot (GH-21348)
Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
(cherry picked from commit ba650af7d6)
2022-02-04 16:31:21 +09:00
Miss Islington (bot) 5765eaa136
bpo-46616: Ensures test_importlib.test_windows cleans up registry keys after completion (GH-31086)
(cherry picked from commit 89a0a90c2e)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-02-02 12:25:37 -08:00
Miss Islington (bot) 85b421fbff
bpo-44359: Fix test_ftplib unhandled thread exceptions (GH-31069)
test_ftplib now silently ignores socket errors to prevent logging
unhandled threading exceptions.
(cherry picked from commit 0611eafc70)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-02-01 18:12:27 -08:00
Miss Islington (bot) 1dcd772804
bpo-44031: fix test_tabnanny failure in non-ascii CWD (GH-31014)
(cherry picked from commit 108e66b6d2)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-02-01 03:20:07 -08:00
Miss Islington (bot) 6a188d88c5
bpo-46482: add a test for `typing.Annotation.__new__` (GH-30821)
(cherry picked from commit 4c0612ad00)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-01 02:27:36 -08:00
Kumar Aditya a5451c96a1
bpo-26552: Fixed case where failing `asyncio.ensure_future` did not close the coroutine (#30288) (#31003) 2022-01-28 22:57:18 -08:00
Miss Islington (bot) 95b70e2ccf
bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (GH-30913)
(cherry picked from commit c27a33132b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-28 08:56:50 -08:00
Miss Islington (bot) 20f5313667
bpo-46542: test_json uses support.infinite_recursion() (GH-30972)
Fix test_json tests checking for RecursionError: modify these tests
to use support.infinite_recursion().
(cherry picked from commit e7a6285f1b)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-01-27 16:57:07 -08:00
Miss Islington (bot) bfcb41420a
bpo-46539: Pass status of special typeforms to forward references (GH-30926)
Previously this didn't matter because there weren't any valid code paths
that could trigger a type check with a special form, but after the bug
fix for `Annotated` wrapping special forms it's now possible to annotate
something like `Annotated['ClassVar[int]', (3, 4)]`. This change would
also be needed for proposed future changes, such as allowing `ClassVar`
and `Final` to nest each other in dataclasses.
(cherry picked from commit ced50051bb)

Co-authored-by: Gregory Beauregard <greg@greg.red>
2022-01-27 08:48:08 -08:00
Miss Islington (bot) 486a4b3829
bpo-44734: Fix floating point precision in test_turtle (GH-30910)
(cherry picked from commit aa78287bc6)

Co-authored-by: Karolina Surma <33810531+befeleme@users.noreply.github.com>
2022-01-27 06:21:15 -08:00
Petr Viktorin 5c39e474db
[3.10] bpo-45703: Invalidate _NamespacePath cache on importlib.invalidate_cache (GH-29384) (GH-30922)
Consider the following directory structure:

    .
    └── PATH1
        └── namespace
            └── sub1
                └── __init__.py

And both PATH1 and PATH2 in sys path:

    $ PYTHONPATH=PATH1:PATH2 python3.11
    >>> import namespace
    >>> import namespace.sub1
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace'])
    >>> ...

While this interpreter still runs, PATH2/namespace/sub2 is created:

    .
    ├── PATH1
    │   └── namespace
    │       └── sub1
    │           └── __init__.py
    └── PATH2
        └── namespace
            └── sub2
                └── __init__.py

The newly created module cannot be imported:

    >>> ...
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace'])
    >>> import namespace.sub2
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'namespace.sub2'

Calling importlib.invalidate_caches() now newly allows to import it:

    >>> import importlib
    >>> importlib.invalidate_caches()
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace'])
    >>> import namespace.sub2
    >>> namespace.__path__
    _NamespacePath(['.../PATH1/namespace', '.../PATH2/namespace'])

This was not previously possible.
2022-01-27 06:00:23 -08:00
Miss Islington (bot) 89db090295
bpo-44791: Fix substitution of ParamSpec in Concatenate with different parameter expressions (GH-27518)
* Substitution with a list of types returns now a tuple of types.
* Substitution with Concatenate returns now a Concatenate with
  concatenated lists of arguments.
* Substitution with Ellipsis is not supported.
(cherry picked from commit ecfacc362d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-01-27 05:01:24 -08:00
Miss Islington (bot) 2572c670d4
[3.10] bpo-23556: [doc] Fix inaccuracy in documentation for raise without args. Improve tests for context in nested except handlers. (GH-29236) (GH-30953)
(cherry picked from commit 08c0ed2d9c)


Co-authored-by: Kinshuk Dua <kinshukdua@gmail.com>

Automerge-Triggered-By: GH:iritkatriel
2022-01-27 02:51:06 -08:00
Miss Islington (bot) c730342005
bpo-46529: increase coverage of `typing.Union.__repr__` method (GH-30911)
(cherry picked from commit d0c690b5f8)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-26 02:39:40 -08:00
Pablo Galindo Salgado 3fc8b74ace
[3.10] bpo-46091: Correctly calculate indentation levels for whitespace lines with continuation characters (GH-30130). (GH-30898)
(cherry picked from commit a0efc0c196)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-01-25 22:33:57 +00:00
Victor Stinner 4a57fa296b
[3.10] bpo-45382: test.pythoninfo logs more Windows versions (GH-30891)
Add the following info to test.pythoninfo:

* windows.ver: output of the shell "ver" command
* windows.version and windows.version_caption: output of the
  "wmic os get Caption,Version /value" command.

(cherry picked from commit b0898f4aa9)

* bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890)

(cherry picked from commit cef0a5458f)
2022-01-25 21:20:34 +01:00
Miss Islington (bot) 75d88b91e6
bpo-41682: fixed flaky test test_sendfile_close_peer_in_the_middle_of_receiving (GH-30845) (#30860)
(cherry picked from commit 1c705fda8f)

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

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-01-25 18:40:13 +01:00
Ken Jin 9a7d010467
[3.10] bpo-46445, bpo-46519: Re-import typing.NewType (GH-30886)
Partially reverts 65b88d5e01.
2022-01-25 23:31:12 +08:00
Miss Islington (bot) 41e0aead3d
bpo-46491: Allow Annotated on outside of Final/ClassVar (GH-30864)
We treat Annotated type arg as class-level annotation. This exempts it from checks against Final and ClassVar in order to allow using them in any nesting order.

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

Co-authored-by: Gregory Beauregard <greg@greg.red>
2022-01-25 06:38:45 -08:00
Miss Islington (bot) 894e8c1348
bpo-46503: Prevent an assert from firing when parsing some invalid \N sequences in f-strings. (GH-30865) (GH-30866)
* bpo-46503: Prevent an assert from firing.  Also fix one nearby tiny PEP-7 nit.

* Added blurb.
(cherry picked from commit 0daf72194b)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2022-01-24 22:13:11 -05:00
Nikita Sobolev eaeb994680
[3.10] bpo-46416: Allow direct invocation of `Lib/test/test_typing.py` (GH-30641) (GH-30697)
Use `__name__`
(cherry picked from commit 2792d6d18e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-25 00:18:38 +08:00
Miss Islington (bot) b2c7fe1f61
Improve grouper() recipe to demonstrate all forms of zip() (GH-30837) (GH-30840) 2022-01-23 16:02:31 -06:00
Pablo Galindo Salgado 633db1c4eb
[3.10] bpo-46240: Correct the error for unclosed parentheses when the tokenizer is not finished (GH-30378). (GH-30819)
(cherry picked from commit 70f415fb8b)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-01-23 03:10:37 +00:00
Miss Islington (bot) f66ef3eab6
bpo-46266: Add calendar day of week constants to __all__ (GH-30412) (GH-30424)
(cherry picked from commit e5894ca8fd)

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

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-23 02:00:11 +01:00
Miss Islington (bot) 486b4d3d8e
bpo-41682: Skip unstable test_asyncio sendfile test on Windows (GH-30801) (GH-30812)
(cherry picked from commit 1ded8ed8e8)

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

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-23 01:58:16 +01:00
Miss Islington (bot) 83aef4d340
bpo-43118: Fix bug in inspect.signature around 'base.__text_signature__' (GH-30285) (#30765)
(cherry picked from commit 881a763cfe)

Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>

Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>
2022-01-22 09:28:48 -08:00
Miss Islington (bot) 6111d5dee2
bpo-46425: fix direct invocation of `asyncio` tests (GH-30725) (#30782)
(cherry picked from commit 5a5340044c)

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

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-22 14:29:51 +02:00
Miss Islington (bot) 90e2998db7
[3.10] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) (#30784)
* bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777)

* bpo-46469: Make asyncio generic classes return GenericAlias

* 📜🤖 Added by blurb_it.

* Update Misc/NEWS.d/next/Library/2022-01-22-05-05-08.bpo-46469.plUab5.rst

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit ea5b96842e)

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

* Fix tests

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-01-22 14:28:51 +02:00
Miss Islington (bot) d4a9e34401
bpo-46442: improve and rename testExceptionCleanupNames (GH-30758)
The test tested that explicitly deleting the local variable bound to the exception
did not cause problems, but it did not test what it actually claimed to test, i.e.
that the variable is deleted automatically.
(cherry picked from commit 82c53229e1)

Co-authored-by: Yellow Dusk <yellow.dusk1590@fastmail.com>
2022-01-21 23:34:29 -08:00
Miss Islington (bot) 46e6aad129
bpo-46445: Cover multiple inheritance of `TypedDict` in `test_typing` (GH-30719)
(cherry picked from commit 65b88d5e01)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-21 14:37:52 -08:00
Miss Islington (bot) 05063fa15c
bpo-46434: Handle missing docstrings in pdb help (GH-30705)
(cherry picked from commit 60705cff70)

Co-authored-by: Tom Sparrow <793763+sparrowt@users.noreply.github.com>
2022-01-21 11:32:43 -08:00
Miss Islington (bot) a1015c6478
bpo-46426: Improve tests for the dir_fd argument (GH-30668) (GH-30739)
Ensure that directory file descriptors refer to directories different
from the current directory, and that src_dir_fd and dst_dir_fd refer
to different directories.

Add context manager open_dir_fd() in test.support.os_helper.
(cherry picked from commit 54610bb448)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-01-21 19:31:25 +02:00
Miss Islington (bot) 1d11fdd3ee
bpo-21987: Fix TarFile.getmember getting a dir with a trailing slash (GH-30283)
(cherry picked from commit cfadcc31ea)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
2022-01-21 00:05:57 -08:00
Miss Islington (bot) e5edc8d737
bpo-46080: fix argparse help generation exception in edge case (GH-30111)
Fix an uncaught exception during help text generation when
argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS
and help is specified.
(cherry picked from commit 9e87c0e03f)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-20 15:13:17 -08:00
Miss Islington (bot) 1fb1f5d8bd
[3.10] bpo-46339: Fix crash in the parser when computing error text for multi-line f-strings (GH-30529) (GH-30542)
* bpo-46339: Fix crash in the parser when computing error text for multi-line f-strings (GH-30529)

Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit cedec19be8)

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

* Fix interactive mode

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-01-20 13:05:10 +00:00
Nikita Sobolev a6a0885480
[3.10] bpo-46425: Fix direct invocation of multiple test modules (GH-30666) (GH-30699) 2022-01-20 10:44:21 +09:00
Miss Islington (bot) 07b12fdf55
bpo-46437: remove useless `hasattr` from `test_typing` (GH-30704)
(cherry picked from commit 263c0dd160)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-19 14:30:07 -08:00
Miss Islington (bot) 39374c44d9
[3.10] bpo-46413: properly test `__{r}or__` code paths in `_SpecialGenericAlias` (GH-30640) (GH-30694)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 0a49148e87)


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

Automerge-Triggered-By: GH:Fidget-Spinner
2022-01-19 08:11:12 -08:00
Miss Islington (bot) baf26d07a6
bpo-46424: [typing] cover `Annotation[arg]` invalid usage in tests (GH-30663)
(cherry picked from commit 32398294fb)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-19 07:54:07 -08:00
Miss Islington (bot) 42038d00ea
bpo-46411: Remove unnecessary calls to sys.exc_info() in tests (GH-30638)
(cherry picked from commit a287b31bcb)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-01-17 23:33:00 -08:00
Miss Islington (bot) 1345b460f5
bpo-13886: Skip PTY non-ASCII tests if readline is loaded (GH-30631)
Skip test_builtin PTY tests on non-ASCII characters if the readline
module is loaded. The readline module changes input() behavior, but
test_builtin is not intented to test the readline module.

When the readline module is loaded, PyOS_Readline() uses the readline
implementation. In some cases, the Python readline callback
rlhandler() is called by readline with a string without non-ASCII
characters.
(cherry picked from commit ad6e640f91)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-01-17 05:35:07 -08:00
Miss Islington (bot) 3ce6945f5f
Define Py_BUILD_CORE_MODULE 2022-01-13 01:42:47 -08:00
Miss Islington (bot) a468866a67
bpo-46345: Add a test case for implicit `Optional` class attribute (GH-30535)
(cherry picked from commit 1de60155d5)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-12 17:45:49 -08:00
Miss Islington (bot) 19a85501ce
bpo-46237: Fix the line number of tokenizer errors inside f-strings (GH-30463)
(cherry picked from commit 6fa8b2ceee)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-01-11 08:33:08 -08:00
Miss Islington (bot) e0ec08dc49
bpo-46205: exit if no workers are alive in runtest_mp (GH-30470)
(cherry picked from commit e13cdca0f5)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2022-01-10 19:29:31 -08:00
Miss Islington (bot) d2245cf190
bpo-46299: improve `test_descr.py` with stricter error handling (GH-30471)
(cherry picked from commit e63066cfed)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-07 21:26:01 -08:00
Miss Islington (bot) e35430bec5
[3.10] bpo-42378: fixed log truncation on logging shutdown (GH-27310) (GH-30468)
Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
2022-01-07 22:15:25 +00:00
Miss Islington (bot) 3cb64ede57
bpo-46263: Fix second location that needs MALLOC_CONF on FreeBSD (GH-30440)
Automerge-Triggered-By: GH:tiran
(cherry picked from commit c9137d4b63)

Co-authored-by: Christian Heimes <christian@python.org>
2022-01-06 12:12:04 -08:00
Miss Islington (bot) b951dec441
bpo-46263: FreeBSD 14.0 jemalloc workaround for junk bytes of freed memory (GH-30434)
Automerge-Triggered-By: GH:tiran
(cherry picked from commit a4aa52dc28)

Co-authored-by: Christian Heimes <christian@python.org>
2022-01-06 07:36:47 -08:00
Miss Islington (bot) ba124672d7
bpo-20369: concurrent.futures.wait() now deduplicates futures given a… (GH-30168)
* bpo-20369: concurrent.futures.wait() now deduplicates futures given as arg.

* 📜🤖 Added by blurb_it.

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

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-01-04 06:27:13 -08:00
Miss Islington (bot) 576e38f9db
bpo-42918: Improve built-in function compile() in mode 'single' (GH-29934) (GH-30040)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit 28179aac79)

Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>
2021-12-27 17:15:44 +01:00
Serhiy Storchaka 03c7449fbc
[3.10] bpo-46032: Check types in singledispatch's register() at declaration time (GH-30050) (GH-30254)
The registry() method of functools.singledispatch() functions checks now
the first argument or the first parameter annotation and raises a TypeError if it is
not supported. Previously unsupported "types" were ignored (e.g. typing.List[int])
or caused an error at calling time (e.g. list[int]).

(cherry picked from commit 078abb676c)
2021-12-25 16:12:32 +02:00
Miss Islington (bot) 8005e22c9c
bpo-46150: ensure `fakeuser` does not exist in `PosixPathTest.test_expanduser` (GH-30240)
Ensure `fakeuser` does not exist in `PosixPathTest.test_expanduser`
(cherry picked from commit b8de8b7039)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2021-12-24 00:31:13 -08:00
Miss Islington (bot) 1c77aa9fc3
Allow test_pathlib to pass on systems where fakeuser exists. (GH-30244)
(cherry picked from commit d8880677a7)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2021-12-24 00:07:24 -08:00
Pablo Galindo Salgado dc73199a21
[3.10] bpo-46110: Add a recursion check to avoid stack overflow in the PEG parser (GH-30177) (GH-30214)
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>.
(cherry picked from commit e9898bf153)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-12-20 16:23:37 +00:00
Miss Islington (bot) 95948169d7
bpo-23819: Get rid of assert statements in test_asyncio (GH-30212) (GH-30213)
To keep checks even if run tests with optimized Python.

Either use special assertion methods like assertEqual() or
raise an AssertionError explicitly.
(cherry picked from commit 6ca78affc8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-12-20 14:50:45 +02:00
Andrew Svetlov cdb4579607
[3.10] bpo-46129: Rewrite asyncio.locks tests with IsolatedAsyncioTestCase (GH-30198) (GH-30202)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>.
(cherry picked from commit 9c06fd8951)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2021-12-19 17:17:40 +02:00
Miss Islington (bot) 4f945ad7a5
bpo-46099: Fix pthread_getcpuclockid test on Solaris (GH-30140) (GH-30183)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
(cherry picked from commit 427a490c49)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2021-12-18 15:49:01 +02:00
Miss Islington (bot) 251d2eadc7
bpo-46114: Fix OpenSSL version check for 3.0.1 (GH-30170)
(cherry picked from commit 2985feac4e)

Co-authored-by: Christian Heimes <christian@python.org>
2021-12-17 07:38:11 -08:00
Miss Islington (bot) 87539cc716
bpo-45755: [typing] Reveal class attributes of generic in generic aliases in `dir()` (GH-29962)
(cherry picked from commit d6e1374716)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-12-17 03:33:07 -08:00
Miss Islington (bot) cbb4d4a642
Fix a typo in the message from make_ssl_certs. (GH-30152) (GH-30161)
The file is utils.py not util.py.

Automerge-Triggered-By: GH:gpshead
(cherry picked from commit 69ef1b5998)

Co-authored-by: Yilei "Dolee" Yang <yileiyang9@gmail.com>
2021-12-16 21:51:11 -08:00
Miss Islington (bot) 09d7319bfe
bpo-46105: Honor spec when generating requirement specs with urls and extras. (GH-30151)
(cherry picked from commit 109d966021)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2021-12-16 13:19:14 -08:00
Miss Islington (bot) 8e4c96295b
bpo-26952: [argparse] clearer error when formatting an empty mutually… (GH-30099) (GH-30114)
(cherry picked from commit 86de99588d)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2021-12-15 12:20:04 +00:00
Miss Islington (bot) 908fd691f9
[3.10] bpo-46063: Add 'delay=True' to file handler initialization. (GH-30103) (GH-30104) 2021-12-14 17:27:00 +00:00
Miss Islington (bot) f84e2f6c0a
[3.10] bpo-46063: Improve algorithm for computing which rolled-over log file… (GH-30093) (GH-30094)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2021-12-14 01:17:56 +00:00
Serhiy Storchaka e55deaabd8
[3.10] bpo-27718: Fix help for the signal module (GH-30063) (GH-30080)
Functions signal(), getsignal(), pthread_sigmask(), sigpending(),
sigwait() and valid_signals() were omitted.

If __all__ is not defined all non-builtin functions should have
correct __module__.
(cherry picked from commit e08c0d8eec)
2021-12-13 12:14:51 +02:00
Miss Islington (bot) 94483f1e3c
bpo-46054: Fix parsing error when parsing non-utf8 characters in source files (GH-30068) (GH-30069)
(cherry picked from commit 4325a766f5)

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

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-12-12 16:52:49 +00:00
Miss Islington (bot) 438817fdd5
bpo-46042: Improve SyntaxError locations in the symbol table (GH-30059) (GH-30064)
(cherry picked from commit 59435eea08)

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

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-12-12 01:24:12 +00:00
Miss Islington (bot) e1e3f648ad
bpo-45822: Minor cleanups to the test_Py_CompileString test (GH-29750) (GH-29758)
(cherry picked from commit abfc794bbf)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-12-11 01:02:56 +01:00
Miss Islington (bot) 934a24c641
bpo-46025: Fix a crash in the atexit module for auto-unregistering functions (GH-30002) (GH-30005)
(cherry picked from commit f0d290d25c)

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

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-12-09 15:16:09 +00:00
Mark Shannon 99c72326d2
[3.10] bpo-46009: Do not exhaust generator when send() method raises (GH-29986). (GH-29988)
* [3.10] bpo-46009: Do not exhaust generator when send() method raises (GH-29986).
(cherry picked from commit 69806b9516)

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

* Rename variable after cherry-pick.

* Add NULL check.
2021-12-08 14:46:32 +00:00
Pablo Galindo Salgado c521412003
[3.10] bpo-46004: Fix error location for loops with invalid targets (GH-29959). (GH-29961)
(cherry picked from commit 1c7a1c3be0)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-12-07 15:23:33 +00:00
Miss Islington (bot) cb68c0a3a4
bpo-45664: Fix resolve_bases() and new_class() for GenericAlias instance as a base (GH-29298)
(cherry picked from commit 2b318ce1c9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-12-05 13:26:37 -08:00
Miss Islington (bot) abceb66c7e
bpo-45663: Fix is_dataclass() for dataclasses which are subclasses of types.GenericAlias (GH-29294)
(cherry picked from commit 446be16686)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-12-05 13:04:29 -08:00
Miss Islington (bot) f1dd5ed1f3
bpo-45662: Fix the repr of InitVar with a type alias to the built-in class (GH-29291)
For example, InitVar[list[int]].
(cherry picked from commit 1fd4de5bdd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-12-05 13:02:47 -08:00
Miss Islington (bot) beb834292d
bpo-27946: Fix possible crash in ElementTree.Element (GH-29915)
Getting an attribute via attrib.get() simultaneously with replacing
the attrib dict can lead to access to deallocated dict.
(cherry picked from commit d15cdb2f32)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-12-05 11:04:52 -08:00
Irit Katriel 4d2cc3ed46
bpo-45614: Fix traceback display for exceptions with invalid module name (GH-29726) (GH-29826)
(cherry picked from commit 4dfae6f38e)
2021-11-29 10:07:24 +00:00
Miss Islington (bot) 305236e03a
bpo-37658: Actually return result in race condition (GH-29202)
(cherry picked from commit 934a826237)

Co-authored-by: Sam Bull <aa6bs0@sambull.org>
2021-11-29 00:37:34 -08:00
Miss Islington (bot) 2c398a5acf
[3.10] bpo-19460: Add test for MIMENonMultipart (GH-29817) (GH-29818)
Co-authored-by: 180909 <wjh180909@gmail.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2021-11-28 12:57:10 +02:00
Pablo Galindo Salgado c72311d917
[3.10] bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside parentheses. (GH-29767)
Backport of GH-29757

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-11-25 01:01:40 +00:00
Miss Islington (bot) 56b5cd52ab
bpo-45859: Mark test_field_descriptor in test_collections as CPython-only (GH-29691) (GH-29708)
(cherry picked from commit 4fad314246)

Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>

Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
2021-11-22 09:05:54 -06:00
Miss Islington (bot) 10343bd983
bpo-44649: Fix dataclasses(slots=True) with a field with a default, but init=False (GH-29692)
Special handling is needed, because for non-slots dataclasses the instance attributes are not set: reading from a field just references the class's attribute of the same name, which contains the default value. But this doesn't work for classes using __slots__: they don't read the class's attribute. So in that case (and that case only), initialize the instance attribute. Handle this for both normal defaults, and for fields using default_factory.
(cherry picked from commit d3062f672c)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2021-11-22 05:47:41 -08:00
Miss Islington (bot) 9841ac2da5
bpo-45852: Fix the Counter/iter test for statistics.mode() (GH-29667) (GH-29671)
Suggested by Stefan Pochmann.
(cherry picked from commit 48744db70e)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2021-11-20 18:27:44 -06:00
Miss Islington (bot) cf8c8788c9
Added kw_only parameter to make_dataclasses. (GH-29679)
(cherry picked from commit f7638dd0f9)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2021-11-20 15:46:56 -08:00
Pablo Galindo Salgado 511ee1c0fa
[3.10] bpo-45727: Make the syntax error for missing comma more consistent (GH-29427) (GH-29647)
(cherry picked from commit 546cefcda7)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-11-20 17:39:17 +00:00
Łukasz Langa 904af3de2b
[3.10] bpo-45848: Allow the parser to get error lines from encoded files (GH-29646) (GH-29661)
(cherry picked from commit fdcc46d955)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-11-20 16:34:56 +01:00
Miss Islington (bot) 5cf05c71d1
bpo-45835: Fix race condition in test_queue (GH-29601) (GH-29612)
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 17:05:40 +01:00
Łukasz Langa 8eabe60108
[3.10] bpo-45826: Fix a crash in suggestions.c by checking for `traceback is None` (GH-29590) (GH-29602)
(cherry picked from commit 5d90c467c0)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2021-11-18 01:28:04 +01:00
Pablo Galindo Salgado e3aa9fd77b
[3.10] bpo-45822: Respect PEP 263's coding cookies in the parser even if flags are not provided (GH-29582) (GH-29586)
(cherry picked from commit da20d7401d)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-11-18 00:17:18 +01:00
Miss Islington (bot) 1079b3e3cb
bpo-42540: reallocation of id_mutex should not force default allocator (GH-29564)
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 13:16:01 -08:00
Pablo Galindo Salgado 5618c81e13
[3.10] bpo-45716: Improve the error message when using True/False/None as keywords in a call (GH-29413). (GH-29428)
(cherry picked from commit e2d65630f3)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-11-16 22:31:16 +00:00
Miss Islington (bot) bf26a6da7a
bpo-45738: Fix computation of error location for invalid continuation (GH-29550)
characters in the parser
(cherry picked from commit 25835c518a)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-11-13 17:30:03 -08:00
Miss Islington (bot) e4c5a5eaba
bpo-45235: Revert an argparse bugfix that caused a regression (GH-29525) (GH-29530) 2021-11-12 12:44:55 -06:00
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