Commit Graph

12343 Commits

Author SHA1 Message Date
Kumar Aditya 4ad222991f
[3.10] GH-93899: fix checks for eventfd flags (GH-95170). (#95345)
(cherry picked from commit 4dd099baff)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-28 12:24:47 +02:00
Miss Islington (bot) 657efca298
GH-95045: gc untrack _lsprof.Profiler before deallocating it (GH-95315)
Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit deacf391d7)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-27 05:28:26 -07:00
Miss Islington (bot) 2f9e47c026
gh-95041: Fail syslog.syslog in case inner call to syslog.openlog fails (GH-95264)
(cherry picked from commit b1f648efc5)

Co-authored-by: Noam Cohen <noam@noam.me>
2022-07-26 04:56:04 -07:00
Miss Islington (bot) dd0c1a3577
gh-95041: Fix several minor issues in syslog.openlog() (GH-95058)
* syslog_get_argv() swallows exceptions, but not in all cases.
* if ident is non UTF-8 encodable, syslog.openlog() fails after setting the
  global reference to ident. Now the C string saved internally in the previous
  call to openlog() points to the freed memory.
* PySys_Audit() can crash if ident is NULL.
* There may be a race condition with syslog.syslog(), because the global
  reference to ident is decrefed before setting the new value.
* Possible use of freed memory if syslog.openlog() is called while
  the GIL is released in syslog.syslog().
(cherry picked from commit 68c555a50a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-07-25 23:35:25 -07:00
Miss Islington (bot) 8fd2d36c1c
gh-95095: Use SSL_CTX_get_max_proto_version instead of SSL_CTX_ctrl (GH-95096)
The wrapper macros are more readable and match the form recommended in
the OpenSSL documentation. They also slightly less error-prone, as the
mapping of arguments to SSL_CTX_ctrl is not always clear. (Though in
this case it's straightforward.)
https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_get_max_proto_version.html
(cherry picked from commit 936f71e5d4)

Co-authored-by: David Benjamin <davidben@davidben.net>
2022-07-21 12:10:53 -07:00
Miss Islington (bot) 31a390e43f
[3.10] gh-94930: skipitem() in getargs.c should return non-NULL on error (GH-94931) (GH-94963)
(cherry picked from commit 067f0da335)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-07-19 21:57:59 +03:00
Miss Islington (bot) 2d79804bb0
GH-91153: Handle mutating __index__ methods in bytearray item assignment (GH-94891)
(cherry picked from commit f36589510b)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-07-19 10:04:47 -07:00
Miss Islington (bot) 5d75edd925
gh-94821: Fix autobind of empty unix domain address (GH-94826)
When binding a unix socket to an empty address on Linux, the socket is
automatically bound to an available address in the abstract namespace.

    >>> s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    >>> s.bind("")
    >>> s.getsockname()
    b'\x0075499'

Since python 3.9, the socket is bound to the one address:

    >>> s.getsockname()
    b'\x00'

And trying to bind multiple sockets will fail with:

    Traceback (most recent call last):
      File "/home/nsoffer/src/cpython/Lib/test/test_socket.py", line 5553, in testAutobind
        s2.bind("")
    OSError: [Errno 98] Address already in use

Added 2 tests:
- Auto binding empty address on Linux
- Failing to bind an empty address on other platforms

Fixes f6b3a07b7d (bpo-44493: Add missing terminated NUL in sockaddr_un's length (GH-26866)
(cherry picked from commit c22f134211)

Co-authored-by: Nir Soffer <nsoffer@redhat.com>
2022-07-17 08:39:30 -07:00
Miss Islington (bot) aa2142def6
bpo-45924: Fix asyncio incorrect traceback when future's exception is raised multiple times (GH-30274) (#94748)
(cherry picked from commit 86c1df1872)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-11 15:38:27 +01:00
Miss Islington (bot) 916686fdb2
GH-94736: Fix _multiprocessing.SemLock subclassing (GH-94738)
* fix allocator and deallocator

* 📜🤖 Added by blurb_it.

* code review

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit f5b76330cf)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-11 05:39:09 -07:00
Miss Islington (bot) d4796c2231
gh-94637: Release GIL in SSLContext.set_default_verify_paths (GH-94658)
(cherry picked from commit 78307c7dc2)

Co-authored-by: Christian Heimes <christian@python.org>
2022-07-09 09:35:54 -07:00
Erlend Egeberg Aasland 797745e749
[3.10] gh-94321: Document sqlite3.PrepareProtocol (GH-94620) (#94671)
(cherry picked from commit fb6dccae34)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-07-08 01:44:09 +02:00
Miss Islington (bot) c5819c1f6c
GH-94644: fix test_curses ref leak (GH-94647)
(cherry picked from commit 277f55cb04)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-07 04:41:06 -07:00
Pablo Galindo Salgado 5e24c80b94
[3.10] gh-94510: Raise on re-entrant calls to sys.setprofile and syssettrace (GH-94511) (#94579)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>.
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-07-05 19:52:33 +01:00
Kumar Aditya 079ea44570
[3.10] GH-89988: Fix memory leak in pickle.Pickler dispatch_table lookup (GH-94298) (#94385) 2022-06-28 17:14:47 +01:00
Miss Islington (bot) c481cd6256
GH-94254: Make _struct module types immutable (GH-94269)
(cherry picked from commit 17ed560fcd)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-06-26 03:45:00 -07:00
Erlend Egeberg Aasland deb4d0457f
[3.10] gh-90016: Reword sqlite3 adapter/converter docs (GH-93095) (#94273)
Also add adapters and converter recipes.

Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com.
(cherry picked from commit bd3c1c187e)
2022-06-25 22:55:38 +02:00
Miss Islington (bot) 86e49a5026
[3.10] gh-94207: Fix struct module leak (GH-94239) (GH-94266)
* gh-94207: Fix struct module leak (GH-94239)

Make _struct.Struct a GC type

This fixes a memory leak in the _struct module, where as soon
as a Struct object is stored in the cache, there's a cycle from
the _struct module to the cache to Struct objects to the Struct
type back to the module. If _struct.Struct is not gc-tracked, that
cycle is never collected.

This PR makes _struct.Struct GC-tracked, and adds a regression test.
(cherry picked from commit 6b865349aa)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2022-06-25 16:05:06 +01:00
Miss Islington (bot) 525ab8f310
Fix typo in _io.TextIOWrapper Clinic input (GH-94037) (GH-94117)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit ca308c13da)

Co-authored-by: fikotta <81991278+fikotta@users.noreply.github.com>
2022-06-22 14:22:46 +02:00
Miss Islington (bot) 2e8eac1c2d
gh-94101 Disallow instantiation of SSLSession objects (GH-94102)
Fixes GH-94101

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

Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
2022-06-22 03:50:03 -07:00
Miss Islington (bot) ddac87c1c1
DOC: correct bytesarray -> bytearray in comments (GH-92410) (GH-94090)
(cherry picked from commit 0709586744)

Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
2022-06-22 10:48:14 +02:00
Victor Stinner 9d73adf7a4
gh-84461: Silence some compiler warnings on WASM (GH-93978) (#94025)
(cherry picked from commit 774ef28814)

Co-authored-by: Christian Heimes <christian@python.org>
2022-06-20 16:09:55 +02:00
Erlend Egeberg Aasland c4440e6bc0
[3.10] gh-93925: Improve clarity of sqlite3 commit/rollback, and close docs (GH-93926) (#94011)
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>.
(cherry picked from commit 6446592c89)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2022-06-19 21:43:03 +02:00
Erlend Egeberg Aasland 2229d34a6e
[3.10] gh-79579: Improve DML query detection in sqlite3 (GH-93623) (#93801)
The fix involves using pysqlite_check_remaining_sql(), not only to check
for multiple statements, but now also to strip leading comments and
whitespace from SQL statements, so we can improve DML query detection.

pysqlite_check_remaining_sql() is renamed lstrip_sql(), to more
accurately reflect its function, and hardened to handle more SQL comment
corner cases.

(cherry picked from commit 46740073ef)
2022-06-14 15:05:36 +02:00
Miss Islington (bot) 1190b63721
gh-92930: _pickle.c: Acquire strong references before calling save() (GH-92931)
(cherry picked from commit 4c496f1f11)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2022-06-10 20:53:07 -07:00
Steve Dower 9041b00283
bpo-42658: Use LCMapStringEx in ntpath.normcase to match OS behaviour for case-folding (GH-93674)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
2022-06-10 17:36:02 +01:00
Miss Islington (bot) 8d8251a9b1
gh-90763: Modernise xx template module initialisation (GH-93078)
Use C APIs such as PyModule_AddType instead of PyModule_AddObject.
Also remove incorrect module decrefs if module fails to initialise.
(cherry picked from commit a87c9b538f)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
2022-06-10 04:16:57 -07:00
Erlend Egeberg Aasland 9cc0afcb87
[3.10] gh-93421: Update sqlite3 cursor.rowcount only after SQLITE_DONE (GH-93526) (GH-93599)
(cherry picked from commit 875de61)
2022-06-08 13:31:14 +02:00
Miss Islington (bot) 550c44b895
gh-92839: fixed typo in _bisectmodule.c (line 131) (GH-92849) (#93321) 2022-05-28 13:48:25 -05:00
Miss Islington (bot) add8820df8
Fix NULL test in _testinternalcapi (GH-92861)
(cherry picked from commit 702e0da000)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2022-05-16 18:54:47 -07:00
Miss Islington (bot) 36d42e701f
Check result of utc_to_seconds and skip fold probe in pure Python (GH-91582)
The `utc_to_seconds` call can fail, here's a minimal reproducer on
Linux:

TZ=UTC python -c "from datetime import *; datetime.fromtimestamp(253402300799 + 1)"

The old behavior still raised an error in a similar way, but only
because subsequent calculations happened to fail as well. Better to fail
fast.

This also refactors the tests to split out the `fromtimestamp` and
`utcfromtimestamp` tests, and to get us closer to the actual desired
limits of the functions. As part of this, we also changed the way we
detect platforms where the same limits don't necessarily apply (e.g.
Windows).

As part of refactoring the tests to hit this condition explicitly (even
though the user-facing behvior doesn't change in any way we plan to
guarantee), I noticed that there was a difference in the places that
`datetime.utcfromtimestamp` fails in the C and pure Python versions, which
was fixed by skipping the "probe for fold" logic for UTC specifically —
since UTC doesn't have any folds or gaps, we were never going to find a
fold value anyway. This should prevent some failures in the pure python
`utcfromtimestamp` method on timestamps close to 0001-01-01.

There are two separate news entries for this because one is a
potentially user-facing change, the other is an internal code
correctness change that, if anything, changes some error messages. The
two happen to be coupled because of the test refactoring, but they are
probably best thought of as independent changes.

Fixes GH-91581
(cherry picked from commit 83c0247d47)

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2022-05-14 08:01:53 -07:00
Itai Steinherz 9be9b585aa
bpo-46785: Fix race condition between os.stat() and unlink on Windows (GH-31858)
* [3.10] bpo-46785: Fix race condition between os.stat() and unlink on Windows (GH-31858).
(cherry picked from commit 39e6b8ae6a)

Co-authored-by: Itai Steinherz <itaisteinherz@gmail.com>
2022-05-10 23:52:39 +01:00
Erlend Egeberg Aasland 2a2421e538
[3.10] gh-80254: Disallow recursive usage of cursors in `sqlite3` converters (#92274)
* [3.10] gh-80254: Disallow recursive usage of cursors in `sqlite3` converters (#29054)

(cherry picked from commit f629dcfe83)

Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

* Fix ref leak in pysqlite_cursor_iternext
2022-05-05 12:46:21 -07:00
Miss Islington (bot) 178a238f25
gh-92036: Fix gc_fini_untrack() (GH-92037)
Fix a crash in subinterpreters related to the garbage collector. When
a subinterpreter is deleted, untrack all objects tracked by its GC.
To prevent a crash in deallocator functions expecting objects to be
tracked by the GC, leak a strong reference to these objects on
purpose, so they are never deleted and their deallocator functions
are not called.
(cherry picked from commit 14243369b5)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-05-04 03:23:29 -07:00
Serhiy Storchaka 62ddbbcfaf
[3.10] gh-91583: AC: Fix regression for functions with defining_class (GH-91739) (GH-92079)
Argument Clinic now generates the same efficient code as before
adding the defining_class parameter.
(cherry picked from commit a055dac0b4)
2022-05-03 11:53:46 +03:00
Erlend Egeberg Aasland 178d79ae67
[3.10] gh-89301: Fix regression with bound values in traced SQLite statements (#92147)
(cherry picked from commit 721aa96540)
2022-05-02 10:21:13 -06:00
Gregory P. Smith ea1eba03e7
[3.10] gh-91401: Conservative backport of `subprocess._USE_VFORK` (#91932)
This does not alter the `_posixsubprocess.fork_exec()` private API to
avoid issues for anyone relying on that (bad idea) or for anyone who's
`subprocess.py` and `_posixsubprocess.so` upgrades may not become
visible to existing Python 3.10 processes at the same time.

Backports the concept of cd5726fe67.

Provides a fail-safe way to disable vfork for #91401.

I didn't backport the documentation as I don't actually expect this to be used and `.. versionadded: 3.10.5` always looks weird in docs. It's being done more to have a fail-safe in place for people just in case.
2022-05-01 16:09:50 -07:00
Miss Islington (bot) 923ef87c77
gh-91734: Fix ossaudio support on Solaris (GH-91735)
(cherry picked from commit 4420faf273)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2022-04-20 04:06:29 -07:00
Oleg Iarygin e7e8a9fa4f
[3.10] gh-91118: Fix docstrings that do not honor --without-doc-strings (GH-31769) (#91662)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit a573cb2fec)

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2022-04-19 13:01:09 -07:00
Miss Islington (bot) 9ed179b07d
bpo-47151: Fallback to fork when vfork fails in subprocess. (GH-32186)
bpo-47151: Fallback to fork when vfork fails in subprocess. An OS kernel can specifically decide to disallow vfork() in a process. No need for that to prevent us from launching subprocesses.
(cherry picked from commit 4a08c4c469)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-03-31 14:09:50 -07:00
Miss Islington (bot) 5944807b09
[3.10] bpo-44493: Add missing terminated NUL in sockaddr_un's length (GH-26866) (GH-32140)
Add missing terminated NUL in sockaddr_un's length

- Linux: https://man7.org/linux/man-pages/man7/unix.7.html
- *BSD: SUN_LEN
(cherry picked from commit f6b3a07b7d)


Co-authored-by: ty <zonyitoo@users.noreply.github.com>

Automerge-Triggered-By: GH:gpshead
2022-03-28 11:26:49 -07:00
Christian Heimes 1b6acaad9a
[3.10] bpo-47101: list only activated algorithms in hashlib.algorithms_available (GH-32076) (GH-32085)
Co-authored-by: Christian Heimes <christian@python.org>
2022-03-23 22:15:25 +01:00
Miss Islington (bot) 1b21b55ee0
bpo-23691: Protect the re.finditer() iterator from re-entering (GH-32012)
(cherry picked from commit 08eb754d84)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-03-21 04:30:58 -07:00
Gregory P. Smith 4c989e19c8
[3.10] bpo-38256: Fix binascii.crc32 large input. (GH-32000) (GH-32013)
Inputs >= 4GiB to `binascii.crc32(...)` when compiled to use the zlib
crc32 implementation (the norm on POSIX) no longer return the wrong
result.
2022-03-20 14:46:52 -07:00
Pablo Galindo Salgado 6fd9737373
[3.10] bpo-46968: Check for 'sys/auxv.h' in the configure script (GH-31961). (GH-31974)
(cherry picked from commit 8e3fde728f)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2022-03-18 13:33:11 +00:00
Jelle Zijlstra d8ba5c102c
[3.10] sqlite3: normalise pre-acronym determiners (GH-31772) (GH-31806)
For consistency, replace "a SQL" with "an SQL"..
(cherry picked from commit 2d5835a019)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2022-03-11 17:10:55 -08:00
Victor Stinner 393e2bf6bc
bpo-46968: Fix faulthandler for Sapphire Rapids Xeon (GH-31789) (GH-31830)
In Linux kernel 5.14 one can dynamically request size of altstacksize
based on hardware capabilities with getauxval(AT_MINSIGSTKSZ).

This changes allows for Python extension's request to Linux kernel
to use AMX_TILE instruction set on Sapphire Rapids Xeon processor
to succeed, unblocking use of the ISA in frameworks.

Introduced HAVE_LINUX_AUXVEC_H in configure.ac and pyconfig.h.in
Used cpython_autoconf:269 docker container to generate configure.

(cherry picked from commit 3b128c0548)

Co-authored-by: Oleksandr Pavlyk <oleksandr.pavlyk@intel.com>
2022-03-12 00:04:14 +01:00
Jelle Zijlstra 5dfe981791
[3.10] Docstring: replace pysqlite with sqlite3 (GH-31758) (GH-31777)
Replace two instances of "pysqlite" with "sqlite3" in sqlite3
docstrings. Also reword "is a no-op" to "does nothing" for clarity..
(cherry picked from commit b33a1ae703)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2022-03-09 10:19:27 -08:00
Miss Islington (bot) 95b001fe67
bpo-23325: Fix SIG_IGN and SIG_DFL int comparison in signal module (GH-31759)
(cherry picked from commit c8a47e76a3)

Co-authored-by: Christian Heimes <christian@python.org>
2022-03-08 10:53:24 -08:00
Erlend Egeberg Aasland f3d3b2d5c5
[3.10] bpo-46878: Purge 'non-standard' from sqlite3 docstrings (GH-31612) (GH-31753)
(cherry picked from commit 4d95fa1ac5)
2022-03-08 07:30:14 -08:00