summaryrefslogtreecommitdiff
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* bpo-41710: gc_collect_main() uses _PyTime_GetPerfCounter() (GH-28676)Victor Stinner2021-10-011-2/+2
| | | | | | | | | If the DEBUG_STATS debug flag is set, gc_collect_main() now uses _PyTime_GetPerfCounter() instead of _PyTime_GetMonotonicClock() to measure the elapsed time. On Windows, _PyTime_GetMonotonicClock() only has a resolution of 15.6 ms, whereas _PyTime_GetPerfCounter() is closer to a resolution of 100 ns.
* bpo-41710: PyThread_acquire_lock_timed() clamps the timout (GH-28643)Victor Stinner2021-09-303-3/+3
| | | | | | | | | | | | | | | | | | | PyThread_acquire_lock_timed() now clamps the timeout into the [_PyTime_MIN; _PyTime_MAX] range (_PyTime_t type) if it is too large, rather than calling Py_FatalError() which aborts the process. PyThread_acquire_lock_timed() no longer uses MICROSECONDS_TO_TIMESPEC() to compute sem_timedwait() argument, but _PyTime_GetSystemClock() and _PyTime_AsTimespec_truncate(). Fix _thread.TIMEOUT_MAX value on Windows: the maximum timeout is 0x7FFFFFFF milliseconds (around 24.9 days), not 0xFFFFFFFF milliseconds (around 49.7 days). Set PY_TIMEOUT_MAX to 0x7FFFFFFF milliseconds, rather than 0xFFFFFFFF milliseconds. Fix PY_TIMEOUT_MAX overflow test: replace (us >= PY_TIMEOUT_MAX) with (us > PY_TIMEOUT_MAX).
* bpo-41710: Add _PyTime_AsTimespec_clamp() (GH-28629)Victor Stinner2021-09-304-4/+47
| | | | | | | | | | | | | | | Add the _PyTime_AsTimespec_clamp() function: similar to _PyTime_AsTimespec(), but clamp to _PyTime_t min/max and don't raise an exception. PyThread_acquire_lock_timed() now uses _PyTime_AsTimespec_clamp() to remove the Py_UNREACHABLE() code path. * Add _PyTime_AsTime_t() function. * Add PY_TIME_T_MIN and PY_TIME_T_MAX constants. * Replace _PyTime_AsTimeval_noraise() with _PyTime_AsTimeval_clamp(). * Add pytime_divide_round_up() function. * Fix integer overflow in pytime_divide(). * Add pytime_divmod() function.
* bpo-43753: _operator.is_() uses Py_Is() (GH-28641)Victor Stinner2021-09-301-4/+2
|
* bpo-45211: Remember the stdlib dir during startup. (gh-28586)Eric Snow2021-09-281-0/+10
| | | | | During runtime startup we figure out the stdlib dir but currently throw that information away. This change preserves it and exposes it via PyConfig.stdlib_dir, _Py_GetStdlibDir(), and sys._stdlib_dir. https://bugs.python.org/issue45211
* bpo-35606: Fix math.prod tests using 'start' as keyword parameter (GH-28595)Pablo Galindo Salgado2021-09-281-8/+3
|
* bpo-45211: Move helpers from getpath.c to internal API. (gh-28550)Eric Snow2021-09-271-56/+8
| | | | | | | | | | | | This accomplishes 2 things: * consolidates some common code between getpath.c and getpathp.c * makes the helpers available to code in other files FWIW, the signature of the join_relfile() function (in fileutils.c) intentionally mirrors that of Windows' PathCchCombineEx(). Note that this change is mostly moving code around. No behavior is meant to change. https://bugs.python.org/issue45211
* bpo-44958: Revert GH-27844 (GH-28574)Erlend Egeberg Aasland2021-09-263-40/+39
| | | | This reverts commit 050d1035957379d70e8601e6f5636637716a264b, but keeps the tests.
* bpo-21302: Add nanosleep() implementation for time.sleep() in Unix (GH-28545)Victor Stinner2021-09-251-23/+33
| | | Co-authored-by: Livius <egyszeregy@freemail.hu>
* bpo-44019: Implement operator.call(). (GH-27888)Antony Lee2021-09-241-0/+22
| | | | | | Having `operator.call(obj, arg)` mean `type(obj).__call__(obj, arg)` is consistent with the other dunder operators. The semantics with `*args, **kwargs` then follow naturally from the single-arg semantics.
* bpo-21302: time.sleep() uses waitable timer on Windows (GH-28483)Victor Stinner2021-09-221-43/+110
| | | | | | | | | | | | On Windows, time.sleep() now uses a waitable timer which has a resolution of 100 ns (10^-7 sec). Previously, it had a solution of 1 ms (10^-3 sec). * On Windows, time.sleep() now calls PyErr_CheckSignals() before resetting the SIGINT event. * Add _PyTime_As100Nanoseconds() function. * Complete and update time.sleep() documentation. Co-authored-by: Livius <egyszeregy@freemail.hu>
* [codemod] Fix non-matching bracket pairs (GH-28473)Mohamad Mansour2021-09-225-7/+7
| | | | | Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44958: Only reset `sqlite3` statements when needed (GH-27844)Erlend Egeberg Aasland2021-09-213-39/+40
|
* bpo-45041: Simplify `sqlite3.Cursor.executescript()` (GH-28020)Erlend Egeberg Aasland2021-09-191-42/+25
|
* bpo-45040: Simplify sqlite3 transaction control functions (GH-28019)Erlend Egeberg Aasland2021-09-192-63/+28
|
* Clean up initialization __class_getitem__ with Py_GenericAlias. (GH-28450)Serhiy Storchaka2021-09-197-9/+9
| | | | | The cast to PyCFunction is redundant. Overuse of redundant casts can hide actual bugs.
* bpo-45228: Fix stack buffer overflow in parsing J1939 address (GH-28404)Serhiy Storchaka2021-09-171-8/+8
|
* bpo-21302: Add _PyTime_AsNanoseconds() (GH-28350)Victor Stinner2021-09-152-43/+37
| | | | | | | | | | | | | | | | | Refactor pytime.c: * Add pytime_from_nanoseconds() and pytime_as_nanoseconds(), and use explicitly these functions * Add two empty lines between functions * PEP 7: add braces { ... } * C99: declare variables where they are set * Rename private functions to lowercase * Rename error_time_t_overflow() to pytime_time_t_overflow() * Rename win_perf_counter_frequency() to py_win_perf_counter_frequency() * py_get_monotonic_clock(): add an assertion to detect overflow when mach_absolute_time() unsigned uint64_t is casted to _PyTime_t (signed int64_t). _testcapi: use _PyTime_FromNanoseconds().
* closes bpo-45190: Update Unicode data to version 14.0.0. (GH-28336)Benjamin Peterson2021-09-143-30621/+31662
|
* bpo-21302: Add clock_nanosleep() implementation for time.sleep() (GH-28111)Livius2021-09-131-5/+31
| | | | | | In Unix operating systems, time.sleep() now uses the clock_nanosleep() function, if available, which allows to sleep for an interval specified with nanosecond precision. Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-45126: Fix ref. leak in `sqlite3.Connection.__init__` (GH-28231)Erlend Egeberg Aasland2021-09-122-13/+49
|
* bpo-43413: Fix handling keyword arguments in subclasses of some buitin ↵Serhiy Storchaka2021-09-1211-33/+58
| | | | | | | | classes (GH-26456) * Constructors of subclasses of some buitin classes (e.g. tuple, list, frozenset) no longer accept arbitrary keyword arguments. * Subclass of set can now define a __new__() method with additional keyword parameters without overriding also __init__().
* bpo-44987: Speed up unicode normalization of ASCII strings (GH-28283)Dong-hee Na2021-09-111-0/+4
|
* bpo-45163: Haiku build fix. (GH-28269)David CARLIER2021-09-111-1/+1
| | | | | | linkage issues mainly for shared libs and missing system library, also little nit into the signal extension as strsignal returns a constant in this platform.
* bpo-40563: Support pathlike objects on dbm/shelve (GH-21849)Henry-Joseph Audéoud2021-09-104-24/+12
| | | | Co-authored-by: Hakan Çelik <hakancelik96@outlook.com>
* bpo-45067 - Verify the version of ncurses for extended color support feature ↵Senthil Kumaran2021-09-091-2/+2
| | | | | | | | | | | | | | usage. (GH-28260) * issue45067 - Fix _curses compilation in CentOS 7. Verify the version of ncurses for extended color support feature usage. The function extended_color_content was introduced in 2017. The ncurses-devel package in CentOS 7 had a older version ncurses resulted in compilation error. For compiling ncurses with extended color support, we verify the version of the ncurses library. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-44219: Release the GIL during isatty syscalls (GH-28250)Vincent Michel2021-09-091-0/+2
| | | | | | Release the GIL while performing isatty() system calls on arbitrary file descriptors. In particular, this affects os.isatty(), os.device_encoding() and io.TextIOWrapper. By extension, io.open() in text mode is also affected.
* bpo-38371: Remove deprecated `tkinter` split() method (GH-28237)Erlend Egeberg Aasland2021-09-082-211/+1
|
* bpo-39573: Py_TYPE becomes a static inline function (GH-28128)Victor Stinner2021-09-081-4/+3
| | | | | Convert the Py_TYPE() and Py_SIZE() macros to static inline functions. The Py_SET_TYPE() and Py_SET_SIZE() functions must now be used to set an object type and size.
* Remove documentation for non-existing socket class attributes (GH-28029)Matti Picus2021-09-071-3/+0
| | | The functions in question are available on the module-level only.
* bpo-45012: Release GIL around stat in os.scandir (GH-28085)Stanisław Skonieczny2021-09-071-2/+8
| | | | | Releasing GIL allows other threads to continue its work when os.scandir is fetching DirEntry.stat info from file system.
* bpo-42064: Pass module state to trace, progress, and authorizer callbacks ↵Erlend Egeberg Aasland2021-09-072-73/+111
| | | | | | | | (GH-27940) - add print-or-clear traceback helper - add helpers to clear and visit saved contexts - modify callbacks to use the new callback_context struct
* bpo-45034: Fix how upper limit is formatted for `struct.pack("H", ...)` ↵Nikita Sobolev2021-09-071-6/+6
| | | | | | (GH-28178) Co-authored-by: Mark Dickinson <dickinsm@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-44991: Normalise `sqlite3` callback naming (GH-28088)Erlend Egeberg Aasland2021-09-072-52/+59
| | | | | | | | - all callbacks are now named xxx_callback - normalise callable naming in set_*() functions - normalise context argument naming in callbacks The sqlite code is being "touched" in bpo-42064 (and related issues); this style change makes it easier to work with and review.
* Remove unused macros from Modules/_sqlite/microprotocols.h (GH-28171)Erlend Egeberg Aasland2021-09-051-6/+0
|
* bpo-45094: Add Py_NO_INLINE macro (GH-28140)Victor Stinner2021-09-033-4/+4
| | | | | * Rename _Py_NO_INLINE macro to Py_NO_INLINE: make it public and document it. * Sort macros in the C API documentation.
* bpo-45082: Cleanup ctypes.c_buffer alias (GH-28129)Victor Stinner2021-09-021-2/+2
| | | | | * Remove commented deprecation of ctypes.c_buffer. * Remove references to ctypes.c_string which doesn't exist. * Remove StringTestCase: it only had skipped test methods.
* bpo-43613: Faster implementation of gzip.compress and gzip.decompress (GH-27941)Ruben Vorderman2021-09-022-13/+28
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-37330: open() no longer accept 'U' in file mode (GH-28118)Victor Stinner2021-09-022-29/+3
| | | | | open(), io.open(), codecs.open() and fileinput.FileInput no longer accept "U" ("universal newline") in the file mode. This flag was deprecated since Python 3.3.
* bpo-45085: Remove the binhex module (GH-28117)Victor Stinner2021-09-022-558/+1
| | | | | | | | | | The binhex module, deprecated in Python 3.9, is now removed. The following binascii functions, deprecated in Python 3.9, are now also removed: * a2b_hqx(), b2a_hqx(); * rlecode_hqx(), rledecode_hqx(). The binascii.crc_hqx() function remains available.
* bpo-45060: Get rid of few uses of the equality operators with None (GH-28087)Serhiy Storchaka2021-08-312-4/+4
|
* bpo-42064: Offset arguments for PyObject_Vectorcall in the _sqlite module ↵Petr Viktorin2021-08-312-10/+14
| | | | | | | (GH-27931) This allows e.g. methods to be called efficiently by providing space for a "self" argument; see PY_VECTORCALL_ARGUMENTS_OFFSET docs.
* bpo-44991: Make GIL handling more explicit in `sqlite3` callbacks (GH-27934)Erlend Egeberg Aasland2021-08-311-35/+27
| | | | | | | | - acquire the GIL at the very start[1] - release the GIL at the very end [1] The trace callback performs a sanity check before acquiring the GIL Automerge-Triggered-By: GH:encukou
* bpo-16379: expose SQLite error codes and error names in `sqlite3` (GH-27786)Erlend Egeberg Aasland2021-08-303-29/+153
|
* bpo-44689: ctypes.util.find_library() now finds macOS 11+ system libraries ↵Tobias Bergkvist2021-08-301-3/+26
| | | | | when built on older macOS systems (#27251) Previously, when built on older macOS systems, `find_library` was not able to find macOS system libraries when running on Big Sur due to changes in how system libraries are stored.
* bpo-44394: Update libexpat copy to 2.4.1 (GH-26945)Victor Stinner2021-08-2920-177/+1368
| | | | | | | Update the vendored copy of libexpat to 2.4.1 (from 2.2.8) to get the fix for the CVE-2013-0340 "Billion Laughs" vulnerability. This copy is most used on Windows and macOS. Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* Fix typo in a comment in Modules/_ssl.c: s/validata/validate/ (GH-27993)Adam Dangoor2021-08-271-1/+1
|
* bpo-41818: Add termios.tcgetwinsize(), termios.tcsetwinsize(). (GH-23686)Soumendra Ganguly2021-08-262-1/+223
| | | | | | | | | | | | * Add termios.tcgetwinsize(), termios.tcsetwinsize(). Update docs. * Add TIOCGSIZE support to termios.tcgetwinsize() * Add TIOCSSIZE support to termios.tcsetwinsize() Authored-by: Soumendra Ganguly <soumendraganguly@gmail.com> * termios.tcgetwinsize() and termios.tcsetwinsize() should return/accept two-item tuples instead of lists. * Refactor tcsetwinsize to share common code and accept any two item sequence, with overflow checking. Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
* bpo-27334: Fix reference leak introduced by GH-26202 (GH-27942)Erlend Egeberg Aasland2021-08-251-0/+1
|
* bpo-27334: roll back transaction if sqlite3 context manager fails to commit ↵Erlend Egeberg Aasland2021-08-251-7/+21
| | | | | | (GH-26202) Co-authored-by: Luca Citi Co-authored-by: Berker Peksag <berker.peksag@gmail.com>