Commit Graph

27240 Commits

Author SHA1 Message Date
Ethan Furman 1b4addf3cb
[3.10] bpo-43945: [Enum] reduce scope of new format() behavior (GH-26752)
* [Enum] reduce scope of new format behavior

Instead of treating all Enums the same for format(), only user mixed-in
enums will be affected.  In other words, IntEnum and IntFlag will not be
changing the format() behavior, due to the requirement that they be
drop-in replacements of existing integer constants.

If a user creates their own integer-based enum, then the new behavior
will apply:

    class Grades(int, Enum):
        A = 5
        B = 4
        C = 3
        D = 2
        F = 0

Now:  format(Grades.B)  -> DeprecationWarning and '4'
3.12:                   -> no warning, and 'B'.

(cherry picked from commit f60b07ab6c)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2021-06-18 14:25:42 -07:00
Pablo Galindo a8c418d5ed
[3.10] bpo-44368: Improve syntax errors with invalid as pattern targets (GH-26632) (GH-26792)
(cherry picked from commit 05073036dc)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-06-18 22:15:57 +01:00
Miss Islington (bot) bf55a799e0
bpo-44451: Reset DeprecationWarning filters in test_importlib.test_entry_points_by_index (GH-26784)
This avoids the following error if DeprecationWarnings are ignored.

    ======================================================================
    ERROR: test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests)
    Prior versions of Distribution.entry_points would return a
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/builddir/build/BUILD/Python-3.10.0b3/Lib/test/test_importlib/test_metadata_api.py", line 145, in test_entry_points_by_index
        expected = next(iter(caught))
    StopIteration
    ----------------------------------------------------------------------
    Ran 1402 tests in 2.125s
    FAILED (errors=1, skipped=18, expected failures=1)
(cherry picked from commit df1502e47f)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2021-06-18 13:30:53 -07:00
Miss Islington (bot) bba726710b
[3.10] Reorganize the pattern matching suite (GH-26661) (GH-26787)
(cherry picked from commit c106cf31f8)


Co-authored-by: Brandt Bucher <brandt@python.org>

Automerge-Triggered-By: GH:brandtbucher
2021-06-18 10:48:07 -07:00
Miss Islington (bot) eb0a6801be
bpo-43024: improve signature (in help, etc) for functions taking sent… (GH-24331) (GH-26773)
…inel defaults
(cherry picked from commit f73377d57c)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2021-06-17 17:41:46 +01:00
Miss Islington (bot) 08f2b9dede
bpo-44389: Fix typo in ssl deprecation warning message (GH-26754)
`ssl.SSL_NO_TLS` should be `ssl.OP_NO_TLS`.
(cherry picked from commit c544393b89)

Co-authored-by: Joe <nigelchiang@outlook.com>
2021-06-17 03:00:56 -07:00
Ethan Furman 41c2a4a727
[3.10] bpo-44342: [Enum] improve test, add andrei kulakov to ACKS (GH-26726)
* [3.10] [Enum] improve test, add andrei kulakov to ACKS (GH-26726).
(cherry picked from commit cb2014f207)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2021-06-15 18:50:59 -07:00
Miss Islington (bot) 0f99324f61
bpo-44342: [Enum] fix data type search (GH-26667)
In an inheritance chain of

  int -> my_int -> final_int

the data type is now final_int (not my_int)
(cherry picked from commit 3a7cccfd6c)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2021-06-15 14:07:37 -07:00
Miss Islington (bot) 133cddf76e
bpo-44409: Fix error location in tokenizer errors that happen during initialization (GH-26712)
(cherry picked from commit 507ed6fa1d)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-06-14 10:07:52 -07:00
Miss Islington (bot) 2b57ad3f53
bpo-43425: Update test_c_parser not to use TempdirManager (GH-26693)
(cherry picked from commit 736ed6f7a9)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2021-06-13 17:24:11 -07:00
Miss Islington (bot) 128899d8b8
bpo-43475: Fix the Python implementation of hash of Decimal NaN (GH-26679)
(cherry picked from commit 9f1c5f6e8a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-06-13 07:05:28 -07:00
Miss Islington (bot) 4becc569a6
[3.10] bpo-44389: Fix deprecation of OP_NO_TLSv1_3 (GH-26700) (GH-26705)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit bf527277d4)


Co-authored-by: Christian Heimes <christian@python.org>

Automerge-Triggered-By: GH:tiran
2021-06-13 05:07:00 -07:00
Miss Islington (bot) d03f342a83
bpo-44396: Update multi-line-start location when reallocating tokenizer buffers (GH-26676) (GH-26695)
Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit a342cc5891)
2021-06-12 21:27:02 +01:00
Miss Islington (bot) 9c0180ae77
bpo-43318: Fix a bug where pdb does not always echo cleared breakpoints (GH-24646) (GH-26674)
(cherry picked from commit 4cb6ba1432)

Co-authored-by: huzhaojie <hu.zj@foxmail.com>
2021-06-11 17:18:19 +01:00
Miss Islington (bot) 0a186b1ec1
bpo-44242: [Enum] improve error messages (GH-26669)
(cherry picked from commit c956734d7a)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2021-06-11 02:58:57 -07:00
Miss Islington (bot) d7930fb720
bpo-44362: ssl: improve deprecation warnings and docs (GH-26646)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit e26014f1c4)

Co-authored-by: Christian Heimes <christian@python.org>
2021-06-11 00:36:17 -07:00
Miss Islington (bot) b613132861
bpo-44342: [Enum] changed pickling from by-value to by-name (GH-26658) (GH-26660)
by-value lookups could fail on complex enums, necessitating a check for
__reduce__ and possibly sabotaging the final enum;

by-name lookups should never fail, and sabotaging is no longer necessary
for class-based enum creation.
(cherry picked from commit 62f1d2b3d7)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2021-06-10 16:37:27 -07:00
Miss Islington (bot) 01286017c3
bpo-44356: [Enum] allow multiple data-type mixins if they are all the same (GH-26649) (GH-26653)
This enables, for example, two base Enums to both inherit from `str`, and then both be mixed into the same final Enum:

    class Str1Enum(str, Enum):
        GH- some behavior here

    class Str2Enum(str, Enum):
        GH- some more behavior here

    class FinalStrEnum(Str1Enum, Str2Enum):
        GH- this now works
(cherry picked from commit 8a4f0850d7)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2021-06-10 15:01:03 -07:00
Miss Islington (bot) e3bc32fc1a
bpo-37022: Fix bug where pdb's do_p/do_pp commands swallow exceptions from repr (GH-18180) (GH-26650)
(cherry picked from commit 6544b2532d)

Co-authored-by: Daniel Hahler <git@thequod.de>
2021-06-10 21:56:57 +01:00
Ethan Furman 749648609d
[3.10] bpo-44242: [Enum] remove missing bits test from Flag creation (GH-26586) (GH-26635)
Move the check for missing named flags in flag aliases from Flag creation
to a new *verify* decorator..

(cherry picked from commit eea8148b7d)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2021-06-10 07:24:20 -07:00
Miss Islington (bot) f807a4fad4
bpo-44368: Ensure we don't raise incorrect custom syntax errors with soft keywords (GH-26630)
(cherry picked from commit 457ce60fc7)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-06-09 14:45:43 -07:00
Miss Islington (bot) c0496093e5
bpo-44349: Fix edge case when displaying text from files with encoding in syntax errors (GH-26611) (GH-26616)
(cherry picked from commit 9fd21f649d)

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

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-06-09 01:29:21 +01:00
Miss Islington (bot) eeefa7f6c0
bpo-43833: Emit warnings for numeric literals followed by keyword (GH-25466)
Emit a deprecation warning if the numeric literal is immediately followed by
one of keywords: and, else, for, if, in, is, or. Raise a syntax error with
more informative message if it is immediately followed by other keyword or
identifier.

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

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-06-08 16:52:23 -07:00
Batuhan Taskaya bd6f0d3ead
[3.10] bpo-11105: reduce the recursion limit for tests. (GH-26607)
(cherry picked from commit e58d762c1f)

Co-authored-by: Batuhan Taskaya <batuhan@python.org>
2021-06-08 20:39:30 +03:00
Miss Islington (bot) 933b5b6359
bpo-44335: Fix a regression when identifying invalid characters in syntax errors (GH-26589)
(cherry picked from commit d334c73b56)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-06-08 04:46:56 -07:00
Miss Islington (bot) d80f4265db
fix: use unambiguous punction in 'invalid escape sequence' message (GH-26582)
(cherry picked from commit ffd87b7093)

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2021-06-07 17:36:19 -07:00
Miss Islington (bot) 0d441d2e70
bpo-38323: Skip SubprocessMultiLoopWatcherTest as they can hang the test suite (GH-26542) (GH-26544)
(cherry picked from commit f171877ebe)

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

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-06-05 01:05:54 +01:00
Miss Islington (bot) 3f4d801bf9
bpo-44048: Fix two hashlib test cases under FIPS mode (GH-26470) (GH-26531)
test_disallow_instantiation and test_readonly_types try to test all the available
digests, however under FIPS mode, while the algorithms are available, trying to use
them will fail with a ValueError.
(cherry picked from commit a46c220edc)

Co-authored-by: stratakis <cstratak@redhat.com>

Co-authored-by: stratakis <cstratak@redhat.com>
2021-06-04 19:38:02 +01:00
Pablo Galindo e53f72a1b4
[3.10] bpo-44305: Improve syntax error for try blocks without except or finally (GH-26523) (GH-26524)
(cherry picked from commit b250f89bb7)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-06-04 00:11:43 +01:00
Pablo Galindo 3283bf4519
[3.10] bpo-44273: Improve syntax error message for assigning to "..." (GH-26477) (GH-26478)
Use "ellipsis" instead of "Ellipsis" in syntax error messages to eliminate confusion with built-in variable Ellipsis.
(cherry picked from commit 39dd141)

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

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-06-03 22:22:28 +01:00
Miss Islington (bot) 976598d36b
bpo-11105: Do not crash when compiling recursive ASTs (GH-20594)
When compiling an AST object with a direct / indirect reference
cycles, on the conversion phase because of exceeding amount of
calls, a segfault was raised. This patch adds recursion guards to
places for preventing user inputs to not to crash AST but instead
raise a RecursionError.
(cherry picked from commit f3491242e4)

Co-authored-by: Batuhan Taskaya <batuhan@python.org>
2021-06-03 13:27:00 -07:00
Miss Islington (bot) d2ab15f537
bpo-43921: Fix test_ssl.test_wrong_cert_tls13() on Windows (GH-26502) (GH-26518)
Fix test_ssl.test_wrong_cert_tls13(): use suppress_ragged_eofs=False,
since read() can raise ssl.SSLEOFError on Windows.
(cherry picked from commit ea0210fa8c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-06-03 22:15:15 +02:00
Mark Shannon cea0585b79
[3.10] bpo-44298: Backport #26513 to 3.10 (#26516)
* Backport 937cebc93 to 3.10

* Update importlib
2021-06-03 19:57:31 +01:00
Miss Islington (bot) 98e5a7975d
bpo-44022: Improve the regression test. (GH-26503)
It wasn't actually detecting the regression due to the
assertion being too lenient.
(cherry picked from commit e60ab843cb)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2021-06-02 21:04:20 -07:00
Miss Islington (bot) e5e93e6145
bpo-43921: Fix test_ssl.test_pha_required_nocert() (GH-26489)
Fix test_pha_required_nocert() of test_ssl: catch two more EOF cases
(when the recv() method returns an empty string).
(cherry picked from commit 320eaa7f42)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-06-02 16:48:40 -07:00
Miss Islington (bot) 7207203e1d
[3.10] bpo-44246: Restore compatibility in entry_points (GH-26468) (GH-26471)
* [bpo-44246](): Entry points performance improvements.

From importlib_metadata 4.3.1.

* [bpo-44246](): Sync with importlib_metadata 4.4
(cherry picked from commit c34ed08d97)


Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

Automerge-Triggered-By: GH:jaraco
2021-05-31 09:41:55 -07:00
Miss Islington (bot) d1480ad2f5
bpo-44246: Entry points performance improvements. (GH-26467)
From importlib_metadata 4.3.1.
(cherry picked from commit 410b70d39d)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2021-05-31 09:12:32 -07:00
Miss Islington (bot) 97b4576f65
bpo-38693: Prefer f-strings in importlib.resources (importlib_resources 5.0.6). (GH-26387) (#26389)
Automerge-Triggered-By: GH:jaraco
(cherry picked from commit f6fbdb90ee)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2021-05-26 17:09:27 -04:00
Miss Islington (bot) 7b3b6982a5
bpo-44232: Fix type_new() error reporting (GH-26359) (GH-26365)
Fix a regression in type() when a metaclass raises an exception. The
C function type_new() must properly report the exception when a
metaclass constructor raises an exception and the winner class is not
the metaclass.
(cherry picked from commit bd199e72fb)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-05-26 11:30:55 +02:00
Miss Islington (bot) 86779878df
bpo-44151: linear_regression() minor API improvements (GH-26199) (GH-26338) 2021-05-24 18:11:12 -07:00
Miss Islington (bot) 50b0d148a6
bpo-44184: Fix subtype_dealloc() for freed type (GH-26274) (GH-26290)
Fix a crash at Python exit when a deallocator function removes the
last strong reference to a heap type.

Don't read type memory after calling basedealloc() since
basedealloc() can deallocate the type and free its memory.

_PyMem_IsPtrFreed() argument is now constant.
(cherry picked from commit 615069eb08)

Co-authored-by: Victor Stinner <vstinner@python.org>

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-05-22 00:50:11 +02:00
Miss Islington (bot) ae1732d461
bpo-44180: Fix edge cases in invalid assigment rules in the parser (GH-26283)
The invalid assignment rules are very delicate since the parser can
easily raise an invalid assignment when a keyword argument is provided.
As they are very deep into the grammar tree, is very difficult to
specify in which contexts these rules can be used and in which don't.
For that, we need to use a different version of the rule that doesn't do
error checking in those situations where we don't want the rule to raise
(keyword arguments and generator expressions).

We also need to check if we are in left-recursive rule, as those can try
to eagerly advance the parser even if the parse will fail at the end of
the expression. Failing to do this allows the parser to start parsing a
call as a tuple and incorrectly identify a keyword argument as an
invalid assignment, before it realizes that it was not a tuple after all.
(cherry picked from commit c878a97968)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-05-21 11:20:43 -07:00
Miss Islington (bot) fdb65e399e
[3.10] bpo-43643: Sync with python/importlib_resources@c17a610aad. (GH-26284) (GH-26286)
* [bpo-43643](): Sync with python/importlib_resources@c17a610aad.
* Sync with python/importlib_resources@89fd5e961a.
(cherry picked from commit 875b3d84b3)


Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

Automerge-Triggered-By: GH:jaraco
2021-05-21 10:52:24 -07:00
Miss Islington (bot) 07dba474c5
bpo-44180: Report generic syntax errors in the furthest position reached in the first parser pass (GH-26253) (GH-26281)
(cherry picked from commit b51081c1a8)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-05-21 16:29:58 +01:00
Barney Gale ee51c56c02
[3.10] bpo-38671: Add test that `pathlib.Path.resolve()` returns an absolute path. (GH-26184) (GH-26270)
Issue should be fixed in [bpo-43757]()

Co-Authored-by: Tzu-ping Chung <uranusjr@gmail.com>
(cherry picked from commit 18f41c04ff)

Co-authored-by: Barney Gale <barney.gale@gmail.com>

Automerge-Triggered-By: GH:encukou
2021-05-21 04:54:56 -07:00
Miss Islington (bot) 4389711ce9
bpo-36160: Fix test_site so that it can run independently of other tests (GH-12131) (GH-26262)
(cherry picked from commit 1270ad6ec8)

Co-authored-by: native-api <vano@mail.mipt.ru>
2021-05-20 11:42:00 +01:00
Miss Islington (bot) ec0699c044
bpo-44168: Fix error message in the parser for keyword arguments for invalid expressions (GH-26210) (GH-26247)
(cherry picked from commit 33c0c90dea)

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

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-05-19 19:28:31 +01:00
Irit Katriel 373741a97c
[3.10] bpo-25872: Add unit tests for linecache and threading (GH-25913) (GH-26212)
(cherry picked from commit 115dea9e26)

Co-authored-by: uniocto <serit142sa33go@gmail.com>
2021-05-18 14:53:57 +01:00
Miss Islington (bot) a44bb6ddb1
bpo-33433 Fix private address checking for IPv4 mapped IPv6. (GH-26172)
For IPv4 mapped IPv6 addresses, defer privacy check to the mapped IPv4 address. Solves bug where public mapped IPv4 addresses are considered private by the IPv6 check.

Automerge-Triggered-By: GH:gpshead
(cherry picked from commit 83f0f8d62f)

Co-authored-by: Pete Wicken <2273100+JamoBox@users.noreply.github.com>
2021-05-17 12:42:08 -07:00
Miss Islington (bot) b913f47e87
bpo-39950: Fix deprecation warning in test for `pathlib.Path.link_to()` (GH-26155) (GH-26178)
(cherry picked from commit 1a08c5ac49)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2021-05-16 15:35:44 -07:00