Commit graph

110709 commits

Author SHA1 Message Date
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)
b2a989995e
bpo-45464: [doc] Explain that subclassing multiple exceptions is fragile (GH-29094) (GH-29104)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
(cherry picked from commit dff0b71343)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-20 20:50:09 +02:00
Miss Islington (bot)
696a89fef8
bpo-45532: Replace 'default' with 'main' as default in sys.version (GH-29100)
(cherry picked from commit d2cd5eef0c)

Co-authored-by: Jeong YunWon <69878+youknowone@users.noreply.github.com>
2021-10-20 10:41:35 -07: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)
d6afe3be01
Cleanup a couple of comments left on PR 28775 post-merge. (GH-29079)
(cherry picked from commit 1dfac27dff)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2021-10-20 09:42:39 -07:00
Miss Islington (bot)
5537b9f105
bpo-45536: Check OpenSSL APIs in configure (GH-29088)
(cherry picked from commit 81520fe677)

Co-authored-by: Christian Heimes <christian@python.org>
2021-10-20 08:46:32 -07:00
Miss Islington (bot)
0d0312e1ac
Add PEPs 593 & 647 to list of PEPs at top of typing docs (GH-29097)
(cherry picked from commit d9e1dae35a)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2021-10-20 08:36:34 -07:00
Miss Islington (bot)
b8dbb3a7f9
bpo-45436: Fix tkinter tests with Tcl/Tk 8.6.11+ (GH-29077) (GH-29080)
Since v8.6.11, a few configuration options seem to accept an empty value
where they did not previously; particularly the `type` of a `Menu`
widget, and the `compound` of any ttk widget with a label.  Providing an
explicit expected error message to `checkEnumParam` bypasses the check
of an empty value, which no longer raises `TclError`.
(cherry picked from commit 4fe454c6f5)

Co-authored-by: Zachary Ware <zach@python.org>
2021-10-20 16:30:57 +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)
092ec4b9d1
bpo-45449: add note about PEP 585 in collections.abc's documentation (GH-29047) (GH-29067)
Signed-off-by: Filipe Laíns <lains@riseup.net>

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 7bafa0cf58)
2021-10-19 20:41:33 +02:00
Miss Islington (bot)
8cef526a87
bpo-45515: Add zoneinfo to the datetime documentation (GH-29038) (GH-29065)
We should have done this way back when 3.9 was released, but it fell off
the radar.

Co-authored-by: Paul Ganssle <git@m.ganssle.io>
(cherry picked from commit 8e40ca127f)
2021-10-19 20:35:34 +02:00
Miss Islington (bot)
97ce855ca8
bpo-45475: Revert __iter__ optimization for GzipFile, BZ2File, and LZMAFile. (GH-29016)
This reverts commit d2a8e69c2c.
(cherry picked from commit 0a4c82ddd3)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2021-10-18 20:15:48 -07:00
Miss Islington (bot)
b1949e0b58
[3.10] bpo-45221: Fix handling of LDFLAGS and CPPFLAGS options in setup.py (GH-29031) (GH-29037)
(cherry picked from commit 6a533a4238)


Co-authored-by: andrei kulakov <andrei.avk@gmail.com>

Automerge-Triggered-By: GH:ned-deily
2021-10-18 11:49:28 -07:00
Miss Islington (bot)
7082abf53d
Improve multiserver queue recipe (GH-29012) (GH-29013) 2021-10-17 18:43:10 -05: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)
a294703073
[3.10] bpo-45495: Add 'case' and 'match' to IDLE completions list. (GH-29000) (GH-29001)
Since the keyword list is frozen, only compute it once per
session.  The colorizer already handles context keywords.
(cherry picked from commit 42ac06dcd2)


Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>

Automerge-Triggered-By: GH:terryjreedy
2021-10-16 16:14:11 -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
Miss Islington (bot)
855d6247ad
[3.10]bpo-45463: Clarify that global statements allows multiple names (GH-28851) (GH-28989)
The global statement allows specifying a list of identifiers
(https://docs.python.org/3/reference/simple_stmts.htmlGH-the-global-statement).

The "Execution model" chapter described the global statement as if it
only allowed one single name. Pluralize "name" in the appropriate places.
(cherry picked from commit 4ecd119b00)

Co-authored-by: Luca Chiodini <luca@chiodini.org>

Co-authored-by: Luca Chiodini <luca@chiodini.org>
2021-10-16 10:01:54 -04:00
Miss Islington (bot)
2b6eb81496
bpo-45428: Fix reading filenames from stdin in py_compile (GH-28848)
Strip trailing '\n'.
(cherry picked from commit 59a633d3e2)

Co-authored-by: Graham Inggs <ginggs@debian.org>
2021-10-15 05:14:35 -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
Dong-hee Na
70b150a366
[3.10] no-issue: Make silence about warning '_POSIX_C_SOURCE redefined' (GH-28948) (GH-28951) 2021-10-15 01:35:53 +09:00
Miss Islington (bot)
f40b230df9
bpo-45386: Handle strftime's ValueError graciously in xmlrpc.client (GH-28765) (GH-28934)
At import time, the xmlrpc.client module uses different date formats to
test strftime so it can format years with 4 digits consistently.
Depending on the underlying C library and its strftime implementation
some of these calls can result in ValueErrors, blocking the
xmlrpc.client module from being imported.

This commit changes the behavior of this bit of code to react to
ValueError exceptions, treating the format that caused them as an
non-viable option.
(cherry picked from commit 1c83135381)

Co-authored-by: rtobar <rtobarc@gmail.com>
2021-10-13 19:59:45 +02: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)
5abb2dec2c
[docs] lexical_analysis: Expand the text on `_` (GH-28903) (GH-28933)
Also:
* Expand the discussion into its own entry. (Even before this,
  text on ``_`` was longet than the text on ``_*``.)

* Briefly note the other common convention for `_`: naming unused
  variables.

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 3dee0cb621)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2021-10-13 18:58:06 +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)
47673c47db
bpo-20692: Add Programming FAQ entry for 1.__class__ error. (GH-28918)
To avoid error, add either space or parentheses.
(cherry picked from commit 380c440875)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2021-10-12 22:37:51 -07:00
Miss Islington (bot)
edae3e2ac7
[3.10] bpo-45405: Prevent `internal configure error when running configure` with recent versions of non-Apple clang. (GH-28845) (GH-28911)
Change the configure logic to function properly on macOS when the compiler
outputs a platform triplet for option --print-multiarch.

Co-authored-by: Ned Deily <nad@python.org>
(cherry picked from commit 9c4766772c)


Co-authored-by: David Bohman <debohman@gmail.com>

Automerge-Triggered-By: GH:ned-deily
2021-10-12 17:31:32 -07:00
Miss Islington (bot)
854db7e821
Fix format string in _PyImport_LoadDynamicModuleWithSpec() (GH-28863)
(cherry picked from commit f79f3b41c8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-12 10:10:59 -07:00
Miss Islington (bot)
035ad8cf98
Slight correct grammar (GH-28860)
(cherry picked from commit 1b11582f0e)

Co-authored-by: nobodyatandnothing <91722596+nobodyatandnothing@users.noreply.github.com>
2021-10-12 10:01:11 -07:00
Miss Islington (bot)
32866dd471
bpo-45441: Update some moved URLs in documentation (GH-28861)
(cherry picked from commit b37dc9b3bc)

Co-authored-by: 180909 <wjh180909@gmail.com>
2021-10-12 07:20:43 -07: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)
3d7009e88e
bpo-42253: Update xml.dom.minidom.rst (GH-23126) (GH-28874)
Document that the "standalone" parameter was added in Python 3.9.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit c7e81fcf95)

Co-authored-by: Jens Diemer <github.com@jensdiemer.de>
2021-10-12 10:17:53 +03:00
Miss Islington (bot)
bb4f885892
bpo-45351, asyncio: Enhance echo server example, print all addresses (GH-28828)
(cherry picked from commit 659812b451)

Co-authored-by: Olaf van der Spek <olafvdspek@gmail.com>
2021-10-11 12:34:47 -07:00
Miss Islington (bot)
56825b697e
Handle error when PyUnicode_GetLength returns a negative value. (GH-28859)
(cherry picked from commit 560a79f94e)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2021-10-11 04:40:43 -07: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)
3a58d60620
Fix a leak in _PyImport_LoadDynamicModuleWithSpec() after failing PySys_Audit() (GH-28862)
(cherry picked from commit 9883ca498d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-10-11 02:22:29 -07:00
Miss Islington (bot)
aff69c34b0
Fix the "Finding all Adverbs" example (GH-21420) (#28839)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit dbd62e74da)

Co-authored-by: Rim Chatti <chattiriim@gmail.com>
2021-10-10 14:43:38 -07: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)
3c27013077
Fix class pattern docs to refer to class patterns (GH-28849)
(cherry picked from commit 0bcc5ade9b)

Co-authored-by: Christophe Nanteuil <35002064+christopheNan@users.noreply.github.com>
2021-10-10 07:35:23 -07:00
Jason R. Coombs
14a483aa40
[3.10] bpo-45419: Fix interfaces on DegenerateFiles.Path (GH-28844) 2021-10-10 07:23:06 -07:00
Miss Islington (bot)
459a4db5ea
bpo-45353: Remind sys.modules users to copy when iterating. (GH-28842)
This is true of all dictionaries in Python, but this one tends to
catch people off guard as they don't realize when sys.modules might
change out from underneath them as a hidden side effect of their
code.  Copying it first avoids the RuntimeError.  An example when
this happens in single threaded code are codecs being loaded which
are an implicit time of use import that most need not think about.
(cherry picked from commit 3d1ca867ed)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2021-10-09 12:54:20 -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
Dong-hee Na
c80f0b7aa1
[3.10] bpo-20028: Keep original exception when PyUnicode_GetLength return -1 (GH-28832) (GH-28834) 2021-10-10 01:13:21 +09: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