| Commit message (Collapse) | Author | Age | Files | Lines | 
| | 
| 
| 
| 
| 
| 
|  | 
(GH-96973)
(cherry picked from commit dfc73b57247aac575c83055d960c03bdc28b51fd)
Automerge-Triggered-By: GH:brandtbucher
 | 
| | 
| 
|  | 
(cherry picked from commit 900bfc53cb133e8bc2b122362ec04256f623d5b0)
 | 
| | 
| 
| 
| 
|  | 
(GH-95143)
(cherry picked from commit e402b26b7fb953a2f0c17a0044bb6d6cbd726e54)
 | 
| | 
| 
| 
| 
|  | 
(GH-95067) (GH-95068)
(cherry picked from commit 742d4614e1a645d765dbf76c19bd9a818239b1cb)
 | 
| | 
| 
| 
| 
|  | 
(cherry picked from commit 74761548862eb5a324c23d86a6233d884f386f2e)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
 | 
| | 
| 
|  | 
(cherry picked from commit 264b3ddfd561d97204ffb30be6a7d1fb0555e560)
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
optimization for blocks that have a line number (GH-94592) (GH-94643)
Inlining of code that corresponds to source code lines, can make it hard to distinguish later between code which is only reachable from except handlers, and that which is reachable in normal control flow. This caused problems with the debugger's jump feature.
This PR turns off the inlining optimisation for code which has line numbers. We still inline things like the implicit "return None"..
(cherry picked from commit bde06e1b8381f140b296a397ddd1deb1c784ff8e)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
|  | 
specified by PEP 626 (GH-94552) (GH-94562)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Mark Shannon <mark@hotpy.org>
(cherry picked from commit 324d01944d16868b07df9e8eef6987766a31a36d)
 | 
| | 
| 
| 
|  | 
(cherry picked from commit b152bf448b321e3a4c0a7280e0b608840f5ac661)
 | 
| | 
| 
| 
| 
|  | 
called (GH-94389) (GH-94442)
(cherry picked from commit be82d26570343dafc8a89be5a1a0e2f58d51a904)
 | 
| | 
| 
| 
| 
|  | 
method calls. (GH-93673) (#93895)
Co-authored-by: Mark Shannon <mark@hotpy.org>
 | 
| | 
| 
| 
| 
| 
| 
|  | 
(GH-93110)
(cherry picked from commit a458be3263b4cb92f3fde726461e8ef44b2a4a9d)
Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
|  | 
(GH-92620) (GH-92621)
(cherry picked from commit 7c6b7ade8df35355484d3944779fe35dcc560aab)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
 | 
| |  | 
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
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-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
 | 
| | 
| 
|  | 
(for gh-90868)
 | 
| |  | 
 | 
| |  | 
 | 
| |  | 
 | 
| |  | 
 | 
| |  | 
 | 
| |  | 
 | 
| | 
| 
| 
| 
| 
| 
| 
|  | 
* Make virtual opcodes negative. 
* Make is_jump detect only actual jumps.
* Use is_block_push for the exception block setup opcodes.
 | 
| |  | 
 | 
| | 
| 
| 
|  | 
(GH-32115)
 | 
| | 
| 
|  | 
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
* Moves the bytecode to the end of the corresponding PyCodeObject, and quickens it in-place.
* Removes the almost-always-unused co_varnames, co_freevars, and co_cellvars member caches
* _PyOpcode_Deopt is a new mapping from all opcodes to their un-quickened forms.
* _PyOpcode_InlineCacheEntries is renamed to _PyOpcode_Caches
* _Py_IncrementCountAndMaybeQuicken is renamed to _PyCode_Warmup
* _Py_Quicken is renamed to _PyCode_Quicken
* _co_quickened is renamed to _co_code_adaptive (and is now a read-only memoryview).
* Do not emit unused nonzero opargs anymore in the compiler.
 | 
| | 
| 
| 
|  | 
additional NULL. (GH-31933)
 | 
| |  | 
 | 
| | 
| 
|  | 
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
 | 
| |  | 
 | 
| |  | 
 | 
| |  | 
 | 
| |  | 
 | 
| | 
| 
| 
| 
|  | 
Objects (gh-31366)
https://bugs.python.org/issue46765
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
* Move handling of bound-methods to PRECALL.
* Remove call_shape.postcall_shrink
* Remove call_shape.callable
* Remove call_shape.callable. Change CALL oparg to match PRECALL oparg.
* Move KW_NAMES before PRECALL.
* Update opcode docs in dis.rst
 | 
| | 
| 
| 
|  | 
* Change calling sequence: Add PUSH_NULL. Merge PRECALL_FUNCTION and PRECALL_METHOD into PRECALL.
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
|  | 
* Make sure all backward jumps use JUMP_ABSOLUTE.
* Add news.
* Fix up news item.
* Make test use consistent style.
 | 
| | 
| 
| 
| 
| 
| 
|  | 
Instead of manually enumerating the global strings in generate_global_objects.py, we extrapolate the list from usage of _Py_ID() and _Py_STR() in the source files.
This is partly inspired by gh-31261.
https://bugs.python.org/issue46541
 | 
| |  | 
 | 
| |  | 
 | 
| |  | 
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
global objects. (gh-30928)
We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code.  It is still used in a number of non-builtin stdlib modules.
The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime.  A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings).
https://bugs.python.org/issue46541#msg411799 explains the rationale for this change.
The core of the change is in:
* (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros
* Include/internal/pycore_runtime_init.h - added the static initializers for the global strings
* Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState
* Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers
I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings.  That check is added to the PR CI config.
The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()).  This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *.
The following are not changed (yet):
* stop using _Py_IDENTIFIER() in the stdlib modules
* (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API
* (maybe) intern the strings during runtime init
https://bugs.python.org/issue46541
 | 
| |  | 
 | 
| |  | 
 | 
| |  | 
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
* Add PRECALL_FUNCTION opcode.
* Move 'call shape' varaibles into struct.
* Replace CALL_NO_KW and CALL_KW with KW_NAMES and CALL instructions.
* Specialize for builtin methods taking using the METH_FASTCALL | METH_KEYWORDS protocol.
* Allow kwnames for specialized calls to builtin types.
* Specialize calls to tuple(arg) and str(arg).
 | 
| | 
| 
| 
|  | 
(GH-30751)
 | 
| |  | 
 |