Commit Graph

25971 Commits

Author SHA1 Message Date
Miss Islington (bot) d5aadb2854
bpo-42388: Fix subprocess.check_output input=None when text=True (GH-23467)
When the modern text= spelling of the universal_newlines= parameter was added
for Python 3.7, check_output's special case around input=None was overlooked.
So it behaved differently with universal_newlines=True vs text=True.  This
reconciles the behavior to be consistent and adds a test to guarantee it.

Also clarifies the existing check_output documentation.

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
(cherry picked from commit 64abf37344)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2020-12-24 21:18:13 -08:00
Serhiy Storchaka 80c445cafb
[3.8] bpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781) (GH-23854)
* Tkinter functions and constructors which need a default root window
  raise now RuntimeError with descriptive message instead of obscure
  AttributeError or NameError if it is not created yet or cannot
  be created automatically.

* Add tests for all functions which use default root window.

* Fix import in the pynche script.

(cherry picked from commit 3d569fd6dc)
2020-12-19 16:38:37 +02:00
Miss Islington (bot) a3dec9d8ec
bpo-41891: ensure asyncio.wait_for waits for task completion (GH-22461)
(cherry picked from commit 17ef4319a3)

Co-authored-by: Richard Kojedzinszky <rkojedzinszky@users.noreply.github.com>
2020-12-18 09:45:24 -08:00
Miss Islington (bot) 718bf1a7a1
bpo-41804: Enhance test_epoll.test_control_and_wait() (GH-23795) (GH-23814)
Use shorter timeout and replace send() with sendall().
(cherry picked from commit 79782fe4f8)

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

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-12-17 12:14:25 +01:00
Miss Islington (bot) 0a24a57888
bpo-42644: Validate values in logging.disable() (GH-23786)
* bpo-42644: Validate values in logging.disable()

Technically make the value of manager a property that checks and convert
values assigned to it properly. This has the side effect of making
`logging.disable` also accept strings representing the various level of
warnings.

We want to validate the type of the disable attribute at assignment
time, as it is later compared to other levels when emitting warnings and
would generate a `TypeError: '>=' not supported between ....` in a
different part of the code base, which can make it difficult to track
down.

When assigned an incorrect value; it will raise a TypeError when the
wrong type, or ValueError if an invalid str.

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
(cherry picked from commit b32d8b4f9b)

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
2020-12-16 02:10:32 -08:00
Miss Islington (bot) f6d1520219
bpo-40084: [Enum] dir() includes member attributes (GH-19219) (GH-22853)
(cherry picked from commit 68526fe258)

Co-authored-by: Angelin BOOZ <9497359+lem2clide@users.noreply.github.com>
2020-12-09 11:25:06 -08:00
Ethan Furman 21ca80eef4
[3.8] [Enum] reformat and add doc strings (GH-23705). (GH-23706)
* [3.8] [Enum] reformat and add doc strings (GH-23705).
2020-12-08 13:28:47 -08:00
Miss Islington (bot) cbfcc67170
bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497) (GH-23704)
(cherry picked from commit 37440eef7f)
2020-12-08 11:52:58 -08:00
Miss Islington (bot) 699e5e4489
bpo-41889: [Enum] fix multiple-inheritance regression (GH-22487) (GH-23672)
(cherry picked from commit c266736ec1)
2020-12-07 15:50:14 -08:00
Brandt Bucher 7c79798238
bpo-42536: GC track recycled tuples (GH-23623) (GH-23652)
Several built-in and standard library types now ensure that their internal result tuples are always tracked by the garbage collector:

- collections.OrderedDict.items
- dict.items
- enumerate
- functools.reduce
- itertools.combinations
- itertools.combinations_with_replacement
- itertools.permutations
- itertools.product
- itertools.zip_longest
- zip

Previously, they could have become untracked by a prior garbage collection.
(cherry picked from commit 226a012d1c)
2020-12-07 20:08:24 +00:00
Miss Islington (bot) ca52aa3ddd
bpo-39825: Fixes sysconfig.get_config_var('EXT_SUFFIX') on Windows to match distutils (GH-22088)
(cherry picked from commit c0afb7fa0e)

Co-authored-by: Matti Picus <matti.picus@gmail.com>
2020-12-07 09:50:48 -08:00
Miss Islington (bot) a4e7d5f750
bpo-17735: inspect.findsource now raises OSError when co_lineno is out of range (GH-23633)
This can happen when a file was edited after it was imported.
(cherry picked from commit 2e0760bb2e)

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
2020-12-04 13:44:53 -08:00
Miss Islington (bot) 3b14f18205
bpo-42116: Fix inspect.getsource handling of trailing comments (GH-23630)
(cherry picked from commit 6e1eec71f5)

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
2020-12-04 12:20:09 -08:00
Miss Islington (bot) 8e8f82dd94
bpo-41473: Reenable test_gdb on gdb 9.2 and newer (GH-23637)
https://bugzilla.redhat.com/show_bug.cgi?id=1866884 is fixed in gdb
10.1 (failed to reproduce on gdb-10.1-1.fc34.aarch64).
(cherry picked from commit 066394018a)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-12-04 07:41:02 -08:00
Miss Islington (bot) 930d5377c5
bpo-42553: Fix test_asyncio.test_call_later() (GH-23627)
Fix test_asyncio.test_call_later() race condition: don't measure
asyncio performance in the call_later() unit test. The test failed
randomly on the CI.
(cherry picked from commit 7e5e13d113)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-12-03 05:15:28 -08:00
Miss Islington (bot) 1cc5c943c0
bpo-42482: remove reference to exc_traceback from TracebackException (GH-23531)
(cherry picked from commit 427613f005)

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
2020-11-30 17:53:40 -08:00
Irit Katriel d82e08d185
[3.8] bpo-42474: test TracebackException comparison to non-equal instances (GH-23558) 2020-11-29 17:41:19 -08:00
Miss Islington (bot) 4498e98a6b
bpo-34215: Clarify IncompleteReadError message when "expected" is None (GH-21925) (#23540)
Co-Authored-By: Tyler Bell <mrbell321@gmail.com>
(cherry picked from commit 8085f742f4)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-11-28 16:44:34 +02:00
Miss Islington (bot) bda2e68c88
bpo-12800: tarfile: Restore fix from 011525ee9 (GH-21409)
Restore fix from 011525ee92.
(cherry picked from commit 4fedd7123e)

Co-authored-by: Julien Palard <julien@palard.fr>
2020-11-25 02:01:01 -08:00
Miss Islington (bot) 66dd5338a1
bpo-42398: Fix "make regen-all" race condition (GH-23362) (GH-23367)
Fix a race condition in "make regen-all" when make -jN option is used
to run jobs in parallel. The clinic.py script now only use atomic
write to write files. Moveover, generated files are now left
unchanged if the content does not change, to not change the file
modification time.

The "make regen-all" command runs "make clinic" and "make
regen-importlib" targets:

* "make regen-importlib" builds object files (ex: Modules/_weakref.o)
  from source files (ex: Modules/_weakref.c) and clinic files (ex:
  Modules/clinic/_weakref.c.h)
* "make clinic" always rewrites all clinic files
  (ex: Modules/clinic/_weakref.c.h)

Since there is no dependency between "clinic" and "regen-importlib"
Makefile targets, these two targets can be run in parallel. Moreover,
half of clinic.py file writes are not atomic and so there is a race
condition when "make regen-all" runs jobs in parallel using make -jN
option (which can be passed in MAKEFLAGS environment variable).

Fix clinic.py to make all file writes atomic:

* Add write_file() function to ensure that all file writes are
  atomic: write into a temporary file and then use os.replace().
* Moreover, write_file() doesn't recreate or modify the file if the
  content does not change to avoid modifying the file modification
  file.
* Update test_clinic to verify these assertions with a functional
  test.
* Remove Clinic.force attribute which was no longer used, whereas
  Clinic.verify remains useful.

(cherry picked from commit 8fba9523cf)
(cherry picked from commit c53c3f4000)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-11-18 08:28:57 -08:00
Miss Islington (bot) 73e02ff0d4
bpo-41561: skip test_min_max_version_mismatch (GH-22308)
skip test_min_max_version_mismatch when TLS 1.0 is not available

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

Co-authored-by: Christian Heimes <christian@python.org>
2020-11-18 04:29:34 -08:00
Miss Islington (bot) 109c17315a
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:21:53 -08:00
Serhiy Storchaka 547d2bcc55
[3.8] bpo-42103: Improve validation of Plist files. (GH-22882) (GH-23116)
* 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)
2020-11-03 09:32:15 +02:00
Miss Skeleton (bot) 1e96de9ed4
bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067)
(cherry picked from commit 301822859b)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-11-02 07:46:00 -08:00
Miss Skeleton (bot) 39a56e5523
[3.8] bpo-29566: binhex.binhex now consitently writes MacOS 9 line endings. (GH-23059) (GH-23070)
[[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:16 -08:00
Miss Skeleton (bot) 8b4842b7a8
[3.8] bpo-40592: shutil.which will not return None anymore if ; is the last char in PATHEXT (GH-20088) (GH-22913)
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:37:58 -07:00
Miss Skeleton (bot) e866f33a48
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:44 -07:00
Miss Skeleton (bot) 4cde523aa4
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 04:58:06 -07:00
Miss Skeleton (bot) d1eb75585e
bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764) (GH-22807)
(cherry picked from commit 3185267400)

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

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

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2020-10-20 09:17:58 +02:00
Miss Skeleton (bot) 65894cac08
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:35:23 -07:00
Miss Skeleton (bot) 3faef630a4
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:44:05 -07:00
Miss Skeleton (bot) 371146a3f8
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:07:20 -07:00
Anthony Sottile 1c5a65723e
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:14:18 +03:00
Irit Katriel 1a3f7c042a
[3.8] bpo-32498: Improve exception message on passing bytes to urllib.parse.unquote (GH-22746) 2020-10-19 00:06:34 +03:00
Miss Skeleton (bot) 1040299e92
bpo-41966: Fix pickling pure datetime.time subclasses (GH-22731) (GH-22748)
(cherry picked from commit c304c9a7ef)

Co-authored-by: scaramallion <scaramallion@users.noreply.github.com>
2020-10-18 18:33:28 +03:00
Miss Skeleton (bot) 400175ad91
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:16:52 +03:00
Jason R. Coombs 967fddae2f
[3.8] bpo-41855: Fix duplicate results in FastPath.zip_children() (#22404)
* bpo-41855: Backport fixes from importlib_metadata 1.5.2.

* Add blurb.

* Add anchor for finders and loaders
2020-10-15 17:05:12 -04:00
Miss Skeleton (bot) aeb66c1abb
bpo-41984: GC track all user classes (GH-22701/GH-22707)
(cherry picked from commit c13b847a6f)
2020-10-15 08:51:48 -07:00
Miss Skeleton (bot) 8b4642d328
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:12 -07:00
Miss Skeleton (bot) 33057c7092
bpo-41739: Fix test_logging.test_race_between_set_target_and_flush() (GH-22655) (GH-22656) (GH-22662)
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)
(cherry picked from commit f5393dc2a0)

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

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-10-12 10:51:10 +02:00
Miss Skeleton (bot) 6c6c256df3
bpo-41944: No longer call eval() on content received via HTTP in the CJK codec tests (GH-22566) (GH-22577)
(cherry picked from commit 2ef5caa58f)

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

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-10-06 14:38:54 +02:00
Miss Skeleton (bot) 78bddc7794
bpo-41939: Fix test_site.test_license_exists_at_url() (GH-22559)
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-06 00:03:27 -07:00
Serhiy Storchaka 09a7b3b618
[3.8] bpo-41909: Enable previously disabled recursion checks. (GH-22536) (GH-22551)
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:28:00 +03:00
Pablo Galindo fd22823991
[3.8] bpo-41840: Report module-level globals as both local and global in the symtable module (GH-22391). (GH-22529)
(cherry picked from commit fb0a4651f1)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-10-03 22:50:00 +01:00
Miss Skeleton (bot) cfed534333
bpo-41900: C14N 2.0 serialisation failed for unprefixed attributes when a default namespace was defined. (GH-22474) (GH-22508)
(cherry picked from commit 6a412c94b6)
2020-10-03 08:42:38 +02:00
Miss Islington (bot) e4008404fb
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 12:18:39 -07:00
Thomas Grainger ae462297c0
[3.8] bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (GH-21956) (#22398)
Closes bpo issue 41602.
(cherry picked from commit a68a2ad19c)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2020-09-24 18:44:14 +02:00
Miss Islington (bot) 488e3eb70d
bpo-41811: create SortKey members using first given value (GH-22316) (GH-22326)
(cherry picked from commit ae0d2a33ec)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2020-09-19 12:56:30 -07:00
Ethan Furman 5efb1a77e7
[3.8] bpo-39728: Enum: fix duplicate `ValueError` (GH-22277) (GH-22283)
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:38:14 -07:00