summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-91719: Add pycore_opcode.h internal header file (#91906)Victor Stinner2022-04-253-6/+8
| | | | | | | | | | | Move the following API from Include/opcode.h (public C API) to a new Include/internal/pycore_opcode.h header file (internal C API): * EXTRA_CASES * _PyOpcode_Caches * _PyOpcode_Deopt * _PyOpcode_Jump * _PyOpcode_OpName * _PyOpcode_RelativeJump
* gh-84461: Add sys._emscripten_info, improve docs and build (gh-91781)Christian Heimes2022-04-231-0/+118
|
* gh-89279: In ceval.c, redefine some macros for speed (#32387)Guido van Rossum2022-04-221-13/+60
| | | | | | | | | | | Macros Py_DECREF, Py_XDECREF, Py_IS_TYPE, _Py_atomic_load_32bit_impl and _Py_DECREF_SPECIALIZED are redefined as macros that completely replace the inline functions of the same name. These three came out in the top four of functions that (in MSVC) somehow weren't inlined. Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* gh-91768: C API no longer use "const PyObject*" type (#91769)Victor Stinner2022-04-211-4/+6
| | | | | | | | | | | | | Py_REFCNT(), Py_TYPE(), Py_SIZE() and Py_IS_TYPE() functions argument type is now "PyObject*", rather than "const PyObject*". * Replace also "const PyObject*" with "PyObject*" in functions: * _Py_strhex_impl() * _Py_strhex_with_sep() * _Py_strhex_bytes_with_sep() * Remove _PyObject_CAST_CONST() and _PyVarObject_CAST_CONST() macros. * Py_IS_TYPE() can now use Py_TYPE() in its implementation.
* GH-91719: Make MSVC generate somewhat faster switch code (#91718)Guido van Rossum2022-04-211-2/+4
| | | | | | | | | | | Apparently a switch on an 8-bit quantity where all cases are present generates a more efficient jump (doing only one indexed memory load instead of two). So we make opcode and use_tracing uint8_t, and generate a macro full of extra `case NNN:` lines for all unused opcodes. See https://github.com/faster-cpython/ideas/issues/321#issuecomment-1103263673
* GH-88116: Use a compact format to represent end line and column offsets. ↵Mark Shannon2022-04-212-178/+145
| | | | | | | | | | | | (GH-91666) * Stores all location info in linetable to conform to PEP 626. * Remove column table from code objects. * Remove end-line table from code objects. * Document new location table format
* gh-91731: Replace Py_BUILD_ASSERT() with static_assert() (#91730)Victor Stinner2022-04-203-25/+44
| | | | | | | | | | | | 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.
* Cast to (destructor) to fix compiler warnings (GH-91711)Dennis Sweeney2022-04-201-11/+11
|
* gh-90667: Add specializations of Py_DECREF when types are known (GH-30872)Dennis Sweeney2022-04-192-41/+45
|
* bpo-46712: share more global strings in deepfreeze (gh-32152)Kumar Aditya2022-04-191-0/+3
| | | (for gh-90868)
* gh-91625: Don't ignore extended args of adaptive opcodes (GH-91626)Dennis Sweeney2022-04-171-16/+21
|
* Fix refleaks in PyErr_SetHandledException (GH-91627)Dennis Sweeney2022-04-171-3/+2
|
* gh-78607: Replace __ltrace__ with __lltrace__ (GH-91619)Dennis Sweeney2022-04-161-1/+1
|
* gh-91462: Make lltrace output human-readable. (GH-91463)Dennis Sweeney2022-04-161-35/+83
| | | | | | * Transform opcodes into opnames * Print the whole stack at each opcode, and eliminate prtrace output at each (push/pop/stackadj) * Display info about the function at each resume_frame
* Fix an out of date comment in compile.c (GH-91615)Irit Katriel2022-04-161-1/+2
|
* gh-89770: Implement PEP-678 - Exception notes (GH-31317)Irit Katriel2022-04-161-24/+57
|
* gh-91276: Make JUMP_IF_TRUE_OR_POP/JUMP_IF_FALSE_OR_POP relative (GH-32215)Irit Katriel2022-04-152-4/+19
|
* gh-90501: Add PyErr_GetHandledException and PyErr_SetHandledException (GH-30531)Irit Katriel2022-04-151-8/+33
|
* gh-90699: Use _Py_STR(empty) instead of PyUnicode_New(0, 0) for BUILD_STRING ↵Dennis Sweeney2022-04-151-6/+2
| | | | (GH-91476)
* gh-89455: Fix an uninitialized bool in exception print context. (#91466)Gregory P. Smith2022-04-141-0/+1
| | | | | | | | | | | | | | | | | | | | | Fix an uninitialized bool in exception print context. `struct exception_print_context.need_close` was uninitialized. Found by oss-fuzz in a test case running under the undefined behavior sanitizer. https://oss-fuzz.com/testcase-detail/6217746058182656 ``` Python/pythonrun.c:1241:28: runtime error: load of value 253, which is not a valid value for type 'bool' #0 0xbf2203 in print_chained cpython3/Python/pythonrun.c:1241:28 #1 0xbea4bb in print_exception_cause_and_context cpython3/Python/pythonrun.c:1320:19 #2 0xbea4bb in print_exception_recursive cpython3/Python/pythonrun.c:1470:13 #3 0xbe9e39 in _PyErr_Display cpython3/Python/pythonrun.c:1517:9 ``` Pretty obvious what the ommission was upon code inspection.
* Fill holes in internal compiler structs (#91458)L. A. F. Pereira2022-04-131-18/+18
|
* bpo-45995: add "z" format specifer to coerce negative 0 to zero (GH-30049)John Belmonte2022-04-113-2/+49
| | | | | | | | Add "z" format specifier to coerce negative 0 to zero. See https://github.com/python/cpython/issues/90153 (originally https://bugs.python.org/issue45995) for discussion. This covers `str.format()` and f-strings. Old-style string interpolation is not supported. Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NONE/NOT_NONE relative (GH-32400)Irit Katriel2022-04-114-75/+225
|
* Fix some typos in comments (GH-32422)jonasdlindner2022-04-091-1/+1
|
* bpo-47000: Add `locale.getencoding()` (GH-32068)Inada Naoki2022-04-092-10/+16
|
* bpo-47260: Fix os.closerange() potentially being a no-op in a seccomp ↵Alexey Izbyshev2022-04-081-4/+5
| | | | | | | | | | | | | | | | | | sandbox (GH-32418) _Py_closerange() currently assumes that close_range() closes all file descriptors even if it returns an error (other than ENOSYS). This assumption can be wrong on Linux if a seccomp sandbox denies the underlying syscall, pretending that it returns EPERM or EACCES. In this case _Py_closerange() won't close any descriptors at all, which in the worst case can be a security issue. Fix this by falling back to other methods in case of any close_range() error. Note that fallbacks will not be triggered on any problems with closing individual file descriptors because close_range() is documented to ignore such errors on both Linux[1] and FreeBSD[2]. [1] https://man7.org/linux/man-pages/man2/close_range.2.html [2] https://www.freebsd.org/cgi/man.cgi?query=close_range&sektion=2
* bpo-47177: Replace `f_lasti` with `prev_instr` (GH-32208)Brandt Bucher2022-04-073-37/+47
|
* bpo-35134: Remove the Include/code.h header file (GH-32385)Victor Stinner2022-04-075-5/+0
| | | | | | Remove the Include/code.h header file. C extensions should only include the main <Python.h> header file. Python.h includes directly Include/cpython/code.h instead.
* bpo-47009: Fix assert on big endian (GH-32332)Christian Heimes2022-04-051-1/+1
|
* bpo-47120: make JUMP_NO_INTERRUPT relative (GH-32221)Irit Katriel2022-04-053-23/+32
|
* bpo-47186: Replace JUMP_IF_NOT_EG_MATCH by CHECK_EG_MATCH + jump (GH-32309)Irit Katriel2022-04-053-28/+32
|
* bpo-47009: Let PRECALL_NO_KW_LIST_APPEND do its own POP_TOP (GH-32239)Dennis Sweeney2022-04-052-5/+8
|
* bpo-47000: Make `io.text_encoding()` respects UTF-8 mode (GH-32003)Inada Naoki2022-04-041-1/+4
| | | Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* bpo-47176: Interrupt handling for wasm32-emscripten builds without pthreads ↵Hood Chatham2022-04-032-0/+58
| | | | | | (GH-32209) Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: Brett Cannon <brett@python.org>
* bpo-47172: Compiler enhancements (GH-32200)Irit Katriel2022-04-011-36/+41
| | | | | | | | * Make virtual opcodes negative. * Make is_jump detect only actual jumps. * Use is_block_push for the exception block setup opcodes.
* bpo-47186: Replace JUMP_IF_NOT_EXC_MATCH by CHECK_EXC_MATCH + jump (GH-32231)Irit Katriel2022-04-013-15/+15
|
* bpo-47009: Streamline list.append for the common case (GH-31864)Dennis Sweeney2022-04-011-9/+4
|
* bpo-47120: Replace the JUMP_ABSOLUTE opcode by the relative JUMP_BACKWARD ↵Irit Katriel2022-03-314-85/+104
| | | | (GH-32115)
* bpo-47164: Add _PyCFunction_CAST() macro (GH-32192)Victor Stinner2022-03-316-36/+36
| | | Use the macro in C files of the Python/ directory.
* bpo-47164: Add _PyASCIIObject_CAST() macro (GH-32191)Victor Stinner2022-03-311-6/+6
| | | | | | | | | | | | Add macros to cast objects to PyASCIIObject*, PyCompactUnicodeObject* and PyUnicodeObject*: _PyASCIIObject_CAST(), _PyCompactUnicodeObject_CAST() and _PyUnicodeObject_CAST(). Using these new macros make the code more readable and check their argument with: assert(PyUnicode_Check(op)). Remove redundant assert(PyUnicode_Check(op)) in macros using directly or indirectly these new CAST macros. Replacing existing casts with these macros.
* bpo-47162: Add call trampoline to mitigate bad fpcasts on Emscripten (GH-32189)Christian Heimes2022-03-303-6/+20
|
* Merge deoptimization blocks in interpreter (GH-32155)Mark Shannon2022-03-302-36/+26
|
* bpo-46864: Suppress even more ob_shash deprecation warnings (GH-32176)Christian Heimes2022-03-301-0/+5
|
* bpo-47053: Refactor BINARY_OP_INPLACE_ADD_UNICODE (GH-32122)Dennis Sweeney2022-03-291-14/+18
|
* bpo-47127: Specialize calls for fastcall c methods with keywords (GH-32125)Kumar Aditya2022-03-273-11/+47
| | | | * add PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS
* bpo-43224: Implement PEP 646 grammar changes (GH-31018)Matthew Rahtz2022-03-262-14/+13
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-47053: Reduce deoptimization in BINARY_OP_INPLACE_ADD_UNICODE (GH-31318)Dennis Sweeney2022-03-252-6/+9
| | | | | * Don't deopt if refcounts are too big * Detect more at specialization time
* bpo-42197: Don't create `f_locals` dictionary unless we actually need it. ↵Mark Shannon2022-03-251-3/+7
| | | | | | | | | | | (GH-32055) * `PyFrame_FastToLocalsWithError` and `PyFrame_LocalsToFast` are no longer called during profile and tracing. (Contributed by Fabio Zadrozny) * Make accesses to a frame's `f_locals` safe from C code, not relying on calls to `PyFrame_FastToLocals` or `PyFrame_LocalsToFast`. * Document new `PyFrame_GetLocals` C-API function.
* bpo-46841: remove no-longer-used macro UPDATE_PREV_INSTR_OPARG (GH-32100)Irit Katriel2022-03-241-2/+0
|
* bpo-46864: Suppress deprecation warnings for ob_shash. (GH-32042)Inada Naoki2022-03-231-1/+4
|