Commit Graph

25473 Commits

Author SHA1 Message Date
Steve Dower 25fbe33b92
bpo-4963: Fix for initialization and non-deterministic behavior issues in mimetypes (GH-14375) 2019-06-25 08:20:43 -07:00
Jeroen Demeyer d917cfe405 [3.8] bpo-37250: put back tp_print for backwards compatibility (GH-14193)
This is a 3.8-only compatibility measure for third-party Cython-based sdists.

https://bugs.python.org/issue37250
2019-06-25 12:58:58 +02:00
Miss Islington (bot) d32594ad27
bpo-24214: Fixed the UTF-8 and UTF-16 incremental decoders. (GH-14304)
* The UTF-8 incremental decoders fails now fast if encounter
  a sequence that can't be handled by the error handler.
* The UTF-16 incremental decoders with the surrogatepass error
  handler decodes now a lone low surrogate with final=False.
(cherry picked from commit 894263ba80)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-06-25 02:12:16 -07:00
Miss Islington (bot) 26fe6c3537 bpo-36974: inherit tp_vectorcall_offset unconditionally (GH-13858) (GH-14342)
(cherry picked from commit a8b27e623d)

Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
2019-06-25 10:19:16 +02:00
Miss Islington (bot) 20372d6524
bpo-37393: Fix deprecation warnings in test_ntpath. (GH-14357)
eval() was being called an extra time without a filter for
deprecation warnings.
(cherry picked from commit 9fe42b49c7)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-06-25 00:12:19 -07:00
Miss Islington (bot) 5bf3b89dfb
bpo-37394: Fix pure Python implementation of the queue module (GH-14351)
(cherry picked from commit 3f5b9088b0)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-06-24 19:14:37 -07:00
Miss Islington (bot) b183b963f6
Get rid of exception traceback printing in asyncio tests (GH-14343)
(cherry picked from commit 549f7d45c8)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-06-24 10:21:35 -07:00
Miss Islington (bot) 366dac99c0
bpo-37359: Fix regrtest --cleanup (GH-14336)
(cherry picked from commit 9bbf4d7083)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-24 04:37:55 -07:00
Victor Stinner 2ec4545ebe
bpo-37359: Add --cleanup option to python3 -m test (GH-14332) (GH-14334)
* regrtest: Add --cleanup option to remove "test_python_*" directories
  of previous failed test jobs.
* Add "make cleantest" to run "python3 -m test --cleanup".

(cherry picked from commit 47fbc4e45b)
2019-06-24 12:51:47 +02:00
Serhiy Storchaka 914d6b7973
[3.8] bpo-35431: Test math.comb() and math.perm() for OverflowError only on CPython. (GH-14146) (#14226)
Other implementation can raise MemoryError, but it can takes hours.
(cherry picked from commit 1b8a46d597)
2019-06-23 17:50:04 +03:00
Miss Islington (bot) 874ff65e0a
bpo-35224: Reverse evaluation order of key: value in dict comprehensions (GH-14139)
… as proposed in PEP 572; key is now evaluated before value.

https://bugs.python.org/issue35224
(cherry picked from commit c8a35417db)

Co-authored-by: Jörn Heissler <joernheissler@users.noreply.github.com>
2019-06-22 15:34:03 -07:00
Miss Islington (bot) 9b32b44d3e
bpo-37323: Suppress DeprecationWarning raised by @asyncio.coroutine (GH-14293)
When the test is ran with `PYTHONWARNINGS=error` the environment variable is passed to the python interpreter used in `assert_python_ok` where `DeprecationWarning` from  `@asyncio.coroutine` is converted into an error. Ignore the `DeprecationWarning` in `assert_python_ok`.

https://bugs.python.org/issue37323
(cherry picked from commit 186f70905d)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-06-22 03:43:07 -07:00
Miss Islington (bot) 3523e0c47b
bpo-37362: test_gdb now ignores stderr (GH-14287)
test_gdb no longer fails if it gets an "unexpected" message on
stderr: it now ignores stderr. The purpose of test_gdb is to test
that python-gdb.py commands work as expected, not to test gdb.
(cherry picked from commit e56a123fd0)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-21 14:39:58 -07:00
Steve Dower 6c7947713a
bpo-37316: mmap.mmap() passes the wrong variable to PySys_Audit() (GH-14152)
Also, add a missing call to va_end() in PySys_Audit().
2019-06-21 09:45:13 -07:00
Miss Islington (bot) 95ff622028 bpo-37258: Not a bug, but added a unit test and updated documentation. (GH-14229) (GH-14230)
(cherry picked from commit 0150001653)
2019-06-19 14:46:55 +01:00
Serhiy Storchaka f5b89afde1
bpo-37163: Deprecate passing argument obj of dataclasses.replace() by keyword. (GH-13877) 2019-06-19 10:33:27 +03:00
Miss Islington (bot) 35aa0b0ced
bpo-34903: Document that some strptime formats only require 1 digit (GH-14149)
For datetime.datetime.strptime(), the leading zero for some two-digit formats is optional.

This adds a footnote to the strftime/strptime documentation to reflect this fact, and adds some tests to ensure that it is true.

bpo-34903
(cherry picked from commit 6b9c204ee7)

Co-authored-by: Mike Gleen <mike.gleen@gmail.com>
2019-06-18 12:21:27 -07:00
Miss Islington (bot) f49c85d0cb
bpo-35031: also disable TLS 1.3 for test_start_tls_server_1 on macOS (GH-14188)
(cherry picked from commit a514f782b8)

Co-authored-by: Ned Deily <nad@python.org>
2019-06-18 01:56:51 -07:00
Miss Islington (bot) 69610f86d3
Fix test_embed.test_pre_initialization_sys_options() env vars (GH-14172)
test_pre_initialization_sys_options() of test_embed now removes
PYTHON* environment variables like PYTHONWARNINGS.
(cherry picked from commit dbdc991a62)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-17 15:31:43 -07:00
Miss Islington (bot) 988fff5d0e
bpo-36922: use Py_TPFLAGS_METHOD_DESCRIPTOR in lookup_maybe_method() (GH-13865)
(cherry picked from commit 2e9954d347)

Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
2019-06-17 05:12:42 -07:00
Miss Islington (bot) a5ddbfbf50
bpo-35031, test_asycio: disable TLS 1.3 in test_start_tls_server_1() (GH-14148)
bpo-35031, bpo-35998: Reintroduce workaround on Windows and FreeBSD
in test_start_tls_server_1() of test_asyncio: disable TLS v1.3 on the
client context.
(cherry picked from commit c034b7824f)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-17 03:06:41 -07:00
Miss Islington (bot) 693945d45d bpo-37267: Do not check for FILE_TYPE_CHAR in os.dup() on Windows (GH-14051) (GH-14140)
On Windows, os.dup() no longer creates an inheritable fd when handling a
character file.
(cherry picked from commit 28fca0c422)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-06-17 10:45:26 +02:00
Miss Islington (bot) ad505918a1
bpo-36688: Adding an implementation of RLock in _dummy_thread (GH-12943)
(cherry picked from commit c5905f39bc)

Co-authored-by: Joost Lek <vlabakje@gmail.com>
2019-06-17 01:34:27 -07:00
Miss Islington (bot) 58a1a76bae
bpo-35922: Fix RobotFileParser when robots.txt has no relevant crawl delay or request rate (GH-11791)
Co-Authored-By: Tal Einat <taleinat+github@gmail.com>
(cherry picked from commit 8047e0e1c6)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2019-06-16 00:07:54 -07:00
Miss Islington (bot) f0e5c01182
bpo-28009: Fix uuid SkipUnless logic to be based on platform programs capable of introspection (GH-12777)
uuid could try fallback methods that had no chance of working on a particular
platform, and this could cause spurious test failures, as well as degraded
performance as fallback options were tried and failed.

This fixes both the uuid module and its test's SkipUnless logic to use a
prefiltered list of techniques that may at least potentially work on that platform.

Patch by Michael Felt (aixtools).
(cherry picked from commit 3a1d50e7e5)

Co-authored-by: Michael Felt <aixtools@users.noreply.github.com>
2019-06-15 09:10:34 -07:00
Miss Islington (bot) bb07321c6a
bpo-37279: Fix asyncio sendfile support when extra data are sent in fallback mode. (GH-14075)
(cherry picked from commit ef2152354f)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-06-15 04:24:16 -07:00
Miss Islington (bot) e696b15a62
bpo-35537: Rewrite setsid test for os.posix_spawn (GH-11721)
bpo-35537, bpo-35876: Fix also test_start_new_session() of
test_subprocess: use os.getsid() rather than os.getpgid().
(cherry picked from commit 5884043252)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-14 10:49:22 -07:00
Miss Islington (bot) 3b976d19c8
bpo-37261: Document sys.unraisablehook corner cases (GH-14059)
Document reference cycle and resurrected objects issues in
sys.unraisablehook() and threading.excepthook() documentation.

Fix test.support.catch_unraisable_exception(): __exit__() no longer
ignores unraisable exceptions.

Fix test_io test_writer_close_error_on_close(): use a second
catch_unraisable_exception() to catch the BufferedWriter unraisable
exception.
(cherry picked from commit 212646cae6)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-14 09:59:54 -07:00
Miss Islington (bot) 0c2eb6d210
bpo-35998: Avoid TimeoutError in test_asyncio: test_start_tls_server_1() (GH-14080)
(cherry picked from commit f0749da9a5)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-06-14 09:12:48 -07:00
Miss Islington (bot) 8b66dbb212
bpo-37278: Fix test_asyncio ProactorLoopCtrlC (GH-14074)
Join the thread to prevent leaking a running thread and leaking a
reference.

Cleanup also the test:

* asyncioWindowsProactorEventLoopPolicy became the default policy,
  there is no need to set it manually.
* Only start the thread once the loop is running.
* Use a shorter sleep in the thread (100 ms rather than 1 sec).
* Use close_loop(loop) rather than loop.close().
* Use longer variable names.
(cherry picked from commit 07559450b2)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-14 04:53:13 -07:00
Miss Islington (bot) 7cd581a6bf
bpo-37269: Correctly optimise conditionals with constant booleans (GH-14071)
Fix a regression introduced by af8646c805 that was causing code of the form:

if True and False:
   do_something()

to be optimized incorrectly, eliminating the block.
(cherry picked from commit 05f8318655)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-06-13 23:13:24 -07:00
Miss Islington (bot) 5282b3b1d2
bpo-37213: Handle negative line deltas correctly in the peephole optimizer (GH-13969)
The peephole optimizer was not optimizing correctly bytecode after negative deltas were introduced. This is due to the fact that some special values (255) were being searched for in both instruction pointer delta and line number deltas.
(cherry picked from commit 3498c642f4)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-06-13 11:35:40 -07:00
Miss Islington (bot) b4f5b21253
bpo-37261: Fix support.catch_unraisable_exception() (GH-14052)
The __exit__() method of test.support.catch_unraisable_exception
context manager now ignores unraisable exception raised when clearing
self.unraisable attribute.
(cherry picked from commit 6d22cc8e90)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-13 06:25:59 -07:00
Miss Islington (bot) cbda40db7b
bpo-37210: Fix pure Python pickle when _pickle is unavailable (GH-14016)
Allow pure Python implementation of pickle to work
even when the C _pickle module is unavailable.

Fix test_pickle when _pickle is missing: declare PyPicklerHookTests
outside "if has_c_implementation:" block.
(cherry picked from commit 63ab4ba07b)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-13 05:28:11 -07:00
Victor Stinner e40a97a721
[3.8] bpo-36402: Fix threading._shutdown() race condition (GH-13948) (GH-14050)
* bpo-36402: Fix threading._shutdown() race condition (GH-13948)

Fix a race condition at Python shutdown when waiting for threads.
Wait until the Python thread state of all non-daemon threads get
deleted (join all non-daemon threads), rather than just wait until
Python threads complete.

* Add threading._shutdown_locks: set of Thread._tstate_lock locks
  of non-daemon threads used by _shutdown() to wait until all Python
  thread states get deleted. See Thread._set_tstate_lock().
* Add also threading._shutdown_locks_lock to protect access to
  threading._shutdown_locks.
* Add test_finalization_shutdown() test.

(cherry picked from commit 468e5fec8a)

* bpo-36402: Fix threading.Thread._stop() (GH-14047)

Remove the _tstate_lock from _shutdown_locks, don't remove None.

(cherry picked from commit 6f75c87375)
2019-06-13 13:44:23 +02:00
Victor Stinner c15a682603
bpo-37223: test_io: silence destructor errors (GH-14031)
* bpo-18748: Fix _pyio.IOBase destructor (closed case) (GH-13952)

_pyio.IOBase destructor now does nothing if getting the closed
attribute fails to better mimick _io.IOBase finalizer.

(cherry picked from commit 4f6f7c5a61)

* bpo-37223: test_io: silence destructor errors (GH-13954)

Implement also MockNonBlockWriterIO.seek() method.

(cherry picked from commit b589cef9c4)

* bpo-37223, test_io: silence last 'Exception ignored in:' (GH-14029)

Use catch_unraisable_exception() to ignore 'Exception ignored in:'
error when the internal BufferedWriter of the BufferedRWPair is
destroyed. The C implementation doesn't give access to the
internal BufferedWriter, so just ignore the warning instead.

(cherry picked from commit 913fa1c824)
2019-06-13 00:23:49 +02:00
Miss Islington (bot) 3955dfff60
Make asyncio stream sendfile fail on error (was hang) (GH-14025)
(cherry picked from commit 0d1942774a)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-06-12 12:10:44 -07:00
Victor Stinner b2fd32b2f0
bpo-35766: compile(): rename feature_version parameter (GH-13994) (GH-14001)
Rename compile() feature_version parameter to _feature_version and
convert it to a keyword-only parameter.

Update also test_type_comments to pass feature_version as a tuple.

(cherry picked from commit efdf6ca90f)
2019-06-12 16:17:05 +02:00
Miss Islington (bot) 70a4178ec4
bpo-35545: Skip `test_asyncio.test_create_connection_ipv6_scope` on AIX (GH-14011)
because "getaddrinfo()" behaves different on AIX

https://bugs.python.org/issue35545
(cherry picked from commit 32dda263e4)

Co-authored-by: Michael Felt <aixtools@users.noreply.github.com>
2019-06-12 05:20:12 -07:00
Miss Islington (bot) 9d37ae0bee
bpo-36918: Fix "Exception ignored in" in test_urllib (GH-13996)
Mock the HTTPConnection.close() method in a few unit tests to avoid
logging "Exception ignored in: ..." messages.
(cherry picked from commit eb976e47e2)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-11 19:26:02 -07:00
Abhilash Raj 36eea7af48 [3.8] bpo-36520: Email header folded incorrectly (GH-13608) (GH-13909)
* [bpo-36520](https://bugs.python.org/issue36520): reset the encoded word offset when starting a new
line during an email header folding operation

* 📜🤖 Added by blurb_it.

* [bpo-36520](https://bugs.python.org/issue36520): add an additional test case, and provide descriptive
comments for the test_folding_with_utf8_encoding_* tests

* [bpo-36520](https://bugs.python.org/issue36520): fix whitespace issue

* [bpo-36520](https://bugs.python.org/issue36520): changes per reviewer request -- remove extraneous
backslashes; add whitespace between terminating quotes and
line-continuation backslashes; use "bpo-" instead of
"issue GH-" in comments
(cherry picked from commit f6713e84af)

Co-authored-by: websurfer5 <49998481+websurfer5@users.noreply.github.com>


https://bugs.python.org/issue36520
2019-06-11 16:28:10 -07:00
Miss Islington (bot) b9ecc0fada
Fix test_posix if RWF_HIPRI is defined but not preadv2. (GH-13980)
If preadv2 is not available, preadv will raise NotImplementedError.
(cherry picked from commit 44867bb937)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2019-06-11 10:58:57 -07:00
Miss Islington (bot) 1c31d19e35
closes bpo-33758: Skip test_get_type_hints_modules_forwardref. (GH-13977)
This test "works" if things are run in the right order, so it's better to use @skip than @expectedFailure here.
(cherry picked from commit 910b3fcb01)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2019-06-11 09:37:59 -07:00
Miss Islington (bot) 583ff84351 bpo-37219: Remove erroneous optimization for differencing an empty set (GH-13965) (GH-13967)
(cherry picked from commit 1f11cf9521)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-06-11 01:41:23 -07:00
Miss Islington (bot) feaceaafe8 bpo-37178: Allow a one argument form of math.perm() (GH-13905) (GH-13919)
(cherry picked from commit e119b3d136)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-06-08 09:17:33 -07:00
Miss Islington (bot) c5daae4ef6
bpo-37173: Show passed class in inspect.getfile error (GH-13861)
Currently, inspect.getfile(str) will report nonsense:

```pytb
>>> inspect.getfile(str)
TypeError: <module 'builtins' (built-in)> is a built-in class
```

This fixes that

https://bugs.python.org/issue37173
(cherry picked from commit d407d2a726)

Co-authored-by: Philipp A <flying-sheep@web.de>
2019-06-08 05:24:59 -07:00
Miss Islington (bot) 3b5bac27c0
cross port importlib-metadata PR GH-76 (GH-13903)
https://gitlab.com/python-devs/importlib_metadata/merge_requests/76
(cherry picked from commit 65e5860fcc)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2019-06-07 14:44:03 -07:00
Miss Islington (bot) 606ac581e2
bpo-37150: Throw ValueError if FileType class object was passed in add_argument (GH-13805)
There is a possibility that someone (like me) accidentally will omit parentheses with `FileType` arguments after `FileType`, and parser will contain wrong file until someone will try to use it.

Example:
```python
parser = argparse.ArgumentParser()
parser.add_argument('-x', type=argparse.FileType)
```

https://bugs.python.org/issue37150
(cherry picked from commit 03d5831a2d)

Co-authored-by: zygocephalus <grrrr@protonmail.com>
2019-06-07 14:11:59 -07:00
Miss Islington (bot) 84d47bd8ad
bpo-37181: Fix test_regrtest failures on Windows arm64 (GH-13872)
(cherry picked from commit e7e5039d69)

Co-authored-by: Paul Monson <paulmon@users.noreply.github.com>
2019-06-07 11:17:52 -07:00
Miss Islington (bot) 5effd10bf1
bpo-37191: Move TestPEP590 from test_capi to test_call (GH-13892)
(cherry picked from commit 740a84de73)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-07 09:13:16 -07:00