summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* gh-91968: Add socket constants SO_USER_COOKIE/SO_RTABLE from BSD (#91967)David CARLIER2022-05-081-0/+6
| | | | | Those are somewhat equivalent to Linux' SO_MARK. Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-92356: Fix regression in ctypes function call overhead (#92357)Michael Droettboom2022-05-061-0/+1
| | | | | | 38f331d introduced a delayed initialization routine to set up ctypes formattable (`_ctypes_init_fielddesc`), but inadvertently removed setting the `initialization` flag to 1 to avoid initting each time.
* gh-80010: Expand fromisoformat to include most of ISO-8601 (#92177)Paul Ganssle2022-05-061-71/+288
| | | This expands `fromisoformat` to cover most of the common uses of ISO 8601. We may expand the scope more in the future.
* gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)Victor Stinner2022-05-052-1/+2
| | | | | | | | | | | | Add the -P command line option and the PYTHONSAFEPATH environment variable to not prepend a potentially unsafe path to sys.path. * Add sys.flags.safe_path flag. * Add PyConfig.safe_path member. * Programs/_bootstrap_python.c uses config.safe_path=0. * Update subprocess._optim_args_from_interpreter_flags() to handle the -P command line option. * Modules/getpath.py sets safe_path to 1 if a "._pth" file is present.
* gh-82616: Add process_group support to subprocess.Popen (#23930)Gregory P. Smith2022-05-051-7/+13
| | | | | | | | One more thing that can help prevent people from using `preexec_fn`. Also adds conditional skips to two tests exposing ASAN flakiness on the Ubuntu 20.04 Address Sanitizer Github CI system. When that build is run on more modern systems the "problem" does not show up. It seems ASAN implementation related. Co-authored-by: Zackery Spytz <zspytz@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-92345: Import rlcompleter before sys.path is extended (#92346)Christian Heimes2022-05-051-1/+10
| | | | | | | | | | ``pymain_run_python()`` now imports ``readline`` and ``rlcompleter`` before sys.path is extended to include the current working directory of an interactive interpreter. Non-interactive interpreters are not affected. Also move imports of ``re`` and ``keyword`` module to top level so they are materialized early, too. The ``keyword`` module is trivial and the ``re`` is already imported via ``inspect`` -> ``linecache``.
* gh-92301: subprocess: Prefer close_range() to procfs-based fd closing (#92303)Alexey Izbyshev2022-05-051-18/+70
| | | | | | | | #92301: subprocess: Prefer `close_range()` to procfs-based fd closing. `close_range()` is much faster for large number of file descriptors, e.g. 4 times faster for 1000 descriptors in a Linux 5.16-based environment. We prefer close_range() only if it's known to be async-signal-safe.
* bpo-41818: Add os.login_tty() for *nix. (#29658)Soumendra Ganguly2022-05-052-10/+100
| | | | | | * Add `os.login_tty(fd)` for Unix. Reviewed-by: Christian Heimes <christian@python.org> Signed-off-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
* GH-92239: Make sure that PEP 523 is supported, even when specializing first. ↵Mark Shannon2022-05-041-1/+36
| | | | (GH-92245)
* gh-92210: Move socket.__init__ to argument clinic (#92237)Joshua Herman2022-05-042-14/+91
| | | | | | Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no> Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-89022: Improve sqlite3 exceptions related to binding params and API ↵Erlend Egeberg Aasland2022-05-042-15/+19
| | | | | | | | | | | | | misuse (#91572) * Map SQLITE_MISUSE to sqlite3.InterfaceError SQLITE_MISUSE implies misuse of the SQLite C API, which, if it happens, is _not_ a user error; it is an sqlite3 extension module error. * Raise better errors when binding parameters fail. Instead of always raising InterfaceError, guessing what went wrong, raise accurate exceptions with more accurate error messages.
* Use static inline function Py_EnterRecursiveCall() (#91988)Victor Stinner2022-05-043-25/+28
| | | | | | | | | | | | | | | | Currently, calling Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() may use a function call or a static inline function call, depending if the internal pycore_ceval.h header file is included or not. Use a different name for the static inline function to ensure that the static inline function is always used in Python internals for best performance. Similar approach than PyThreadState_GET() (function call) and _PyThreadState_GET() (static inline function). * Rename _Py_EnterRecursiveCall() to _Py_EnterRecursiveCallTstate() * Rename _Py_LeaveRecursiveCall() to _Py_LeaveRecursiveCallTstate() * pycore_ceval.h: Rename Py_EnterRecursiveCall() to _Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() and _Py_LeaveRecursiveCall()
* gh-92036: Fix gc_fini_untrack() (#92037)Victor Stinner2022-05-041-0/+6
| | | | | | | | 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.
* gh-80254: Disallow recursive usage of cursors in `sqlite3` converters (#29054)Erlend Egeberg Aasland2022-05-031-7/+24
| | | | Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-91928: Add `datetime.UTC` alias for `datetime.timezone.utc` (GH-91973)Kabir Kwatra2022-05-031-0/+4
| | | | | | | | | ### fixes #91928 `UTC` is now module attribute aliased to `datetime.timezone.utc`. You can now do the following: ```python from datetime import UTC ```
* gh-92206: Improve scoping of sqlite3 statement helper (#92260)Erlend Egeberg Aasland2022-05-033-9/+8
|
* gh-89289: Fix compiler warning in _sqlite/connection.c (#92258)Erlend Egeberg Aasland2022-05-031-1/+1
|
* gh-92206: Improve scoping of sqlite3 bind param functions (#92250)Erlend Egeberg Aasland2022-05-033-257/+250
|
* gh-91320: Use _PyCFunction_CAST() (#92251)Victor Stinner2022-05-0324-127/+127
| | | | | | | | | | Replace "(PyCFunction)(void(*)(void))func" cast with _PyCFunction_CAST(func). Change generated by the command: sed -i -e \ 's!(PyCFunction)(void(\*)(void)) *\([A-Za-z0-9_]\+\)!_PyCFunction_CAST(\1)!g' \ $(find -name "*.c")
* gh-91320: Argument Clinic uses _PyCFunction_CAST() (#32210)Victor Stinner2022-05-0374-724/+724
| | | | Replace "(PyCFunction)(void(*)(void))func" cast with _PyCFunction_CAST(func).
* gh-89289: Harden sqlite3.Connection init (#92214)Erlend Egeberg Aasland2022-05-031-8/+15
| | | | | - Make sure SQLite resources are freed if database open fails - Remove unneeded branches if init is aborted
* gh-92206: Improve scoping of sqlite3 reset statement helper (#92241)Erlend Egeberg Aasland2022-05-033-30/+28
|
* bpo-46696: Add socket.SO_INCOMING_CPU constant (#31237)David CARLIER2022-05-031-0/+3
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-89452: Prefer gdbm-compat over ndbm (#92208)Łukasz Langa2022-05-031-4/+4
| | | | | This makes macOS gdbm provided by Homebrew not segfault through correct selection of the linked library (-lgdbm_compat) *AND* the correct ndbm-style header (gdbm-ndbm.h instead of the invalid ndbm.h).
* gh-90887: posix module: Add more flags for fcopy_file (#31300)David CARLIER2022-05-031-0/+3
| | | | | | Closes #90887 Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-92154: Expose PyCode_GetCode in the C API (GH-92168)Ken Jin2022-05-031-0/+24
|
* gh-92206: Improve scoping of sqlite3 register cursor helper (#92212)Erlend Egeberg Aasland2022-05-033-28/+23
|
* gh-92206: Move pysqlite_step() to Modules/_sqlite/cursor.c (#92207)Erlend Egeberg Aasland2022-05-033-16/+14
|
* bpo-46785: Fix race condition between os.stat() and unlink on Windows (GH-31858)Itai Steinherz2022-05-021-1/+11
|
* gh-89301: Fix regression with bound values in traced SQLite statements (#92053)Erlend Egeberg Aasland2022-05-021-14/+40
|
* gh-91952: Make TextIOWrapper.reconfigure() supports "locale" encoding (GH-91982)Inada Naoki2022-05-011-2/+10
|
* gh-92019: Make sqlite3.Blob indexing conform with the norm (#92020)Erlend Egeberg Aasland2022-04-301-18/+44
| | | | | | - get index now returns an int - set index now requires an int in range(0, 256) Resolves #92019
* gh-91583: AC: Fix regression for functions with defining_class (GH-91739)Serhiy Storchaka2022-04-3017-432/+782
| | | | | Argument Clinic now generates the same efficient code as before adding the defining_class parameter.
* gh-91324: List feature macros in the stable ABI manifest, improve tests ↵Petr Viktorin2022-04-282-0/+62
| | | | (GH-32415)
* gh-91498: socket: Add TCP_CONNECTION_INFO on macOS (#69256)David CARLIER2022-04-271-0/+3
| | | Fixes GH-91498
* gh-91870: Remove unsupported SRE opcode CALL (GH-91872)Serhiy Storchaka2022-04-263-40/+37
| | | | | | | It was initially added to support atomic groups, but that support was never fully implemented, and CALL was only left in the compiler, but not interpreter and parser. ATOMIC_GROUP is now used to support atomic groups.
* gh-91401: Add a failsafe way to disable vfork. (#91490)Gregory P. Smith2022-04-251-3/+4
| | | | | | | | | | | | | | Just in case there is ever an issue with _posixsubprocess's use of vfork() due to the complexity of using it properly and potential directions that Linux platforms where it defaults to on could take, this adds a failsafe so that users can disable its use entirely by setting a global flag. No known reason to disable it exists. But it'd be a shame to encounter one and not be able to use CPython without patching and rebuilding it. See the linked issue for some discussion on reasoning. Also documents the existing way to disable posix_spawn.
* gh-64783: Fix signal.NSIG value on FreeBSD (#91929)Victor Stinner2022-04-253-35/+27
| | | | | | | | | Fix signal.NSIG value on FreeBSD to accept signal numbers greater than 32, like signal.SIGRTMIN and signal.SIGRTMAX. * Add Py_NSIG constant. * Add pycore_signal.h internal header file. * _Py_Sigset_Converter() now includes the range of valid signals in the error message.
* gh-89653: PEP 670: Functions don't cast pointers (#91697)Victor Stinner2022-04-251-4/+6
| | | | | | | | | | | | | | | | | | | | | In the limited C API version 3.11 and newer, the following functions no longer cast their object pointer argument with _PyObject_CAST() or _PyObject_CAST_CONST(): * Py_REFCNT(), Py_TYPE(), Py_SIZE() * Py_SET_REFCNT(), Py_SET_TYPE(), Py_SET_SIZE() * Py_IS_TYPE() * Py_INCREF(), Py_DECREF() * Py_XINCREF(), Py_XDECREF() * Py_NewRef(), Py_XNewRef() * PyObject_TypeCheck() * PyType_Check() * PyType_CheckExact() Split Py_DECREF() implementation in 3 versions to make the code more readable. Update the xxlimited.c extension, which uses the limited C API version 3.11, to pass PyObject* to these functions.
* gh-91217: deprecate spwd (#91846)Brett Cannon2022-04-231-0/+7
| | | Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* gh-91291: Accept attributes as keyword arguments in decimal.localcontext ↵Sam Ezeh2022-04-222-57/+95
| | | | | (#32242) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-69093: Add indexing and slicing support to sqlite3.Blob (#91599)Erlend Egeberg Aasland2022-04-221-5/+202
| | | | Authored-by: Aviv Palivoda <palaviv@gmail.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@innova.no>
* gh-90623: signal.raise_signal() calls PyErr_CheckSignals() (#91756)Victor Stinner2022-04-212-1/+17
| | | | signal.raise_signal() and os.kill() now call PyErr_CheckSignals() to check immediately for pending signals.
* gh-91731: Replace Py_BUILD_ASSERT() with static_assert() (#91730)Victor Stinner2022-04-205-10/+17
| | | | | | | | | | | | Python 3.11 now uses C11 standard which adds static_assert() to <assert.h>. * In pytime.c, replace Py_BUILD_ASSERT() with preprocessor checks on SIZEOF_TIME_T with #error. * On macOS, py_mach_timebase_info() now accepts timebase members with the same size than _PyTime_t. * py_get_monotonic_clock() now saturates GetTickCount64() to _PyTime_MAX: GetTickCount64() is unsigned, whereas _PyTime_t is signed.
* gh-91734: Fix ossaudio support on Solaris (GH-91735)Jakub Kulík2022-04-201-0/+4
|
* bpo-46712: share more global strings in deepfreeze (gh-32152)Kumar Aditya2022-04-192-1/+2
| | | (for gh-90868)
* gh-91616: re module, fix .fullmatch() mismatch when using Atomic Grouping or ↵Ma Lin2022-04-191-7/+7
| | | | | | | | | Possessive Quantifiers (GH-91681) These jumps should use DO_JUMP0() instead of DO_JUMP(): - JUMP_POSS_REPEAT_1 - JUMP_POSS_REPEAT_2 - JUMP_ATOMIC_GROUP
* gh-90699: Use module state to access insert str object. (GH-91693)Dong-hee Na2022-04-191-3/+49
|
* gh-91526: io: Remove device encoding support from TextIOWrapper (GH-91529)Inada Naoki2022-04-191-50/+6
| | | | `TextIOWrapper.__init__()` called `os.device_encoding(file.fileno())` if fileno is 0-2 and encoding=None. But it is very rarely works, and never documented behavior.
* bpo-47256: Increasing the depth of backtracking in RE (GH-32411)Ma Lin2022-04-182-44/+44
| | | | | | | | | | Limit the maximum capturing group to 2**30-1 on 64-bit platforms (it was 2**31-1). No change on 32-bit platforms (2**28-1). It allows to reduce the size of SRE(match_context): - On 32 bit platform: 36 bytes, no change. (msvc2022) - On 64 bit platform: 72 bytes -> 56 bytes. (msvc2022/gcc9.4) which leads to increasing the depth of backtracking.