Commit Graph

104559 Commits

Author SHA1 Message Date
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) 886d83e5aa
bpo-37077: Add native thread ID (TID) for AIX (GH-13624)
This is the followup  for issue36084

https://bugs.python.org/issue37077
(cherry picked from commit d0eeb936d8)

Co-authored-by: Michael Felt <aixtools@users.noreply.github.com>
2019-06-13 15:54:04 -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) ec3839a215
bpo-6689: os.path.commonpath raises ValueError for different drives isn't documented (GH-14045)
It would raise ValueError("Paths don't have the same drive") if the paths on different drivers, which is not documented.

os.path.commonpath raises ValueError when the *paths* are in different drivers, but it is not documented.
Update the document according @Windsooon 's suggestion.
It actually raise ValueError according line 355 of [test of path](https://github.com/python/cpython/blob/master/Lib/test/test_ntpath.py)

https://bugs.python.org/issue6689
(cherry picked from commit 95492032c4)

Co-authored-by: Makdon <makdon@makdon.me>
2019-06-13 07:12:49 -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) 0a9baec16c bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073) (GH-14032)
Calling setlocale(LC_CTYPE, "") on a system where GetACP() returns CP_UTF8 results in empty strings in _tzname[].

This causes time.tzname to be an empty string.
I have reported the bug to the UCRT team and will follow up, but it will take some time get a fix into production.

In the meantime one possible workaround is to temporarily change the locale by calling setlocale(LC_CTYPE, "C") before calling _tzset and restore the current locale after if the GetACP() == CP_UTF8 or CP_UTF7

@zooba

https://bugs.python.org/issue36779
(cherry picked from commit b4c7defe58)

Co-authored-by: Paul Monson <paulmon@users.noreply.github.com>
2019-06-13 15:22:51 +02: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
Miss Islington (bot) 032bf30643
bpo-37253: Remove PyAST_obj2mod_ex() function (GH-14020)
PyAST_obj2mod_ex() is similar to PyAST_obj2mod() with an additional
'feature_version' parameter which is unused.
(cherry picked from commit 022ac0a497)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-13 00:46:01 -07:00
Miss Islington (bot) c80183e6ca
bpo-35070: test_getgrouplist may fail on macOS if too many groups (GH-13071)
(cherry picked from commit 8725c83ed5)

Co-authored-by: Jeffrey Kintscher <49998481+websurfer5@users.noreply.github.com>
2019-06-13 00:27:23 -07:00
Victor Stinner f9445a391e
[3.8] bpo-37253: Document PyCompilerFlags.cf_feature_version (GH-14019) (GH-14038)
* Update PyCompilerFlags structure documentation.
* Document the new cf_feature_version field in the Changes in the C
  API section of the What's New in Python 3.8 doc.

(cherry picked from commit 2c9b498759)
2019-06-13 02:40:41 +02:00
Miss Islington (bot) 92e836c7dc
bpo-37253: Add _PyCompilerFlags_INIT macro (GH-14018)
Add a new _PyCompilerFlags_INIT macro to initialize PyCompilerFlags
variables, rather than initializing cf_flags and cf_feature_version
explicitly in each variable.
(cherry picked from commit 37d66d7d4b)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-12 17:36:03 -07: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
Miss Islington (bot) f72886a066
bpo-37236: pragma optimize off for _Py_c_quot on Windows arm64 (GH-13983)
(cherry picked from commit ff6bb0aa95)

Co-authored-by: Paul Monson <paulmon@users.noreply.github.com>
2019-06-12 11:27:15 -07:00
Miss Islington (bot) bb3e8a68b2
bpo-37201: fix test_distutils failures for Windows ARM64 (GH-13902)
(cherry picked from commit daf6262751)

Co-authored-by: Paul Monson <paulmon@users.noreply.github.com>
2019-06-12 10:44:29 -07:00
Miss Islington (bot) c9ca96dd96
bpo-37160: Thread native ID NetBSD support (GH-13835)
(cherry picked from commit 5287022eee)

Co-authored-by: David Carlier <dcarlier@afilias.info>
2019-06-12 09:03:04 -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) 669e07be48 Add some placeholder notes for major 3.8 features (GH-13927) (#13929)
(cherry picked from commit b9438ceb20)

Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
2019-06-12 13:31:13 +02:00
Miss Islington (bot) 996e52623a bpo-26219: Fix compiler warning in _PyCode_InitOpcache() (GH-13997) (GH-14000)
Fix MSVC warning:

    objects\codeobject.c(285): warning C4244: '=':
    conversion from 'Py_ssize_t' to 'unsigned char',
    possible loss of data
(cherry picked from commit 376ce9852e)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-06-12 12:14:43 +02:00
Miss Islington (bot) 878227e721
bpo-29505: Fuzz json module, enforce size limit on int(x) fuzz (GH-13991)
* bpo-29505: Enable fuzz testing of the json module, enforce size limit on int(x) fuzz and json input size to avoid timeouts.

Contributed by by Ammar Askar for Google.
(cherry picked from commit a6e190e94b)

Co-authored-by: Ammar Askar <aaskar@google.com>
2019-06-11 21:48:17 -07:00
Miss Islington (bot) 811f84d55d
bpo-32625: Updated documentation for EXTENDED_ARG. (GH-13985)
Python 3.6 changed the size of bytecode instruction, while the documentation for `EXTENDED_ARG` was not updated accordingly.
(cherry picked from commit 405f648db7)

Co-authored-by: Yao Zuo <laike9m@users.noreply.github.com>
2019-06-11 20:53:58 -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
Miss Islington (bot) 3ba21070c6 bpo-35766: Change format for feature_version to (major, minor) (GH-13992) (GH-13993)
(A single int is still allowed, but undocumented.)

https://bugs.python.org/issue35766
(cherry picked from commit 10b55c1643)

Co-authored-by: Guido van Rossum <guido@python.org>
2019-06-12 02:55:28 +02: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) 36926df834
bpo-37238: Enable building for Windows using Visual Studio 2019 (GH-13988)
(cherry picked from commit 04856c2193)

Co-authored-by: Paul Monson <paulmon@users.noreply.github.com>
2019-06-11 15:35:55 -07:00
Miss Islington (bot) 785688832d
bpo-35766: What's new in the ast and typing modules (GH-13984)
(cherry picked from commit 9b33ce48a7)

Co-authored-by: Guido van Rossum <guido@python.org>
2019-06-11 14:13:25 -07:00
Miss Islington (bot) 83abd9658b
bpo-36607: Eliminate RuntimeError raised by asyncio.all_tasks() (GH-13971)
If internal tasks weak set is changed by another thread during iteration.

https://bugs.python.org/issue36607
(cherry picked from commit 65aa64fae8)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-06-11 13:32:12 -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
Makdon fe5f8b9ce2 [3.8] bpo-37216: Fix version and filename in Mac using document (GH-13964) 2019-06-11 01:37:34 -04:00
Miss Islington (bot) 5b94b857f5
closes bpo-35184: Fix XML_POOR_ENTROPY option that breaks makesetup parsing of pyexpat line in Setup. (GH-13064)
When the line is uncommented, the equals character causes it to be incorrectly interpreted
as a macro definition by makesetup.  This results in invalid Makefile output.

The expat code only requires XML_POOR_ENTROPY to be defined; the value is unnecessary.
(cherry picked from commit 408a2ef1ac)

Co-authored-by: aaronpaulhurst <aaronpaulhurst@gmail.com>
2019-06-10 19:14:23 -07:00
Miss Islington (bot) bac6e63fd6
bpo-37215: Fix dtrace issue introduce by bpo-36842 (GH-13940)
Signed-off-by: Christian Heimes <christian@python.org>

https://bugs.python.org/issue37215
(cherry picked from commit 8a8b59c979)

Co-authored-by: Christian Heimes <christian@python.org>
2019-06-10 08:38:23 -07:00
Miss Islington (bot) 3f7629d93c
bpo-11122: fix hardcoded path checking for rpmbuild in bdist_rpm.py (GH-10594)
(cherry picked from commit 45a14942c9)

Co-authored-by: Marcin Niemira <marcin.niemira@gmail.com>
2019-06-08 14:25:21 -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) 6324ac1293
bpo-34886: Fix subprocess.run handling of exclusive arguments (GH-11727)
Fix an unintended ValueError from :func:`subprocess.run` when checking for
conflicting `input` and `stdin` or `capture_output` and `stdout` or `stderr` args
when they were explicitly provided but with `None` values within a passed in
`**kwargs` dict rather than as passed directly by name.
(cherry picked from commit 8cc605acdd)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2019-06-08 08:15:02 -07:00
Miss Islington (bot) 22b69da4c3
bpo-29505: Fix interpreter in fuzzing targets to be relocatable (GH-13907)
(cherry picked from commit a15a7bcaea)

Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
2019-06-08 08:03:05 -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) 3d03a35ba0 [3.8] bpo-37188: Fix a divide-by-zero in arrays of size-0 objects (#13911) 2019-06-08 11:46:53 +02: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) 6c9effabe0 IDLE: Standardize naming convention for DummyEditwin in tests (GH-13876) (#13885)
* Change from Dummy_Editwin to DummyEditwin to match other tests.
(cherry picked from commit 7f8a38a7c4)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2019-06-07 16:05:18 -04:00
Miss Islington (bot) 6e053079ac
bpo-37138: fix undefined behaviour with memcpy() on NULL array (GH-13867)
(cherry picked from commit 1f9531764c)

Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
2019-06-07 11:25:53 -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
Petr Viktorin 9689f80e61 bpo-37191: Avoid declaration-after-statement in header included from Python.h (GH-13887) 2019-06-07 18:31:56 +02: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
Victor Stinner 3576266760
bpo-37169: Rewrite _PyObject_IsFreed() unit tests (GH-13888) (GH-13895)
Replace two Python function calls with a single one to ensure that no
memory allocation is done between the invalid object is created and
when _PyObject_IsFreed() is called.

(cherry picked from commit 3bf0f3ad20)
2019-06-07 17:41:39 +02:00
Zackery Spytz dd492d9c35 [3.8] bpo-37170: Fix the cast on error in PyLong_AsUnsignedLongLongMask() (GH-13860) (GH-13891)
(cherry picked from commit dc2476500d)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-06-07 16:22:58 +02:00