Commit Graph

45151 Commits

Author SHA1 Message Date
Miss Islington (bot) 652a1cb0e1 bpo-38521: Fix error in NormalDist.__eq__() (GH-16840) (GH-16842)
(cherry picked from commit 5eabec022b)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-10-18 14:41:19 -07:00
Senthil Kumaran 0f3187c1ce
[3.8] bpo-27657: Fix urlparse() with numeric paths (GH-661) (#16839)
* bpo-27657: Fix urlparse() with numeric paths

Revert parsing decision from bpo-754016 in favor of the documented
consensus in bpo-16932 of how to treat strings without a // to
designate the netloc.

* bpo-22891: Remove urlsplit() optimization for 'http' prefixed inputs.
(cherry picked from commit 5a88d50ff0)

Co-authored-by: Tim Graham <timograham@gmail.com>
2019-10-18 08:23:14 -07:00
Miss Islington (bot) c615db608d
bpo-33604: Raise TypeError on missing hmac arg. (GH-16805)
Also updates the documentation to clarify the situation surrounding
the digestmod parameter that is required despite its position in the
argument list as of 3.8.0 as well as removing old python2 era
references to "binary strings".

We indavertently had this raise ValueError in 3.8.0 for the missing
arg.  This is not considered an API change as no reasonable code would
be catching this missing argument error in order to handle it.
(cherry picked from commit f33c57d5c7)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2019-10-17 20:48:42 -07:00
Miss Islington (bot) afbcd9f26d
bpo-35998: Fix test_asyncio.test_start_tls_server_1() (GH-16815)
main() is now responsible to send the ANSWER, rather than
ServerProto. main() now waits until it got the HELLO before sending
the ANSWER over the new transport.

Previously, there was a race condition between main() replacing the
protocol and the protocol sending the ANSWER once it gets the HELLO.

TLSv1.3 was disabled for the test: reenable it.
(cherry picked from commit fab4ef2df0)

Co-authored-by: Victor Stinner <vstinner@python.org>
2019-10-16 01:36:57 -07:00
Miss Islington (bot) f705f8e9b5
bpo-38478: Correctly handle keyword argument with same name as positional-only parameter (GH-16800)
(cherry picked from commit f3ef06a7cb)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-10-15 05:02:34 -07:00
Victor Stinner f82ce5b1b1
[3.8] bpo-36389: Backport debug enhancements from master (GH-16796)
* bpo-36389: _PyObject_CheckConsistency() available in release mode (GH-16612)

bpo-36389, bpo-38376: The _PyObject_CheckConsistency() function is
now also available in release mode. For example, it can be used to
debug a crash in the visit_decref() function of the GC.

Modify the following functions to also work in release mode:

* _PyDict_CheckConsistency()
* _PyObject_CheckConsistency()
* _PyType_CheckConsistency()
* _PyUnicode_CheckConsistency()

Other changes:

* _PyMem_IsPtrFreed(ptr) now also returns 1 if ptr is NULL
  (equals to 0).
* _PyBytesWriter_CheckConsistency() now returns 1 and is only used
  with assert().
* Reorder _PyObject_Dump() to write safe fields first, and only
  attempt to render repr() at the end.

(cherry picked from commit 6876257eaa)

* bpo-36389: Fix _PyBytesWriter in release mode (GH-16624)

Fix _PyBytesWriter API when Python is built in release mode with
assertions.

(cherry picked from commit 60ec6efd96)

* bpo-38070: Enhance visit_decref() debug trace (GH-16631)

subtract_refs() now pass the parent object to visit_decref() which
pass it to _PyObject_ASSERT(). So if the "is freed" assertion fails,
the parent is used in debug trace, rather than the freed object. The
parent object is more likely to contain useful information. Freed
objects cannot be inspected are are displayed as "<object at xxx is
freed>" with no other detail.

(cherry picked from commit 4d5f94b8cd)

* Fix also a typo in PYMEM_DEADBYTE macro comment

* bpo-36389: Add newline to _PyObject_AssertFailed() (GH-16629)

Add a newline between the verbose object dump and the Py_FatalError()
logs for readability.

(cherry picked from commit 7775349895)
2019-10-15 03:06:16 +02:00
Gregory P. Smith 4f0587f161
[3.8] bpo-38456: Use /bin/true in test_subprocess (GH-16737)
* [3.8] bpo-38456: Use /bin/true in test_subprocess (GH-16736)

Instead of sys.executable, "-c", "pass" or "import sys; sys.exit(0)"
use /bin/true when it is available.  On a reasonable machine this
shaves up to two seconds wall time off the otherwise ~40sec execution
on a --with-pydebug build.  It should be more notable on many
buildbots or overloaded slower I/O systems (CI, etc)..
(cherry picked from commit 67b93f80c7)

* Handle when there is no 'true' command

backport of 46113e0cf3 by Pablo Galindo.
2019-10-14 13:40:32 -07:00
Łukasz Langa 85da2ddc89 Python 3.8.0
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl2keYQACgkQsmmV4xAl
 BWgtYA/+OuuxCQieZTU9h10naQvzp42/4g69EjvV396wvgGWABxAUVQGJr5swX39
 M3Z8f26AhIhxyLP55BqHB+0RxnuEZ/9EtbPUhAu/LJFj6jct2YtFcObAect+Ey0l
 +rdPY5amCLgJGghG7sEaWD7MOn5SK/ub6jFbY9Jj7fBdaKe+jj703tw3iR0TfCtH
 m1vrBnD4iMt3+7N7FlOXV84UGfwQtYWOyNYn9mUCi+beFDmoScMItpkozKKK+1FC
 jEatdZIiWHOaacgSXcYRxDRPOt8W/YewW5wbnk+/i/7uiUcPJAKpoKr07tRImVDX
 D0Uc0IMJIyAKNw4jlo0yBoG1QdovqnFGCsJgnhmJKeQgWKiJMlFWF0jn7rnl/Awu
 xGp5xedIUVQ8wKuhIEkIalZ9LI/IKEmhwQTz7aPyV9okiFlHHonpxmgeQWFZgmzN
 4XD/+ihuZRJ+KUTshTqAYzbQ1uNjZJzOjJUwiV1LRXHaYxixW8yrFsr+jcpWGybF
 j2YTNKh7JSWloAa/bZdD+TPp8mATAXvGqoRa8YaDWzYogD8avpIsoSzNchKPEEO7
 HyapQykFlmR7roOOgqLt1BmJvnbLJeQYdNc/PadtNlyiI+IVaQiiEr9EYpe/Nnz7
 0krlnTZmcKekXoc7VopPhB9s2jLAoCVeIr/WE6CHbZ6NBeauIcQ=
 =u2+m
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl2k1EMQHGx1a2FzekBs
 YW5nYS5wbAAKCRCyaZXjECUFaMhNEACVjtdwLS3T+U04gyYbYbBEv5ETpplDvhI8
 sNgNWncp2pHav5RJqzxOMoCUrlh1axgylqceMFtxkTbYiQvbEtna+K6jYW94mz2t
 TJhS9hWaSN8lUp9W637t0evn8ah3unuyfS3aqBs9LxLV9UJcn2hzJqbLJ288JClm
 7ZrAkD2CqQse2vs+XN6no2V2Pc4XRf40v4XstJS5dqykg7cvbaSnpnyHKYJEV3bM
 MyUoXUR/D7rxXtwOPLqtDlFrZj690IuAjPuV3o0+0MXXs6JJ+flWo5HFQ/EUGdt1
 Yq30gt4iau/Jdy/mVJCBggD79BVz3lcTfITZQ9CwpgxeivxeCqamlYsTwylanLrU
 CNyCLeyhEB5m2VyZ/yWIqoTcN7hxKXYqAn6ELKHIy2O/JcT00giG9IDDC7+OeW3Q
 8jN7zhb1AXhO1u+S+Kraw6fJDUxnq3AEknfShUpOW2KfyQwxh2HjpHJGPSrzIkjZ
 YMC8t6tyvHlpFnoqHWknLURkm4l8zfxl7rg4Z2tnu/41MmHtZE0MocDLKytzXUW2
 zsxJllqA6rRJPh4Rz/n6Mb6o4vgdJ5tHT2rsxhSmu2YiRjD4hp3Ovm5T6TMdMquh
 r+BXlMl+lN5J6xuEvwNSlUMcU/QKOrAvPBlgsSwhXMVp2/HZ20kfc2gRWg6O4PhM
 eMzH9by1Uw==
 =W9XA
 -----END PGP SIGNATURE-----

Merge tag 'v3.8.0' into 3.8

Python 3.8.0
2019-10-14 22:02:08 +02:00
Miss Islington (bot) aa909b6b12
bpo-38453: Resolve test directories before chdir to them (GH-16723)
(cherry picked from commit d83fc27029)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-10-14 09:01:29 -07:00
Łukasz Langa fa919fdf25
v3.8.0 2019-10-14 15:34:47 +02:00
Miss Islington (bot) 927f07c816 bpo-38469: Handle named expression scope with global/nonlocal keywords (GH-16755) (#16760)
The symbol table handing of PEP572's assignment expressions is not resolving correctly the scope of some variables in presence of global/nonlocal keywords in conjunction with comprehensions.
(cherry picked from commit fd5c414880)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-10-14 13:40:15 +02:00
Miss Islington (bot) 6da52ac411
bpo-38431: Fix __repr__ method of InitVar to work with typing objects. (GH-16702)
(cherry picked from commit 793cb85437)

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2019-10-13 05:04:05 -07:00
Miss Islington (bot) e540bb5461
bpo-38332: Catch KeyError from unknown cte in encoded-word. (GH-16503)
KeyError should cause a failure in parsing the encoded word and should be caught and raised as a _InvalidEWError instead.
(cherry picked from commit 65dcc8a8dc)

Co-authored-by: Andrei Troie <andreitroie90@gmail.com>
2019-10-12 10:03:24 -07:00
Abhilash Raj 5a638a8055
[3.8] bpo-38449: Revert "bpo-22347: Update mimetypes.guess_type to allow oper parsing of URLs" (GH-16724) (GH-16728)
This reverts commit 87bd2071c7.

The reason for revert is a regression caused by the change in 3.8.0rc1, see bpo-38449 for more details.

https://bugs.python.org/issue38449
(cherry picked from commit 19a3d87300)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
2019-10-12 09:58:11 -07:00
Miss Islington (bot) 1da648aceb
bpo-38341: Add SMTPNotSupportedError in the exports of smtplib (GH-16525)
Add SMTPNotSupportedError in the exports of smtplib

Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>
(cherry picked from commit 3faf826e58)

Co-authored-by: nde <denayer.norman@gmail.com>
2019-10-12 09:08:24 -07:00
Miss Islington (bot) 73665b4147
bpo-38347: find pathfix for Python scripts whose name contain a '-' (GH-16536)
pathfix.py: Assume all files that end on '.py' are Python scripts when working recursively.
(cherry picked from commit 2b7dc40b2a)

Co-authored-by: Ruediger Pluem <r.pluem@gmx.de>
2019-10-11 06:56:49 -07:00
Miss Islington (bot) 398d84747d
Re-enable the OverflowError test for test_truediv on test_complex (GH-16591)
(cherry picked from commit 1dbe537385)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-10-10 10:11:07 -07:00
Miss Islington (bot) 8ab11c433a bpo-38109: Add missing constants to Lib/stat.py (GH-16665) (GH-16690)
Add missing stat.S_IFDOOR, stat.S_IFPORT, stat.S_IFWHT,
stat.S_ISDOOR, stat.S_ISPORT, and stat.S_ISWHT values to
the Python implementation of the stat module.
(cherry picked from commit 7bb14316b8)

Co-authored-by: Ronan Lamy <ronan.lamy@gmail.com>
2019-10-10 15:50:32 +02:00
Pablo Galindo 0bd9fac7a8 [3.8] bpo-38379: don't claim objects are collected when they aren't (GH-16658) (GH-16683)
* [bpo-38379](https://bugs.python.org/issue38379):  when a finalizer resurrects an object,
nothing is actually collected in this run of gc.
Change the stats to relect that truth.
(cherry picked from commit ecbf35f933)

Co-authored-by: Tim Peters <tim.peters@gmail.com>





https://bugs.python.org/issue38379



Automerge-Triggered-By: @pablogsal
2019-10-09 14:25:06 -07:00
Miss Islington (bot) 359a1975cb
bpo-37531: regrtest ignores output on timeout (GH-16659)
bpo-37531, bpo-38207: On timeout, regrtest no longer attempts to call
`popen.communicate() again: it can hang until all child processes
using stdout and stderr pipes completes. Kill the worker process and
ignores its output.

Reenable test_regrtest.test_multiprocessing_timeout().

bpo-37531: Change also the faulthandler timeout of the main process
from 1 minute to 5 minutes, for Python slowest buildbots.
(cherry picked from commit 0ec618af98)

Co-authored-by: Victor Stinner <vstinner@python.org>
2019-10-09 07:02:15 -07:00
Vinay Sajip d004a5b082
bpo-38368: Added fix for ctypes crash when handling arrays in structs/unions. (GH-16589) (GH-16671)
(cherry picked from commit e8bedbddad)
2019-10-09 06:47:57 +01:00
Pablo Galindo 526ef856dd
[3.8] bpo-38395: Fix ownership in weakref.proxy methods (GH-16632) (GH-16662)
The implementation of weakref.proxy's methods call back into the Python
API using a borrowed references of the weakly referenced object
(acquired via PyWeakref_GET_OBJECT). This API call may delete the last
reference to the object (either directly or via GC), leaving a dangling
pointer, which can be subsequently dereferenced.

To fix this, claim a temporary ownership of the referenced object when
calling the appropriate method. Some functions because at the moment they
do not need to access the borrowed referent, but to protect against
future changes to these functions, ownership need to be fixed in
all potentially affected methods..
(cherry picked from commit 10cd00a9e3)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-10-08 21:38:11 +01:00
Miss Islington (bot) 7162440a72
bpo-38407: Add docstrings for typing.SupportsXXX classes. (GH-16644)
(cherry picked from commit 8252c52e57)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-10-08 07:14:57 -07:00
Miss Islington (bot) 10b475a151
bpo-38405: Make nested subclasses of typing.NamedTuple pickleable. (GH-16641)
(cherry picked from commit 13abda4100)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-10-08 07:12:38 -07:00
Miss Islington (bot) a1f45008f1
bpo-36698: IDLE no longer fails when write non-encodable characters to stderr. (GH-16583)
It now escapes them with a backslash, as the regular Python interpreter.
Added the "errors" field to the standard streams.
(cherry picked from commit b690a2759e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-10-08 04:51:16 -07:00
Miss Islington (bot) 4880e5a1b6
bpo-38344: Fix syntax in activate.bat (GH-16533)
(cherry picked from commit e310af9e29)

Co-authored-by: James Abel <j@abel.co>
2019-10-07 14:26:57 -07:00
Miss Islington (bot) dc191245d8
bpo-13153: Use OS native encoding for converting between Python and Tcl. (GH-16545)
On Windows use UTF-16 (or UTF-32 for 32-bit Tcl_UniChar) with the
"surrogatepass" error handler for converting to/from Tcl Unicode objects.

On Linux use UTF-8 with the "surrogateescape" error handler for converting
to/from Tcl String objects.

Converting strings from Tcl to Python and back now never fails
(except MemoryError).
(cherry picked from commit 06cb94bc84)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-10-04 03:28:54 -07:00
Miss Islington (bot) 8edde5caab
bpo-34344 Fix AbstractEventLoopPolicy.get_event_loop docstring (GH-16463)
(cherry picked from commit b23a8423a9)

Co-authored-by: idomic <michael.ido@gmail.com>
2019-10-03 14:26:57 -07:00
Miss Islington (bot) 6067e1d2be
bpo-38355: Fix ntpath.realpath failing on sys.executable (GH-16551)
(cherry picked from commit a0e3d27e4e)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-10-03 08:49:56 -07:00
Victor Stinner de3195c937
[3.8] bpo-36670, regrtest: Fix WindowsLoadTracker() for partial line (GH-16550) (GH-16560)
* bpo-36670, regrtest: Fix WindowsLoadTracker() for partial line (GH-16550)

WindowsLoadTracker.read_output() now uses a short buffer for
incomplete line.

(cherry picked from commit 3e04cd268e)

* bpo-36670: Enhance regrtest WindowsLoadTracker (GH-16553)

The last line is now passed to the parser even if it does not end
with a newline, but only if it's a valid value.

(cherry picked from commit c65119d5bf)

* bpo-36670: Enhance regrtest (GH-16556)

* Add log() method: add timestamp and load average prefixes
  to main messages.
* WindowsLoadTracker:

  * LOAD_FACTOR_1 is now computed using SAMPLING_INTERVAL
  * Initialize the load to the arithmetic mean of the first 5 values
    of the Processor Queue Length value (so over 5 seconds), rather
    than 0.0.
  * Handle BrokenPipeError and when typeperf exit.

* format_duration(1.5) now returns '1.5 sec', rather than
  '1 sec 500 ms'

(cherry picked from commit 098e25672f)
2019-10-03 17:26:25 +02:00
Miss Islington (bot) 183733dfb6
bpo-38338, test.pythoninfo: add more ssl infos (GH-16539)
test.pythoninfo now logs environment variables used by OpenSSL and
Python ssl modules, and logs attributes of 3 SSL contexts
(SSLContext, default HTTPS context, stdlib context).
(cherry picked from commit b3e7045f83)

Co-authored-by: Victor Stinner <vstinner@python.org>
2019-10-02 09:52:50 -07:00
Miss Islington (bot) a72de93388
bpo-36670: regrtest bug fixes (GH-16537)
* Fix TestWorkerProcess.__repr__(): start_time is only valid
  if _popen is not None.
* Fix _kill(): don't set _killed to True if _popen is None.
* _run_process(): only set _killed to False after calling
  run_test_in_subprocess().
(cherry picked from commit 2ea71a07d0)

Co-authored-by: Victor Stinner <vstinner@python.org>
2019-10-02 04:54:18 -07:00
Łukasz Langa 34214de6ab
v3.8.0rc1 2019-10-01 14:58:26 +02:00
Miss Islington (bot) 6b4c70abca
bpo-36670: Multiple regrtest bugfixes (GH-16511)
* Windows: Fix counter name in WindowsLoadTracker. Counter names are
  localized: use the registry to get the counter name. Original
  change written by Lorenz Mende.
* Regrtest.main() now ensures that the Windows load tracker is also
  killed if an exception is raised
* TestWorkerProcess now ensures that worker processes are no longer
  running before exiting: kill also worker processes when an
  exception is raised.
* Enhance regrtest messages and warnings: include test name,
  duration, add a worker identifier, etc.
* Rename MultiprocessRunner to TestWorkerProcess
* Use print_warning() to display warnings.

Co-Authored-By: Lorenz Mende <Lorenz.mende@gmail.com>
(cherry picked from commit 982bfa4da0)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-10-01 03:47:52 -07:00
Miss Islington (bot) 938c00ca9e bpo-38319: Fix shutil._fastcopy_sendfile(): set sendfile() max block size (GH-16491) (#16506)
(cherry picked from commit 94e165096f)

Co-authored-by: Giampaolo Rodola <g.rodola@gmail.com>
2019-10-01 09:55:02 +02:00
Miss Islington (bot) 2f644c0dc9 Fix and improve `asyncio.run()` docs (GH-16403) (GH-16504)
(cherry picked from commit e407013089)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2019-09-30 18:46:43 -07:00
Christian Heimes bfca56b3dd [3.8] bpo-38270: More fixes for strict crypto policy (GH-16418) (#16437)
test_hmac and test_hashlib test built-in hashing implementations and
OpenSSL-based hashing implementations. Add more checks to skip OpenSSL
implementations when a strict crypto policy is active.

Use EVP_DigestInit_ex() instead of EVP_DigestInit() to initialize the
EVP context. The EVP_DigestInit() function clears alls flags and breaks
usedforsecurity flag again.

Signed-off-by: Christian Heimes <christian@python.org>

https://bugs.python.org/issue38270.
(cherry picked from commit 9055815809)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-30 09:10:38 +02:00
Miss Islington (bot) 2f87a7dc5a bpo-30773: Fix ag_running; prohibit running athrow/asend/aclose in parallel (GH-7468) (#16486)
(cherry picked from commit fc4a044a3c)

Co-authored-by: Yury Selivanov <yury@magic.io>
2019-09-29 23:19:02 -07:00
Yury Selivanov 1c19d656a7
bpo-38242: Revert "bpo-36889: Merge asyncio streams (GH-13251)" (#16482) (#16485)
See https://bugs.python.org/issue38242 for more details
2019-09-29 22:30:17 -07:00
Lisa Roach 21f24ead90
[3.8] bpo-38163: Child mocks detect their type as sync or async (GH-16471) (GH-16484) 2019-09-29 22:22:44 -07:00
Miss Islington (bot) 36e7e4aabb bpo-38161: Removes _AwaitEvent from AsyncMock. (GH-16443) (GH-16481) 2019-09-29 21:23:33 -07:00
Miss Islington (bot) b76ab35240 bpo-38108: Makes mock objects inherit from Base (GH-16060) (GH-16470) 2019-09-29 21:02:46 -07:00
Miss Islington (bot) c9ed9e6fc7
bpo-38317: Fix PyConfig.warnoptions priority (GH-16478)
Fix warnings options priority: PyConfig.warnoptions has the highest
priority, as stated in the PEP 587.

* Document options order in PyConfig.warnoptions documentation.
* Make PyWideStringList_INIT macro private: replace "Py" prefix
  with "_Py".
* test_embed: add test_init_warnoptions().
(cherry picked from commit fb4ae152a9)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-09-29 16:58:57 -07:00
Miss Islington (bot) 19cd5951ec
bpo-38019: correctly handle pause/resume reading of closed asyncio unix pipe (GH-16472)
(cherry picked from commit 58498bc717)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-29 05:20:15 -07:00
Gregory P. Smith 36c6fa9680
bpo-38115: Deal with invalid bytecode offsets in lnotab (GH-16079) (GH-16464)
Document that lnotab can contain invalid bytecode offsets (because of
terrible reasons that are difficult to fix). Make dis.findlinestarts()
ignore invalid offsets in lnotab. All other uses of lnotab in CPython
(various reimplementations of addr2line or line2addr in Python, C and gdb)
already ignore this, because they take an address to look for, instead.

Add tests for the result of dis.findlinestarts() on wacky constructs in
test_peepholer.py, because it's the easiest place to add them.

(cherry picked from commit c8165036f3)
2019-09-28 08:22:00 -07:00
Miss Islington (bot) 8f478b489a
bpo-38216, bpo-36274: Allow subclasses to separately override validation and encoding behavior (GH-16448)
* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path.
(cherry picked from commit 7774d7831e)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2019-09-28 07:23:34 -07:00
Lisa Roach 52bdd414ed
[3.8] bpo-38136: Updates await_count and call_count to be different things (GH-16192) (GH-16431) 2019-09-27 15:44:34 -07:00
Miss Islington (bot) 6447b9f9bd
bpo-38243, xmlrpc.server: Escape the server_title (GH-16373)
Escape the server title of xmlrpc.server.DocXMLRPCServer
when rendering the document page as HTML.
(cherry picked from commit e8650a4f8c)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-09-27 13:19:41 -07:00
Miss Islington (bot) b2c2a0c02c
cleanup ababstractproperty in typing.py (GH-16432)
(cherry picked from commit 6ce03ec627)

Co-authored-by: HongWeipeng <961365124@qq.com>
2019-09-27 01:13:38 -07:00
Christian Heimes 1931132db3
[3.8] bpo-38275: Skip ssl tests for disabled versions (GH-16386) (GH-16425)
test_ssl now handles disabled TLS/SSL versions better. OpenSSL's crypto
policy and run-time settings are recognized and tests for disabled versions
are skipped.

Signed-off-by: Christian Heimes <christian@python.org>

https://bugs.python.org/issue38275
(cherry picked from commit df6ac7e2b8)
2019-09-26 22:53:09 +02:00
Miss Islington (bot) c989340065
bpo-38239: Fix test_gdb for Link Time Optimization (LTO) (GH-16422)
(cherry picked from commit 64b4a3a2de)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-09-26 08:13:39 -07:00
Victor Stinner 96c8475362
[3.8] bpo-38234: Backport init path config changes from master (GH-16423)
* bpo-38234: Py_SetPath() uses the program full path (GH-16357)

Py_SetPath() now sets sys.executable to the program full path
(Py_GetProgramFullPath()), rather than to the program name
(Py_GetProgramName()).

Fix also memory leaks in pathconfig_set_from_config().

(cherry picked from commit 1ce152a42e)

* bpo-38234: Add tests for Python init path config (GH-16358)


(cherry picked from commit bb6bf7d342)

* bpo-38234: test_embed: test pyvenv.cfg and pybuilddir.txt (GH-16366)

Add test_init_pybuilddir() and test_init_pyvenv_cfg() to test_embed
to test pyvenv.cfg and pybuilddir.txt configuration files.

Fix sysconfig._generate_posix_vars(): pybuilddir.txt uses UTF-8
encoding, not ASCII.

(cherry picked from commit 52ad33abbf)

* bpo-38234: Cleanup getpath.c (GH-16367)

* search_for_prefix() directly calls reduce() if found is greater
  than 0.
* Add calculate_pybuilddir() subfunction.
* search_for_prefix(): add path string buffer for readability.
* Fix some error handling code paths: release resources on error.
* calculate_read_pyenv(): rename tmpbuffer to filename.
* test.pythoninfo now also logs windows.dll_path

(cherry picked from commit 221fd84703)

* bpo-38234: Fix test_embed pathconfig tests (GH-16390)

bpo-38234: On macOS and FreeBSD, the temporary directory can be
symbolic link. For example, /tmp can be a symbolic link to /var/tmp.
Call realpath() to resolve all symbolic links.

(cherry picked from commit 00508a7407)

* bpo-38234: Add test_init_setpath_config() to test_embed (GH-16402)

* Add test_embed.test_init_setpath_config(): test Py_SetPath()
  with PyConfig.
* test_init_setpath() and test_init_setpythonhome() no longer call
  Py_SetProgramName(), but use the default program name.
* _PyPathConfig: isolated, site_import  and base_executable
  fields are now only available on Windows.
* If executable is set explicitly in the configuration, ignore
  calculated base_executable: _PyConfig_InitPathConfig() copies
  executable to base_executable.
* Complete path config documentation.

(cherry picked from commit 8bf39b606e)

* bpo-38234: Complete init config documentation (GH-16404)


(cherry picked from commit 88feaecd46)

* bpo-38234: Fix test_embed.test_init_setpath_config() on FreeBSD (GH-16406)

Explicitly preinitializes with a Python preconfiguration to avoid
Py_SetPath() implicit preinitialization with a compat
preconfiguration.

Fix also test_init_setpath() and test_init_setpythonhome() on macOS:
use self.test_exe as the executable (and base_executable), rather
than shutil.which('python3').

(cherry picked from commit 49d99f01e6)

* bpo-38234: Py_Initialize() sets global path configuration (GH-16421)

* Py_InitializeFromConfig() now writes PyConfig path configuration to
  the global path configuration (_Py_path_config).
* Add test_embed.test_get_pathconfig().
* Fix typo in _PyWideStringList_Join().

(cherry picked from commit 12f2f177fc)
2019-09-26 16:17:34 +02:00
Miss Islington (bot) 4267e8f72a
bpo-38271: encrypt private key test files with AES256 (GH-16385)
The private keys for test_ssl were encrypted with 3DES in traditional
PKCSGH-5 format. 3DES and the digest algorithm of PKCSGH-5 are blocked by
some strict crypto policies. Use PKCSGH-8 format with AES256 encryption
instead.

Signed-off-by: Christian Heimes <christian@python.org>

https://bugs.python.org/issue38271

Automerge-Triggered-By: @tiran
(cherry picked from commit bfd0c963d8)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-25 09:13:54 -07:00
Miss Islington (bot) ca14f047b0
bpo-38005: Remove support of string argument in InterpreterID(). (GH-16227)
Make negative interpreter id to raise ValueError instead of RuntimeError.
(cherry picked from commit 543a3951a1)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-09-25 08:56:05 -07:00
Miss Islington (bot) 66cd041df8
[3.8] bpo-38270: Check for hash digest algorithms and avoid MD5 (GH-16382) (GH-16393)
Make it easier to run and test Python on systems with restrict crypto policies:

* add requires_hashdigest to test.support to check if a hash digest algorithm is available and working
* avoid MD5 in test_hmac
* replace MD5 with SHA256 in test_tarfile
* mark network tests that require MD5 for MD5-based digest auth or CRAM-MD5


https://bugs.python.org/issue38270
(cherry picked from commit c64a1a61e6)


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


https://bugs.python.org/issue38270



Automerge-Triggered-By: @tiran
2019-09-25 08:50:31 -07:00
Victor Stinner 2e566bf35e
bpo-37064: Skip test_tools.test_pathfix if installed (GH-15705) (GH-16389)
If Python is installed, skip test_tools.test_pathfix test because
Tools/scripts/pathfix.py script is not installed.

(cherry picked from commit 3f43ceff18)
2019-09-25 16:12:32 +02:00
Victor Stinner c71c54c626
bpo-37064: Add -k and -a options to pathfix.py tool (GH-16387)
* bpo-37064: Add option -k to Tools/scripts/pathfix.py (GH-15548)

Add flag -k to pathscript.py script: preserve shebang flags.

(cherry picked from commit 50254ac4c1)

* bpo-37064: Add option -a to pathfix.py tool (GH-15717)

Add option -a to Tools/Scripts/pathfix.py script: add flags.

(cherry picked from commit 1dc1acbd73)
2019-09-25 15:22:40 +02:00
Miss Islington (bot) 16cec136b7 bpo-38248: Fix inconsistent immediate asyncio.Task cancellation (GH-16330) (GH-16383)
(cherry picked from commit edad4d89e3)

Co-authored-by: Yury Selivanov <yury@edgedb.com>
2019-09-25 04:48:52 -07:00
Miss Islington (bot) 4633355a06
bpo-38260: Add Docs on asyncio.run (GH-16337)
Add docs about return and raise exception on asyncio.run

https://bugs.python.org/issue38260

Automerge-Triggered-By: @asvetlov
(cherry picked from commit 17deb16883)

Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
2019-09-25 02:12:47 -07:00
Miss Islington (bot) ce62dcc460 bpo-22273: Update ctypes to correctly handle arrays in small structur… (GH-15839) (GH-16370)
(cherry picked from commit 12f209eccb)
2019-09-25 05:10:20 +01:00
Miss Islington (bot) 1a17a054f6
[3.8] bpo-36871: Handle spec errors in assert_has_calls (GH-16005) (GH-16364)
The fix in PR 13261 handled the underlying issue about the spec for specific methods not being applied correctly, but it didn't fix the issue that was causing the misleading error message.

The code currently grabs a list of responses from _call_matcher (which may include exceptions). But it doesn't reach inside the list when checking if the result is an exception. This results in a misleading error message when one of the provided calls does not match the spec.


https://bugs.python.org/issue36871



Automerge-Triggered-By: @gpshead
(cherry picked from commit b5a7a4f0c2)


Co-authored-by: Samuel Freilich <sfreilich@google.com>


https://bugs.python.org/issue36871



Automerge-Triggered-By: @gpshead
2019-09-24 17:29:17 -07:00
Miss Islington (bot) 081641fe52
bpo-37123: multiprocessing test_mymanager() accepts SIGTERM (GH-16349)
Multiprocessing test test_mymanager() now also expects -SIGTERM, not
only exitcode 0.

bpo-30356: BaseManager._finalize_manager() sends SIGTERM to the
manager process if it takes longer than 1 second to stop, which
happens on slow buildbots.
(cherry picked from commit b0e1ae5f54)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-09-24 05:39:47 -07:00
Miss Islington (bot) fea9ca1b0c
bpo-38212: Increase MP test_queue_feeder_donot_stop_onexc() timeout (GH-16348)
Multiprocessing tests: increase test_queue_feeder_donot_stop_onexc()
timeout from 1 to 60 seconds.
(cherry picked from commit 99799c7220)

Co-authored-by: Victor Stinner <vstinner@python.org>
2019-09-24 04:07:28 -07:00
Miss Islington (bot) fe9089a08b Updated incorrect level-setting code to use setLevel(). (GH-16325) (GH-16327)
(cherry picked from commit 1d094af716)
2019-09-22 04:26:37 +01:00
Miss Islington (bot) 37bc935523 bpo-38237: Let pow() support keyword arguments (GH-16302) (GH-16320)
Backported with release manager approval
2019-09-21 01:22:29 -07:00
Lisa Roach 865bb685a6 [3.8] bpo-38093: Correctly returns AsyncMock for async subclasses. (GH-15947) (GH-16299)
(cherry picked from commit 8b03f943c3)

Co-authored-by: Lisa Roach <lisaroach14@gmail.com>
2019-09-21 08:00:04 +02:00
Miss Islington (bot) f4e0ceb211
Doc: Fix spelling errors of 'initial' in enum.py (GH-16314)
(cherry picked from commit bb16fb2cb8)

Co-authored-by: HongWeipeng <hongweichen8888@sina.com>
2019-09-20 22:41:35 -07:00
Miss Islington (bot) 8fe4755aa3 Minor code and comment cleanup (GH-16315) (GH-16316)
(cherry picked from commit 7ce4bfa8cf)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-09-20 22:18:10 -07:00
Miss Islington (bot) b50edac42f
bpo-33694: Remove test_asyncio ProactorDatagramTransportTests (GH-16288)
ProactorDatagramTransportTests tests are too close to the
implementation.
(cherry picked from commit bc2256ea17)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-09-20 14:27:28 -07:00
Victor Stinner fb7746d5d1
bpo-37531: sync regrtest with master branch (GH-16285) 2019-09-19 18:05:09 +02:00
Victor Stinner 47bbab9f76
[3.8] bpo-38070: Py_FatalError() logs runtime state (GH-16258)
* bpo-38070: _Py_DumpTraceback() writes <no Python frame> (GH-16244)

When a Python thread has no frame, _Py_DumpTraceback() and
_Py_DumpTracebackThreads() now write "<no Python frame>", rather than
writing nothing.

(cherry picked from commit 8fa3e1740b)

* bpo-38070: Enhance _PyObject_Dump() (GH-16243)

_PyObject_Dump() now dumps the object address for freed objects and
objects with ob_type=NULL.

(cherry picked from commit b39afb7876)

* bpo-38070: Add _PyRuntimeState.preinitializing (GH-16245)

Add _PyRuntimeState.preinitializing field: set to 1 while
Py_PreInitialize() is running.

_PyRuntimeState: rename also pre_initialized field to preinitialized.

(cherry picked from commit d3b904144e)

* bpo-38070: Py_FatalError() logs runtime state (GH-16246)


(cherry picked from commit 1ce16fb097)
2019-09-18 14:10:16 +02:00
Serhiy Storchaka 2adcd79bf9
bpo-38191: Use positional-only parameters in TypedDict(). (GH-16240) 2019-09-18 09:08:01 +03:00
Miss Islington (bot) 31af1cce9d bpo-36546: No longer a need to make "data" positional only (GH-16252) (GH-16253)
(cherry picked from commit 272d0d017a)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-09-17 21:06:53 -07:00
Miss Islington (bot) 54ba5f19d4
bpo-38191: Accept arbitrary keyword names in NamedTuple() and TypedDict(). (GH-16222)
This includes such names as "cls", "self", "typename", "_typename",
"fields" and "_fields".
Passing positional arguments by keyword is deprecated.
(cherry picked from commit 2bf31ccab3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-09-17 11:41:55 -07:00
Miss Islington (bot) 3c1786f18b
bpo-38013: make async_generator_athrow object tolerant to throwing exceptions (GH-16070)
Even when the helper is not started yet.

This behavior follows conventional generator one.
There is no reason for `async_generator_athrow` to handle `gen.throw()` differently.

https://bugs.python.org/issue38013
(cherry picked from commit c275312a62)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-17 06:20:06 -07:00
Miss Islington (bot) 5f1590d5e6 bpo-37531: regrtest main process uses shorter timeout (GH-16220) (GH-16224)
When using multiprocesss (-jN), the main process now uses a timeout
of 60 seconds instead of the double of the --timeout value. The
buildbot server stops a job which does not produce any output in 1200
seconds.
(cherry picked from commit 46b0b81220)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-09-17 14:34:13 +02:00
Miss Islington (bot) f668d2b775
bpo-37828: Fix default mock_name in unittest.mock.assert_called error (GH-16166)
In the format string for assert_called the evaluation order is incorrect and hence for mock's without name, 'None' is printed whereas it should be 'mock' like for other messages. The error message is ("Expected '%s' to have been called." % self._mock_name or 'mock').
(cherry picked from commit 5f5f11faf9)

Co-authored-by: Abraham Toriz Cruz <awonderfulcode@gmail.com>
2019-09-17 04:35:56 -07:00
Miss Islington (bot) d8d653c2d0
bpo-38185: Fixed case-insensitive string comparison in sqlite3.Row indexing. (GH-16190)
(cherry picked from commit f669581a95)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-09-16 23:39:11 -07:00
Miss Islington (bot) 73ccc3322f
bpo-35379: When exiting IDLE, catch any AttributeError. (GH-16212)
One happens when EditorWindow.close is called twice.
Printing a traceback, when IDLE is run from a terminal,
is useless and annoying.
(cherry picked from commit dfd34a9cd5)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-09-16 23:23:12 -07:00
Miss Islington (bot) f04299d978
bpo-38175: Fix a memory leak in comparison of sqlite3.Row objects. (GH-16155)
(cherry picked from commit 8debfa5040)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-09-16 23:14:20 -07:00
Miss Islington (bot) ad845becf2
bpo-38183: Test_idle ignores user config directory GH-16198)
It no longer tries to create or access .idlerc or any files within.
Users must run IDLE to discover problems with saving settings.
(cherry picked from commit 0048afc16a)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-09-16 20:32:55 -07:00
Miss Islington (bot) 917c622b53
Doc: Fix Wikipedia link for functools.lru_cache (GH-16183)
(cherry picked from commit 336b3064d8)

Co-authored-by: amist <amistern0@gmail.com>
2019-09-16 11:55:04 -07:00
Miss Islington (bot) cc8edfbd9c
bpo-38100: Fix spelling error in unittest.mock code (GH-16168)
(cherry picked from commit a9187c3118)

Co-authored-by: marcoramirezmx <55331462+marcoramirezmx@users.noreply.github.com>
2019-09-16 09:52:45 -07:00
Miss Islington (bot) 4924d55847
bpo-38081: Add more non-fatal error codes for ntpath.realpath (GH-16156)
(cherry picked from commit 89b8933bb5)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-16 07:43:36 -07:00
Christian Heimes e8d7fa2db8
[3.8] bpo-38153: Normalize hashlib algorithm names (GH-16083) (GH-16144)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 995b5d38e7)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-16 14:08:55 +02:00
Serhiy Storchaka f37a983102
[3.8] bpo-38005: Fixed comparing and creating of InterpreterID and ChannelID. (GH-15652) (GH-16145)
* Fix a crash in comparing with float (and maybe other crashes).
* They are now never equal to strings and non-integer numbers.
* Comparison with a large number no longer raises OverflowError.
* Arbitrary exceptions no longer silenced in constructors and comparisons.
* TypeError raised in the constructor contains now the name of the type.
* Accept only ChannelID and int-like objects in channel functions.
* Accept only InterpreterId, int-like objects and str in the InterpreterId constructor.
* Accept int-like objects, not just int in interpreter related functions.
(cherry picked from commit bf169915ec)
2019-09-14 19:36:19 +03:00
Serhiy Storchaka d322abbb83
[3.8] bpo-37206: Unrepresentable default values no longer represented as None. (GH-13933) (GH-16141)
In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values
(like in the optional third parameter of getattr). "None" should be used if None is accepted
as argument and passing None has the same effect as not passing the argument at all.
(cherry picked from commit 279f44678c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-09-14 13:31:50 +03:00
Miss Islington (bot) 66da347ef0
bpo-37953: Fix deprecation warnings in test_typing (GH-16133)
self.assertEquals() is deprecated.

```
./python -We -m test test_typing
Run tests sequentially
0:00:00 load avg: 0.23 [1/1] test_typing
test test_typing failed -- Traceback (most recent call last):
  File "/home/lubuntu2/cpython/Lib/test/test_typing.py", line 2382, in test_forward_equality_gth
    self.assertEquals(Union[c1, c1_gth], Union[c1])
  File "/home/lubuntu2/cpython/Lib/unittest/case.py", line 1390, in deprecated_func
    warnings.warn(
DeprecationWarning: Please use assertEqual instead.

test_typing failed

== Tests result: FAILURE ==

1 test failed:
    test_typing

Total duration: 140 ms
Tests result: FAILURE
```

https://bugs.python.org/issue37953
(cherry picked from commit d057b896f9)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-09-14 01:02:19 -07:00
Miss Islington (bot) e91edfed42
bpo-37953: Fix ForwardRef hash and equality checks (GH-15400)
Ideally if we stick a ForwardRef in a dictionary we would like to reliably be able to get it out again.

https://bugs.python.org/issue37953
(cherry picked from commit e082e7cbe4)

Co-authored-by: plokmijnuhby <39633434+plokmijnuhby@users.noreply.github.com>
2019-09-13 13:00:39 -07:00
Miss Islington (bot) cd85200f6d
Fix typo in test_api.py. (GH-16119)
(cherry picked from commit 0bc17ea2f5)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2019-09-13 10:49:09 -07:00
Miss Islington (bot) cf25765cf7 bpo-34706: Preserve subclassing in inspect.Signature.from_callable (GH-16108) (GH-16113)
https://bugs.python.org/issue34706

Specifically in the case of a class that does not override its
constructor signature inherited from object.

These are Buck Evan @bukzor's changes cherrypicked from GH-9344.
(cherry picked from commit 5b9ff7a0dc)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2019-09-13 18:42:35 +01:00
Miss Islington (bot) 436b429ade
bpo-38092: Reduce overhead when using multiprocessing in a Windows virtual environment (GH-16098)
https://bugs.python.org/issue38092
(cherry picked from commit f2b7556ef8)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-13 09:59:11 -07:00
Miss Islington (bot) 83c21fdc36
bpo-37199: Replace the early returns added in c2cda63. (GH-14535)
(cherry picked from commit 81319a81b2)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-09-13 09:12:33 -07:00
Miss Islington (bot) 590ed09a5b
bpo-25068: urllib.request.ProxyHandler now lowercases the dict keys (GH-13489)
(cherry picked from commit b761e3aed1)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-09-13 07:25:51 -07:00
Andrew Svetlov 6638c92260
[3.8] bpo-38148: Add slots to asyncio transports (GH-16077) (GH-16093)
* bpo-38148: Add slots to asyncio transports

* Update Misc/NEWS.d/next/Library/2019-09-13-08-55-43.bpo-38148.Lnww6D.rst

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit 9eb35ab0d7)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-13 16:14:55 +03:00
Miss Islington (bot) 44cb89a78a
bpo-12144: Handle cookies with expires attribute in CookieJar.make_cookies (GH-13921)
Handle time comparison for cookies with `expires` attribute when `CookieJar.make_cookies` is called.

Co-authored-by: Demian Brecht <demianbrecht@gmail.com>

https://bugs.python.org/issue12144

Automerge-Triggered-By: @asvetlov
(cherry picked from commit bb41147eab)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-13 04:47:51 -07:00
Miss Islington (bot) b9bfe143d1
bpo-36889: Document Stream class and add docstrings (GH-14488)
* This just copies the docs from `StreamWriter` and `StreamReader`.
* Add docstring for asyncio functions.

https://bugs.python.org/issue36889

Automerge-Triggered-By: @asvetlov
(cherry picked from commit d31b31516c)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-13 04:23:43 -07:00
Miss Islington (bot) 52c99aeb9f
Fix the ImportWarning regarding __spec__ and __package__ being None (GH-16003)
(cherry picked from commit 6e1a30b15e)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-13 03:53:22 -07:00
Miss Islington (bot) 8750dfe09e
bpo-37785: Fix xgettext warning in argparse (GH-15161)
(cherry picked from commit 42671aea2d)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2019-09-13 02:45:27 -07:00
Miss Islington (bot) 21bfff9a5a
closes bpo-37803: pdb: fix handling of options (--help / --version) (GH-15193)
The "--" should not be included with long options passed to
getopt.getopt.

Fixes https://bugs.python.org/issue37803
(cherry picked from commit 855df7f273)

Co-authored-by: Daniel Hahler <github@thequod.de>
2019-09-12 09:05:52 -07:00
Jason R. Coombs a0d4aac50b
[3.8] bpo-38121: Sync importlib.metadata with 0.22 backport (GH-15993) (GH-16064)
* bpo-38121: Sync importlib.metadata with 0.22 backport

* 📜🤖 Added by blurb_it..
(cherry picked from commit 8ed6503eca)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2019-09-12 16:41:31 +01:00
Miss Islington (bot) 98a4a713d0 bpo-37935: Added tests for os.walk(), glob.iglob() and Path.glob() (GH-15956) (GH-16043)
Test that they do not keep too many file descriptors open for the host OS in a reasonable test scenario.

See [bpo-37935](https://bugs.python.org/issue37935).
(cherry picked from commit f9dc2ad890)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-09-12 16:07:47 +01:00
Miss Islington (bot) 824407f76e
bpo-21872: fix lzma library decompresses data incompletely (GH-14048)
* 1. add test case with wrong behavior
* 2. fix bug when max_length == -1
* 3. allow b"" as valid input data for decompress_buf()
* 4. when max_length >= 0, let needs_input mechanism works
* add more asserts to test case
(cherry picked from commit 4ffd05d7ec)

Co-authored-by: animalize <animalize@users.noreply.github.com>
2019-09-12 07:41:11 -07:00
Miss Islington (bot) 717cc61ed1
bpo-36991: Fix incorrect exception escaping ZipFile.extract() (GH-13632)
(cherry picked from commit 2f1b857562)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2019-09-12 07:33:53 -07:00
Miss Islington (bot) 67b90a079c bpo-38132: Simplify _hashopenssl code (GH-16023) (#16040)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 5a4f82f457)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-12 14:03:50 +01:00
Miss Islington (bot) 345bfc990f
bpo-36373: Deprecate explicit loop in task and subprocess API (GH-16033)
(cherry picked from commit a488879cba)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-12 05:59:50 -07:00
Miss Islington (bot) db0d8a5b2c bpo-37972: unittest.mock._Call now passes on __getitem__ to the __getattr__ chaining so that call() can be subscriptable (GH-15565) (GH-15965)
* bpo-37972: unittest.mock._Call now passes on __getitem__ to the __getattr__ chaining so that call() can be subscriptable

* 📜🤖 Added by blurb_it.

* Update 2019-08-28-21-40-12.bpo-37972.kP-n4L.rst

added name of the contributor

* bpo-37972: made all dunder methods chainable for _Call

* bpo-37972: delegate only attributes of tuple instead to __getattr__
(cherry picked from commit 72c359912d)

Co-authored-by: blhsing <github@ydooby.com>
2019-09-12 12:52:49 +02:00
Miss Islington (bot) f60fd95dcc closes bpo-37405: Make socket.getsockname() always return a tuple for AF_CAN. (GH-14392) (GH-16018)
This fixes a regression from 3.5. In recent releases, `getsockname()` in the AF_CAN case has returned a string.
(cherry picked from commit 954900a3f9)

Co-authored-by: bggardner <brent@ebrent.net>
2019-09-12 11:34:28 +01:00
Miss Islington (bot) 52baf90a74
bpo-38008: Move builtin protocol whitelist to mapping instead of list (GH-15647)
Fixes https://bugs.python.org/issue38008
(cherry picked from commit 692a0dc915)

Co-authored-by: Divij Rajkumar <drajkuma1@gmail.com>
2019-09-12 03:32:36 -07:00
Petr Viktorin 3562ae2540
[3.8] bpo-37879: Suppress subtype_dealloc decref when base type is a C heap type (GH-15323, GH-16004) (GH-15966)
The instance destructor for a type is responsible for preparing
an instance for deallocation by decrementing the reference counts
of its referents.

If an instance belongs to a heap type, the type object of an instance
has its reference count decremented while for static types, which
are permanently allocated, the type object is unaffected by the
instance destructor.

Previously, the default instance destructor searched the class
hierarchy for an inherited instance destructor and, if present,
would invoke it.

Then, if the instance type is a heap type, it would decrement the
reference count of that heap type.  However, this could result in the
premature destruction of a type because the inherited instance
destructor should have already decremented the reference count
of the type object.

This change avoids the premature destruction of the type object
by suppressing the decrement of its reference count when an
inherited, non-default instance destructor has been invoked.

Finally, an assertion on the Py_SIZE of a type was deleted.  Heap
types have a non zero size, making this into an incorrect assertion.

https://github.com/python/cpython/pull/15323.
(cherry picked from commit ff023ed36e)
Fixup: https://github.com/python/cpython/pull/16004.
(cherry picked from commit 5e9caeec76)

Co-authored-by: Eddie Elizondo <eduardo.elizondorueda@gmail.com>
2019-09-12 10:44:46 +01:00
Miss Islington (bot) 8af4e0c994 Correct typo in min version test (GH-16001)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit de606ea169)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-11 11:19:12 -07:00
Miss Islington (bot) d6ac67f48f bpo-34001: Fix test_ssl with LibreSSL (GH-13783) (#15997)
(cherry picked from commit c9bc49c5f6)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-11 19:59:13 +02:00
Miss Islington (bot) f90cbcbfe3
bpo-36528: Remove duplicate re tests. (GH-2689)
Co-Authored-By: Makdon <makdon@makdon.me>
(cherry picked from commit e6557d3c62)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-11 09:46:29 -07:00
Miss Islington (bot) 63eefc3567 bpo-37885: venv: Don't produce unbound variable warning on deactivate (GH-15973)
Before, running deactivate from a bash shell configured to treat undefined variables as errors (`set -u`) would produce a warning:

```
$ python3 -m venv test
$ source test/bin/activate
(test) $ deactivate
-bash: $1: unbound variable
```
(cherry picked from commit 5209e586b7)

Co-authored-by: Daniel Abrahamsson <hamsson@gmail.com>
2019-09-11 08:55:57 -07:00
Miss Islington (bot) 20f80bfc83
bpo-36634: Fixes activate.bat when existing values contain double quotes (GH-15924)
(cherry picked from commit 574b324bdc)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-11 08:21:58 -07:00
Miss Islington (bot) b4808c1265 closes bpo-37252: Fix devpoll tests. (GH-14017) (GH-15948)
(cherry picked from commit 95da826db9)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2019-09-11 16:37:38 +02:00
Miss Islington (bot) 42edfcfd12 bpo-36919: make test_source_encoding.test_issue2301 implementation-independent (GH-13639) (GH-15952)
* bpo-36919: make test_issue2301 implementation-independent
(cherry picked from commit b6643dcfc2)

Co-authored-by: Pavel Koneski <pavel.koneski@gmail.com>
2019-09-11 15:37:18 +01:00
Miss Islington (bot) b18b19809d
bpo-38107: Replace direct future and task contructor calls with factories in asyncio tests (GH-15928)
(cherry picked from commit 9aee90018a)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-11 07:21:53 -07:00
Miss Islington (bot) fef5bdc645 bpo-34519: Add additional aliases for HP Roman 8 (GH-8956) (GH-15945)
* bpo-34519: Add additional aliases for HP Roman 8

HP Roman 8 is known under mode aliases than listed in aliases.py.

Patch by Michael Osipov.
(cherry picked from commit a828514cc3)

Co-authored-by: Michael Osipov <michael.osipov@siemens.com>
2019-09-11 15:13:54 +01:00
Miss Islington (bot) 35d0934040 bpo-37305: add MIME type for Web App Manifest (GH-14199) (#15946)
* bpo-37305: add MIME type for Web App Manifest

Co-authored-by: Filip Š <filip.stamcar@hotmail.com>
2019-09-11 15:13:31 +01:00
Miss Islington (bot) cbd7b2a399 bpo-31163: Added return values to pathlib.Path instance's rename and replace methods. (GH-13582) (GH-15944)
* bpo-31163: Added return values to pathlib.Path instance's rename and replace methods.
(cherry picked from commit 088a09af4b)

Co-authored-by: hui shang <shangdahao@gmail.com>
2019-09-11 15:12:54 +01:00
Vinay Sajip 3b92ddb761
[3.8] bpo-35168: Make shlex.punctuation_chars read-only (GH-11631) (GH-15927)
(cherry picked from commit 972cf5c06a)

Co-authored-by: Alex <a.v.shkop@gmail.com>
2019-09-11 13:39:52 +01:00
Miss Islington (bot) e3bd941e4e
bpo-20504 : in cgi.py, fix bug when a multipart/form-data request has… (GH-10638)
* bpo-20504 : in cgi.py, fix bug when a multipart/form-data request has no content-length header

* Add Misc/NEWS.d/next file.

* Add rst formatting for NEWS.d/next file

* Reaplce assert by self.assertEqual
(cherry picked from commit 2d7cacacc3)

Co-authored-by: Pierre Quentel <pierre.quentel@gmail.com>
2019-09-11 05:09:23 -07:00
Miss Islington (bot) f3e430b079
bpo-35066: Make trailing percent test more portable. (GH-15907)
Different libc implementations have different behavior when presented with trailing % in strftime strings. To make test_strftime_trailing_percent more portable, compare the output of datetime.strftime directly to that of time.strftime rather than hardcoding.
(cherry picked from commit f2173ae38f)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2019-09-11 04:47:16 -07:00
Brett Cannon 0a6693a469
[3.8] bpo-37409: fix relative import with no parent (GH-14956) (GH-15913)
Relative imports use resolve_name to get the absolute target name,
which first seeks the current module's absolute package name from the globals:
If __package__ (and __spec__.parent) are missing then
import uses __name__, truncating the last segment if
the module is a submodule rather than a package __init__.py
(which it guesses from whether __path__ is defined).

The __name__ attempt should fail if there is no parent package (top level modules),
if __name__ is '__main__' (-m entry points), or both (scripts).
That is, if both __name__ has no subcomponents and the module does not seem
to be a package __init__ module then import should fail..
(cherry picked from commit 92420b3e67)

Co-authored-by: Ben Lewis <benjimin@users.noreply.github.com>
2019-09-11 12:38:22 +01:00
Miss Islington (bot) 57491de7c3
bpo-38081: Fixes ntpath.realpath('NUL') (GH-15899)
(cherry picked from commit 92521fea5d)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-11 03:43:30 -07:00
Andrew Svetlov 4601f7a49f
[3.8] bpo-36373: Fix deprecation warnings (GH-15889) (GH-15901)
https://bugs.python.org/issue36373
(cherry picked from commit 7264e92b71)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-11 13:40:36 +03:00
Zachary Ware df935b5f0b
[3.8] bpo-37936: Systematically distinguish rooted vs. unrooted in .gitignore (GH-15823) (GH-15900)
A root cause of bpo-37936 is that it's easy to write a .gitignore
rule that's intended to apply to a specific file (e.g., the
`pyconfig.h` generated by `./configure`) but actually applies to all
similarly-named files in the tree (e.g., `PC/pyconfig.h`.)

Specifically, any rule with no non-trailing slashes is applied in an
"unrooted" way, to files anywhere in the tree.  This means that if we
write the rules in the most obvious-looking way, then

 * for specific files we want to ignore that happen to be in
   subdirectories (like `Modules/config.c`), the rule will work
   as intended, staying "rooted" to the top of the tree; but

 * when a specific file we want to ignore happens to be at the root of
   the repo (like `platform`), then the obvious rule (`platform`) will
   apply much more broadly than intended: if someone tries to add a
   file or directory named `platform` somewhere else in the tree, it
   will unexpectedly get ignored.

That's surprising behavior that can make the .gitignore file's
behavior feel finicky and unpredictable.

To avoid it, we can simply always give a rule "rooted" behavior when
that's what's intended, by systematically using leading slashes.

Further, to help make the pattern obvious when looking at the file and
minimize any need for thinking about the syntax when adding new rules:
separate the rules into one group for each type, with brief comments
identifying them.

For most of these rules it's clear whether they're meant to be rooted
or unrooted, but in a handful of cases I've only guessed.  In that
case the safer default (the choice that won't hide information) is the
narrower, rooted meaning, with a leading slash.  If for some of these
the unrooted meaning is desired after all, it'll be easy to move them
to the unrooted section at the top.

(cherry picked from commit 455122a009)

Co-authored-by: Greg Price <gnprice@gmail.com>
2019-09-11 11:31:12 +01:00
Miss Islington (bot) 872c85a179
bpo-37424: Avoid a hang in subprocess.run timeout output capture (GH-14490)
Fixes a possible hang when using a timeout on subprocess.run() while
capturing output. If the child process spawned its own children or otherwise
connected its stdout or stderr handles with another process, we could hang
after the timeout was reached and our child was killed when attempting to read
final output from the pipes.
(cherry picked from commit 580d2782f7)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2019-09-11 03:05:14 -07:00
Miss Islington (bot) 74b0291b03
bpo-28494: Test existing zipfile working behavior. (GH-15853)
Add unittests for executables with a zipfile appended to test_zipfile, as zipfile.is_zipfile and zipfile.ZipFile work properly on these today.
(cherry picked from commit 3f4db4a0ba)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2019-09-10 15:57:54 -07:00
Victor Stinner d42a4fdc63
bpo-37531: Enhance regrtest multiprocess timeout (GH-15345) (GH-15871)
* Write a message when killing a worker process
* Put a timeout on the second popen.communicate() call
  (after killing the process)
* Put a timeout on popen.wait() call
* Catch popen.kill() and popen.wait() exceptions

(cherry picked from commit de2d9eed8b)
2019-09-10 17:54:51 +02:00
Jason R. Coombs 97c2f68a4c
[3.8] bpo-38086: Sync importlib.metadata with importlib_metadata 0.21. (GH-15840) (#15861)
https://gitlab.com/python-devs/importlib_metadata/-/tags/0.21.
(cherry picked from commit 17499d8270)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2019-09-10 15:58:29 +01:00
Miss Islington (bot) 41c965f930
Fix subprocess docstring typo (GH-15812)
(cherry picked from commit 182e1d1f84)

Co-authored-by: Matthias <xmatthias@outlook.com>
2019-09-10 07:51:29 -07:00
Miss Islington (bot) 2ed0ac6bf1 bpo-38088: Fixes distutils not finding vcruntime140.dll with only v142 toolset installed (GH-15849)
(cherry picked from commit cd8221152d)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-10 15:42:26 +01:00
Steve Dower 206e4c3d35
bpo-38087: Fix case sensitivity in test_pathlib and test_ntpath (GH-15850) 2019-09-10 15:29:28 +01:00
Miss Islington (bot) f12ff05bc0
bpo-38066: Hide internal Stream methods (GH-15762)
feed_eof(), feed_data(), set_exception(), and set_transport() are prefixed with underscore now.

https://bugs.python.org/issue38066
(cherry picked from commit 12c122ae95)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-10 06:44:32 -07:00
Miss Islington (bot) c43f26eca3
closes bpo-25461: Update os.walk() docstring to match the online docs. (GH-11836)
(cherry picked from commit 734f1202a5)

Co-authored-by: Bernt Røskar Brenna <bernt.brenna@gmail.com>
2019-09-10 06:21:57 -07:00
Miss Islington (bot) c3008dd480
bpo-37251: Removes __code__ check from _is_async_obj. (GH-15830)
(cherry picked from commit f1a297acb6)

Co-authored-by: Lisa Roach <lisaroach14@gmail.com>
2019-09-10 06:16:00 -07:00
Miss Islington (bot) eaa1b09412
docs: Add references to AsyncMock in unittest.mock.patch (GH-13681)
Update the docs as patch can now return an AsyncMock if the patched
object is an async function.
(cherry picked from commit f5e7f39d29)

Co-authored-by: Mario Corchero <mcorcherojim@bloomberg.net>
2019-09-10 06:15:19 -07:00
Miss Islington (bot) eb1bc48c74 bpo-37619: update_one_slot() should not ignore wrapper descriptors for wrong type (GH-15838)
(cherry picked from commit 57ea335606)

Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be>
2019-09-10 05:55:12 -07:00
Miss Islington (bot) 55daf1a561
bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [queue] (GH-13950)
This PR deprecate explicit loop parameters in all public asyncio APIs

This issues is split to be easier to review.

fourth step: queue.py

https://bugs.python.org/issue36373
(cherry picked from commit 9008be303a)

Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
2019-09-10 05:50:14 -07:00
Miss Islington (bot) bb8fc8bd30
bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [locks] (GH-13920)
This PR deprecate explicit loop parameters in all public asyncio APIs

This issues is split to be easier to review.

Third step: locks.py

https://bugs.python.org/issue36373
(cherry picked from commit 537877d85d)

Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
2019-09-10 04:26:54 -07:00
Steve Dower fdd17abc51
bpo-35941: Fix performance regression in SSL certificate code (GH-12610)
Accumulate certificates in a set instead of doing a costly list contain
operation. A Windows cert store can easily contain over hundred
certificates. The old code would result in way over 5,000 comparison
operations

Signed-off-by: Christian Heimes <christian@python.org>
2019-09-10 02:02:04 -07:00
Miss Islington (bot) 29bde48ade
bpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818)
This only happened when initializing the subprocess to run a module.
This recent bug only affected 3.7.4 and 3.8.0b2 to 3.8.0b4.
(cherry picked from commit c59295a1ca)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-09-09 20:29:01 -07:00
Miss Islington (bot) 421ef39968
Fix punctuation in `os.execvpe` docstring. (GH-15051)
(cherry picked from commit fb6807b043)

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2019-09-09 10:44:46 -07:00
Miss Islington (bot) eadf6b8787
bpo-35803: Document and test dir=PathLike for tempfile (GH-11644)
Co-Authored-By: Ammar Askar <ammar_askar@hotmail.com>
(cherry picked from commit 370138ba9c)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2019-09-09 10:31:31 -07:00
Miss Islington (bot) 0468a85cc4
Clarify that shutil's copy functions can accept path-like values (GH-15141)
(cherry picked from commit 9488a5289d)

Co-authored-by: Boris Verhovsky <boris.verk@gmail.com>
2019-09-09 10:18:51 -07:00
Steve Dower 2d5594fac2
bpo-20490: Improve circular import error message (GH-15308) 2019-09-09 09:45:18 -07:00
Miss Islington (bot) 78d15faf6c
bpo-38006: Avoid closure in weakref.WeakValueDictionary (GH-15641)
weakref.WeakValueDictionary defines a local remove() function used as
callback for weak references. This function was created with a
closure.  Modify the implementation to avoid the closure.
(cherry picked from commit a2af05a0d3)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-09-09 09:24:16 -07:00
Miss Islington (bot) b6ef8f2beb
bpo-37876: Tests for ROT-13 codec (GH-15314)
The Rot-13 codec is for educational use but does not have unit tests,
dragging down test coverage. This adds a few very simple tests.
(cherry picked from commit b3b48c81f0)

Co-authored-by: Zeth <theology@gmail.com>
2019-09-09 09:12:01 -07:00
Miss Islington (bot) 0d4396c04c
bpo-38059: Using sys.exit() over exit() in inspect.py (GH-15666)
Constants added by the site module like exit() "should not be used in programs"
(cherry picked from commit e3c59a7527)

Co-authored-by: Alan Yee <alanyee@users.noreply.github.com>
2019-09-09 08:20:36 -07:00
Miss Islington (bot) 3bd4bed78a bpo-34596: Fallback to a default reason when @unittest.skip is uncalled (GH-9082) (#15781)
* bpo-34596: Fallback to a default reason when @unittest.skip is uncalled

* Change default reason to empty string

* Fix rst formatting of NEWS entry
(cherry picked from commit d5fd75c53f)

Co-authored-by: Naitree Zhu <Naitreey@gmail.com>
2019-09-09 17:01:14 +02:00
Miss Islington (bot) bee8bfe5f4
bpo-37212: Preserve keyword argument order in unittest.mock.call and error messages (GH-14310)
(cherry picked from commit 9d607061c9)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-09 04:42:43 -07:00
Miss Islington (bot) 87a5a331ea
bpo-36250: ignore ValueError from signal in non-main thread (GH-12251)
Authored-By: blueyed <github@thequod.de>
(cherry picked from commit 8d64bfafdf)

Co-authored-by: Daniel Hahler <github@thequod.de>
2019-09-09 04:25:21 -07:00
Steve Dower eb02196bd9
bpo-11953: Extend table of Windows WSA* error codes (GH-15004) 2019-09-09 03:36:04 -07:00
Miss Islington (bot) ebca7eb093
bpo-32587: Make winreg.REG_MULTI_SZ support zero-length strings (GH-13239)
* bpo-32587: Make winreg.REG_MULTI_SZ support PendingFileRenameOperations

* Address review comments.
(cherry picked from commit e223ba13d8)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-09-09 03:11:00 -07:00
Miss Islington (bot) 6e3809c7ce
bpo-34410: Fix a crash in the tee iterator when re-enter it. (GH-15625)
RuntimeError is now raised in this case.
(cherry picked from commit 526a01467b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-09-09 02:07:51 -07:00
Raymond Hettinger cc1bdf91d5
[3.8] bpo-36018: Address more reviewer feedback (GH-15733) (GH-15734) 2019-09-08 18:40:06 -07:00
Miss Islington (bot) 4009a8522d
bpo-38041: Refine IDLE Shell restart lines. (GH-15709)
Restart lines now always start with '=' and never end with ' ' and fill the width of the window unless that would require ending with ' ', which could be wrapped by itself and possible confusing the user.
(cherry picked from commit 38da805d56)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-09-06 11:14:49 -07:00
Miss Islington (bot) 4d1abedce9 bpo-37380: subprocess: don't use _active on win (GH-14360) (GH-15707)
As noted by @eryksun in [1] and [2], using _cleanup and _active(in
__del__) is not necessary on Windows, since:

> Unlike Unix, a process in Windows doesn't have to be waited on by
> its parent to avoid a zombie. Keeping the handle open will actually
> create a zombie until the next _cleanup() call, which may be never
> if Popen() isn't called again.

This patch simply defines `subprocess._active` as `None`, for which we already
have the proper logic in place in `subprocess.Popen.__del__`, that prevents it
from trying to append the process to the `_active`. This patch also defines
`subprocess._cleanup` as a noop for Windows.

[1] https://bugs.python.org/issue37380GH-msg346333
[2] https://bugs.python.org/issue36067GH-msg336262

Signed-off-by: Ruslan Kuprieiev <ruslan@iterative.ai>
(cherry picked from commit 042821ae3c)

Co-authored-by: Ruslan Kuprieiev <kupruser@gmail.com>
2019-09-06 11:14:31 +02:00
Miss Islington (bot) dafbe32656 bpo-36324: Apply review comments from Allen Downey (GH-15693) (GH-15694)
(cherry picked from commit e4810b2a6c)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-09-05 00:42:22 -07:00
Miss Islington (bot) bdcbb83c66
bpo-38026: fix inspect.getattr_static (GH-15676)
It should avoid dynamic lookup including `isinstance`.

This is a regression caused by GH-5351.
(cherry picked from commit 8f9cc8771f)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2019-09-04 21:25:59 -07:00
Miss Islington (bot) 9c2654d1aa
bpo-37902: IDLE: Add scrolling for IDLE browsers. (GH-15368)
Modify the wheel event handler so it can also be used for module, path, and stack browsers.
Patch by George Zhang.
(cherry picked from commit 2cd9025858)

Co-authored-by: GeeTransit <geetransit@gmail.com>
2019-09-04 18:53:47 -07:00
Abhilash Raj 6ad0a2c45f
[3.8] bpo-37764: Fix infinite loop when parsing unstructured email headers. (GH-15239) (GH-15686)
Fixes a case in which email._header_value_parser.get_unstructured hangs the system for some invalid headers. This covers the cases in which the header contains either:
- a case without trailing whitespace
- an invalid encoded word

https://bugs.python.org/issue37764

This fix should also be backported to 3.7 and 3.8

https://bugs.python.org/issue37764
(cherry picked from commit c5b242f87f)

Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
2019-09-04 18:20:40 -07:00
Miss Islington (bot) 6d7a786d2e
bpo-22347: Update mimetypes.guess_type to allow proper parsing of URLs (GH-15522)
https://bugs.python.org/issue22347
(cherry picked from commit 87bd2071c7)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-09-04 17:54:59 -07:00
Miss Islington (bot) 29825a3392
Fix idlelib.help comments (GH-15669)
(cherry picked from commit 6cd9666ce9)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-09-04 17:39:34 -07:00
Miss Islington (bot) cad7abf8ab
bpo-38030: Fix os.stat failures on block devices on Windows (GH-15681)
(cherry picked from commit 772ec0fad5)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-04 15:18:05 -07:00
Miss Islington (bot) 4dd1c9d9c2
closes bpo-37966: Fully implement the UAX GH-15 quick-check algorithm. (GH-15558)
The purpose of the `unicodedata.is_normalized` function is to answer
the question `str == unicodedata.normalized(form, str)` more
efficiently than writing just that, by using the "quick check"
optimization described in the Unicode standard in UAX GH-15.

However, it turns out the code doesn't implement the full algorithm
from the standard, and as a result we often miss the optimization and
end up having to compute the whole normalized string after all.

Implement the standard's algorithm.  This greatly speeds up
`unicodedata.is_normalized` in many cases where our partial variant
of quick-check had been returning MAYBE and the standard algorithm
returns NO.

At a quick test on my desktop, the existing code takes about 4.4 ms/MB
(so 4.4 ns per byte) when the partial quick-check returns MAYBE and it
has to do the slow normalize-and-compare:

  $ build.base/python -m timeit -s 'import unicodedata; s = "\uf900"*500000' \
      -- 'unicodedata.is_normalized("NFD", s)'
  50 loops, best of 5: 4.39 msec per loop

With this patch, it gets the answer instantly (58 ns) on the same 1 MB
string:

  $ build.dev/python -m timeit -s 'import unicodedata; s = "\uf900"*500000' \
      -- 'unicodedata.is_normalized("NFD", s)'
  5000000 loops, best of 5: 58.2 nsec per loop

This restores a small optimization that the original version of this
code had for the `unicodedata.normalize` use case.

With this, that case is actually faster than in master!

$ build.base/python -m timeit -s 'import unicodedata; s = "\u0338"*500000' \
    -- 'unicodedata.normalize("NFD", s)'
500 loops, best of 5: 561 usec per loop

$ build.dev/python -m timeit -s 'import unicodedata; s = "\u0338"*500000' \
    -- 'unicodedata.normalize("NFD", s)'
500 loops, best of 5: 512 usec per loop
(cherry picked from commit 2f09413947)

Co-authored-by: Greg Price <gnprice@gmail.com>
2019-09-03 20:03:37 -07:00
Miss Islington (bot) 952ea67289
bpo-38022: IDLE: upgrade help.html to sphinx 2.x HTML5 output (GH-15664)
The HTML5 output from Sphinx 2.x adds  '<p>' tags within list elements.  Using a new prevtag attribute, ignore these instead of emitting unwanted '\n\n'.

Also stop looking for 'first' classes on tags (no longer present) and fix the bug of double-spacing instead of single spacing after <pre> blocks.
(cherry picked from commit 580bdb0ece)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-09-03 14:18:45 -07:00
Ashwin Ramaswami 59e8fba718 [3.8] bpo-21315: Fix parsing of encoded words with missing leading ws (GH-13425) (GH-15655)
* [bpo-21315](https://bugs.python.org/issue21315): Fix parsing of encoded words with missing leading ws.

Because of missing leading whitespace, encoded word would get parsed as
unstructured token. This patch fixes that by looking for encoded words when
splitting tokens with whitespace.

Missing trailing whitespace around encoded word now register a defect
instead.

Original patch suggestion by David R. Murray on [bpo-21315](https://bugs.python.org/issue21315).
(cherry picked from commit 66c4f3f38b)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
(cherry picked from commit dc20fc4311)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>





https://bugs.python.org/issue21315
2019-09-03 10:08:39 -07:00
Miss Islington (bot) 1c18aec3bb
bpo-35771: IDLE: Fix flaky tool-tip hover delay tests (GH-15634)
Extending the hover delay in test_tooltip should avoid spurious test_idle failures.
One longer delay instead of two shorter delays results in a net speedup.
(cherry picked from commit 132acaba5a)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-09-02 22:39:08 -07:00
Miss Islington (bot) bf69e160c4 bpo-38010 Sync importlib.metadata with importlib_metadata 0.20. (GH-15646) (GH-15648)
Sync importlib.metadata with importlib_metadata 0.20.
(cherry picked from commit 102e9b40ff)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2019-09-02 12:11:01 -04:00
Raymond Hettinger bd8ca9aacc
[3.8] bpo-29553: Fix ArgumentParser.format_usage() for mutually exclusive groups (GH-14976) (GH-15494) (GH-15624) 2019-08-30 15:25:38 -07:00
Miss Islington (bot) 4bd1d05ee2
Fix typos mostly in comments, docs and test names (GH-15209)
(cherry picked from commit 39d87b5471)

Co-authored-by: Min ho Kim <minho42@gmail.com>
2019-08-30 13:42:54 -07:00
Miss Islington (bot) 3d75857dfa
IDLE: Fix 2 typos found by Min ho Kim. (GH-15617)
(cherry picked from commit 15119bc2a7)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-08-30 13:36:06 -07:00
Miss Islington (bot) 17f61ed25a
bpo-37140: Fix StructUnionType_paramfunc() (GH-15612)
Fix a ctypes regression of Python 3.8. When a ctypes.Structure is
passed by copy to a function, ctypes internals created a temporary
object which had the side effect of calling the structure finalizer
(__del__) twice. The Python semantics requires a finalizer to be
called exactly once. Fix ctypes internals to no longer call the
finalizer twice.

Create a new internal StructParam_Type which is only used by
_ctypes_callproc() to call PyMem_Free(ptr) on Py_DECREF(argument).
StructUnionType_paramfunc() creates such object.
(cherry picked from commit 96b4087ce7)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-08-30 05:50:44 -07:00
Łukasz Langa 23d532a435 Python 3.8.0b4
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl1oSsoACgkQsmmV4xAl
 BWiZ2w/9EGp9XonU8NCJShlmjmat3q1S1FKQD69W4817cQRNtj8Lv6UP17epkVtX
 8ASRA5IdUuMhU30A6eUMmk0HmVjTDvxQTCpC0qSa1gDxd6vysydTDOmxyoRExR5R
 secZIYswJVsKUGyiR0+aOaOqDJSS4zUMLttdBeiEKwZEXyXntqOStB3nx/lURKkM
 wLzQM0N7HQKvqY9lc3ANQ12LcD9rpj9xn4dx3mauINNOJlA1sy3ymt/6iiRJlYYC
 LwoahzS8q1TSvz6X/E0kHZ3cZ//uiAgDF9XpuDUm5bwKwClHm5hxnDF53do6FP3V
 u4CIDNySksrvxha+5F9Y8Ln9M8t2pjfl+XzKMPoEb7pGugV8TAhnWdRk0CO6FkS4
 ApLiY0CsxrB+vpQxOVBwIchqM9QXXf6kZxh8T/R1qkFRpThepLNGR87rXEuZLt+I
 HjJPgiC1gvyiVESvzMFllMbCq1syjrONsvRQOjL4NhrdjH+xPuscuNZlgClwW1uz
 plIScSsAZyPI22Vs55ppLpxo8gU8y87i4nHBr82asc4e84R1gWqlrQbnut6Q7r38
 cT41RKlMgY5YG41L/hUaYPyWXhIbYXk3KTyi0FW+ShPQriFaL348XWJTpfDupSZh
 rv7Bnh4JGUkmDw988VMCL9WbWDdo9gZjJPeHuI8MHWrO3ZP8130=
 =O/oH
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl1o5dYQHGx1a2FzekBs
 YW5nYS5wbAAKCRCyaZXjECUFaLU6D/9botf8rulCYHS799GjFWt9kjBycZYhUJij
 +pDLDm+ORq50eJnQYYgE3eTFLhRO7IypnIf1eSoFv/pxxDgWdqsKLoLRA8qjCjc6
 PBmK2w88QBpDpX54B5yZrwFihlH9xRZSOmKAepOkDDa1VTUUiID2Wo+ZGG6+yjmg
 EV6vdWBVTDbHTRND5d/mP7AZ+n/LAN1SUwO4QCIsLXLb/8L+1CLs2/7iOWEvu5TP
 4DGO0D3e+kZv67EnrJB3mlxwgSupEnHwiNg0GL8NoFA4WRXMNx5l8QmhQuwj1ybz
 NbhbR8pZIejBrJE7Va58g6Yg5/7qTHNFSnsNT9o5OFBNahLzqB6/aNspyn+Wyb3b
 KsfirTXGCdau4ufDJWLRXTn/OkmbG141F5p82BXoPr4NMchdcAivVQbWMB2QvZ/D
 8S6AcUIscmD8uY+UT1d2fq0gxXPIf8+oXOqhlZ3TypnFuQKtEMU0htytvVVvEtJo
 PTs0mGxLq56/bvAE56lLuW5wJLXJOGZ9JSW6HqiYNEcEcotwY/RvraQ4TuTwHu5f
 /ZKIzAYJ+WwalVQDXky6rUd4xFOiQ0xeAz+hvdRAf9RtIMfOQUGQz8pv0x6m5ULO
 FBRJArkT+OYpAODFJDg1dvy1PWKSb9RRZC1HoZx1Hgk92hUtpliVQ/Rmh7jpE+0G
 M6l5t87ofA==
 =hIaU
 -----END PGP SIGNATURE-----

Merge tag 'v3.8.0b4' into 3.8

Python 3.8.0b4
2019-08-30 11:01:00 +02:00
Miss Islington (bot) 27f418640c bpo-37976: Prevent shadowing of TypeError in zip() (GH-15592) (GH-15608)
(cherry picked from commit 6a650aaf77)

Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
2019-08-29 23:23:17 -07:00
Miss Islington (bot) c19d6bca55 Steven Bethard designated a new maintainer for argparse (GH-15605) (GH-15606)
(cherry picked from commit 496058f599)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-29 21:27:33 -07:00
Łukasz Langa d93605de72
Python 3.8.0b4 2019-08-29 23:59:20 +02:00
Łukasz Langa 25a044ee6c
[3.8] bpo-37834: Prevent shutil.rmtree exception (GH-15602) (#15603)
when built on non-Windows system without fd system call support,
like older versions of macOS.
(cherry picked from commit 7fcc2088a5)

Co-authored-by: Ned Deily <nad@python.org>
2019-08-29 23:51:19 +02:00
Serhiy Storchaka 96631dcb11
[3.8] bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593). (GH-15599)
(cherry picked from commit 4901fe274b)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2019-08-29 18:29:59 +03:00
Miss Islington (bot) c71ae1a45b bpo-36743: __get__ is sometimes called without the owner argument (GH-12992) (GH-15589)
(cherry picked from commit 0dac68f1e5)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-29 02:02:51 -07:00
Miss Islington (bot) 102130a63c
bpo-37960: Silence only necessary errors in repr() of buffered and text streams. (GH-15543)
(cherry picked from commit b235a1b473)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-08-29 01:13:29 -07:00
Miss Islington (bot) d1d42bf4a4
bpo-37372: Fix error unpickling datetime.time objects from Python 2 with seconds>=24. (GH-14307)
(cherry picked from commit 122376df55)

Co-authored-by: Justin Blanchard <UncombedCoconut@gmail.com>
2019-08-29 00:56:04 -07:00
Serhiy Storchaka 097eae5b9b
[3.8] bpo-37950: Fix ast.dump() when call with incompletely initialized node. (GH-15510) (GH-15582)
(cherry picked from commit e64f948e76)
2019-08-29 10:50:28 +03:00
Miss Islington (bot) 38d311d79e bpo-36871: Ensure method signature is used when asserting mock calls to a method (GH15578)
* Fix call_matcher for mock when using methods

* Add NEWS entry

* Use None check and convert doctest to unittest

* Use better name for mock in tests. Handle _SpecState when the attribute was not accessed and add tests.

* Use reset_mock instead of reinitialization. Change inner class constructor signature for check

* Reword comment regarding call object lookup logic
(cherry picked from commit c96127821e)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-08-29 07:58:27 +01:00
Miss Islington (bot) 612d3935ec
bpo-35946: Improve assert_called_with documentation (GH-11796)
(cherry picked from commit f5896a05ed)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2019-08-28 23:39:47 -07:00
Miss Islington (bot) 4adcaf8151 bpo-34775: Return NotImplemented in PurePath division. (GH-9509) (GH-15172)
(cherry picked from commit 4c69be22df)

Co-authored-by: aiudirog <aiudirog@gmail.com>
2019-08-29 01:05:59 -04:00
Miss Islington (bot) e471a543a4
bpo-18378: Recognize "UTF-8" as a valid name in locale._parse_localename (GH-14736)
(cherry picked from commit b0caf32981)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2019-08-28 21:56:00 -07:00
bsiem bd127b1b7d [3.8] bpo-37482: Fix email address name with encoded words and special chars (GH-14561) (GH-15380)
Special characters in email address header display names are normally
put within double quotes. However, encoded words (=?charset?x?...?=) are
not allowed withing double quotes. When the header contains a word with
special characters and another word that must be encoded, the first one
must also be encoded.

In the next example, the display name in the From header is quoted and
therefore the comma is allowed; in the To header, the comma is not
within quotes and not encoded, which is not allowed and therefore
rejected by some mail servers.

From: "Foo Bar, France" <foo@example.com>
To: Foo Bar, =?utf-8?q?Espa=C3=B1a?= <foo@example.com>

https://bugs.python.org/issue37482
(cherry picked from commit df0c21ff46)

Co-authored-by: bsiem <52461103+bsiem@users.noreply.github.com>
2019-08-29 00:47:15 -04:00
Miss Islington (bot) 23985c6a64 closes bpo-37965: Fix compiler warning of distutils CCompiler.test_function. (GH-15561)
https://bugs.python.org/issue37965

https://bugs.python.org/issue37965

Automerge-Triggered-By: @benjaminp
(cherry picked from commit 55aabee075)

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2019-08-28 10:32:34 -07:00
Miss Islington (bot) 2cb82d2a88 bpo-36582: Make collections.UserString.encode() return bytes, not str (GH-13138) (GH-15557)
(cherry picked from commit 2a16eea71f)

Co-authored-by: Daniel Fortunov <asqui@users.noreply.github.com>
2019-08-27 21:59:54 -07:00
Miss Islington (bot) c75f0e5bde
Fix an invalid assertEqual() call in test_descr.py (GH-15318)
(cherry picked from commit 6b2e3256b6)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-08-26 16:02:21 -07:00
Steve Dower 04b750740b
bpo-37664: Update ensurepip bundled wheels, again (GH-15483) 2019-08-26 12:57:57 -07:00
Miss Islington (bot) 69d22b8fee
bpo-34679: Restore instantiation Windows IOCP event loop from non-main thread (GH-15492)
* Restore running proactor event loop from non-main thread

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit 1c06009986)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-08-26 03:14:54 -07:00
Miss Islington (bot) 522a394a72 [3.8] bpo-36917: Add default implementation of ast.NodeVisitor.visit_Constant(). (GH-15490) (GH-15509)
It emits a deprecation warning and calls corresponding method
visit_Num(), visit_Str(), etc.
(cherry picked from commit c3ea41e9bf)
2019-08-26 10:43:33 +03:00
Miss Islington (bot) a3875171d7
bpo-37805: Add tests for json.dump(..., skipkeys=True) (GH-15489)
https://bugs.python.org/issue37805

Automerge-Triggered-By: @methane
(cherry picked from commit 44cd86bbdd)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-08-26 00:27:31 -07:00
Miss Islington (bot) 077887059a bpo-37824: Properly handle user input warnings in IDLE shell. (GH-15500)
Cease turning SyntaxWarnings into SyntaxErrors.
(cherry picked from commit 1039f39c9c)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-08-26 02:52:45 -04:00
Nick Coghlan 6ca030765d
[3.8] bpo-37757: Disallow PEP 572 cases that expose implementation details (GH-15491)
- drop TargetScopeError in favour of raising SyntaxError directly
  as per the updated PEP 572
- comprehension iteration variables are explicitly local, but
  named expression targets in comprehensions are nonlocal or
  global. Raise SyntaxError as specified in PEP 572
- named expression targets in the outermost iterable of a
  comprehension have an ambiguous target scope. Avoid resolving
  that question now by raising SyntaxError. PEP 572
  originally required this only for cases where the bound name
  conflicts with the iteration variable in the comprehension,
  but CPython can't easily restrict the exception to that case
  (as it doesn't know the target variable names when visiting
  the outermost iterator expression)

(cherry picked from commit 5dbe0f59b7)
2019-08-26 00:41:47 +10:00
Miss Islington (bot) e266d062e0
bpo-37929: IDLE: avoid Squeezer-related config dialog crashes (GH-15452)
These were caused by keeping around a reference to the Squeezer
instance and calling it's load_font() upon config changes, which
sometimes happened even if the shell window no longer existed.

This change completely removes that mechanism, instead having the
editor window properly update its width attribute, which can then
be used by Squeezer.
(cherry picked from commit d4b4c00b57)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-08-24 23:18:01 -07:00
Raymond Hettinger 21161d73d9
[3.8] bpo-37942: Improve argument clinic float converter (GH-15470) (GH-15480)
(cherry picked from commit aef9ad82f7)
2019-08-24 19:45:12 -07:00
Miss Islington (bot) d5a66bc56f bpo-37798: Test both Python and C versions in test_statistics.py (GH-15453) (GH-15467)
(cherry picked from commit 8ad22a4226)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-08-24 11:14:20 -07:00
Miss Islington (bot) c410f381bf bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170) (#15461)
* fix Path._add_implied_dirs to include all implied directories

* fix Path._add_implied_dirs to include all implied directories

* Optimize code by using sets instead of lists

* 📜🤖 Added by blurb_it.

* fix Path._add_implied_dirs to include all implied directories

* Optimize code by using sets instead of lists

* 📜🤖 Added by blurb_it.

* Add tests to zipfile.Path.iterdir() fix

* Update test for zipfile.Path.iterdir()

* remove whitespace from test file

* Rewrite NEWS blurb to describe the user-facing impact and avoid implementation details.

* remove redundant [] within set comprehension

* Update to use unique_everseen to maintain order and other suggestions in review

* remove whitespace and add back add_dirs in tests

* Add new standalone function parents using posixpath to get parents of a directory

* removing whitespace (sorry)

* Remove import pathlib from zipfile.py

* Rewrite _parents as a slice on a generator of the ancestry of a path.

* Remove check for '.' and '/', now that parents no longer returns those.

* Separate calculation of implied dirs from adding those

* Re-use _implied_dirs in tests for generating zipfile with dir entries.

* Replace three fixtures (abcde, abcdef, abde) with one representative example alpharep.

* Simplify implementation of _implied_dirs by collapsing the generation of parent directories for each name.
(cherry picked from commit a4e2991bdc)

Co-authored-by: shireenrao <shireenrao@gmail.com>
2019-08-24 12:03:52 -04:00
Serhiy Storchaka ed146b52a3
[3.8] bpo-37830: Fix compilation of break and continue in finally. (GH-15320) (GH-15456)
Fix compilation of "break" and "continue" in the
"finally" block when the corresponding "try" block
contains "return" with a non-constant value.
(cherry picked from commit ef61c524dd)
2019-08-24 13:41:53 +03:00
Miss Islington (bot) ef3ccd7370 bpo-19119: Remove invalid test and rename a misnamed test (GH-15442) (GH-15447)
(cherry picked from commit 4101181fd8)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-23 22:54:07 -07:00
Miss Islington (bot) 5779c53632 bpo-37798: Add C fastpath for statistics.NormalDist.inv_cdf() (GH-15266) (GH-15441)
(cherry picked from commit 0a18ee4be7)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-08-23 15:39:27 -07:00
Victor Stinner af84a88ef8
bpo-36763: PyConfig_Read() handles PySys_AddXOption() (GH-15431) (GH-15435)
PyConfig_Read() is now responsible to handle early calls to
PySys_AddXOption() and PySys_AddWarnOption().

Options added by PySys_AddXOption() are now handled the same way than
PyConfig.xoptions and command line -X options.

For example, PySys_AddXOption(L"faulthandler") enables faulthandler
as expected.

(cherry picked from commit 120b707a6d)
2019-08-23 21:16:51 +02:00
Miss Islington (bot) 3921d12174
bpo-37549: os.dup() fails for standard streams on Windows 7 (GH-15389)
(cherry picked from commit 5be666010e)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-08-23 12:04:27 -07:00
Miss Islington (bot) 761e5a7c7f bpo-26589: Add http status code 451 (GH-15413) (GH-15436)
(cherry picked from commit 8f080b0995)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-23 10:56:44 -07:00
Miss Islington (bot) a6427cb2a2
bpo-36763: Implement PyWideStringList_Insert() of PEP 587 (GH-15423)
(cherry picked from commit 3842f2997f)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-08-23 09:24:42 -07:00
Miss Islington (bot) 5c77730300
bpo-37915: Fix comparison between tzinfo objects and timezone objects (GH-15390)
https://bugs.python.org/issue37915

Automerge-Triggered-By: @pablogsal
(cherry picked from commit 4be11c009a)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-08-23 01:48:40 -07:00
Miss Islington (bot) 5fda09cc1e
bpo-28556: Add a regression test to typing (GH-15396)
This adds a regression test for the issue found in the Python 2 backport, see https://github.com/python/typing/issues/656

https://bugs.python.org/issue28556
(cherry picked from commit 8889627b53)

Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
2019-08-22 11:11:27 -07:00
Miss Islington (bot) 8ede9676bb Add missing space to warning message (GH-14915) (GH-15379)
This typo was introduced in GH-13409 when changing the message text.
(cherry picked from commit c4106af38b)

Co-authored-by: Florian Bruhin <me@the-compiler.org>
2019-08-21 23:30:26 -07:00
Miss Islington (bot) 967d625a6d
bpo-37834: Fix test on Windows 7 (GH-15377)
(cherry picked from commit 374be59b8e)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-08-21 18:01:22 -07:00
Steve Dower a50d2f7e19
bpo-9949: Call normpath() in realpath() and avoid unnecessary prefixes (GH-15376) 2019-08-21 17:23:38 -07:00
Miss Islington (bot) f93c15aedc
bpo-36311: Fixes decoding multibyte characters around chunk boundaries and improves decoding performance (GH-15083)
(cherry picked from commit 7ebdda0dbe)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-08-21 16:53:56 -07:00
Steve Dower 9eb3d54639
bpo-37834: Normalise handling of reparse points on Windows (GH-15370)
bpo-37834: Normalise handling of reparse points on Windows
* ntpath.realpath() and nt.stat() will traverse all supported reparse points (previously was mixed)
* nt.lstat() will let the OS traverse reparse points that are not name surrogates (previously would not traverse any reparse point)
* nt.[l]stat() will only set S_IFLNK for symlinks (previous behaviour)
* nt.readlink() will read destinations for symlinks and junction points only

bpo-1311: os.path.exists('nul') now returns True on Windows
* nt.stat('nul').st_mode is now S_IFCHR (previously was an error)
2019-08-21 15:52:42 -07:00
Miss Islington (bot) c30c869e8d
bpo-9949: Enable symlink traversal for ntpath.realpath (GH-15287)
(cherry picked from commit 75e064962e)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-08-21 14:09:33 -07:00
Miss Islington (bot) 7e293f5e4c
Fix difflib `?` hint in diff output when dealing with tabs (GH-15201)
(cherry picked from commit e1c638da6a)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2019-08-21 12:18:26 -07:00
Miss Islington (bot) 44f2c09680
bpo-35518: Skip test that relies on a deceased network service. (GH-15349)
If this service had thoroughly vanished, we could just ignore the
test until someone gets around to either recreating such a service
or redesigning the test to somehow work locally.  The
`support.transient_internet` mechanism catches the failure to
resolve the domain name, and skips the test.

But in fact the domain snakebite.net does still exist, as do its
nameservers -- and they can be quite slow to reply.  As a result
this test can easily take 20-30s before it gets auto-skipped.

So, skip the test explicitly up front.
(cherry picked from commit 5b95a1507e)

Co-authored-by: Greg Price <gnprice@gmail.com>
2019-08-20 21:08:57 -07:00
Miss Islington (bot) 1271ee8187
bpo-37868: Improve is_dataclass for instances. (GH-15325)
(cherry picked from commit b0f4dab873)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2019-08-19 22:59:21 -07:00
Greg Price 8c1c426a63 bpo-36502: Correct documentation of str.isspace() (GH-15019) (GH-15296)
The documented definition was much broader than the real one:
there are tons of characters with general category "Other",
and we don't (and shouldn't) treat most of them as whitespace.

Rewrite the definition to agree with the comment on
_PyUnicode_IsWhitespace, and with the logic in makeunicodedata.py,
which is what generates that function and so ultimately governs.

Add suitable breadcrumbs so that a reader who wants to pin down
exactly what this definition means (what's a "bidirectional class"
of "B"?) can do so.  The `unicodedata` module documentation is an
appropriate central place for our references to Unicode's own copious
documentation, so point there.

Also add to the isspace() test a thorough check that the
implementation agrees with the intended definition.
2019-08-19 10:53:22 +01:00
Paul Ganssle 27b38b99b3
bpo-37642: Update acceptable offsets in timezone (GH-14878) (#15227)
This fixes an inconsistency between the Python and C implementations of
the datetime module. The pure python version of the code was not
accepting offsets greater than 23:59 but less than 24:00. This is an
accidental legacy of the original implementation, which was put in place
before tzinfo allowed sub-minute time zone offsets.

GH-14878

(cherry picked from commit 92c7e30adf)
2019-08-15 15:08:57 -04:00
Miss Islington (bot) 557802dc17
bpo-37849: IDLE: fix completion window positioning above line (GH-15267)
(cherry picked from commit 71662dc2f1)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-08-14 10:24:04 -07:00
Victor Stinner d85c5670ff
[3.8] bpo-37531: Fix regrtest timeout for subprocesses (GH-15072) (GH-15279)
* bpo-37531: Fix regrtest timeout for subprocesses (GH-15072)

Co-Authored-By: Joannah Nanjekye <joannah.nanjekye@ibm.com>
(cherry picked from commit b0c8369c60)

* bpo-36511: Fix failures in Windows ARM32 buildbot (GH-15181)

(cherry picked from commit ed70a344b5)

Backport also minor fixes from master (fix typo, remove importlib import).
2019-08-14 16:31:32 +02:00
Miss Islington (bot) e7ec9e04c8
bpo-25172: Add test for crypt ImportError on Windows (GH-15252)
(cherry picked from commit 243a73deee)

Co-authored-by: shireenrao <shireenrao@gmail.com>
2019-08-13 14:52:20 -07:00
Miss Islington (bot) 7f7f74734a
bpo-25172: Raise appropriate ImportError msg when crypt module used on Windows (GH-15149)
(cherry picked from commit f4e725f224)

Co-authored-by: shireenrao <shireenrao@gmail.com>
2019-08-13 14:27:14 -07:00
Miss Islington (bot) ee98951252
bpo-37583: Add err 113 to support.get_socket_conn_refused_errs() (GH-14729)
Add error number 113 EHOSTUNREACH to get_socket_conn_refused_errs()
of test.support.
(cherry picked from commit 1ac2a83f30)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2019-08-13 11:11:49 -07:00
Miss Islington (bot) 0c64b57e01 [3.8] bpo-37354: Make Powershell Activate.ps1 script static to allow for signing (GH-14967)
- Remove use of replacement text in the script
- Make use of the pyvenv.cfg file for prompt value.
- Add parameters to allow more flexibility
- Make use of the current path, and assumptions about where env puts things, to compensate
- Make the script a bit more 'idiomatic' Powershell
- Add script documentation (Get-Help .\.venv\Scripts\Activate.ps1 shows PS help page now
(cherry picked from commit 732775d6be)

Co-authored-by: Derek Keeler <d3r3kk@users.noreply.github.com>
2019-08-12 14:09:26 -07:00
Miss Islington (bot) 5ba1cb0393 bpo-37819: Add Fraction.as_integer_ratio() (GH-15212) (GH-15215)
(cherry picked from commit f03b4c8a48)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-11 15:02:23 -07:00
Miss Islington (bot) 9500bbe937
bpo-32178: Fix IndexError trying to parse 'To' header starting with ':'. (GH-15044)
This should fix the IndexError trying to retrieve `DisplayName.display_name` and `DisplayName.value` when the `value` is basically an empty string.

https://bugs.python.org/issue32178
(cherry picked from commit 09a1872a80)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
2019-08-11 14:04:31 -07:00
Serhiy Storchaka 4c5b6bac24 [3.8] bpo-32912: Revert SyntaxWarning on invalid escape sequences (GH-15142)
* bpo-32912: Revert warnings for invalid escape sequences.

DeprecationWarning will continue to be emitted for invalid escape sequences in string and bytes literals in 3.8 just as it did in 3.7.

SyntaxWarning may be emitted in the future. But per mailing list discussion, we don't yet know when because we haven't settled on how to do so in a non-disruptive manner.
2019-08-09 15:34:22 -07:00
Miss Islington (bot) 217077440a
bpo-34155: Dont parse domains containing @ (GH-13079)
Before:

        >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses
        (Address(display_name='', username='a', domain='malicious.org'),)

        >>> parseaddr('a@malicious.org@important.com')
        ('', 'a@malicious.org')

    After:

        >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses
        (Address(display_name='', username='', domain=''),)

        >>> parseaddr('a@malicious.org@important.com')
        ('', 'a@')

https://bugs.python.org/issue34155
(cherry picked from commit 8cb65d1381)

Co-authored-by: jpic <jpic@users.noreply.github.com>
2019-08-09 01:31:27 -07:00
Pablo Galindo 162d45c531
[3.8] bpo-37795: Capture DeprecationWarnings in the test suite (GH-15184) (GH-15188)
(cherry picked from commit aa542c2)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-08-09 01:22:59 +01:00
Miss Islington (bot) e780d2f1f5 Make importlib.metadata a simple module (GH-15153) (GH-15154)
(cherry picked from commit 3a5c433fce)

Co-authored-by: Barry Warsaw <barry@python.org>
2019-08-06 21:38:22 -04:00
Miss Islington (bot) 5349f8cd78
bpo-36419: IDLE - Refactor autocompete and improve testing. (GH-15121)
(cherry picked from commit 1213123005)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-08-04 17:08:16 -07:00
Miss Islington (bot) 9c95fc752c
bpo-37748: Re-order the Run menu. (GH-15115)
Put the most common choice, Run Module, at the top.
(cherry picked from commit 14070299cd)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-08-04 14:04:49 -07:00
Miss Islington (bot) 0c16f6b307 bpo-28292: Mark calendar.py helper functions as private. (GH-15113) (GH-15116)
(cherry picked from commit b1c8ec010f)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-04 13:34:56 -07:00
Miss Islington (bot) d7d607c000 bpo-36324: Update comments to include the target hash sums (GH-15110) (GH-15112)
(cherry picked from commit 8183bb8150)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-04 12:16:19 -07:00
Miss Islington (bot) 1d2b4dba6c
bpo-37706: IDLE - fix sidebar code bug and drag tests (GH-15103)
Convert mouse y to line number in the sidebar rather than the text.
(cherry picked from commit 86f1a18abf)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-08-04 09:43:56 -07:00
Miss Islington (bot) dde944f9df
bpo-37685: Fixed comparisons of datetime.timedelta and datetime.timezone. (GH-14996)
There was a discrepancy between the Python and C implementations.

Add singletons ALWAYS_EQ, LARGEST and SMALLEST in test.support
to test mixed type comparison.
(cherry picked from commit 17e52649c0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-08-04 03:01:55 -07:00
Miss Islington (bot) 4e402d37eb Correct description of HTTP status code 308. (GH-15098)
Permanent redirect was explained as a temporary redirect.
(cherry picked from commit 5c72badd06)

Co-authored-by: Florian Wendelborn <1133858+FlorianWendelborn@users.noreply.github.com>
2019-08-03 11:39:46 -07:00
Miss Islington (bot) 6b833901fe
bpo-30974: Change os.path.samefile docstring to match docs (GH-7337)
(cherry picked from commit 8e568ef266)

Co-authored-by: Timo Furrer <tuxtimo@gmail.com>
2019-08-02 16:04:53 -07:00
Miss Islington (bot) 79af3bd1d1
bpo-20523: pdb searches for .pdbrc in ~ instead of $HOME (GH-11847)
Previously pdb checked the $HOME environmental variable
to find the user .pdbrc. If $HOME is not set, the user
.pdbrc would not be found.

Change pdb to use `os.path.expanduser('~')` to determine
the user's home directory. Thus, if $HOME is not set (as
in tox or on Windows), os.path.expanduser('~') falls
back on other techniques for locating the user's home
directory.

This follows pip's implementation for loading .piprc.

Co-authored-by: Dan Lidral-Porter <dlp@aperiodic.org>
(cherry picked from commit 7ea9a85f13)

Co-authored-by: Timothy Hopper <tdhopper@users.noreply.github.com>
2019-08-02 15:42:50 -07:00
Miss Islington (bot) 1cc70322c9
bpo-16970: Adding error message for invalid args (GH-14844)
BPO -16970: Adding error message for invalid args

Applied the patch argparse-v2 patch issue 16970, ran patch check and the test suite, test_argparse with 0 errors

https://bugs.python.org/issue16970
(cherry picked from commit 4b3e975923)

Co-authored-by: tmblweed <tmblweed@users.noreply.github.com>
2019-08-01 22:16:44 -07:00
Miss Islington (bot) 8399641c34
bpo-18049: Sync thread stack size to main thread size on macOS (GH-14748)
This changeset increases the default size of the stack
for threads on macOS to the size of the stack
of the main thread and reenables the relevant
recursion test.
(cherry picked from commit 1a057bab0f)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2019-08-01 07:38:57 -07:00
Miss Islington (bot) 77fcccb532
bpo-37723: Fix performance regression on regular expression parsing. (GH-15030)
Improve performance of sre_parse._uniq function.
(cherry picked from commit 9f55551f3d)

Co-authored-by: yannvgn <hi@yannvgn.io>
2019-07-31 13:22:09 -07:00
Miss Islington (bot) d8b914a30b
bpo-37085: Expose SocketCAN bcm_msg_head flags (GH-13646)
Expose the CAN_BCM SocketCAN constants used in the bcm_msg_head struct
flags (provided by <linux/can/bcm.h>) under the socket library.

This adds the following constants with a CAN_BCM prefix:

  * SETTIMER
  * STARTTIMER
  * TX_COUNTEVT
  * TX_ANNOUNCE
  * TX_CP_CAN_ID
  * RX_FILTER_ID
  * RX_CHECK_DLC
  * RX_NO_AUTOTIMER
  * RX_ANNOUNCE_RESUME
  * TX_RESET_MULTI_IDX
  * RX_RTR_FRAME
  * CAN_FD_FRAME

The CAN_FD_FRAME flag was introduced in the 4.8 kernel, while the other
ones were present since SocketCAN drivers were mainlined in 2.6.25. As
such, it is probably unnecessary to guard against these constants being
missing.
(cherry picked from commit 31c4fd2a10)

Co-authored-by: karl ding <karlding@users.noreply.github.com>
2019-07-31 02:10:38 -07:00
Miss Islington (bot) 34de5dcf21
bpo-34162: Add missing items to idlelib/NEWS.txt. (GH-15034)
(cherry picked from commit fff5cb21ae)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-30 22:19:28 -07:00
Miss Islington (bot) 01c62c9f6b
Fix idlelib typos discovered by min ho, pr 15018. (GH-15029)
(cherry picked from commit 0acb646b8e)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-30 15:34:20 -07:00
Miss Islington (bot) 0f9efbcf9a Don't skip pickle check_frame_opcodes() (GH-15027)
This looks like the only place that proto 4 framing gets exercised
so leave it as part of the PGO task.
(cherry picked from commit eca7ffc61c)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2019-07-30 13:10:15 -07:00
Miss Islington (bot) 382cb85401 bpo-37707: Exclude expensive unit tests from PGO task (GH-15009) (#15024)
Mark some individual tests to skip when --pgo is used.  The tests
marked increase the PGO task time significantly and likely don't
help improve optimization of the final executable.
(cherry picked from commit 52a48e62c6)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2019-07-30 11:34:32 -07:00
Miss Islington (bot) 8b50e3e272
bpo-34162: Update idlelib/news.txt. (GH-15011)
(cherry picked from commit f35c51d2ea)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-29 15:39:49 -07:00
Miss Islington (bot) 8513b90e11
bpo-37706: Disable 3 IDLE scrollbar tests on Mac. (GH-15010)
They pass with tk 8.5.9 (Azure) but fail with the 8.6.x we install.
(cherry picked from commit e8874b85b4)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-29 15:15:50 -07:00
Łukasz Langa 6f53a6824b Python 3.8.0b3
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl0+9AAACgkQsmmV4xAl
 BWjXqg//aKCwPmf0ZE8ZsW6Qlikrn/fovyiA37Uw3Lp7byI8AWpmjTGyDfbbOWvG
 VlifRgMTjdo4z4CrDBMumzDvQhud8/3ok1H/JpCo8Lwb/wEwOxmAQ8qZAtCo5oyA
 5yW/QyFkclsW/t7OAXSFvqkk0F6BzAvbMuaWwwzdfQP+MCTSrkrG3S29JJvBQ2VU
 DPZtfZ2RIkJo9pyI77OCsxILNVTtxLoD8EsqFEvEAanjDNqGSbyD7gxRSg5s27z7
 Tc7qw573oAYVRBb1GuYzeI7AhwwanH4JudUleROBvq3APgYNch6ROBcqlxLdGbvo
 c/hhXJAtCcrjxGLPllGgwfUboJe2ftw8Ory4uvkyAiaW5+3/17iETxXul0uFx0Mc
 dWRjXl47EYsyCkvNA8qckB/VGPunRbW6k4LEKiBWtig9SXmzRqoLYKiCETx0xdfK
 mP/8bX+LP1PG1ti2sYrUr6znRbVBL4u3e1yixQeqNZdzDN9PQykdW34svxxXBHOK
 hvQoGRB4L6zhbnrk2bsSUbAK1P+Ohl9oeNo6c7TNAxzxOeZcQ+CYBUY8aKCR8v5z
 c49YHT33bheaPAa5Sa4f1eVl/W0w6Pu5vT/r7g4ayvnS3f/Bz3+0Zk9FKy5NzJcl
 0yZ7gbsjVkJWbBFanZ0jRs5vgYefjacR7i/sE3Ha79s1950NZdI=
 =Azjr
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl0/XNcQHGx1a2FzekBs
 YW5nYS5wbAAKCRCyaZXjECUFaMIrD/wLevGsmaVYOXngPZagB+iJA6Xexe+hhaNF
 /+zdiRevPA3z1zXbF2rJ7BmrJsL5AwvgZMDutj6Wdpg2//AwNly5XcrvbPCtrrPR
 qM6XFpgVGOsAM74E4VAr0a3OgHQJIgUMCYkqZ9EqWdEKHyk9tHeOUcxFlQgvd3Nn
 93jj5B8BuynkLEcgXJ5hxbn8dB7fC5gUNloQ+zcqdOgqvo3S4JZ2VCjvEaZlUprC
 pbhaRGzAbu6hUT6gbGUOB6qNBDfiZdSybps8AYpzYqj/+WKUWc5Cojr7N/KCeGRG
 9K+zH2WOzcD0UFLeXJmuAUL3rUtUjYtix/rLlpDY1p8VOkzfIR4F2iKnjtmNmTB9
 WnBDcpy0ITJF+meBhBX3xkfzzY9chj6AgEHZ/iXYhtIrZYTgIey/oyUyFNbZvsaO
 8BVkNoaa4DQFBVfz9bzIn/CVKS+cjrrv+4hxArqvlTpvqr5ueqYfRP2dXRHwYzum
 WczP3t2cq8GUj5MeEbHaRQV/JTY2CNtENazKG2OPCwsBNCfDxJ3DbSTpxJWSzz4P
 AnmhjLng7LAPsS8FZ4KuAmOKKlCbpgiVcZcYJdD+RUUtQufZLz7WOaRA0s8YnwjM
 7mhOHGIfUPZZFFLXDt3BefiwEVb5d16JWw6nKXItIpL4IJc8j2Q64ki9WbRZGH/m
 Oh32VYhYzw==
 =C154
 -----END PGP SIGNATURE-----

Merge tag 'v3.8.0b3' into 3.8

Python 3.8.0b3
2019-07-29 22:53:25 +02:00
Miss Islington (bot) bf0b8a6cb2
Add additional test for multi-line SyntaxError (GH-15003)
(cherry picked from commit 44212ec811)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2019-07-29 08:26:29 -07:00
Miss Islington (bot) 9ea738e580
bpo-37500: Make sure dead code does not generate bytecode but also detect syntax errors (GH-14612)
https://bugs.python.org/issue37500

Add a new field to the compiler structure that allows to be configured
so no bytecode is emitted. In this way is possible to detect errors by
walking the nodes while preserving optimizations.

https://bugs.python.org/issue37500
(cherry picked from commit 18c5f9d44d)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-07-29 07:47:30 -07:00
Miss Islington (bot) cf52bd0b9b
Fix `SyntaxError` indicator printing too many spaces for multi-line strings (GH-14433)
(cherry picked from commit 5b94f3578c)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2019-07-29 07:18:47 -07:00
Łukasz Langa 4336222407
Python 3.8.0b3 2019-07-29 15:26:01 +02:00
Miss Islington (bot) 36fd7b6f01
bpo-36044: Avoid warnings in Windows PGO build and add lzma, bz2 and sqlite coverage (GH-14985)
https://bugs.python.org/issue36044

Automerge-Triggered-By: @zooba
(cherry picked from commit e1b9002472)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-07-28 18:20:02 -07:00
Miss Islington (bot) f96334c179 bpo-37697: Sync with importlib_metadata 0.19 (GH-14993) (GH-14995)
* bpo-37697: Sync with importlib_metadata 0.19

* Run make regen-importlib

* 📜🤖 Added by blurb_it.
(cherry picked from commit 049460da9c)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2019-07-28 15:45:46 -04:00
Miss Islington (bot) c94386d013
bpo-37692: Improve highlight config sample (GH-14983)
Use an example shell interaction in the sample and better labels for shell elements.
(cherry picked from commit b222955355)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-28 09:39:03 -07:00
Miss Islington (bot) 76821bab9c bpo-37691: Let math.dist() accept sequences and iterables for coordinates (GH-14975) (GH-14984)
(cherry picked from commit 6b5f1b496f)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-07-27 14:26:58 -07:00
Miss Islington (bot) 171019354a
bpo-37628: Fix IDLE config sample sizes (GH-14958)
The boxes for the font and highlight samples are now constrained by the overall config dialog size.  They gain scrollbars when the when a large font size makes the samples too large for the box.
(cherry picked from commit 3221a63c69)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-07-27 10:19:12 -07:00
Miss Islington (bot) f6ab188323
bpo-17535: Increase line number horizontal padding by 2 pixels (GH-14959)
(cherry picked from commit 46ebd4a6a2)

Co-authored-by: Tal Einat <taleinat@gmail.com>
2019-07-26 20:46:52 -07:00
Miss Islington (bot) c503390126
bpo-37664: Update regex for ignoring cache warning on some buildbots (GH-14960)
(cherry picked from commit b1eb20e68e)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-07-26 09:24:43 -07:00
Miss Islington (bot) 25cb4fd4fb
bpo-37502: handle default parameter for buffers argument of pickle.loads correctly (GH-14593)
(cherry picked from commit 898318b53d)

Co-authored-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2019-07-25 09:18:20 -07:00
Miss Islington (bot) 69802f6163
closes bpo-37675: Use pkgutil.iter_modules to find fixers in a package rather than listdir. (14942)
(cherry picked from commit 93e8aa62cf)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2019-07-24 17:00:39 -07:00
Miss Islington (bot) 0cdb21d6eb
bpo-37664: Update bundled pip to 19.2.1 and setuptools to 41.0.1 (GH-14934)
(cherry picked from commit 5380def826)

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2019-07-24 12:28:12 -07:00
Stefan Behnel bb697899aa
[3.8] bpo-37399: Correctly attach tail text to the last element/comment/pi (GH-14856) (GH-14936)
* bpo-37399: Correctly attach tail text to the last element/comment/pi, even when comments or pis are discarded.
Also fixes the insertion of PIs when "insert_pis=True" is configured for a TreeBuilder.
2019-07-24 20:46:01 +02:00
Miss Islington (bot) 9d54de1658
bpo-37667: Add regression test for regrtest. (GH-14929)
Verify that it appears to find roughly the right number of tests in the stdlib's testsuite.
(cherry picked from commit e95ac20103)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2019-07-23 23:30:27 -07:00
Miss Islington (bot) 9f77cfc37e
Only setup PGO tests when --pgo is enabled. (GH-14927)
(cherry picked from commit f0807ab24c)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2019-07-23 21:53:34 -07:00
Miss Islington (bot) fc63d5a361 bpo-29446: IDLE -- add explicit imports (GH-14919) (GH-14920)
Stop depending on tkinter import *.
(cherry picked from commit c6fd6c83b7)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-23 16:23:43 -04:00
Miss Islington (bot) 1da6a313dd
bpo-17535: IDLE editor line numbers (GH-14030)
(cherry picked from commit 7123ea009b)

Co-authored-by: Tal Einat <taleinat@gmail.com>
2019-07-23 06:04:13 -07:00
Jeroen Demeyer bf8e82f976 [3.8] bpo-36974: separate vectorcall functions for each calling convention (GH-13781) (#14782) 2019-07-23 12:39:51 +02:00
Miss Islington (bot) 5dab5e7d24
bpo-33610: validate non-negative integer inputs in IDLE's config (GH-14822)
(cherry picked from commit 1ebee37dde)

Co-authored-by: Tal Einat <taleinat@gmail.com>
2019-07-23 03:18:41 -07:00
Miss Islington (bot) 2406672984
bpo-36044: Reduce number of unit tests run for PGO build (GH-14702)
Reduce the number of unit tests run for the PGO generation task.  This
speeds up the task by a factor of about 15x.  Running the full unit test
suite is slow.  This change may result in a slightly less optimized build
since not as many code branches will be executed.  If you are willing to
wait for the much slower build, the old behavior can be restored using
'./configure [..] PROFILE_TASK="-m test --pgo-extended"'.  We make no
guarantees as to which PGO task set produces a faster build.  Users who
care should run their own relevant benchmarks as results can depend on
the environment, workload, and compiler tool chain.
(cherry picked from commit 4e16a4a311)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2019-07-22 13:17:23 -07:00
Miss Islington (bot) 22fd679dc3 bpo-21478: Record calls to parent when autospecced objects are used as child with attach_mock (GH 14688) (GH-14902)
* Clear name and parent of mock in autospecced objects used with attach_mock

* Add NEWS entry

* Fix reversed order of comparison

* Test child and standalone function calls

* Use a helper function extracting mock to avoid code duplication and refactor tests.
(cherry picked from commit 7397cda997)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-07-22 08:59:00 +01:00
Kyle Stanley 24b5b360fa [3.8] Fix typos in docs, comments and test assert messages (GH-14872). (#14900)
(cherry picked from commit 96e12d5f4f)

Co-authored-by: Min ho Kim <minho42@gmail.com>
2019-07-21 22:48:45 -04:00
Miss Islington (bot) 9325f4091b
bpo-37627: Initialize IDLE Custom Run dialog with previous entries (GH-14870)
Repeat the command line arguments most recently entered before so the user can edit them.
(cherry picked from commit 35b87e6001)

Co-authored-by: Ngalim Siregar <ngalim.siregar@gmail.com>
2019-07-21 13:25:43 -07:00
Miss Islington (bot) a8cac5762c
Fix typo found by Min ho Kim (GH-14879)
(cherry picked from commit 8e3a7380ec)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-21 12:44:28 -07:00
Miss Islington (bot) e8b3a2e78a Minor whitespace, indentation, and quoting changes to improve internal consistency and appease linters (GH-14888) (GH-14889)
(cherry picked from commit 1c0e9bb94b)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-07-21 12:38:58 -07:00
Miss Islington (bot) c613c3319e bpo-36324: Make internal attributes for statistics.NormalDist() private. (GH-14871) (GH-14875) 2019-07-21 00:55:13 -07:00
Miss Islington (bot) e5bfd1ce9d bpo-36546: Clean-up comments (GH-14857) (#14859)
(cherry picked from commit eed5e9a956)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-07-19 02:17:53 -07:00
Miss Islington (bot) 86eb5daaf3 bpo-33610: IDLE's code-context always shows current context immediately (GH-14821) (#14846)
Eliminate delay of up to 100ms and accompanying visual artifact.
Fix bug of never showing context when hide and show.
(cherry picked from commit e0a1f8fb5c)

Co-authored-by: Tal Einat <taleinat@gmail.com>
2019-07-18 16:47:26 -04:00
Miss Islington (bot) 652b667b13
bpo-37552: Skip failing tests in strptime/strftime with UCRT version 17763.615 (GH-14460)
A bug in MSVC UCRT version 17763.615 (which has been fixed in newer versions) is causing test failures in some strptime/strftime tests when the default code page is c65001. This change selectively skips the tests affected by this.
(cherry picked from commit 9cd39b16e2)

Co-authored-by: Paul Monson <paulmon@users.noreply.github.com>
2019-07-18 07:17:58 -07:00
Miss Islington (bot) 028f1d2479 bpo-36390: Gather IDLE Format menu functions into format.py (GH-14827) (GH-14829)
Add two indent spec methods from editor and Rstrip to existing file.
Tests are not added for indent methods because they need change
in lights of 3.x's prohibition on mixing tabs and spaces.
(cherry picked from commit 1b38922434)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-07-17 21:21:08 -04:00
Miss Islington (bot) 635743355d
Fix IndexError when parsing unexpectedly ending quoted-string. (GH-14813)
This exception was caused because the input ended unexpectedly with only one
single quote instead of a pair with some value inside it.
(cherry picked from commit 719a062bcb)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
2019-07-17 10:29:18 -07:00
Miss Islington (bot) 6816ca30af
bpo-37461: Fix infinite loop in parsing of specially crafted email headers (GH-14794)
* bpo-37461: Fix infinite loop in parsing of specially crafted email headers.

Some crafted email header would cause the get_parameter method to run in an
infinite loop causing a DoS attack surface when parsing those headers. This
patch fixes that by making sure the DQUOTE character is handled to prevent
going into an infinite loop.
(cherry picked from commit a4a994bd3e)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
2019-07-17 10:13:54 -07:00
Miss Islington (bot) 1fc43a3faf bpo-36390: IDLE: Combine region formatting methods. (GH-12481) (GH-14811)
Rename paragraph.py to format.py and add region formatting methods
from editor.py.  Add tests for the latter.
(cherry picked from commit 82494aa6d9)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2019-07-17 10:45:20 -04:00
Miss Islington (bot) 6cf7c45cb5
bpo-37530: simplify, optimize and clean up IDLE code context (GH-14675)
* Only create CodeContext instances for "real" editors windows, but
  not e.g. shell or output windows.
* Remove configuration update Tk event fired every second, by having
  the editor window ask its code context widget to update when
  necessary, i.e. upon font or highlighting updates.
* When code context isn't being shown, avoid having a Tk event fired
  every 100ms to check whether the code context needs to be updated.
* Use the editor window's getlineno() method where applicable.
* Update font of the code context widget before the main text widget
(cherry picked from commit 7036e1de3a)

Co-authored-by: Tal Einat <taleinat@gmail.com>
2019-07-17 01:44:55 -07:00
Miss Islington (bot) 178f09f8b7 bpo-27452: IDLE: Cleanup config.py code (GH-14577) (GH-14802)
(cherry picked from commit f8d4cc7dbb)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2019-07-16 17:19:10 -04:00
Miss Islington (bot) 6a2aec0ff5
Fix infinite loop in email folding logic (GH-12732)
As far as I can tell, this infinite loop would be triggered if:

1. The value being folded contains a single word (no spaces) longer than
   max_line_length
2. The max_line_length is shorter than the encoding's name + 9
   characters.

bpo-36564: https://bugs.python.org/issue36564
(cherry picked from commit f69d5c6198)

Co-authored-by: Paul Ganssle <pganssle@users.noreply.github.com>
2019-07-16 11:08:36 -07:00
Miss Islington (bot) cf9a63c6c7
bpo-37593: Swap the positions of posonlyargs and args in the constructor of ast.parameters nodes (GH-14778)
https://bugs.python.org/issue37593
(cherry picked from commit cd6e83b481)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2019-07-14 16:49:52 -07:00
Miss Islington (bot) 3958b7aae8
Clarify that plistlib's load and dump functions take a binary file object (GH-9825)
The documentation says that the fp parameter to plistlib.load "should be a
readable and binary file object" but the docstring only mentions that it
should be readable. Similarly, plistlib.dump's docstring only mentions
"writable". This commit clarifies that fp should also be binary.

https://docs.python.org/3/library/plistlib.htmlGH-plistlib.load
https://docs.python.org/3/library/plistlib.htmlGH-plistlib.dump
(cherry picked from commit 0d4f4352ef)

Co-authored-by: Collin Styles <collingstyles@gmail.com>
2019-07-14 02:25:43 -07:00
Miss Islington (bot) b1e4d1b603 bpo-26967: fix flag grouping with allow_abbrev=False (GH-14316) (GH-14759)
The `allow_abbrev` option for ArgumentParser is documented and intended to disable support for unique prefixes of --options, which may sometimes be ambiguous due to deferred parsing.

However, the initial implementation also broke parsing of grouped short flags, such as `-ab` meaning `-a -b` (or `-a=b`).  Checking the argument for a leading `--` before rejecting it fixes this.

This was prompted by pytest-dev/pytestGH-5469, so a backport to at least 3.8 would be great 😄
And this is my first PR to CPython, so please let me know if I've missed anything!

https://bugs.python.org/issue26967
(cherry picked from commit dffca9e925)

Co-authored-by: Zac Hatfield-Dodds <Zac-HD@users.noreply.github.com>
2019-07-14 07:59:56 +02:00
Miss Islington (bot) 143672cf02
bpo-37579: Improve equality behavior for pure Python datetime and time (GH-14726)
Returns NotImplemented for timedelta and time in __eq__ for different types in Python implementation, which matches the C implementation.

This also adds tests to enforce that these objects will fall back to the right hand side's __eq__ and/or __ne__ implementation.

bpo-37579
(cherry picked from commit e6b46aafad)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-07-13 06:59:37 -07:00
Miss Islington (bot) 36101c2c5d
closes bpo-37347: Fix refcount problem in sqlite3. (GH-14268)
(cherry picked from commit b9a0376b0d)

Co-authored-by: gescheit <gescheit@yandex-team.ru>
2019-07-12 20:33:53 -07:00
Miss Islington (bot) 3d58b78481
bpo-37558: Shared memory tests are failing due to double slashes (GH-14703)
With the addition of shared memory into Python 3.8, we now have three tests failing on Solaris, namely `test_multiprocessing_fork`, `test_multiprocessing_forkserver` and `test_multiprocessing_spawn`. The reason seems to be incorrect name handling which results in two slashes being prepended.

https://bugs.python.org/issue37558
(cherry picked from commit 4737265622)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2019-07-11 11:38:37 -07:00