Commit Graph

24973 Commits

Author SHA1 Message Date
Jason R. Coombs 5765acaf64
[3.7] bpo-22490: Remove __PYVENV_LAUNCHER__ from environment during launch (GH-9516) (GH-19111)
* bpo-22490: Remove "__PYVENV_LAUNCHER__" from the shell environment on macOS

This changeset removes the environment varialbe "__PYVENV_LAUNCHER__"
during interpreter launch as it is only needed to communicate between
the stub executable in framework installs and the actual interpreter.

Leaving the environment variable present may lead to misbehaviour when
launching other scripts.

* Actually commit the changes for issue 22490...

* Correct typo

Co-Authored-By: Nicola Soranzo <nicola.soranzo@gmail.com>

* Run make patchcheck

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>.
(cherry picked from commit 044cf94f61)

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

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2020-03-22 15:25:20 -04:00
Miss Islington (bot) 6056b7b84f
[3.8] bpo-27807: Skip test_site.test_startup_imports() if pth file (GH-19060) (GH-19090)
test_site.test_startup_imports() is now skipped if a path of sys.path
contains a .pth file.

Sort test_site imports.
(cherry picked from commit ba26bf3094)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-03-20 07:27:54 -07:00
Miss Islington (bot) 34f85af322
bpo-38576: Disallow control characters in hostnames in http.client (GH-18995)
Add host validation for control characters for more CVE-2019-18348 protection.
(cherry picked from commit 9165addc22)

Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
2020-03-14 12:12:58 -07:00
Mark Dickinson 4dcfe5f2e4
[3.7] bpo-39871: Fix possible SystemError in atan2, copysign and remainder (GH-18806) (GH-18990)
In math_2(), the first PyFloat_AsDouble() call should be checked
for failure before the second call.

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>.
(cherry picked from commit 5208b4b379)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-03-14 11:51:53 +00:00
Miss Islington (bot) 636eecbbbb
bpo-39689: Do not test undefined casts to _Bool (GH-18964) (#18965)
- When casting to _Bool, arrays should only contain zeros or ones.
(cherry picked from commit 1ae9cde4b2)

Co-authored-by: Stefan Krah <skrah@bytereef.org>
2020-03-12 19:55:36 +01:00
Serhiy Storchaka 6f4e7fcfca
[3.7] bpo-38643: Raise SystemError instead of crashing when PyNumber_ToBase is called with invalid base. (GH-18863). (GH-18955)
(cherry picked from commit e5ccc94bbb)
2020-03-12 10:15:17 +02:00
Miss Islington (bot) d0837d2af2
bpo-39520: Fix un-parsing of ext slices with no dimensions (GH-18304)
(cherry picked from commit 185903de12)

Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
2020-03-11 13:16:36 -07:00
Dong-hee Na 633957d7e3
[3.7] bpo-39828: Fix json.tool to catch BrokenPipeError (GH-18779). (GH-18895)
(cherry picked from commit 700cb58730)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>

Automerge-Triggered-By: @vstinner
2020-03-10 01:30:49 -07:00
Pablo Galindo 2235e04170
[3.7] bpo-39850: Add support for abstract sockets in multiprocessing (GH-18866) (GH-18877)
(cherry picked from commit 6012f30bef)
2020-03-09 14:47:50 +00:00
Miss Islington (bot) cca0b31fb8
bpo-38894: Fix pathlib.Path.glob in the presence of symlinks and insufficient permissions (GH-18815)
Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
(cherry picked from commit eb7560a73d)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-03-07 10:10:10 -08:00
Miss Islington (bot) 65b0310901
[3.8] bpo-39889: Fix unparse.py for subscript. (GH-18824). (GH-18826)
(cherry picked from commit c4928fc1a8)
(cherry picked from commit 92b72788ec)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-03-07 09:13:31 -08:00
Miss Islington (bot) 12c45efe82
[3.7] bpo-39389: gzip: fix compression level metadata (GH-18077) (GH-18101)
* bpo-39389: gzip: fix compression level metadata (GH-18077)

As described in RFC 1952, section 2.3.1, the XFL (eXtra FLags) byte of a
gzip member header should indicate whether the DEFLATE algorithm was
tuned for speed or compression ratio. Prior to this patch, archives
emitted by the `gzip` module always indicated maximum compression.
(cherry picked from commit eab3b3f1c6)

Co-authored-by: William Chargin <wchargin@gmail.com>
2020-03-04 02:06:19 -05:00
Ryan Rowe 3eff46fc7d
bpo-37953: Fix ForwardRef hash and equality checks (GH-15400) (GH-18751)
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 e082e7c)

Co-authored-by: plokmijnuhby <39633434+plokmijnuhby@users.noreply.github.com>
2020-03-03 17:29:40 -05:00
Miss Islington (bot) 69ded3944c
bpo-39778: Don't traverse weak-reference lists OrderedDict's tp_traverse and tp_clear (GH-18749)
Objects do not own weak references to them directly through the __weakref__ list so these
do not need to be traversed by the GC.
(cherry picked from commit 0c2b509f9d)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-03-02 15:53:03 -08:00
Miss Islington (bot) f4d709f4a3
bpo-38971: Open file in codecs.open() closes if exception raised. (GH-17666)
Open issue in the BPO indicated a desire to make the implementation of
codecs.open() at parity with io.open(), which implements a try/except to
assure file stream gets closed before an exception is raised.
(cherry picked from commit 2565edec2c)

Co-authored-by: Chris A <christopher.aporta@gmail.com>
2020-03-02 00:02:16 -08:00
Gregory P. Smith 7c64726ced
[3.7] bpo-39769: Fix compileall ddir for subpkgs. (GH-18676) (GH-18718) (GH-18725)
Fix compileall.compile_dir() ddir= behavior on sub-packages.

Fixes compileall.compile_dir's ddir parameter and compileall command
line flag `-d` to no longer write the wrong pathname to the generated
pyc file for submodules beneath the root of the directory tree being
compiled.  This fixes a regression introduced with Python 3.5.

Tests backported from GH 02673352b5, the
implementation is different due to intervening code changes.  But still
quiet simple.

Why was the bug ever introduced?  The refactoring to add parallel
execution kept the ddir -> dfile computations but discarded the results
instead of sending them to compile_file().  This fixes that.  Lack of tests
meant this went unnoticed..
(cherry picked from commit ce720d3e06)

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
2020-03-01 11:06:54 -08:00
Stefan Krah c4ca1f8f24
[3.7] bpo-39794: Add --without-decimal-contextvar (GH-18702)
* bpo-39794: Add --without-decimal-contextvar (#18702)

(cherry picked from commit 815280eb16)
2020-02-29 23:10:26 +01:00
Miss Islington (bot) 55be9a6c09
bpo-30566: Fix IndexError when using punycode codec (GH-18632)
Trying to decode an invalid string with the punycode codec
shoud raise UnicodeError.

(cherry picked from commit ba22e8f174)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2020-02-25 06:43:46 +03:00
Miss Islington (bot) e349e83826
Give proper credit for figuring out and writing PEP-3118 tests. (GH-18644) (#18645)
(cherry picked from commit b942ba03b8)

Authored-by: Stefan Krah <skrah@bytereef.org>
2020-02-24 12:44:40 +01:00
Miss Islington (bot) 43a0137c87
bpo-39382: Avoid dangling object use in abstract_issubclass() (GH-18530)
Hold reference of __bases__ tuple until tuple item is done with, because by
dropping the reference the item may be destroyed.
(cherry picked from commit 1c56f8ffad)

Co-authored-by: Yonatan Goldschmidt <yon.goldschmidt@gmail.com>
2020-02-22 05:32:36 -08:00
Miss Islington (bot) c6f95543b4
bpo-39576: Prevent memory error for overly optimistic precisions (GH-18581) (#18585)
(cherry picked from commit 90930e6545)

Authored-by: Stefan Krah <skrah@bytereef.org>
2020-02-21 02:15:41 +01:00
Miss Islington (bot) 3c57ca6999
[3.8] bpo-39453: Fix contains method of list to hold strong references (GH-18204)
(cherry picked from commit f64abd1056)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2020-02-17 01:30:44 -08:00
Senthil Kumaran 505b6015a1
Revert "bpo-27657: Fix urlparse() with numeric paths (GH-661)" (#18526)
This reverts commit 82b5f6b16e.

The change broke the backwards compatibility of parsing behavior in a
patch release of Python (3.7.6). A decision was taken to revert this
patch in 3.7.7.

In https://bugs.python.org/issue27657 it was decided that the previous
behavior like

>>> urlparse('localhost:8080')
ParseResult(scheme='', netloc='', path='localhost:8080', params='', query='', fragment='')

>>> urlparse('undefined:8080')
ParseResult(scheme='', netloc='', path='undefined:8080', params='', query='', fragment='')

needs to be preserved in patch releases as number of users rely upon it.

Explicitly mention the releases involved with the revert in NEWS.
Adopt the wording suggested by @ned-deily.
2020-02-16 13:07:25 -08:00
Nathaniel J. Smith f464edf323
bpo-39606: allow closing async generators that are already closed (GH-18475) (GH-18502)
The fix for [bpo-39386](https://bugs.python.org/issue39386) attempted to make it so you couldn't reuse a
agen.aclose() coroutine object. It accidentally also prevented you
from calling aclose() at all on an async generator that was already
closed or exhausted. This commit fixes it so we're only blocking the
actually illegal cases, while allowing the legal cases.

The new tests failed before this patch. Also confirmed that this fixes
the test failures we were seeing in Trio with Python dev builds:
  https://github.com/python-trio/trio/pull/1396

https://bugs.python.org/issue39606
(cherry picked from commit 925dc7fb1d)
2020-02-13 01:33:35 -08:00
Miss Islington (bot) 705d271d55
bpo-39274: Ensure Fraction.__bool__() returns a bool (GH-18017)
Some numerator types used (specifically NumPy) decides to not
return a Python boolean for the "a != b" operation. Using the equivalent
call to bool() guarantees a bool return also for such types.
(cherry picked from commit 427c84f13f)

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
2020-02-06 07:14:37 -08:00
Miss Islington (bot) 97d2a98324
closes bpo-39510: Fix use-after-free in BufferedReader.readinto() (GH-18295)
When called on a closed object, readinto() segfaults on account
of a write to a freed buffer:

    ==220553== Process terminating with default action of signal 11 (SIGSEGV): dumping core
    ==220553==  Access not within mapped region at address 0x2A
    ==220553==    at 0x48408A0: memmove (vg_replace_strmem.c:1272)
    ==220553==    by 0x58DB0C: _buffered_readinto_generic (bufferedio.c:972)
    ==220553==    by 0x58DCBA: _io__Buffered_readinto_impl (bufferedio.c:1053)
    ==220553==    by 0x58DCBA: _io__Buffered_readinto (bufferedio.c.h:253)

Reproducer:

    reader = open ("/dev/zero", "rb")
    _void  = reader.read (42)
    reader.close ()
    reader.readinto (bytearray (42)) GH-GH-GH- BANG!

The problem exists since 2012 when commit dc469454ec added code
to free the read buffer on close().

Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
(cherry picked from commit cb1c0746f2)

Co-authored-by: Philipp Gesang <phg@phi-gamma.net>
2020-02-04 13:43:07 -08:00
Miss Islington (bot) fda6593f92
Fixes in sorting descriptions (GH-18317)
Improvements in listsort.txt and a comment in sortperf.py.

Automerge-Triggered-By: @csabella
(cherry picked from commit 24e5ad4689)

Co-authored-by: Stefan Pochmann <stefan.pochmann@gmail.com>
2020-02-03 16:30:44 -08:00
Alex Rebert 61b3484cdf [3.7] bpo-35182: fix communicate() crash after child closes its pipes (GH-18117) (GH-18151)
When communicate() is called in a loop, it crashes when the child process
has already closed any piped standard stream, but still continues to be running

Co-authored-by: Andriy Maletsky <andriy.maletsky@gmail.com>.
(cherry picked from commit d3ae95e1e9)

Co-authored-by: Alex Rebert <alex@forallsecure.com>





https://bugs.python.org/issue35182



Automerge-Triggered-By: @gpshead
2020-01-23 15:32:31 -08:00
Miss Islington (bot) 958064f8d2
bpo-39421: Fix posible crash in heapq with custom comparison operators (GH-18118)
* bpo-39421: Fix posible crash in heapq with custom comparison operators

* fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators

* fixup! fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators
(cherry picked from commit 79f89e6e5a)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-01-23 06:25:31 -08:00
Miss Islington (bot) b76d5e9ee6
bpo-39386: Prevent double awaiting of async iterator (GH-18081)
(cherry picked from commit a96e06db77)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2020-01-20 15:07:54 -08:00
Miss Islington (bot) 4be9726035
bpo-38293: Allow shallow and deep copying of property objects (GH-16438)
Copying property objects results in a TypeError. Steps to reproduce:

```
>>> import copy
>>> obj = property()
>>> copy.copy(obj)
````

This affects both shallow and deep copying.
My idea for a fix is to add property objects to the list of "atomic" objects in the copy module.
These already include types like functions and type objects.

I also added property objects to the unit tests test_copy_atomic and test_deepcopy_atomic. This is my first PR, and it's highly likely I've made some mistake, so please be kind :)

https://bugs.python.org/issue38293
(cherry picked from commit 9f3fc6c5b4)

Co-authored-by: Guðni Natan Gunnarsson <1493259+GudniNatan@users.noreply.github.com>
2020-01-12 10:00:27 -08:00
Miss Islington (bot) a993658f94
[3.7] Add test cases for dataclasses. (GH-17909) (GH-17920)
* Add test cases for dataclasses.

* Add test for repr output of field.
* Add test for ValueError to be raised when both default and default_factory are passed.
(cherry picked from commit eef1b027ab)


Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>

Automerge-Triggered-By: @ericvsmith
2020-01-10 04:12:30 -08:00
Miss Islington (bot) 00ac28ac4d
bpo-39242: Updated the Gmane domain into news.gmane.io (GH-17903)
(cherry picked from commit 2e6a8efa83)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2020-01-08 07:47:25 -08:00
Miss Islington (bot) 43fbc70360
bpo-39056: Fix handling invalid warning category in the -W option. (GH-17618)
No longer import the re module if it is not needed.
(cherry picked from commit 41ec17e45d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-01-05 04:34:58 -08:00
Miss Islington (bot) 3bdb2d9daf
bpo-39055: Reject a trailing \n in base64.b64decode() with validate=True. (GH-17616)
(cherry picked from commit b19c0d77e6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-01-05 04:32:45 -08:00
Miss Islington (bot) 880a17af7d
bpo-39057: Fix urllib.request.proxy_bypass_environment(). (GH-17619)
Ignore leading dots and no longer ignore a trailing newline.
(cherry picked from commit 6a265f0d0c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-01-05 04:31:44 -08:00
Miss Islington (bot) 0e0e4acaab bpo-39142: Avoid converting namedtuple instances to ConvertingTuple. (GH-17773) (GH-17786)
(cherry picked from commit 46abfc1416)
2020-01-01 20:07:31 +00:00
Dong-hee Na 53f11ba7b1 [3.7] bpo-38588: Fix possible crashes in dict and list when calling P… (GH-17765)
* [3.7] bpo-38588: Fix possible crashes in dict and list when calling PyObject_RichCompareBool (GH-17734)

Take strong references before calling PyObject_RichCompareBool to protect against the case
where the object dies during the call..
(cherry picked from commit 2d5bf568ea)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>

* methane's suggestion

methane's suggestion

Co-Authored-By: Inada Naoki <songofacandy@gmail.com>

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2019-12-31 04:15:10 +00:00
Pablo Galindo 296d45ec10
[3.7] bpo-38610: Fix possible crashes in several list methods (GH-17022) (GH-17759)
Hold strong references to list elements while calling PyObject_RichCompareBool()..
(cherry picked from commit d9e561d23d)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-12-30 19:58:31 +00:00
Bar Harel 59d06b987d [3.7] bpo-38878: Fix os.PathLike __subclasshook__ (GH-17336) (GH-17685)
https://bugs.python.org/issue38878
2019-12-23 18:31:15 +00:00
Miss Islington (bot) b8bbdf049b
bpo-38546: Fix concurrent.futures test_ressources_gced_in_workers() (GH-17652) (GH-17655)
Fix test_ressources_gced_in_workers() of test_concurrent_futures:
explicitly stop the manager to prevent leaking a child process
running in the background after the test completes.

(cherry picked from commit 673c39331f)
(cherry picked from commit b0eb046cbd)

Co-authored-by: Victor Stinner <vstinner@python.org>
2019-12-18 12:51:09 -08:00
Miss Islington (bot) 3dbfe0ac93
bpo-38295: prevent test_relative_path of test_py_compile failure on macOS Catalina (GH-17636)
(cherry picked from commit bf3aa1060a)

Co-authored-by: Ned Deily <nad@python.org>
2019-12-17 01:23:55 -08:00
Miss Islington (bot) c70c8ca746 Fix warnings in test_asyncio.test_base_events (GH-17577) (GH-17580)
Co-authored-by: tirkarthi
(cherry picked from commit 1988344a6b)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2019-12-16 23:12:28 -05:00
Pablo Galindo 4b75466f5a
[3.7] Fix elif start column offset when there is an else following (GH-17596) (GH-17601)
(cherry picked from commit 5936a4ce91)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2019-12-14 10:55:00 +00:00
Miss Islington (bot) d3212036aa bpo-36406: Handle namespace packages in doctest (GH-12520) (GH-17592)
(cherry picked from commit 8289e27393)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-12-13 15:30:04 -08:00
Pablo Galindo 0ed45d0cbf
[3.7] bpo-39031: Include elif keyword when producing lineno/col-offset info for if_stmt (GH-17582) (#17584)
When parsing an "elif" node, lineno and col_offset of the node now point to the "elif" keyword and not to its condition, making it consistent with the "if" node.

https://bugs.python.org/issue39031

Automerge-Triggered-By: @pablogsal.
(cherry picked from commit 025a602af7)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2019-12-13 14:04:14 +00:00
Ned Deily 95157c6a28
bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR (GH-17311) (GH-17570)
(cherry picked from commit ab513a38c9)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2019-12-10 23:49:23 -05:00
Miss Islington (bot) 66d7a5d58a bpo-34776: Fix dataclasses to support __future__ "annotations" mode (GH-9518) (#17532)
(cherry picked from commit d219cc4180)

Co-authored-by: Yury Selivanov <yury@magic.io>
2019-12-09 17:07:54 +01:00
Miss Islington (bot) b9f4b49c6e
bpo-38547: Fix test_pty if the process is the session leader (GH-17519)
Fix test_pty: if the process is the session leader, closing the
master file descriptor raises a SIGHUP signal: simply ignore SIGHUP
when running the tests.
(cherry picked from commit a1838ec259)

Co-authored-by: Victor Stinner <vstinner@python.org>
2019-12-09 03:15:07 -08:00
Miss Islington (bot) 9baa870c27
bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)
now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None.

https://bugs.python.org/issue38979

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

Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
2019-12-08 03:53:07 -08:00