Commit Graph

11359 Commits

Author SHA1 Message Date
Miss Islington (bot) 97136d71a7
bpo-40791: Make compare_digest more constant-time. (GH-20444)
* bpo-40791: Make compare_digest more constant-time.

The existing volatile `left`/`right` pointers guarantee that the reads will all occur, but does not guarantee that they will be _used_. So a compiler can still short-circuit the loop, saving e.g. the overhead of doing the xors and especially the overhead of the data dependency between `result` and the reads. That would change performance depending on where the first unequal byte occurs. This change removes that optimization.

(This is change GH-1 from https://bugs.python.org/issue40791 .)
(cherry picked from commit 31729366e2)

Co-authored-by: Devin Jeanpierre <jeanpierreda@google.com>
2020-11-21 01:12:21 -08:00
Victor Stinner a702bd4b92
bpo-41686: Always create the SIGINT event on Windows (GH-23344) (GH-23347) (GH-23349)
bpo-41686, bpo-41713: On Windows, the SIGINT event,
_PyOS_SigintEvent(), is now created even if Python is configured to
not install signal handlers (PyConfig.install_signal_handlers=0 or
Py_InitializeEx(0)).

(cherry picked from commit 05a5d697f4)
2020-11-17 22:23:18 +01:00
Jakub Stasiak f37628eb71
[3.8] bpo-42237: Fix os.sendfile() on illumos (GH-23154). (GH-23246)
(cherry picked from commit fd4ed57674)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
2020-11-12 14:23:48 +02:00
Jakub Kulík a12f459ec2
[3.8] bpo-35455: Fix thread_time for Solaris OS (GH-11118). (GH-23145)
(cherry picked from commit 9568622c99)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2020-11-04 14:19:17 +00:00
Miss Skeleton (bot) a053a7ecfe
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-10-26 14:46:10 +09:00
Miss Skeleton (bot) 8e980ecfb7
bpo-42144: Add a missing "goto error;" in the _ssl module (GH-22959)
(cherry picked from commit c32f2976b8)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-10-25 11:21:35 -07:00
Miss Skeleton (bot) 4cde523aa4
bpo-38324: Fix test__locale.py Windows failures (GH-20529)
Use wide-char _W_* fields of lconv structure on Windows
Remove "ps_AF" from test__locale.known_numerics on Windows
(cherry picked from commit f2312037e3)

Co-authored-by: TIGirardi <tiagoigirardi@gmail.com>
2020-10-20 04:58:06 -07:00
Miss Skeleton (bot) 6e998fad1c
bpo-16396: Allow wintypes to be imported on non-Windows systems. (GH-21394)
Co-authored-by: Christian Heimes <christian@python.org>
(cherry picked from commit 5456e78f45)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2020-10-19 15:29:37 -07:00
Miss Skeleton (bot) aeb66c1abb
bpo-41984: GC track all user classes (GH-22701/GH-22707)
(cherry picked from commit c13b847a6f)
2020-10-15 08:51:48 -07:00
Miss Skeleton (bot) 9aa34f1bbb
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-03 04:01:41 -07:00
Thomas Grainger ae462297c0
[3.8] bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module (GH-21956) (#22398)
Closes bpo issue 41602.
(cherry picked from commit a68a2ad19c)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2020-09-24 18:44:14 +02:00
Miss Islington (bot) ca2d99d091
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-09-21 15:00:34 -07:00
Miss Islington (bot) 243458115e
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:42:36 -07:00
Felix Yan 16eea45fbd
[3.8] bpo-41302: Support system libmpdec 2.5 for Python 3.8 (GH-21488)
Define UNUSED only when mpdecimal.h doesn't define it. This would support
building with system libmpdec 2.5 while retaining compatibility with system
libmpdec 2.4 or the vendored copy.

Tested to build fine with either system libmpdec or the vendored one.
2020-07-15 22:22:23 +02:00
Miss Islington (bot) f8055fb0f1
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:49 -07:00
Miss Islington (bot) f56c75ed53
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:05:44 -07:00
Tony Solomonik 0b6169e391
bpo-41247: asyncio.set_running_loop() cache running loop holder (#21406)
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.
2020-07-09 10:38:46 -07:00
Miss Islington (bot) 54babbe976
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:15:36 -07:00
Miss Islington (bot) c8b599ff0a
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:37:50 -07:00
Miss Islington (bot) aa7f775614
bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297) (GH-21352)
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 19:12:16 +02:00
scoder 8912c18245
bpo-39960: Allow heap types in the "Carlo Verre" hack check that override "tp_setattro()" (GH-21092) (GH-21339)
Backport to Py3.8.
2020-07-05 22:12:04 +02:00
Guido van Rossum e653369e76
[3.8] bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags (#21023) 2020-06-27 17:35:05 -07:00
Miss Islington (bot) 1dda40c1d2
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:03:51 -07:00
Miss Islington (bot) 1813d318fd
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:38 -07:00
Anthony Sottile 60cbdc81d1
[3.8] bpo-31938: Fix default-value signatures of several functions in the select module (GH-21066) (GH-21098)
(cherry picked from commit d051801052)

Automerge-Triggered-By: @vstinner
2020-06-23 15:17:02 -07:00
Miss Islington (bot) c6e24e7420
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:40:47 -07:00
Miss Islington (bot) 10bf6e4823
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:29 -07:00
Stefan Krah 0f5a28f834
[3.8] Revert bpo-39576: Prevent memory error for overly optimistic precisions (GH-20747)
This reverts commit b6271025c6.
2020-06-09 01:57:11 +02:00
Victor Stinner 6f7346bb39
[3.9] bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20613) (GH-20616)
* 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 18:28:18 +02:00
Miss Islington (bot) 9c0ff178a5
bpo-30008: Fix OpenSSL no-deprecated compilation (GH-20397)
Fix :mod:`ssl`` code to be compatible with OpenSSL 1.1.x builds that use
``no-deprecated`` and ``--api=1.1.0``.

Note: Tests assume full OpenSSL API and fail with limited API.

Signed-off-by: Christian Heimes <christian@python.org>
Co-authored-by: Mark Wright <gienah@gentoo.org>
(cherry picked from commit a871f692b4)

Co-authored-by: Christian Heimes <christian@python.org>
2020-06-01 00:17:16 -07:00
Miss Islington (bot) 45ce0dbc4f
bpo-40795: ctypes calls unraisablehook with an exception (GH-20452)
If ctypes fails to convert the result of a callback or if a ctypes
callback function raises an exception, sys.unraisablehook is now
called with an exception set. Previously, the error was logged into
stderr by PyErr_Print().
(cherry picked from commit 10228bad04)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-05-27 15:56:36 -07:00
Miss Islington (bot) a285af7e62
bpo-13097: ctypes: limit callback to 1024 arguments (GH-19914)
ctypes now raises an ArgumentError when a callback
is invoked with more than 1024 arguments.

The ctypes module allocates arguments on the stack in
ctypes_callproc() using alloca(), which is problematic
when large numbers of arguments are passed. Instead
of a stack overflow, this commit raises an ArgumentError
if more than 1024 parameters are passed.
(cherry picked from commit 29a1384c04)

Co-authored-by: Sean Gillespie <sean@swgillespie.me>
2020-05-27 08:53:03 -07:00
Tal Einat e3e800f3d2
[3.8] bpo-38580: Document that select() accepts iterables, not just sequences (GH-16832)
(cherry picked from commit 372ee27d49)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
2020-05-26 15:59:32 +03:00
Zackery Spytz 5ff5edfef6
[3.8] bpo-35714: Reject null characters in struct format strings (GH-16928) (GH-20419)
struct.error is now raised if there is a null character in a struct
format string.
(cherry picked from commit 3f59b55316)
2020-05-26 11:57:09 +03:00
Miss Islington (bot) 560d643661
bpo-40677: Define IO_REPARSE_TAG_APPEXECLINK explicitly (GH-20206)
This allows building with older versions of the Windows SDK where the value is not defined.
(cherry picked from commit 711f9e180a)

Co-authored-by: Minmin Gong <gongminmin@msn.com>
2020-05-19 05:39:06 -07:00
Miss Islington (bot) ddd5bbdeec
bpo-40653: Move _dirnameW out of GH-ifdef HAVE_SYMLINK/GH-endif (GH-20144)
(cherry picked from commit 7f21c9ac87)

Co-authored-by: Minmin Gong <gongminmin@msn.com>
2020-05-18 09:36:02 -07:00
Miss Islington (bot) 94d9c5e5af
bpo-39148: enable ipv6 for datagrams in Proactor (GH-19121)
Ifdef is not necessary, as AF_INET6 is supported from Windows Vista, and other code in overlapped.c uses AF_INET6 and is not ifdef'd.
Change the raised exception so users are not fooled to think it comes from Windows API.

Automerge-Triggered-By: @njsmith
(cherry picked from commit 442634c42f)

Co-authored-by: Kjell Braden <afflux@pentabarf.de>
2020-05-17 23:42:25 -07:00
Miss Islington (bot) a669443dfb
bpo-40457: Support OpenSSL without TLS 1.0/1.1 (GH-19862)
OpenSSL can be build without support for TLS 1.0 and 1.1. The ssl module
now correctly adheres to OPENSSL_NO_TLS1 and OPENSSL_NO_TLS1_1 flags.

Also update multissltest to test with latest OpenSSL and LibreSSL
releases.

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

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

Co-authored-by: Christian Heimes <christian@python.org>
2020-05-16 01:33:42 -07:00
Christian Heimes 387c7441f5 [3.8] bpo-40515: Require OPENSSL_THREADS (GH-19953) (GH-20119) 2020-05-15 22:36:51 +02:00
Miss Islington (bot) 0e4a5e96f0
[3.8] bpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (GH-19990)
This fixes a possible memory leak in the C implementation of
asyncio.Task.
(cherry picked from commit d2c349b190)

Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
2020-05-08 04:28:38 -07:00
Victor Stinner b07350901c
bpo-40138: Fix Windows os.waitpid() for large exit code (GH-19654)
Fix the Windows implementation of os.waitpid() for exit code
larger than "INT_MAX >> 8". The exit status is now interpreted as an
unsigned number.
2020-04-22 17:57:59 +02:00
Serhiy Storchaka bfda4db0d2
[3.8] bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364) (GH-19583)
Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
(cherry picked from commit 12446e6a60)
2020-04-18 19:11:48 +03:00
Miss Islington (bot) 6b0ca0aeab
bpo-40294: Fix _asyncio when module is loaded/unloaded multiple times (GH-19542)
(cherry picked from commit a75e730075)

Co-authored-by: Jeffrey Quesnelle <jquesnelle@gmail.com>
2020-04-16 19:29:50 -07:00
Miss Islington (bot) c496e29c2b
closes bpo-40266, closes bpo-39953: Use numeric lib code if compiling against old OpenSSL. (GH-19506)
(cherry picked from commit 584a3cfda4)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-04-13 20:31:18 -07:00
Miss Islington (bot) f35e7d3bb0
closes bpo-39953: Generate ifdefs around library code definitions. (GH-19490)
(cherry picked from commit 909b87d2bb)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-04-12 12:17:34 -07:00
Miss Islington (bot) 61511488cf
bpo-31758: Prevent crashes when using an uninitialized _elementtree.XMLParser object (GH-3997) (GH-19485)
(cherry picked from commit 402e1cdb13)
2020-04-12 17:18:57 +02:00
Miss Islington (bot) 2714c907df
closes bpo-39953: Update OpenSSL error codes table. (GH-19082)
I updated the error codes using the OpenSSL 1.1.1f source tree.
(cherry picked from commit 3e0dd3730b)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2020-04-11 13:53:00 -07:00
Miss Islington (bot) 572ef74769
bpo-39689: Do not use native packing for format "?" with standard size (GH-18969)
(cherry picked from commit 472fc843ca)

Co-authored-by: Stefan Krah <skrah@bytereef.org>
2020-03-31 05:26:05 -07:00
Miss Islington (bot) 6a0ee60db4
bpo-40121: Fixes audit event raised on creating a new socket (GH-19238)
(cherry picked from commit 63ba5cccf4)

Co-authored-by: Steve Dower <steve.dower@python.org>
2020-03-31 04:57:06 -07:00
Miss Islington (bot) af6fd1faa6
bpo-40014: Fix os.getgrouplist() (GH-19126)
Fix os.getgrouplist(): if getgrouplist() function fails because the
group list is too small, retry with a larger group list.

On failure, the glibc implementation of getgrouplist() sets ngroups
to the total number of groups. For other implementations, double the
group list size.
(cherry picked from commit f5c7cabb2b)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-03-24 10:40:31 -07:00