Commit Graph

26601 Commits

Author SHA1 Message Date
Yurii Karabas ac472b316c
[3.9] bpo-42345: Fix three issues with typing.Literal parameters (GH-23294) (GH-23335)
Literal equality no longer depends on the order of arguments.

Fix issue related to `typing.Literal` caching by adding `typed` parameter to `typing._tp_cache` function.

Add deduplication of `typing.Literal` arguments.

(cherry picked from commit f03d318ca4)

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
2020-11-17 07:23:36 -08:00
Miss Islington (bot) 656d50f98d
bpo-40637: Don't test builtin PBKDF2 without builtin hashes (GH-20980)
Skip testing of pure Python PBKDF2 when one or more builtin hash module
is not available. Otherwise the import of hashlib prints noise on
stderr.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 975022b77b)

Co-authored-by: Christian Heimes <christian@python.org>
2020-11-17 07:01:55 -08:00
Lysandros Nikolaou 2b800ef809
bpo-42374: Allow unparenthesized walrus in genexps (GH-23319) (GH-23329)
This fixes a regression that was introduced by the new parser.

(cherry picked from commit cb3e5ed071)
2020-11-17 01:38:58 +02:00
Miss Islington (bot) cf70854f10
bpo-42350: Fix Thread._reset_internal_locks() (GH-23268)
Fix the threading.Thread class at fork: do nothing if the thread is
already stopped (ex: fork called at Python exit). Previously, an
error was logged in the child process.
(cherry picked from commit 5909a494cd)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-11-16 07:17:17 -08:00
Miss Islington (bot) 33922cb0aa
bpo-42140: Improve asyncio.wait function (GH-22938)
GH- Improve asyncio.wait function

The original code creates the futures set two times.
We can create this set before, avoiding the second creation.

This new behaviour [breaks the aiokafka library](https://github.com/aio-libs/aiokafka/pull/672), because it gives an iterator to that function, so the second iteration become empty.

Automerge-Triggered-By: GH:1st1
(cherry picked from commit 7e5ef0a571)

Co-authored-by: Diogo Dutra <diogodutradamata@gmail.com>
2020-11-10 15:10:57 -08:00
Miss Islington (bot) 90115a2cf7
bpo-42183: Fix a stack overflow error for asyncio Task or Future repr() (GH-23020)
The overflow occurs under some circumstances when a task or future
recursively returns itself.

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit 42d873c63a)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2020-11-10 06:20:52 -08:00
Miss Islington (bot) e81e09bfc8
bpo-42233: Correctly repr GenericAlias when used with typing module (GH-23081)
Noticed by @serhiy-storchaka in the bpo.  `typing`'s types were not showing the parameterized generic.
Eg. previously:
```python
>>> typing.Union[dict[str, float], list[int]]
'typing.Union[dict, list]'
```
Now:
```python
>>> typing.Union[dict[str, float], list[int]]
'typing.Union[dict[str, float], list[int]]'
```

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

Co-authored-by: kj <28750310+Fidget-Spinner@users.noreply.github.com>
2020-11-07 08:46:08 -08:00
Miss Islington (bot) 3997a4e6bc
Disable peg generator tests when building with PGO (GH-23141)
Otherwise, when running the testsuite, test_peg_generator tries to compile C
code using the optimized flags and fails because it cannot find the profile
data.
(cherry picked from commit 100964e031)

Co-authored-by: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
2020-11-04 15:22:13 -08:00
Miss Skeleton (bot) e277cb7698
bpo-42103: Improve validation of Plist files. (GH-22882)
* Prevent some possible DoS attacks via providing invalid Plist files
  with extremely large number of objects or collection sizes.
* Raise InvalidFileException for too large bytes and string size instead of returning garbage.
* Raise InvalidFileException instead of ValueError for specific invalid datetime (NaN).
* Raise InvalidFileException instead of TypeError for non-hashable dict keys.
* Add more tests for invalid Plist files.
(cherry picked from commit 34637a0ce2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-11-02 13:34:46 -08:00
Lysandros Nikolaou 723e21a8e7
bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067)
(cherry picked from commit 301822859b)
2020-11-02 17:51:56 +02:00
Miss Skeleton (bot) 3defcbac2c
[3.9] bpo-29566: binhex.binhex now consitently writes MacOS 9 line endings. (GH-23059) (GH-23071)
[[bpo-29566]()]() notes that binhex.binhex uses inconsistent line endings (both Unix and MacOS9 line endings are used). This PR changes this to use the MacOS9 line endings everywhere.
(cherry picked from commit 2165cea548)


Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>

Automerge-Triggered-By: GH:ronaldoussoren
2020-11-01 01:39:26 -08:00
Lysandros Nikolaou cfcb952e30
[3.9] bpo-42218: Correctly handle errors in left-recursive rules (GH-23065) (GH-23066)
Left-recursive rules need to check for errors explicitly, since
even if the rule returns NULL, the parsing might continue and lead
to long-distance failures.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
(cherry picked from commit 02cdfc93f8)

Automerge-Triggered-By: GH:lysnikolaou
2020-10-31 12:06:03 -07:00
Pablo Galindo ddcd57e3ea
[3.9] bpo-42214: Fix check for NOTEQUAL token in the PEG parser for the barry_as_flufl rule (GH-23048) (GH-23051)
(cherry picked from commit 06f8c3328d)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-10-31 00:40:42 +00:00
Lysandros Nikolaou c4b58cea47
[3.9] bpo-41659: Disallow curly brace directly after primary (GH-22996) (#23006)
(cherry picked from commit 15acc4eaba)
2020-10-28 00:38:42 +02:00
Miss Skeleton (bot) c12afa92b0
[3.9] bpo-42146: Fix memory leak in subprocess.Popen() in case of uid/gid overflow (GH-22966) (GH-22980)
Fix memory leak in subprocess.Popen() in case of uid/gid overflow

Also add a test that would catch this leak with `--huntrleaks`.

Alas, the test for `extra_groups` also exposes an inconsistency
in our error reporting: we use a custom ValueError for `extra_groups`,
but propagate OverflowError for `user` and `group`.
(cherry picked from commit c0590c0033)


Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>

Automerge-Triggered-By: GH:gpshead
2020-10-25 17:34:29 -07:00
Serhiy Storchaka 0aaecb3048
[3.9] bpo-41052: Fix pickling heap types implemented in C with protocols 0 and 1 (GH-22870). (GH-22963)
(cherry picked from commit 8cd1dbae32)
2020-10-25 17:56:17 +02:00
Miss Skeleton (bot) c437fe39cf
[3.9] bpo-40592: shutil.which will not return None anymore if ; is the last char in PATHEXT (GH-20088) (GH-22912)
shutil.which will not return None anymore for empty str in PATHEXT
Empty PATHEXT will now be defaulted to _WIN_DEFAULT_PATHEXT
(cherry picked from commit da6f098188)


Co-authored-by: Christopher Marchfelder <marchfelder@googlemail.com>
2020-10-23 14:38:05 -07:00
Inada Naoki 8f6787d93d
bpo-42057: Add a test case (GH-22878) 2020-10-22 11:28:36 +09:00
Miss Skeleton (bot) 7917170c5b
bpo-41316: Make tarfile follow specs for FNAME (GH-21511)
tarfile writes full path to FNAME field of GZIP format instead of just basename if user specified absolute path. Some archive viewers may process file incorrectly. Also it creates security issue because anyone can know structure of directories on system and know username or other personal information.

RFC1952 says about FNAME:
This is the original name of the file being compressed, with any directory components removed.

So tarfile must remove directory names from FNAME and write only basename of file.

Automerge-Triggered-By: @jaraco
(cherry picked from commit 22748a83d9)

Co-authored-by: Artem Bulgakov <ArtemSBulgakov@ya.ru>
2020-10-20 22:29:00 -07:00
Miss Skeleton (bot) c17ff5cad2
bpo-38324: Fix test__locale.py Windows failures (GH-20529)
Use wide-char _W_* fields of lconv structure on Windows
Remove "ps_AF" from test__locale.known_numerics on Windows
(cherry picked from commit f2312037e3)

Co-authored-by: TIGirardi <tiagoigirardi@gmail.com>
2020-10-20 05:07:14 -07:00
Miss Skeleton (bot) 3fc7080220
bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764) (GH-22806)
(cherry picked from commit 3185267400)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2020-10-20 10:05:21 +02:00
Miss Skeleton (bot) aa7b03b31b
bpo-41471: Ignore invalid prefix lengths in system proxy settings on macOS (GH-22762) (GH-22773)
(cherry picked from commit 93a1ccabde)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2020-10-20 09:17:22 +02:00
Miss Skeleton (bot) 479553c7c1
bpo-42051: Reject XML entity declarations in plist files (GH-22760)
(cherry picked from commit 05ee790f4d)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2020-10-19 19:34:37 -07:00
Miss Skeleton (bot) e43bee7e11
bpo-38912: fix close before connect callback in test_asyncio SSL tests (GH-22691)
Reduces the rate at which the ENV CHANGED failure occurs in test_asyncio SSL tests (due to unclosed transport), but does not 100% resolve it.
(cherry picked from commit de73d432bb)

Co-authored-by: Justin Turner Arthur <justinarthur@gmail.com>
2020-10-19 18:40:01 -07:00
Miss Skeleton (bot) 72ce82abcf
bpo-27321 Fix email.generator.py to not replace a non-existent header. (GH-18074)
This PR replaces GH-1977. The reason for the replacement is two-fold.

The fix itself is different is that if the CTE header doesn't exist in the original message, it is inserted. This is important because the new CTE could be quoted-printable whereas the original is implicit 8bit.

Also the tests are different. The test_nonascii_as_string_without_cte test in GH-1977 doesn't actually test the issue in that it passes without the fix. The test_nonascii_as_string_without_content_type_and_cte test is improved here, and even though it doesn't fail without the fix, it is included for completeness.

Automerge-Triggered-By: @warsaw
(cherry picked from commit bf838227c3)

Co-authored-by: Mark Sapiro <mark@msapiro.net>
2020-10-19 16:11:37 -07:00
Anthony Sottile 7c949020ef
bpo-40492: Fix --outfile with relative path when the program changes it working dir (GH-19910)
(cherry picked from commit 3c0ac18504)
2020-10-19 00:16:22 +03:00
Miss Skeleton (bot) a055ced9d4
bpo-41966: Fix pickling pure datetime.time subclasses (GH-22731) (GH-22747)
(cherry picked from commit c304c9a7ef)

Co-authored-by: scaramallion <scaramallion@users.noreply.github.com>
2020-10-18 18:32:56 +03:00
Miss Skeleton (bot) 6a2aa4994e
bpo-42065: Fix incorrectly formatted _codecs.charmap_decode error message (GH-19940)
(cherry picked from commit 3635388f52)

Co-authored-by: Max Bernstein <tekknolagi@users.noreply.github.com>
2020-10-18 09:00:18 +03:00
Miss Skeleton (bot) d197b2bb3e
bpo-41984: GC track all user classes (GH-22701/GH-22702)
(cherry picked from commit c13b847a6f)
2020-10-14 20:38:25 -07:00
Miss Skeleton (bot) 881a13cad5
bpo-41939: always enable test_site.test_license_exists_at_url (GH-22688)
(cherry picked from commit 6a48518e8d)

Co-authored-by: Ned Deily <nad@python.org>
2020-10-13 18:59:41 -07:00
Saiyang Gou 1c217652b6
[3.9] bpo-39481: Fix duplicate SimpleQueue type in test_genericalias.py (GH-22619) (#22624)
There are two different `SimpleQueue` types imported (from `multiprocessing.queues` and `queue`) in `Lib/test/test_genericalias.py`, the second one shadowing the first one, making the first one not actually tested. Fix by using different names.

Automerge-Triggered-By: @gvanrossum.
(cherry picked from commit b2c0a43699)

Co-authored-by: Saiyang Gou <gousaiyang@163.com>
2020-10-12 16:52:03 -07:00
Victor Stinner f5393dc2a0
bpo-41739: Fix test_logging.test_race_between_set_target_and_flush() (GH-22655) (GH-22656)
The test now waits until all threads complete to avoid leaking
running threads.

Also, use regular threads rather than daemon threads.

(cherry picked from commit 13ff396c01)
2020-10-12 05:30:48 +01:00
Karthikeyan Singaravelan 20bdeedfb4
[3.9] bpo-41371: Handle lzma lib import error in test_zoneinfo.py (GH-21734) (GH-22039)
(cherry picked from commit 5f0769a)

Co-authored-by: Nathan M <nathanmaynes@gmail.com>
2020-10-10 10:09:09 +05:30
Batuhan Taskaya 42157b9eaa
[3.9] bpo-41979: Accept star-unpacking on with-item targets (GH-22611) (GH-22612)
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>

Automerge-Triggered-By: @pablogsal
2020-10-09 03:31:07 -07:00
Karthikeyan Singaravelan c6f41e62f5
[3.9] bpo-41970: Avoid test failure in test_lib2to3 if the module is already imported (GH-22595) (GH-22609)
(cherry picked from commit 4a9f82f50d)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-10-09 11:08:42 +01:00
Miss Skeleton (bot) b664a1df4e
bpo-41944: No longer call eval() on content received via HTTP in the CJK codec tests (GH-22566)
(cherry picked from commit 2ef5caa58f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-10-06 05:37:36 -07:00
Miss Skeleton (bot) 10b4136bfa
bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559) (#22567)
Call urllib.request.urlcleanup() to reset the global
urllib.request._opener.
(cherry picked from commit 1fce240d6c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-10-05 18:49:41 +02:00
Serhiy Storchaka 7aa22ba923
[3.9] bpo-41909: Enable previously disabled recursion checks. (GH-22536) (GH-22550)
Enable recursion checks which were disabled when get __bases__ of
non-type objects in issubclass() and isinstance() and when intern
strings. It fixes a stack overflow when getting __bases__ leads
to infinite recursion.

Originally recursion checks was disabled for PyDict_GetItem() which
silences all errors including the one raised in case of detected
recursion and can return incorrect result. But now the code uses
PyDict_GetItemWithError() and PyDict_SetDefault() instead.
(cherry picked from commit 9ece9cd65c)
2020-10-05 01:27:38 +03:00
Pablo Galindo 7b7aa94e51
[3.9] bpo-41840: Report module-level globals as both local and global in the symtable module (GH-22391). (GH-22528)
(cherry picked from commit fb0a4651f1)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-10-03 21:23:03 +01:00
Miss Skeleton (bot) a0f2b66433
bpo-41900: C14N 2.0 serialisation failed for unprefixed attributes when a default namespace was defined. (GH-22474) (GH-22507)
(cherry picked from commit 6a412c94b6)
2020-10-03 08:41:35 +02:00
Miss Islington (bot) 048f54dc75
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-19337)
(cherry picked from commit ff9147d93b)

Co-authored-by: Jan Mazur <16736821+mzr@users.noreply.github.com>
2020-09-28 13:18:47 -07:00
Łukasz Langa ca8d46dd42
[3.9] bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (GH-21956) (#22397)
Closes bpo issue 41602.
(cherry picked from commit a68a2ad19c)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2020-09-24 16:34:21 +02:00
Miss Islington (bot) 0e4d526de4
bpo-41811: create SortKey members using first given value (GH-22316) (GH-22325)
(cherry picked from commit ae0d2a33ec)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2020-09-19 12:56:13 -07:00
Ethan Furman a9ba8ba9a7
[3.9] bpo-39728: Enum: fix duplicate `ValueError` (GH-22277) (GH-22282)
fix default `_missing_` to return `None` instead of raising a `ValueError`
Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>
(cherry picked from commit c95ad7a91f)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2020-09-16 17:37:51 -07:00
Miss Islington (bot) 4465df6266
_auto_called cleanup (GH-22285)
(cherry picked from commit fc23a9483e)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2020-09-16 17:27:09 -07:00
Miss Islington (bot) 48f99250ff
bpo-41517: do not allow Enums to be extended (GH-22271)
fix bug that let Enums be extended via multiple inheritance
(cherry picked from commit 3064dbf5df)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2020-09-16 07:35:14 -07:00
Łukasz Langa 7e356f17e4
[3.9] bpo-41687: Fix sendfile implementation to work with Solaris (GH-22040) (GH-22273)
(cherry picked from commit 8c0be6fd91)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2020-09-16 13:52:26 +02:00
Ethan Furman a4677068dd
[3.9] bpo-41789: honor object overrides in Enum classes (GH-22250) (GH-22272)
EnumMeta double-checks that `__repr__`, `__str__`, `__format__`, and `__reduce_ex__` are not the same as `object`'s, and replaces them if they are -- even if that replacement was intentionally done in the Enum being constructed.  This patch fixes that.
2020-09-16 03:58:33 -07:00
Miss Islington (bot) 95b81e2f8c
bpo-39587: Enum - use correct mixed-in data type (GH-22263) (GH-22266)
(cherry picked from commit bff01f3a3a)
2020-09-15 16:59:48 -07:00
Miss Islington (bot) 49917d576a
bpo-41780: Fix __dir__ of types.GenericAlias (GH-22262)
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 2e87774df1)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2020-09-15 16:37:13 -07:00
Pablo Galindo 55e0836849
[3.9] bpo-41631: _ast module uses again a global state (GH-21961) (GH-22258)
Partially revert commit ac46eb4ad6662cf6d771b20d8963658b2186c48c:
"bpo-38113: Update the Python-ast.c generator to PEP384 (gh-15957)".

Using a module state per module instance is causing subtle practical
problems.

For example, the Mercurial project replaces the __import__() function
to implement lazy import, whereas Python expected that "import _ast"
always return a fully initialized _ast module.

Add _PyAST_Fini() to clear the state at exit.

The _ast module has no state (set _astmodule.m_size to 0). Remove
astmodule_traverse(), astmodule_clear() and astmodule_free()
functions..
(cherry picked from commit e5fbe0cbd4)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-09-15 20:32:56 +02:00
Miss Islington (bot) 34e3c7592b
bpo-41731: Make test_cmd_line_script pass with -vv (GH-22206)
Argument script_exec_args is usually an absolute file name,
but twice has form ['-m', 'module_name'].
(cherry picked from commit 7e711ead26)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-09-11 23:45:34 -07:00
Miss Islington (bot) 11a82c7220
bpo-41525: Make the Python program help ASCII-only (GH-21836)
(cherry picked from commit 58de1dd6a8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-09-08 17:47:53 -07:00
Miss Islington (bot) 1671b0e4e0
bpo-41720: Add "return NotImplemented" in turtle.Vec2D.__rmul__(). (GH-22092)
(cherry picked from commit fd4cafd470)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-09-07 09:30:21 -07:00
Victor Stinner c73ee5acc9
bpo-41401: Fix test_fspath_support in test_io. (GH-21640) (GH-22133)
The error is exposed on non-UTF-8 locales.

(cherry picked from commit 67987acd5d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-09-07 16:45:57 +02:00
Miss Islington (bot) a708ae7470
bpo-41218: Improve the test cases for test_compile_top_level_await_no_coro (GH-21363) (GH-22109)
(cherry picked from commit c2c1f1f906)

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

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-09-05 16:37:04 +01:00
Miss Islington (bot) d64d78be20
bpo-41531: Fix compilation of dict literals with more than 0xFFFF elements (GH-21850) (GH-22107)
(cherry picked from commit c51db0ea40)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-09-05 00:38:50 +01:00
Miss Islington (bot) e92219d8f8
bpo-29590: fix stack trace for gen.throw() with yield from (GH-19896)
* Add failing test.

* bpo-29590: fix stack trace for gen.throw() with yield from (GH-NNNN)

When gen.throw() is called on a generator after a "yield from", the
intermediate stack trace entries are lost.  This commit fixes that.
(cherry picked from commit 8b33961e4b)

Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
2020-09-04 16:07:18 -07:00
Miss Islington (bot) 8f13ff959a
bpo-41700: Skip test if the locale is not supported (GH-22081) (GH-22085)
(cherry picked from commit 54a66ade20)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2020-09-04 18:55:25 +09:00
Miss Islington (bot) 8d68e59f11
bpo-39010: Improve test shutdown (GH-22066) (#22082)
Simply closing the event loop isn't enough to avoid warnings. If we
don't also shut down the event loop's default executor, it sometimes
logs a "dangling thread" warning.

Follow-up to GH-22017
(cherry picked from commit be435ae2b0)

Co-authored-by: Ben Darnell <ben@bendarnell.com>

Co-authored-by: Ben Darnell <ben@bendarnell.com>
2020-09-03 13:54:43 -07:00
Miss Islington (bot) a2680058ee
bpo-41696: Fix handling of debug mode in asyncio.run (GH-22069) (#22071)
* bpo-41696: Fix handling of debug mode in asyncio.run

This allows PYTHONASYNCIODEBUG or -X dev to enable asyncio debug mode
when using asyncio.run

* 📜🤖 Added by blurb_it.

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

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2020-09-03 13:54:09 -07:00
Miss Islington (bot) 49571c0b0e
bpo-39010: Fix errors logged on proactor loop restart (GH-22017) (#22034)
Stopping and restarting a proactor event loop on windows can lead to
spurious errors logged (ConnectionResetError while reading from the
self pipe). This fixes the issue by ensuring that we don't attempt
to start multiple copies of the self-pipe reading loop.
(cherry picked from commit ea5a6363c3)

Co-authored-by: Ben Darnell <ben@bendarnell.com>

Co-authored-by: Ben Darnell <ben@bendarnell.com>
2020-09-03 12:38:29 -07:00
Pablo Galindo 270e249290
[3.9] Fix 'gather' rules in the python parser generator (GH-22021) (GH-22080)
Currently, empty sequences in gather rules make the conditional for
gather rules fail as empty sequences evaluate as "False". We need to
explicitly check for "None" (the failure condition) to avoid false
negatives.
(cherry picked from commit e55a0e9)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-09-03 16:35:36 +01:00
Miss Islington (bot) 63fa113c60
Fixed mistake in test for f-string error description (GH-22036) (GH-22059) (GH-22060)
(cherry picked from commit 749ed85e44)

Co-authored-by: han-solo <hanish0019@gmail.com>

Co-authored-by: han-solo <hanish0019@gmail.com>
2020-09-02 08:13:39 -04:00
Pablo Galindo d14775ddbb
[3.9] bpo-41654: Fix deallocator of MemoryError to account for subclasses (GH-22020) (GH-22045)
When allocating MemoryError classes, there is some logic to use
pre-allocated instances in a freelist only if the type that is being
allocated is not a subclass of MemoryError. Unfortunately in the
destructor this logic is not present so the freelist is altered even
with subclasses of MemoryError..
(cherry picked from commit 9b648a95cc)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-09-01 21:40:57 +01:00
Miss Islington (bot) c16a2a1b64
bpo-41681: Fix for `f-string/str.format` error description when using 2 `,` in format specifier (GH-22036) (GH-22041)
* Fixed `f-string/str.format` error description when using two `,` in format specifier.

Co-authored-by: millefalcon <hanish0019@hmail.com>
(cherry picked from commit 0d6aa7f0ee)

Co-authored-by: han-solo <hanish0019@gmail.com>

Co-authored-by: han-solo <hanish0019@gmail.com>
2020-09-01 11:45:59 -04:00
Miss Islington (bot) ca55ecbf9a
bpo-41344: Raise ValueError when creating shared memory of size 0 (GH-21556) (GH-22018)
(cherry picked from commit 475a5fbb56)

Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com>

Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com>
2020-08-30 20:42:22 +01:00
Miss Islington (bot) 7361451b97
bpo-41609: Fix output of pdb's whatis command for instance methods (GH-21935) (#21977)
(cherry picked from commit 022bc7572f)

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
2020-08-27 03:17:40 +02:00
Miss Islington (bot) 211e4c6e9c
bpo-33660: Fix PosixPath to resolve a relative path on root (#21974)
(cherry picked from commit 94ad6c674f)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2020-08-27 02:51:44 +02:00
Miss Islington (bot) 9de6be4e2a
bpo-37658: Fix asyncio.wait_for() to respect waited task status (GH-21894) (GH-21964)
Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already.
(cherry picked from commit a2118a1462)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
2020-08-26 19:15:35 +02:00
Miss Islington (bot) 1036ccb55d
bpo-32751: Wait for task cancel in asyncio.wait_for() when timeout <= 0 (GH-21895) (GH-21963)
When I was fixing bpo-32751 back in GH-7216 I missed the case when
*timeout* is zero or negative.  This takes care of that.

Props to @aaliddell for noticing the inconsistency.
(cherry picked from commit c517fc7121)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
2020-08-26 19:14:59 +02:00
Miss Islington (bot) 2c050e52f1
[3.9] bpo-41503: Fix race between setTarget and flush in logging.handlers.MemoryHandler (GH-21765) (GH-21897)
(cherry picked from commit 2353d77fad)


Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>

Automerge-Triggered-By: @vsajip
2020-08-16 08:34:27 -07:00
Miss Islington (bot) 28bf82661a
bpo-41540: AIX: skip test that is flaky with a default ulimit. (GH-21890) (#21893)
- AIX has extreme over-allocation that is in no relation to the physical
    RAM and swap.

(cherry picked from commit 39dab24621)

Authored-by: Stefan Krah <skrah@bytereef.org>
2020-08-15 20:40:14 +02:00
Miss Islington (bot) 33d3c64095
bpo-41025: Fix subclassing for zoneinfo.ZoneInfo (GH-20965) (GH-21876)
Prior to this change, attempting to subclass the C implementation of
zoneinfo.ZoneInfo gave the following error:

    TypeError: unbound method ZoneInfo.__init_subclass__() needs an argument

https://bugs.python.org/issue41025
(cherry picked from commit 87d8287865)

Co-authored-by: Paul Ganssle <paul@ganssle.io>
2020-08-14 11:18:24 -04:00
Terry Jan Reedy f24430f154
[3.9] bpo-41520: Fix second codeop regression (GH-21848)
Fix the repression introduced by the initial regression fix.

(cherry picked from commit c818b15fa5)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-08-13 14:21:32 -04:00
Miss Islington (bot) 90eff4ed44
bpo-41520: codeop no longer ignores SyntaxWarning (GH-21838)
(cherry picked from commit 369a1cbdee)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-08-12 06:13:09 -07:00
Łukasz Langa 439c93d51f
Python 3.9.0rc1 2020-08-11 20:58:17 +02:00
Victor Stinner a0b57b3317
bpo-38912: regrtest logs unraisable exception into sys.__stderr__ (GH-21718) (GH-21827)
regrtest_unraisable_hook() temporarily replaces sys.stderr with
sys.__stderr__ to help to display errors when a test captures stderr.

(cherry picked from commit 701b63894f)
2020-08-11 17:03:33 +02:00
Steve Dower 70e9243a55
bpo-41490: Update ensurepip to install pip 20.2.1 and setuptools 49.2.1 (GH-21774) 2020-08-08 00:47:40 +01:00
Miss Islington (bot) 5e12a5b822
bpo-41473: Skip test_gdb with gdb 9.2 to work around gdb bug (GH-21768)
gdb 9.2 on Fedora Rawhide is not reliable, see:

* https://bugs.python.org/issue41473
* https://bugzilla.redhat.com/show_bug.cgi?id=1866884
(cherry picked from commit e27a51c11e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-08-07 09:18:29 -07:00
Miss Islington (bot) a1320989f5
bpo-40726: handle uninitalized end_lineno on ast.increment_lineno (GH-20312)
(cherry picked from commit 8f4380d2f5)

Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
2020-08-05 06:52:29 -07:00
Karthikeyan Singaravelan fe928b32da
[3.9] bpo-40360: Handle PendingDeprecationWarning in test_lib2to3. (GH-21694) (GH-21697)
(cherry picked from commit cadda52d97)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
2020-07-31 07:17:18 -07:00
Miss Islington (bot) 41d1c04f73
bpo-41341: Recursive evaluation of ForwardRef in get_type_hints (GH-21553)
The issue raised by recursive evaluation is infinite recursion with
recursive types. In that case, only the first recursive ForwardRef is
evaluated.
(cherry picked from commit 653f420b53)

Co-authored-by: wyfo <joperez@hotmail.fr>
2020-07-26 08:31:24 -07:00
Miss Islington (bot) 8b7544cd02
bpo-41385: Fix test_executable_without_cwd on Windows (GH-21608)
(cherry picked from commit b1a87300a0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-07-26 00:38:52 -07:00
Berker Peksag 2024d7aca1
bpo-38731: Fix NameError in command-line interface of py_compile (GH-21617) 2020-07-25 23:43:47 +03:00
Miss Islington (bot) 4ff8e5ba4f
bpo-41317: Remove reader on cancellation in asyncio.loop.sock_accept() (GH-21595)
(cherry picked from commit 0dd98c2d00)

Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
2020-07-23 13:02:47 -07:00
Miss Islington (bot) 01ab963460
bpo-41295: Reimplement the Carlo Verre "hackcheck" (GH-21528)
Walk down the MRO backwards to find the type that originally defined the final `tp_setattro`, then make sure we are not jumping over intermediate C-level bases with the Python-level call.

Automerge-Triggered-By: @gvanrossum
(cherry picked from commit c53b310e59)

Co-authored-by: scoder <stefan_ml@behnel.de>
2020-07-18 14:39:02 -07:00
Miss Islington (bot) 27b811057f
bpo-39603: Prevent header injection in http methods (GH-18485)
reject control chars in http method in http.client.putrequest to prevent http header injection
(cherry picked from commit 8ca8a2e8fb)

Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
2020-07-18 13:41:55 -07:00
Miss Islington (bot) 28e93dd2b2
bpo-41304: Ensure python3x._pth is loaded on Windows (GH-21495)
(cherry picked from commit 936a660945)

Co-authored-by: Steve Dower <steve.dower@python.org>
2020-07-15 15:14:48 -07:00
Miss Islington (bot) f3232294ee
[3.9] bpo-39017: Avoid infinite loop in the tarfile module (GH-21454) (GH-21482)
Avoid infinite loop when reading specially crafted TAR files using the tarfile module
(CVE-2019-20907).
(cherry picked from commit 5a8d121a1f)


Co-authored-by: Rishi <rishi_devan@mail.com>

Automerge-Triggered-By: @encukou
2020-07-15 05:30:33 -07:00
Miss Islington (bot) 57c984fab6
bpo-41288: Fix a crash in unpickling invalid NEWOBJ_EX. (GH-21458)
Automerge-Triggered-By: @tiran
(cherry picked from commit 4f309abf55)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-07-13 06:09:27 -07:00
Miss Islington (bot) c65ee55512
bpo-41172: Fix check for compiler in test suite (GH-21400)
(cherry picked from commit af56c4fc76)

Co-authored-by: Steve Dower <steve.dower@python.org>
2020-07-09 11:12:07 -07:00
Miss Islington (bot) e68978978f
bpo-40597: Allow email.contextmanager set_content() to set a null string. (GH-20542)
(cherry picked from commit 4fa61a7732)

Co-authored-by: Mark Sapiro <mark@msapiro.net>
2020-07-08 14:21:00 -07:00
Pablo Galindo 6488a4a3c9
[3.9] bpo-41218: Only mark async code with CO_COROUTINE. (GH-21357) (GH-21362)
3.8.3 had a regression where compiling with
ast.PyCF_ALLOW_TOP_LEVEL_AWAIT woudl agressively mark things are
coroutine even if there were not.
(cherry picked from commit bd46174)

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
2020-07-06 23:30:20 +01:00
Miss Islington (bot) 4981fe36c7
bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297)
Also enables using debug build of `python3_d.dll`
Reference: CVE-2020-15523
(cherry picked from commit dcbaa1b49c)

Co-authored-by: Steve Dower <steve.dower@python.org>
2020-07-06 09:52:13 -07:00
Miss Islington (bot) 5a1384935e
bpo-39168: Remove the __new__ method of typing.Generic (GH-21327)
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 7fed75597f)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-07-05 09:02:40 -07:00
Steve Dower e1d4fdc533
bpo-41162: Clear audit hooks later during finalization (GH-21222)
Co-authored-by: Konge <zkonge@outlook.com>
2020-07-03 22:58:29 +01:00
Miss Islington (bot) bfec674254
bpo-39960: Allow heap types in the "Carlo Verre" hack check that override "tp_setattro()" (GH-21092)
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 148f329135)

Co-authored-by: scoder <stefan_ml@behnel.de>
2020-07-02 17:28:41 -07:00
Serhiy Storchaka ecfecc2d6c
[3.9] bpo-41043: Escape literal part of the path for glob(). (GH-20994). (GH-21275)
(cherry picked from commit 9355868458)
2020-07-02 10:05:16 +03:00
Miss Islington (bot) df59293bf0
bpo-40967: Remove deprecated asyncio.Task.current_task() and asyncio.Task.all_tasks() (GH-20874)
(cherry picked from commit 004e64e805)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
2020-07-01 21:06:51 -07:00