Commit graph

11835 commits

Author SHA1 Message Date
Łukasz Langa
168879e366
[3.9] Update URLs in comments and metadata to use HTTPS (GH-27458) (GH-27480)
(cherry picked from commit be42c06bb0)

Co-authored-by: Noah Kantrowitz <noah@coderanger.net>
2021-07-30 16:34:04 +02:00
Erlend Egeberg Aasland
0bc17658f5
[3.9] bpo-31746: Prevent segfaults when sqlite3.Connection is uninitialised (GH-27431) (GH-27465)
(cherry picked from commit 7e311e496b)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2021-07-29 22:12:55 +01:00
Miss Islington (bot)
899e37b202
bpo-40263: Fixes an off-by-one error in _winapi_WaitForMultipleObjects_impl (GH-19501)
(cherry picked from commit 92b5dc780d)

Co-authored-by: Ray Donnelly <mingw.android@gmail.com>
2021-07-28 22:52:11 +01:00
Miss Islington (bot)
94adfe6e2c
bpo-44608: Fix memory leak in _tkinter._flatten() (GH-27107)
if it is called with a sequence or set, but not list or tuple.
(cherry picked from commit f572cbf1fa)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-07-13 22:44:08 -07:00
Miss Islington (bot)
fe73509c5b
bpo-44630: Fix assertion errors in csv module (GH-27127)
Fix incorrect handling of exceptions when interpreting dialect objects in
the csv module. Not clearing exceptions between calls to
PyObject_GetAttrString() causes assertion failures in pydebug mode (or with
assertions enabled).

Add a minimal test that would've caught this (passing None as dialect, or
any object that isn't a csv.Dialect subclass, which the csv module allows
and caters to, even though it is not documented.) In pydebug mode, the test
triggers the assertion failure in the old code.

Contributed-By: T. Wouters [Google]
(cherry picked from commit 0093876328)

Co-authored-by: T. Wouters <thomas@python.org>
2021-07-13 16:20:28 -07:00
Dong-hee Na
9761abf306
[3.9] bpo-44558: Match countOf is/== treatment to c (GH-27007). (GH-27055) 2021-07-07 23:55:22 +09:00
Miss Islington (bot)
324b93295f
bpo-44563: Fix error handling in tee.fromiterable() (GH-27020) (GH-27042)
In debug build failed tee.fromiterable() corrupted the linked list of all GC objects.
(cherry picked from commit f64de53ff0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-07-05 23:34:01 +01:00
Miss Islington (bot)
a65df3f9fc
bpo-41621: Document defaultdict's default_factory parameter (GH-21945)
It defaults to None and is positional only.
(cherry picked from commit d1ae57027f)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2021-06-22 07:42:41 -07:00
Victor Stinner
83ad40efc3
bpo-44434: Don't call PyThread_exit_thread() explicitly (GH-26758) (GH-26825)
_thread.start_new_thread() no longer calls PyThread_exit_thread()
explicitly at the thread exit, the call was redundant.

On Linux with the glibc, pthread_cancel() loads dynamically the
libgcc_s.so.1 library. dlopen() can fail if there is no more
available file descriptor to open the file. In this case, the process
aborts with the error message:

"libgcc_s.so.1 must be installed for pthread_cancel to work"

pthread_cancel() unwinds back to the thread's wrapping function that
calls the thread entry point.

The unwind function is dynamically loaded from the libgcc_s library
since it is tightly coupled to the C compiler (GCC). The unwinder
depends on DWARF, the compiler generates DWARF, so the unwinder
belongs to the compiler.

Thanks Florian Weimer and Carlos O'Donell for their help on
investigating this issue.

(cherry picked from commit 45a78f906d)
2021-06-21 14:22:56 +02:00
Miss Islington (bot)
865269458f
bpo-44363: Get test_capi passing with address sanitizer (GH-26639)
(cherry picked from commit 31aa0dbff4)

Co-authored-by: Mark Shannon <mark@hotpy.org>
2021-06-10 05:01:22 -07:00
Miss Islington (bot)
85b587a38d
bpo-44285: getpath.c: Assert that env_file is NULL during an error check (GH-26486) (GH-26496)
This was flagged by a static analyzer, but the logic of why this is NULL on error is hard to follow for humans as well.
(cherry picked from commit bdb56902a3)

Co-authored-by: stratakis <cstratak@redhat.com>
2021-06-03 01:50:55 +02:00
Miss Islington (bot)
46b16d0bdb
bpo-44263: Fix _decimal and _testcapi GC protocol (GH-26464)
* _testcapi.heapgctype: implement a traverse function since the type
  is defined with Py_TPFLAGS_HAVE_GC.
* _decimal: PyDecSignalDictMixin_Type is no longer defined with
  Py_TPFLAGS_HAVE_GC since it has no traverse function.
(cherry picked from commit 142e5c5445)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-05-31 04:33:31 -07:00
Miss Islington (bot)
021169f768
Fix compiler warning for misleading guarding in the tkinter (GH-26244) (GH-26252)
The newest gcc emmits this warning:

```
/Modules/_tkinter.c:272:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  272 |         if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
      |         ^~
/Modules/_tkinter.c:2869:5: note: in expansion of macro ‘LEAVE_PYTHON’
 2869 |     LEAVE_PYTHON
      |     ^~~~~~~~~~~~
/Modules/_tkinter.c:243:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  243 |     (*(PyThreadState**)Tcl_GetThreadData(&state_key, sizeof(PyThreadState*)))
      |     ^
/Modules/_tkinter.c:272:57: note: in expansion of macro ‘tcl_tstate’
  272 |         if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
      |                                                         ^~~~~~~~~~
/Modules/_tkinter.c:2869:5: note: in expansion of macro ‘LEAVE_PYTHON’
 2869 |     LEAVE_PYTHON

```

that's because the macro packs together two statements at the same level
as the "if". The warning is misleading but is very noisy so it makes
sense to fix it.
(cherry picked from commit 95d04710c5)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-05-19 19:27:19 +01:00
Miss Islington (bot)
509e1c9d35
Fix compiler warning in the xml module (GH-26245) (GH-26248)
The newest version of gcc complains about passing un-initialized arrays
as constant pointers:

```
/Modules/expat/xmltok_ns.c: In function ‘findEncodingNS’:
/Modules/expat/xmltok.h:272:10: warning: ‘buf’ may be used uninitialized [-Wmaybe-uninitialized]
  272 |   (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Modules/expat/xmltok_ns.c:95:3: note: in expansion of macro ‘XmlUtf8Convert’
   95 |   XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
      |   ^~~~~~~~~~~~~~
/Modules/expat/xmltok.h:272:10: note: by argument 5 of type ‘const char *’ to ‘enum XML_Convert_Result(const ENCODING *, const char **, const char *, char **, const char *)’ {aka ‘enum XML_Convert_Result(const struct encoding *, const char **, const char *, char **, const char *)’}
  272 |   (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Modules/expat/xmltok_ns.c:95:3: note: in expansion of macro ‘XmlUtf8Convert’
   95 |   XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
      |   ^~~~~~~~~~~~~~
In file included from /Modules/expat/xmltok.c:1657:
/Modules/expat/xmltok_ns.c:92:8: note: ‘buf’ declared here
   92 |   char buf[ENCODING_MAX];

```
(cherry picked from commit be93f81e58)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-05-19 19:21:07 +01:00
Miss Islington (bot)
2057ce8749
[3.9] bpo-44145: Release the GIL around HMAC_Update. (GH-26157) (GH-26188)
It was always meant to be released for parallelization.
This now matches the other similar code in the module.

Thanks michaelforney for noticing!
(cherry picked from commit c10392e7dd)


Co-authored-by: Gregory P. Smith <greg@krypto.org>

Automerge-Triggered-By: GH:gpshead
2021-05-17 01:07:49 -07:00
Miss Islington (bot)
ce47addfb6
[3.9] bpo-36515: Disable unaligned memory access in _sha3 on ARM (GH-25927) (GH-25928)
Contributed-By: Matthias Klose

Automerge-Triggered-By: GH:tiran
(cherry picked from commit da5c808fb5)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2021-05-06 08:55:35 +02:00
Petr Viktorin
ec18362f6a
[3.9] bpo-42083: Allow NULL doc in PyStructSequence_NewType (#25896)
(cherry picked from commit 2f5baa1750)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-05-04 16:07:13 +02:00
Erlend Egeberg Aasland
ad73d1657c
bpo-43434: Move sqlite3.connect audit event to sqlite3.Connection.__init__ (GH-25818) 2021-05-02 23:43:06 +01:00
Miss Islington (bot)
cf6a79644c
bpo-32745: Fix a regression in the handling of ctypes' c_wchar_p type (GH-8721) (#25812)
Embedded nulls would cause a ValueError to be raised. Thanks go to Eryk Sun for their analysis.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 73766b0341)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2021-05-02 13:03:10 +02:00
Miss Islington (bot)
0252ce3571
bpo-43472: Ensure PyInterpreterState_New audit events are raised when called through _xxsubinterpreters module (GH-25506) (GH-25508)
(cherry picked from commit 7b86e47617)

Co-authored-by: Steve Dower <steve.dower@python.org>

Co-authored-by: Steve Dower <steve.dower@python.org>
2021-04-28 18:20:40 +02:00
Ma Lin
ba7338a460
Fix thread locks in zlib module may go wrong in rare case (#22130)
Setting `next_in` before acquiring the thread lock may mix up compress/decompress state in other threads.
2021-04-26 21:50:33 +02:00
Christian Heimes
e259a77f21
[3.9] bpo-43920: Make load_verify_locations(cadata) error message consistent (GH-25554) (GH-25555)
Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit b9ad88be03)

Co-authored-by: Christian Heimes <christian@python.org>
2021-04-23 14:23:35 +02:00
Miss Islington (bot)
28575923a9
bpo-38822: Check specifically for a drive, not just a colon (GH-25540)
(cherry picked from commit e07d809889)

Co-authored-by: Steve Dower <steve.dower@python.org>
2021-04-23 00:56:45 +01:00
Miss Islington (bot)
8e7cebb497
bpo-38822: Fixed os.stat failing on inaccessible directories. (GH-25527)
It would just fail if the path was inaccessible and had a trailing slash. It should fall back to the parent directory's metadata.
(cherry picked from commit fe63a401a9)

Co-authored-by: Steve Dower <steve.dower@python.org>
2021-04-22 13:09:56 -07:00
Miss Islington (bot)
d8576b1d15
bpo-26227: Fixes decoding of host names on Windows from ANSI instead of UTF-8 (GH-25510)
(cherry picked from commit dc516ef839)

Co-authored-by: Steve Dower <steve.dower@python.org>
2021-04-21 16:43:40 -07:00
Christian Heimes
cdf0287979
[3.9] bpo-43522: Fix SSLContext.hostname_checks_common_name (GH-24899) (GH-25451)
Fix problem with ssl.SSLContext.hostname_checks_common_name. OpenSSL does not
copy hostflags from *struct SSL_CTX* to *struct SSL*.

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

Co-authored-by: Christian Heimes <christian@python.org>
2021-04-17 11:35:24 +02:00
Miss Islington (bot)
7d9d5bf863
[3.9] bpo-43799: OpenSSL 3.0.0: declare OPENSSL_API_COMPAT 1.1.1 (GH-25329) (GH-25382)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit a4833883c9)


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

Automerge-Triggered-By: GH:tiran
2021-04-12 23:40:52 -07:00
Christian Heimes
299ae9c7a2
[3.9] bpo-43788: Generate version specific _ssl_data.h (GH-25300) (GH-25310)
(cherry picked from commit 150af75432)

Co-authored-by: Christian Heimes <christian@python.org>
2021-04-09 18:34:39 +02:00
Miss Islington (bot)
54d89a33e0
bpo-43794: OpenSSL 3.0.0: set OP_IGNORE_UNEXPECTED_EOF by default (GH-25309)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 6f37ebc61e)

Co-authored-by: Christian Heimes <christian@python.org>
2021-04-09 09:21:54 -07:00
Miss Islington (bot)
a188bd44ac
bpo-43789: OpenSSL 3.0.0 Don't call passwd callback again in error case (GH-25303)
(cherry picked from commit d3b73f32ef)

Co-authored-by: Christian Heimes <christian@python.org>
2021-04-09 06:46:11 -07:00
Steve Dower
0af99b44ed
bpo-43105: Importlib now resolves relative paths when creating module spec objects from file locations (GH-25121) 2021-04-07 12:35:36 +01:00
Miss Islington (bot)
05429c917c
bpo-33164: blake2: Fix Coverity scan (GH-25060)
(cherry picked from commit 068ebf9729)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2021-03-29 21:36:39 -07:00
Miss Islington (bot)
c145c03281
bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback (GH-24957)
OpenSSL copies the internal message callback from SSL_CTX->msg_callback to
SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback
to use the callback value of the new context.

PySSL_set_context() now resets the callback and _PySSL_msg_callback()
resets thread state in error path.

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

Co-authored-by: Christian Heimes <christian@python.org>
2021-03-21 08:39:15 -07:00
Serhiy Storchaka
651fc30af7
bpo-43499: Silence compiler warnings about using legacy C API on Windows (GH-24873) 2021-03-16 08:03:37 +02:00
Miss Islington (bot)
cf8d6ef962
bpo-39943: Fix MSVC warnings in sre extension (GH-20508)
(cherry picked from commit 06e3a27a3c)

Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
2021-03-14 05:17:26 -07:00
Pablo Galindo
e6bf1e1001
[3.9] bpo-43439: Wrapt the tuple in the audit events for the gc module (GH-24836) (GH-24855)
* [3.9] bpo-43439: Wrapt the tuple in the audit events for the gc module (GH-24836).
(cherry picked from commit 9c376bc1c4)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>

* Update gcmodule.c

* Update gcmodule.c

* Update gcmodule.c
2021-03-14 05:28:37 +00:00
Pablo Galindo
f814675376
[3.9] bpo-43439: Add audit hooks for gc functions (GH-24794). (GH-24811)
(cherry picked from commit b4f9089d4a)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-03-10 00:50:29 -08:00
Miss Islington (bot)
1385f8355a
[3.9] bpo-43406: Fix possible race condition where `PyErr_CheckSignals` tries to execute a non-Python signal handler (GH-24756) (GH-24761)
We can receive signals (at the C level, in `trip_signal()` in signalmodule.c) while `signal.signal` is being called to modify the corresponding handler.  Later when `PyErr_CheckSignals()` is called to handle the given signal, the handler may be a non-callable object and would raise a cryptic asynchronous exception.
(cherry picked from commit 68245b7a10)


Co-authored-by: Antoine Pitrou <antoine@python.org>
2021-03-06 07:07:46 -08:00
Miss Islington (bot)
132e31f4bf
bpo-43335: Update macro to check gcc version (GH-24662)
(cherry picked from commit bf9de7ab24)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2021-02-27 16:51:36 -08:00
Inada Naoki
d51436f95b
bpo-43260: io: Prevent large data remains in textio buffer. (GH-24592)
When very large data remains in TextIOWrapper, flush() may fail forever.

So prevent that data larger than chunk_size is remained in TextIOWrapper internal
buffer.

Co-Authored-By: Eryk Sun
(cherry picked from commit 01806d5)
2021-02-22 10:32:55 +09:00
Miss Islington (bot)
85fd9f4e45
bpo-42819, readline: Disable bracketed paste (GH-24108) (GH-24545)
(cherry picked from commit 755f3c1521)

Co-authored-by: Dustin Rodrigues <dust.rod@gmail.com>

Co-authored-by: Dustin Rodrigues <dust.rod@gmail.com>
2021-02-16 01:18:07 +01:00
Miss Islington (bot)
df2197f2ec
bpo-43204: Fix LibTomCrypt URL in md5module.c and sha*module.c comments (GH-24507)
Automerge-Triggered-By: GH:tiran
(cherry picked from commit 5ec7d53558)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2021-02-12 03:18:38 -08:00
Miss Islington (bot)
c8b4375fe1
bpo-43132: Fix incorrect handling of PyObject_RichCompareBool() in _zoneinfo (GH-24450) (GH-24457)
PyObject_RichCompareBool() returns -1 on error, but this case is
not handled by the find_in_strong_cache() function.  Any exception
raised by PyObject_RichCompareBool() should be propagated.
(cherry picked from commit effaec0bb5)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2021-02-05 19:13:40 +02:00
Miss Islington (bot)
12bfc595c4
bpo-43108: Fix a reference leak in the curses module (GH-24420)
(cherry picked from commit bb739ec922)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-02-03 05:41:09 -08:00
Miss Islington (bot)
7e729978fa
bpo-42688: Fix ffi alloc/free when using external libffi on macos (GH-23868) (GH-23888)
Automerge-Triggered-By: GH:ronaldoussoren
(cherry picked from commit b3c77ecbbe)

Co-authored-by: erykoff <erykoff@stanford.edu>
2021-02-01 00:15:23 -05:00
Serhiy Storchaka
3c8d693443
[3.9] bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails (GH-21933). (GH-24403)
(cherry picked from commit 3243e8a4b4)

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2021-01-31 21:44:31 +02:00
Miss Islington (bot)
8a833a6f94
bpo-43083: Fix error handling in _sqlite3 (GH-24395)
(cherry picked from commit 9073180db5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-01-31 08:06:15 -08:00
Miss Islington (bot)
895591c1f0
bpo-42979: _zoneinfo exec function checks for PyDateTime_IMPORT failure (GH-24333) (GH-24351)
Importing datetime can fail.
(cherry picked from commit eeb701adc0)

Co-authored-by: Hai Shi <shihai1992@gmail.com>

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2021-01-27 12:08:45 +01:00
Miss Islington (bot)
cb77c5e1dd
bpo-43033: Fix the handling of PyObject_SetAttrString() in _zoneinfo.c (GH-24345) (GH-24349)
(cherry picked from commit 5327f37034)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2021-01-27 11:40:31 +02:00
Miss Islington (bot)
50938b63fb
bpo-41995: Handle allocation failure in _tracemalloc and _zoneinfo (GH-22635)
(cherry picked from commit f1ff800db1)

Co-authored-by: Yunlongs <lylgood@foxmail.com>
2021-01-20 01:03:28 -08:00