summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix format string in _PyImport_LoadDynamicModuleWithSpec() (GH-28863)Serhiy Storchaka2021-10-121-1/+1
|
* bpo-45439: Move _PyObject_CallNoArgs() to pycore_call.h (GH-28895)Victor Stinner2021-10-126-13/+18
| | | | | | | * Move _PyObject_CallNoArgs() to pycore_call.h (internal C API). * _ssl, _sqlite and _testcapi extensions now call the public PyObject_CallNoArgs() function, rather than _PyObject_CallNoArgs(). * _lsprof extension is now built with Py_BUILD_CORE_MODULE macro defined to get access to internal _PyObject_CallNoArgs().
* bpo-45439: Rename _PyObject_CallNoArg() to _PyObject_CallNoArgs() (GH-28891)Victor Stinner2021-10-116-10/+10
| | | | | Fix typo in the private _PyObject_CallNoArg() function name: rename it to _PyObject_CallNoArgs() to be consistent with the public function PyObject_CallNoArgs().
* bpo-45412: Move _Py_SET_53BIT_PRECISION_START to pycore_pymath.h (GH-28882)Victor Stinner2021-10-112-5/+5
| | | | | | | | | | | | | | | Move the following macros , to pycore_pymath.h (internal C API): * _Py_SET_53BIT_PRECISION_HEADER * _Py_SET_53BIT_PRECISION_START * _Py_SET_53BIT_PRECISION_END PEP 7: add braces to if and "do { ... } while (0)" in these macros. Move also _Py_get_387controlword() and _Py_set_387controlword() definitions to pycore_pymath.h. These functions are no longer exported. pystrtod.c now includes pycore_pymath.h.
* bpo-45412: Remove Py_SET_ERRNO_ON_MATH_ERROR() macro (GH-28820)Victor Stinner2021-10-111-2/+3
| | | | | | | | | | | | | | | | | | | | | | Remove the following math macros using the errno variable: * Py_ADJUST_ERANGE1() * Py_ADJUST_ERANGE2() * Py_OVERFLOWED() * Py_SET_ERANGE_IF_OVERFLOW() * Py_SET_ERRNO_ON_MATH_ERROR() Create pycore_pymath.h internal header file. Rename Py_ADJUST_ERANGE1() and Py_ADJUST_ERANGE2() to _Py_ADJUST_ERANGE1() and _Py_ADJUST_ERANGE2(), and convert these macros to static inline functions. Move the following macros to pycore_pymath.h: * _Py_IntegralTypeSigned() * _Py_IntegralTypeMax() * _Py_IntegralTypeMin() * _Py_InIntegralTypeRange()
* Handle error when PyUnicode_GetLength returns a negative value. (GH-28859)Dong-hee Na2021-10-111-0/+3
|
* Restore PEP 523 functionality. (GH-28871)Mark Shannon2021-10-112-6/+12
|
* Fix a leak in _PyImport_LoadDynamicModuleWithSpec() after failing ↵Serhiy Storchaka2021-10-111-1/+1
| | | | PySys_Audit() (GH-28862)
* bpo-29410: Change the default hash algorithm to SipHash13. (GH-28752)Inada Naoki2021-10-101-7/+72
| | | | Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no> Co-authored-by: Christian Heimes <christian@python.org>
* bpo-45256: Small cleanups for the code that inlines Python-to-Python calls ↵Pablo Galindo Salgado2021-10-091-11/+22
| | | | in ceval.c (GH-28836)
* bpo-45256: Remove the usage of the C stack in Python to Python calls (GH-28488)Pablo Galindo Salgado2021-10-091-29/+120
| | | | Ths commit inlines calls to Python functions in the eval loop and steals all the arguments in the call from the caller for performance.
* Fix typos in the Python directory (GH-28767)Christian Clauss2021-10-067-11/+11
|
* bpo-40116: Add insertion order bit-vector to dict values to allow dicts to ↵Mark Shannon2021-10-061-5/+6
| | | | share keys more freely. (GH-28520)
* Normalize jumps in compiler. All forward jumps to use JUMP_FORWARD. (GH-28755)Mark Shannon2021-10-062-12/+35
|
* bpo-45020: Identify which frozen modules are actually aliases. (gh-28655)Eric Snow2021-10-053-14/+92
| | | | | | | In the list of generated frozen modules at the top of Tools/scripts/freeze_modules.py, you will find that some of the modules have a different name than the module (or .py file) that is actually frozen. Let's call each case an "alias". Aliases do not come into play until we get to the (generated) list of modules in Python/frozen.c. (The tool for freezing modules, Programs/_freeze_module, is only concerned with the source file, not the module it will be used for.) Knowledge of which frozen modules are aliases (and the identity of the original module) normally isn't important. However, this information is valuable when we go to set __file__ on frozen stdlib modules. This change updates Tools/scripts/freeze_modules.py to map aliases to the original module name (or None if not a stdlib module) in Python/frozen.c. We also add a helper function in Python/import.c to look up a frozen module's alias and add the result of that function to the frozen info returned from find_frozen(). https://bugs.python.org/issue45020
* bpo-45324: Capture data in FrozenImporter.find_spec() to use in ↵Eric Snow2021-10-052-90/+245
| | | | | | | | | | | exec_module(). (gh-28633) Before this change we end up duplicating effort and throwing away data in FrozenImporter.find_spec(). Now we do the work once in find_spec() and the only thing we do in FrozenImporter.exec_module() is turn the raw frozen data into a code object and then exec it. We've added _imp.find_frozen(), add an arg to _imp.get_frozen_object(), and updated FrozenImporter. We've also moved some code around to reduce duplication, get a little more consistency in outcomes, and be more efficient. Note that this change is mostly necessary if we want to set __file__ on frozen stdlib modules. (See https://bugs.python.org/issue21736.) https://bugs.python.org/issue45324
* bpo-44050: Extension modules can share state when they don't support ↵Hai Shi2021-10-051-1/+3
| | | | | sub-interpreters. (GH-27794) Automerge-Triggered-By: GH:encukou
* bpo-43760: Check for tracing using 'bitwise or' instead of branch in ↵Mark Shannon2021-10-054-216/+244
| | | | dispatch. (GH-28723)
* Fix compiler warning in ceval.c regarding signed comparison (GH-28716)Pablo Galindo Salgado2021-10-041-1/+1
|
* bpo-45355: More use of sizeof(_Py_CODEUNIT) (GH-28720)Serhiy Storchaka2021-10-041-1/+1
|
* bpo-45355: Use sizeof(_Py_CODEUNIT) instead of literal 2 for the size of the ↵Serhiy Storchaka2021-10-032-11/+11
| | | | code unit (GH-28711)
* Remove trailing spaces. (GH-28706)Serhiy Storchaka2021-10-032-2/+2
|
* Fix a couple of compiler warnings. (GH-28677)Mark Shannon2021-10-011-2/+2
|
* bpo-41710: Add private _PyDeadline_Get() function (GH-28674)Victor Stinner2021-10-013-40/+77
| | | | | | | | Add a private C API for deadlines: add _PyDeadline_Init() and _PyDeadline_Get() functions. * Add _PyTime_Add() and _PyTime_Mul() functions which compute t1+t2 and t1*t2 and clamp the result on overflow. * _PyTime_MulDiv() now uses _PyTime_Add() and _PyTime_Mul().
* bpo-41710: Fix PY_TIMEOUT_MAX on Windows (GH-28673)Victor Stinner2021-10-011-5/+5
| | | | | | | | | | WaitForSingleObject() accepts timeout in milliseconds in the range [0; 0xFFFFFFFE] (DWORD type). INFINITE value (0xFFFFFFFF) means no timeout. 0xFFFFFFFE milliseconds is around 49.7 days. PY_TIMEOUT_MAX is (0xFFFFFFFE * 1000) milliseconds on Windows, around 49.7 days. Partially revert commit 37b8294d6295ca12553fd7c98778be71d24f4b24.
* bpo-41710: PyThread_acquire_lock_timed() uses sem_clockwait() (GH-28662)Victor Stinner2021-10-011-6/+33
| | | | | | | | | On Unix, if the sem_clockwait() function is available in the C library (glibc 2.30 and newer), the threading.Lock.acquire() method now uses the monotonic clock (time.CLOCK_MONOTONIC) for the timeout, rather than using the system clock (time.CLOCK_REALTIME), to not be affected by system clock changes. configure now checks if the sem_clockwait() function is available.
* bpo-45020: Add more test cases for frozen modules. (gh-28664)Eric Snow2021-10-011-2/+18
| | | | | I've added a number of test-only modules. Some of those cases are covered by the recently frozen stdlib modules (and some will be once we add encodings back in). However, I figured we'd play it safe by having a set of modules guaranteed to be there during tests. https://bugs.python.org/issue45020
* bpo-41710: PyThread_acquire_lock_timed() clamps the timout (GH-28643)Victor Stinner2021-09-302-33/+52
| | | | | | | | | | | | | | | | | | | 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: Fix building pytime.c on Windows (GH-28644)Victor Stinner2021-09-301-5/+5
|
* bpo-41710: Add pytime_add() and pytime_mul() (GH-28642)Victor Stinner2021-09-301-99/+96
| | | | | | Add pytime_add() and pytime_mul() functions to pytime.c to compute t+t2 and t*k with clamping to [_PyTime_MIN; _PyTime_MAX]. Fix pytime.h: _PyTime_FromTimeval() is not implemented on Windows.
* bpo-41710: Add _PyTime_AsTimespec_clamp() (GH-28629)Victor Stinner2021-09-302-81/+163
| | | | | | | | | | | | | | | 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-45211: Remember the stdlib dir during startup. (gh-28586)Eric Snow2021-09-283-1/+43
| | | | | 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
* Do not check isabs() on Windows. (gh-28584)Eric Snow2021-09-271-0/+2
| | | | | I missed this in gh-28550. https://bugs.python.org/issue45211
* bpo-45211: Move helpers from getpath.c to internal API. (gh-28550)Eric Snow2021-09-273-17/+100
| | | | | | | | | | | | 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-41299: Mark private thread_nt.h functions as static (GH-28553)Victor Stinner2021-09-241-10/+10
| | | | | | | | Mark the following thread_nt.h functions as static: * AllocNonRecursiveMutex() * FreeNonRecursiveMutex() * EnterNonRecursiveMutex() * LeaveNonRecursiveMutex()
* bpo-41299: Fix EnterNonRecursiveMutex() (GH-28548)Victor Stinner2021-09-241-3/+0
| | | Remove Py_FatalError() call: the code works even if now is negative.
* bpo-41299: QueryPerformanceFrequency() cannot fail (GH-28552)Victor Stinner2021-09-241-21/+7
| | | | | | py_win_perf_counter_frequency() no longer checks for QueryPerformanceFrequency() failure. According to the QueryPerformanceFrequency() documentation, the function can no longer fails since Windows XP.
* bpo-45020: Fix some corner cases for frozen module generation. (gh-28538)Eric Snow2021-09-241-2/+2
| | | | | This also includes some cleanup in preparation for a PR to make the "make all" output less noisy. https://bugs.python.org/issue45020
* bpo-20524: adds better error message for `.format()` (GH-28310)Nikita Sobolev2021-09-241-7/+19
| | | It now lists the bad format_spec and the type of the object.
* bpo-21302: time.sleep() uses waitable timer on Windows (GH-28483)Victor Stinner2021-09-221-0/+11
| | | | | | | | | | | | 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>
* bpo-45061: Detect refcount bug on empty tuple singleton (GH-28503)Victor Stinner2021-09-211-0/+10
| | | | | | Detect refcount bugs in C extensions when the empty tuple singleton is destroyed by mistake. Add the _Py_FatalRefcountErrorFunc() function.
* bpo-24076: Fix reference in sum() introduced by GH-28469 (GH-28493)Pablo Galindo Salgado2021-09-211-1/+2
|
* bpo-24076: Inline single digit unpacking in the integer fastpath of sum() ↵scoder2021-09-211-1/+9
| | | | (GH-28469)
* bpo-1514420: Do not attempt to open files with names in <>s when formatting ↵Irit Katriel2021-09-201-0/+9
| | | | | | an exception (GH-28143) Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* Clean up initialization __class_getitem__ with Py_GenericAlias. (GH-28450)Serhiy Storchaka2021-09-191-2/+2
| | | | | The cast to PyCFunction is redundant. Overuse of redundant casts can hide actual bugs.
* bpo-45020: Freeze os, site, and codecs. (gh-28398)Eric Snow2021-09-171-1/+10
| | | https://bugs.python.org/issue45020
* bpo-45219: Factor dictkey indexing (GH-28389)Mark Shannon2021-09-171-20/+19
|
* bpo-45107: Make LOAD_METHOD_CLASS safer and faster, clean up comments (GH-28177)Ken Jin2021-09-172-15/+9
| | | | | * Improve comments * Check cls is a type, remove dict calculation
* bpo-45203: fix compiler warnings (GH-28357)Ken Jin2021-09-171-0/+1
| | | Co-authored-by: Mark Shannon <mark@hotpy.org>
* bpo-45020: Drop the frozen .h files from the repo. (gh-28392)Eric Snow2021-09-1612-14430/+0
| | | | | The main advantage is that the files will no longer show up in diffs and PRs. That means, for a PR, the number of files / lines changed will more clearly reflect the actual change. (This is essentially an un-revert of gh-28375.) https://bugs.python.org/issue45020