Commit Graph

11762 Commits

Author SHA1 Message Date
Łukasz Langa c26a666e67
[3.9] bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (GH-21956) (#22397)
Closes bpo issue 41602.
(cherry picked from commit a68a2ad19c)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2020-10-04 18:40:36 +02:00
Miss Islington (bot) bd55c46895
bpo-41815: SQLite: segfault if backup called on closed database (GH-22322)
GH- [bpo-41815](): SQLite: fix segfault if backup called on closed database

Attempting to backup a closed database will trigger segfault:

```python
import sqlite3
target = sqlite3.connect(':memory:')
source = sqlite3.connect(':memory:')
source.close()
source.backup(target)
```
(cherry picked from commit bfee9fad84)

Co-authored-by: Peter McCormick <peter@pdmccormick.com>
2020-10-04 18:36:45 +02:00
Miss Skeleton (bot) faaa303922
[3.9] bpo-41867: List options for timespec in docstrings of isoformat methods (GH-22418)
(cherry picked from commit 52301312bb)

Co-authored-by: Ram Rachum <ram@rachum.com>
2020-10-04 17:30:49 +02:00
Miss Islington (bot) f76a3889d1
bpo-41662: Fix bugs in binding parameters in sqlite3 (GH-21998)
* When the parameters argument is a list, correctly handle the case
  of changing it during iteration.
* When the parameters argument is a custom sequence, no longer
  override an exception raised in ``__len__()``.
(cherry picked from commit 0b419b7910)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-09-17 00:57:07 -07:00
Miss Islington (bot) 6a39888c2c
bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128)
I just realized that my recent PR with sendfile on Solaris ([PR 22040](https://github.com/python/cpython/pull/22040)) has broken error handling.

Sorry for that, this simple followup fixes that.

Automerge-Triggered-By: @1st1
(cherry picked from commit fa8c9e7010)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2020-09-16 05:25:09 -07:00
Łukasz Langa 7e356f17e4
[3.9] bpo-41687: Fix sendfile implementation to work with Solaris (GH-22040) (GH-22273)
(cherry picked from commit 8c0be6fd91)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2020-09-16 13:52:26 +02:00
Miss Islington (bot) 242eac1f04
On path with known exact float, extract the double with the fast macro. (GH-21072)
(cherry picked from commit 930f4518ae)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2020-09-04 16:12:48 -07:00
Miss Islington (bot) e3cafebb5c
bpo-41568: Fix refleaks in zoneinfo subclasses (GH-21907)
* Fix refleak in C module __init_subclass__

This was leaking a reference to the weak cache dictionary for every
ZoneInfo subclass created.

* Fix refleak in ZoneInfo subclass's clear_cache

The previous version of the code accidentally cleared the global
ZONEINFO_STRONG_CACHE variable (and inducing `ZoneInfo` to create a new
strong cache) on calls to a subclass's `clear_cache()`. This would not
affect guaranteed behavior, but it's still not the right thing to do
(and it caused reference leaks).
(cherry picked from commit c3dd7e45cc)

Co-authored-by: Paul Ganssle <paul@ganssle.io>
2020-08-17 16:24:15 -07:00
Miss Islington (bot) 1864eacc22
bpo-40878: xlc cannot handle C99 extern inline. (GH-21891)
This applies to the default "extc99" mode.  Python does not compile with "stdc99".

(cherry picked from commit 40e700ad04)

Authored-by: Stefan Krah <skrah@bytereef.org>
2020-08-15 20:37:08 +02:00
Miss Islington (bot) fc8ffe27b6
bpo-31122: ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer closes connection during TLS negotiation (GH-18772)
[bpo-31122](): ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer closes connection during TLS negotiation

Reproducer: http://tiny.cc/f4ztnz (tiny url because some bot keeps renaming b.p.o.-nnn as bpo links)
(cherry picked from commit 495bd03566)

Co-authored-by: Dima Tisnek <dimaqq@gmail.com>
2020-08-15 10:44:57 -07:00
Miss Islington (bot) 33d3c64095
bpo-41025: Fix subclassing for zoneinfo.ZoneInfo (GH-20965) (GH-21876)
Prior to this change, attempting to subclass the C implementation of
zoneinfo.ZoneInfo gave the following error:

    TypeError: unbound method ZoneInfo.__init_subclass__() needs an argument

https://bugs.python.org/issue41025
(cherry picked from commit 87d8287865)

Co-authored-by: Paul Ganssle <paul@ganssle.io>
2020-08-14 11:18:24 -04:00
Miss Islington (bot) add7cfc4c6
bpo-41336: Fix the error handling in zoneinfo_new_instance() (GH-21546)
Do not call PyObject_CallMethod() with a live exception (like
KeyboardInterrupt).
(cherry picked from commit eca2549f5a)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-07-20 06:10:11 -07:00
Miss Islington (bot) 4a02da4f95
bpo-40150: Fix mismatched argument in RegisterWaitForSingleObject() call (GH-19686)
(cherry picked from commit af4eda46d1)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-07-15 12:25:59 -07:00
Miss Islington (bot) 9080e1e3f4
Fix -Wstring-prototypes warnings in _zoneinfo.c. (GH-21478)
(cherry picked from commit 0108b2a240)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-07-15 10:23:43 -07:00
Miss Islington (bot) 8ca63f95f7
bpo-41302: Fix build with system libmpdec (GH-21481)
Move definition of UNUSED from modified headers of libmpdec to
_decimal.c itself. This makes the vendored source closer to the
standalone library and fixes build with --with-system-libmpdec.

Tested to build fine with either system libmpdec or the vendored one.
(cherry picked from commit 015efdbef7)

Co-authored-by: Felix Yan <felixonmars@archlinux.org>
2020-07-15 06:01:10 -07:00
Miss Islington (bot) 57c984fab6
bpo-41288: Fix a crash in unpickling invalid NEWOBJ_EX. (GH-21458)
Automerge-Triggered-By: @tiran
(cherry picked from commit 4f309abf55)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-07-13 06:09:27 -07:00
Miss Islington (bot) 90584c02b4
bpo-41252: Fix incorrect refcounting in _ssl.c's _servername_callback() (GH-21407)
(cherry picked from commit ee96f32ca2)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-07-09 03:18:30 -07:00
Miss Islington (bot) fbd71f6684
bpo-41247: asyncio.set_running_loop() cache running loop holder (GH-21401)
The running loop holder cache variable was always set to NULL when
calling set_running_loop.

Now set_running_loop saves the newly created running loop holder in the
cache variable for faster access in get_running_loop.

Automerge-Triggered-By: @1st1
(cherry picked from commit 529f42645d)

Co-authored-by: Tony Solomonik <tony.solomonik@gmail.com>
2020-07-08 12:47:20 -07:00
Miss Islington (bot) 1d1c574340
closes bpo-41235: Fix the error handling in SSLContext.load_dh_params() (GH-21385)
(cherry picked from commit aebc049557)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-07-07 21:40:18 -07:00
Miss Islington (bot) 4981fe36c7
bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297)
Also enables using debug build of `python3_d.dll`
Reference: CVE-2020-15523
(cherry picked from commit dcbaa1b49c)

Co-authored-by: Steve Dower <steve.dower@python.org>
2020-07-06 09:52:13 -07:00
Miss Islington (bot) 9c38408708
Uncomment Py_DEPRECATED for Py_UNICODE APIs (GH-21318)
PyUnicode_EncodeDecimal and PyUnicode_TransformDecimalToASCII
are deprecated since Python 3.3.
But Py_DEPRECATED(3.3) was commented out.
(cherry picked from commit 13c90e82b6)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2020-07-04 19:19:40 -07:00
Miss Islington (bot) bfec674254
bpo-39960: Allow heap types in the "Carlo Verre" hack check that override "tp_setattro()" (GH-21092)
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 148f329135)

Co-authored-by: scoder <stefan_ml@behnel.de>
2020-07-02 17:28:41 -07:00
Miss Islington (bot) df59293bf0
bpo-40967: Remove deprecated asyncio.Task.current_task() and asyncio.Task.all_tasks() (GH-20874)
(cherry picked from commit 004e64e805)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
2020-07-01 21:06:51 -07:00
Miss Islington (bot) 119de0eba8
bpo-40874 Update the required libmpdec version for the decimal module (GH-21202)
(cherry picked from commit 8bea91b5e9)

Authored-by: Stefan Krah <skrah@bytereef.org>
2020-06-28 22:24:58 +02:00
Guido van Rossum 2a1ee1d970
[3.9] bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags (#21022) 2020-06-27 17:34:30 -07:00
Miss Islington (bot) 9191eacf9e
Remove dead code from tracemalloc (GH-21029)
tracemalloc_get_frame() checked filename == NULL two times in a row.

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

Co-authored-by: Christian Heimes <christian@python.org>
2020-06-27 08:39:57 -07:00
Serhiy Storchaka f925407a19
[3.9] bpo-41069: Make TESTFN and the CWD for tests containing non-ascii characters. (GH-21035). (GH-21156)
(cherry picked from commit 700cfa8c90)
2020-06-25 20:39:12 +03:00
Miss Islington (bot) 29aa8085e9
bpo-41094: Additional fix for PYTHONSTARTUP. (GH-21119)
(cherry picked from commit a7dc714701)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-24 10:15:59 -07:00
Miss Islington (bot) 7329c8c7a2
bpo-41094: Fix decoding errors with audit when open files. (GH-21095)
(cherry picked from commit 6c6810d989)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-24 09:45:27 -07:00
Paul Ganssle 6c56356109
[3.9] bpo-41056: Fix a possible MemoryError leak within zoneinfo. (GH-21007)
This was detected by our Coverity scan as a REVERSE_INULL issue.

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

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2020-06-24 11:58:50 -04:00
Anthony Sottile 48fc35ada7
[3.9] bpo-31938: Fix default-value signatures of several functions in the select module (GH-21066) (GH-21097)
(cherry picked from commit d051801052)

Automerge-Triggered-By: @vstinner
2020-06-23 15:19:46 -07:00
Miss Islington (bot) 92f8b480ba
bpo-41085: Fix array.array.index() on 64-bit Windows (GH-21071)
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
for index larger than ``2**31``.
(cherry picked from commit 1d3dad5f96)

Co-authored-by: WildCard65 <WildCard65@users.noreply.github.com>
2020-06-23 06:41:24 -07:00
Miss Islington (bot) 5606d555b6
bpo-26407: Do not mask errors in csv. (GH-20536)
Unexpected errors in calling the __iter__ method are no longer
masked by TypeError in csv.reader(), csv.writer.writerow() and
csv.writer.writerows().
(cherry picked from commit c88239f864)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-22 01:40:54 -07:00
Miss Islington (bot) f19ed6b0c7
bpo-41061: Fix incorrect expressions in hashtable (GH-21028)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 4901ea9526)

Co-authored-by: Christian Heimes <christian@python.org>
2020-06-22 01:01:48 -07:00
Miss Islington (bot) fbf94af2af
bpo-41056: Fix a NULL pointer dereference on MemoryError within the ssl module. (GH-21009)
Detected by Coverity.
(cherry picked from commit eb0d5c38de)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2020-06-21 12:11:41 -07:00
Dong-hee Na 814b07bf81
[3.9] bpo-41052: Opt out serialization/deserialization for _random.Random (GH-21002). (GH-21030)
(cherry picked from commit 6989af0bc7)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2020-06-21 19:33:06 +09:00
Inada Naoki 610a60c601
bpo-36346: Add Py_DEPRECATED to deprecated unicode APIs (GH-20878)
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit 2c4928d37e)
2020-06-18 17:30:53 +09:00
Miss Islington (bot) b498c7f1b3
bpo-36020: Remove snprintf macro in pyerrors.h (GH-20889)
On Windows, GH-include "pyerrors.h" no longer defines "snprintf" and
"vsnprintf" macros.

PyOS_snprintf() and PyOS_vsnprintf() should be used to get portable
behavior.

Replace snprintf() calls with PyOS_snprintf() and replace vsnprintf()
calls with PyOS_vsnprintf().
(cherry picked from commit e822e37946)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-06-15 13:20:10 -07:00
Miss Islington (bot) ee3f7fee94
bpo-40955: Fix memory leak in subprocess module (GH-20825)
```
Direct leak of 8 byte(s) in 1 object(s) allocated from:
    GH-0 0x7f008bf19667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
    GH-1 0x7f007a0bee4a in subprocess_fork_exec /home/heimes/dev/python/cpython/Modules/_posixsubprocess.c:774
    GH-2 0xe0305b in cfunction_call Objects/methodobject.c:546
```

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

Co-authored-by: Christian Heimes <christian@python.org>
2020-06-12 10:02:45 -07:00
Victor Stinner dc40105c88
bpo-40947: getpath.c uses PyConfig.platlibdir (GH-20807) (GH-20813)
Followup of bpo-40854, there is one remaining usage of PLATLIBDIR
which should be replaced by config->platlibdir.

test_sys checks that sys.platlibdir attribute exists and is a string.

Update Makefile: getpath.c and sysmodule.c no longer need PLATLIBDIR
macro, PyConfig.platlibdir member is used instead.

Co-authored-by: Sandro Mani <manisandro@gmail.com>
(cherry picked from commit d72b9644a3)
2020-06-11 18:27:00 +02:00
Miss Islington (bot) 3dc4428a37
Add multicore support to deccheck.py. (GH-20731)
(cherry picked from commit 951d680d56)

Authored-by: Stefan Krah <skrah@bytereef.org>
2020-06-08 19:55:13 +02:00
Victor Stinner 817506432d
bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var (GH-20605) (GH-20725)
(cherry picked from commit 8f023a2f66)

Co-authored-by: Sandro Mani <manisandro@gmail.com>
2020-06-08 19:36:13 +02:00
Miss Islington (bot) 1d711f2e31
bpo-40724: Fix return type of test helper function heapctypewithbuffer_releasebuffer() (GH-20685) (GH-20690)
(cherry picked from commit b8867e5d5a)
Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
2020-06-07 09:28:03 +02:00
Miss Islington (bot) 1e4fa91104
bpo-40724: Support setting buffer slots from type specs (GH-20648) (GH-20683)
This is not part of the limited API but makes the buffer slots available for type specs.
(cherry picked from commit f7c4e23642)
2020-06-07 09:06:40 +02:00
Miss Islington (bot) 18f1226884
Refactor scripts in Tools/peg_generator/scripts (GH-20401)
(cherry picked from commit ba6fd87e41)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-06-05 21:41:12 -07:00
Miss Islington (bot) 83bff88b4b
bpo-40874: Update to libmpdec-2.5.0 (GH-20652)
(cherry picked from commit 087d612efe)

Authored-by: Stefan Krah <skrah@bytereef.org>
2020-06-05 21:41:17 +02:00
Miss Islington (bot) e4e5ec18e2
bpo-40865: Remove unused insint() macro from hash modules (GH-20627)
Automerge-Triggered-By: @tiran
(cherry picked from commit 6ed578f6db)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2020-06-04 13:27:23 -07:00
Victor Stinner 6d62dc1ea4
[3.9] bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578) (GH-20618)
* bpo-40826: Add _Py_EnsureTstateNotNULL() macro (GH-20571)

Add _Py_EnsureTstateNotNULL(tstate) macro: call Py_FatalError() if
tstate is NULL, the error message contains the current function name.

(cherry picked from commit 3026cad59b)

* bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578)

PyOS_InterruptOccurred() now fails with a fatal error if it is called
with the GIL released.

(cherry picked from commit cbe1296922)
2020-06-03 20:16:39 +02:00
Victor Stinner 5d2396c8cf
[3.9] bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20613)
* bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20579)

Fix GIL usage in PyOS_Readline(): lock the GIL to set an exception.

Pass tstate to my_fgets() and _PyOS_WindowsConsoleReadline(). Cleanup
these functions.

(cherry picked from commit c353764fd5)

* bpo-40826: Add _PyOS_InterruptOccurred(tstate) function (GH-20599)

my_fgets() now calls _PyOS_InterruptOccurred(tstate) to check for
pending signals, rather calling PyOS_InterruptOccurred().

my_fgets() is called with the GIL released, whereas
PyOS_InterruptOccurred() must be called with the GIL held.

test_repl: use text=True and avoid SuppressCrashReport in
test_multiline_string_parsing().

Fix my_fgets() on Windows: fgets(fp) does crash if fileno(fp) is closed.

(cherry picked from commit fa7ab6aa0f)
2020-06-03 17:49:25 +02:00
Huon Wilson 3c7609a23c
[3.9] bpo-40630: Add tracemalloc.reset_peak (GH-20102) (GH-20545)
* bpo-40630: Add tracemalloc.reset_peak (GH-20102, cherrypick 8b62644)

The reset_peak function sets the peak memory size to the current size,
representing a resetting of that metric. This allows for recording the
peak of specific sections of code, ignoring other code that may have
had a higher peak (since the most recent `tracemalloc.start()` or
tracemalloc.clear_traces()` call).

* Adjust docs to point to 3.9
2020-06-01 19:26:22 +02:00