summaryrefslogtreecommitdiff
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
...
* bpo-45434: pyport.h no longer includes <stdlib.h> (GH-28914)Victor Stinner2021-10-133-3/+5
| | | | | Include <stdlib.h> explicitly in C files. Python.h includes <wchar.h>.
* bpo-45434: Remove pystrhex.h header file (GH-28923)Victor Stinner2021-10-132-22/+36
| | | | | | | | | | | | | | | Move Include/pystrhex.h to Include/internal/pycore_strhex.h. The header file only contains private functions. The following C extensions are now built with Py_BUILD_CORE_MODULE macro defined to get access to the internal C API: * _blake2 * _hashopenssl * _md5 * _sha1 * _sha3 * _ssl * binascii
* bpo-45340: Don't create object dictionaries unless actually needed (GH-28802)Mark Shannon2021-10-135-10/+25
| | | | | | | | | | | | | | * Never change types' cached keys. It could invalidate inline attribute objects. * Lazily create object dictionaries. * Update specialization of LOAD/STORE_ATTR. * Don't update shared keys version for deletion of value. * Update gdb support to handle instance values. * Rename SPLIT_KEYS opcodes to INSTANCE_VALUE.
* bpo-45434: Move _Py_BEGIN_SUPPRESS_IPH to pycore_fileutils.h (GH-28922)Victor Stinner2021-10-132-20/+19
|
* pycore_pystate.h no longer redefines PyThreadState_GET() (GH-28921)Victor Stinner2021-10-134-19/+10
| | | | | | | | | | | | | | | | | | | | | | Redefining the PyThreadState_GET() macro in pycore_pystate.h is useless since it doesn't affect files not including it. Either use _PyThreadState_GET() directly, or don't use pycore_pystate.h internal C API. For example, the _testcapi extension don't use the internal C API, but use the public PyThreadState_Get() function instead. Replace PyThreadState_Get() with _PyThreadState_GET(). The _PyThreadState_GET() macro is more efficient than PyThreadState_Get() and PyThreadState_GET() function calls which call fail with a fatal Python error. posixmodule.c and _ctypes extension now include <windows.h> before pycore header files (like pycore_call.h). _PyTraceback_Add() now uses _PyErr_Fetch()/_PyErr_Restore() instead of PyErr_Fetch()/PyErr_Restore(). The _decimal and _xxsubinterpreters extensions are now built with the Py_BUILD_CORE_MODULE macro defined to get access to the internal C API.
* bpo-45434: bytearrayobject.h no longer includes <stdarg.h> (GH-28913)Victor Stinner2021-10-134-5/+3
| | | | bytearrayobject.h and _lzmamodule.c don't use va_list and so don't need to include <stdarg.h>.
* bpo-45434: Convert Py_GETENV() macro to a function (GH-28912)Victor Stinner2021-10-131-1/+1
| | | Avoid calling directly getenv() in the header file.
* bpo-45439: Move _PyObject_CallNoArgs() to pycore_call.h (GH-28895)Victor Stinner2021-10-122-9/+7
| | | | | | | * 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-122-2/+2
| | | | | Fix typo in the private _PyObject_CallNoArg() function name: rename it to _PyObject_CallNoArgs() to be consistent with the public function PyObject_CallNoArgs().
* bpo-45439: _PyObject_Call() only checks tp_vectorcall_offset once (GH-28890)Victor Stinner2021-10-121-0/+1
| | | | | | Add _PyVectorcall_Call() helper function. Add "assert(PyCallable_Check(callable));" to PyVectorcall_Call(), similar check than PyVectorcall_Function().
* bpo-45412: Move copysign() define to pycore_pymath.h (GH-28889)Victor Stinner2021-10-122-52/+49
| | | | | Move definitions of copysign(), round(), hypot(), fmod(), etc. from pymath.h to pycore_pymath.h. These functions are not exported by libpython and so must not be part of the C API.
* bpo-41123: Remove Py_UNICODE_COPY() and Py_UNICODE_FILL() (GH-28887)Victor Stinner2021-10-111-13/+0
|
* bpo-45434: Python.h no longer includes <stdlib.h> (GH-28888)Victor Stinner2021-10-111-1/+0
|
* bpo-45412: Move _Py_SET_53BIT_PRECISION_START to pycore_pymath.h (GH-28882)Victor Stinner2021-10-113-85/+108
| | | | | | | | | | | | | | | 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: Update _Py_ADJUST_ERANGE1() comment (GH-28884)Victor Stinner2021-10-111-2/+9
| | | Copy the comment from the removed Py_OVERFLOWED() function.
* bpo-45434: Cleanup Python.h header file (GH-28883)Victor Stinner2021-10-112-52/+39
| | | | | | * Move limits.h include and UCHAR_MAX checks to pyport.h. * Move sanitizers macros to pyport.h. * Remove comment about <assert.h>: C extensions are built with NDEBUG automatically by Python.
* bpo-45412: Remove Py_SET_ERRNO_ON_MATH_ERROR() macro (GH-28820)Victor Stinner2021-10-113-109/+73
| | | | | | | | | | | | | | | | | | | | | | 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()
* Restore PEP 523 functionality. (GH-28871)Mark Shannon2021-10-111-0/+3
|
* bpo-29410: Change the default hash algorithm to SipHash13. (GH-28752)Inada Naoki2021-10-101-4/+4
| | | | Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no> Co-authored-by: Christian Heimes <christian@python.org>
* bpo-45256: Remove the usage of the C stack in Python to Python calls (GH-28488)Pablo Galindo Salgado2021-10-092-0/+3
| | | | 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 Include directory (GH-28745)Christian Clauss2021-10-067-8/+8
|
* bpo-40116: Add insertion order bit-vector to dict values to allow dicts to ↵Mark Shannon2021-10-062-1/+10
| | | | share keys more freely. (GH-28520)
* bpo-45020: Identify which frozen modules are actually aliases. (gh-28655)Eric Snow2021-10-051-0/+7
| | | | | | | 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
* Post 3.11.0a1Pablo Galindo2021-10-051-1/+1
|
* Python 3.11.0a1v3.11.0a1Pablo Galindo2021-10-051-2/+2
|
* bpo-43760: Check for tracing using 'bitwise or' instead of branch in ↵Mark Shannon2021-10-051-0/+1
| | | | dispatch. (GH-28723)
* bpo-41710: Add private _PyDeadline_Get() function (GH-28674)Victor Stinner2021-10-011-0/+16
| | | | | | | | 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: Document _PyTime_t API in pytime.h (GH-28647)Victor Stinner2021-09-301-0/+41
|
* bpo-41710: PyThread_acquire_lock_timed() clamps the timout (GH-28643)Victor Stinner2021-09-302-3/+7
| | | | | | | | | | | | | | | | | | | 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_add() and pytime_mul() (GH-28642)Victor Stinner2021-09-301-3/+5
| | | | | | 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-301-5/+11
| | | | | | | | | | | | | | | 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-0/+3
| | | | | 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-45211: Move helpers from getpath.c to internal API. (gh-28550)Eric Snow2021-09-272-0/+26
| | | | | | | | | | | | 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-21302: time.sleep() uses waitable timer on Windows (GH-28483)Victor Stinner2021-09-221-0/+6
| | | | | | | | | | | | 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-222-2/+2
| | | | | 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-45061: Detect refcount bug on empty tuple singleton (GH-28503)Victor Stinner2021-09-211-0/+6
| | | | | | Detect refcount bugs in C extensions when the empty tuple singleton is destroyed by mistake. Add the _Py_FatalRefcountErrorFunc() function.
* bpo-45116: Py_DEBUG ignores Py_ALWAYS_INLINE (GH-28419)Victor Stinner2021-09-171-1/+10
| | | | If the Py_DEBUG macro is defined, the Py_ALWAYS_INLINE macro does nothing.
* bpo-45116: Add the Py_ALWAYS_INLINE macro (GH-28390)Victor Stinner2021-09-171-0/+22
| | | | | Add the Py_ALWAYS_INLINE macro to ask the compiler to always inline a static inline function. The compiler can ignore it and decides to not inline the function.
* bpo-45219: Factor dictkey indexing (GH-28389)Mark Shannon2021-09-171-1/+3
|
* bpo-21302: Add _PyTime_AsNanoseconds() (GH-28350)Victor Stinner2021-09-151-0/+3
| | | | | | | | | | | | | | | | | 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().
* bpo-45020: Add -X frozen_modules=[on|off] to explicitly control use of ↵Eric Snow2021-09-143-0/+5
| | | | | | | frozen modules. (gh-28320) Currently we freeze several modules into the runtime. For each of these modules it is essential to bootstrapping the runtime that they be frozen. Any other stdlib module that we later freeze into the runtime is not essential. We can just as well import from the .py file. This PR lets users explicitly choose which should be used, with the new "-X frozen_modules=[on|off]" CLI flag. The default is "off" for now. https://bugs.python.org/issue45020
* bpo-45152: Add HAS_CONST macro and get_const_value() function and use… ↵Irit Katriel2021-09-141-0/+4
| | | | (#28262)
* bpo-39573: Py_TYPE becomes a static inline function (GH-28128)Victor Stinner2021-09-081-2/+8
| | | | | 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.
* bpo-45123: PyAiter_Check and PyObject_GetAiter fix & rename. (GH-28194)Yury Selivanov2021-09-071-2/+2
| | | | | | | | Fix PyAiter_Check to only check for the `__anext__` presense (not for `__aiter__`). Rename `PyAiter_Check()` to `PyAIter_Check()`, `PyObject_GetAiter()` -> `PyObject_GetAIter()`. Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-45094: Add Py_NO_INLINE macro (GH-28140)Victor Stinner2021-09-032-18/+14
| | | | | * Rename _Py_NO_INLINE macro to Py_NO_INLINE: make it public and document it. * Sort macros in the C API documentation.
* bpo-44945: Specialize BINARY_ADD (GH-27967)Mark Shannon2021-08-273-26/+34
|
* bpo-44990: Change layout of evaluation frames. "Layout B" (GH-27933)Mark Shannon2021-08-251-7/+37
| | | Places the locals between the specials and stack. This is the more "natural" layout for a C struct, makes the code simpler and gives a slight speedup (~1%)
* bpo-44874: deprecate Py_TRASHCAN_SAFE_BEGIN and Py_TRASHCAN_SAFE_END (GH-27693)Irit Katriel2021-08-181-4/+13
| | | | Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44895: Introduce PYTHONDUMPREFSFILE variable for refcount dumping (GH-27767)Dong-hee Na2021-08-181-0/+1
|