Commit graph

7351 commits

Author SHA1 Message Date
Pablo Galindo Salgado 3b3be05a16
bpo-46940: Don't override existing AttributeError suggestion information (GH-31710)
When an exception is created in a nested call to PyObject_GetAttr, any
external calls will override the context information of the
AttributeError that we have already placed in the most internal call.
This will cause the suggestions we create to nor work properly as the
attribute name and object that we will be using are the incorrect ones.

To avoid this, we need to check first if these attributes are already
set and bail out if that's the case.
2022-03-07 12:23:11 +00:00
Serhiy Storchaka 6927632492
Remove trailing spaces (GH-31695) 2022-03-05 17:47:00 +02:00
Brandt Bucher c4d2d57eef
bpo-46841: Fix BINARY_OP's handling of inline caches (GH-31671) 2022-03-04 10:51:27 -08:00
Brandt Bucher 586b24d3be
bpo-46841: Fix error message hacks in GET_AWAITABLE (GH-31664) 2022-03-04 12:41:17 +00:00
Mark Shannon 03c2a36b2b
bpo-46903: Handle str-subclasses in virtual instance dictionaries. (GH-31658) 2022-03-04 11:31:29 +00:00
Brandt Bucher 05a8bc1c94
bpo-46841: Use inline caching for attribute accesses (GH-31640) 2022-03-03 15:31:00 -08:00
Brandt Bucher 127797f572
bpo-46841: Improve the failure stats for COMPARE_OP (GH-31663) 2022-03-03 11:28:47 -08:00
Mark Shannon b35603532b
Move check for str-only keys in LOAD_GLOBAL specializations to specialization time. (GH-31659) 2022-03-03 15:17:18 +00:00
Shantanu 81d968b7c3
bpo-46831: Update __build_class__ comment (#31522)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-02 21:32:57 -08:00
Inada Naoki 9833bb91e4
bpo-46845: Reduce dict size when all keys are Unicode (GH-31564) 2022-03-02 08:09:28 +09:00
Mark Shannon 3b0f1c5a71
bpo-46841: Use inline cache for BINARY_SUBSCR. (GH-31618) 2022-03-01 16:00:34 +00:00
Brandt Bucher 7820a5897e
bpo-46841: Use inline caching for COMPARE_OP (GH-31622) 2022-03-01 13:53:13 +00:00
Inada Naoki df9f759755
compiler: Merge except_table and cnotab (GH-31614) 2022-03-01 10:27:20 +09:00
Eric Snow 08deed1af5
bpo-46753: Add the empty tuple to the _PyRuntimeState.global_objects. (gh-31345)
https://bugs.python.org/issue46753
2022-02-28 15:15:48 -07:00
Victor Stinner 7496f95873
bpo-45431: Rename CFrame to _PyCFrame in the C API (GH-31584)
Rename also struct _cframe to struct _PyCFrame.

Add a comment suggesting using public functions rather than using
directly the private _PyCFrame structure.
2022-02-28 16:03:57 +01:00
Mark Shannon 4558af5a8f
bpo-46841: Move the cache for LOAD_GLOBAL inline. (GH-31575) 2022-02-28 12:56:29 +00:00
Brandt Bucher 424ecab494
bpo-46841: Use inline caching for UNPACK_SEQUENCE (GH-31591) 2022-02-28 11:54:14 +00:00
Kumar Aditya 0d9b565e62
Propagate errors (however unlikely) from _Py_Deepfreeze_Init() (GH-31596) 2022-02-26 08:35:03 -08:00
Oleg Iarygin 4060111f9d
bpo-46816: Remove declarations for non-__STDC__ compilers (GH-31466)
After Python switched to C11, there is a guarantee that every compiler
conforms to ISO C so checks of __STDC__ have no sense.
2022-02-26 00:16:59 +01:00
Victor Stinner 87af12bff3
bpo-46836: Rename InterpreterFrame to _PyInterpreterFrame (GH-31583)
Rename also struct _interpreter_frame to struct _PyInterpreterFrame.

Reduce risk of name conflicts if a project includes pycore_frame.h.
2022-02-25 16:22:00 +01:00
Victor Stinner f780d9690f
bpo-45316: Move _PyArg_Fini() to internal C API (GH-31580)
Move the private unexported _PyArg_Fini() function to the internal C
API: to the pycore_pylifecycle.h header file.
2022-02-25 16:19:30 +01:00
Victor Stinner 8f2a337a80
bpo-45316: Move private functions to internal C API (GH-31579)
Move the unexported private functions to the internal C API:

* pycore_frame.h: _PyFrame_New_NoTrack()
* pycore_function.h: _PyFunction_GetVersionForCurrentState()
* pycore_genobject.h: _PyAsyncGenValueWrapperNew()
* pycore_genobject.h: _PyCoro_GetAwaitableIter()
* pycore_genobject.h: _PyGen_yf()
2022-02-25 16:07:14 +01:00
Irit Katriel c579243eb6
bpo-46808: remove NEXT_BLOCK() from compile.c (GH-31448) 2022-02-25 12:17:50 +00:00
Brandt Bucher 0f41aac109
bpo-46841: Use *inline* caching for BINARY_OP (GH-31543) 2022-02-25 12:11:34 +00:00
Petr Viktorin 2c228a7b8f
bpo-46748: Don't import <stdbool.h> in public headers (GH-31553)
<stdbool.h> is the standard/modern way to define embedd/extends Python free to define bool, true and false, but there are existing applications that use slightly different redefinitions, which fail if the header is included.

It's OK to use stdbool outside the public headers, though.

https://bugs.python.org/issue46748
2022-02-25 09:25:54 +01:00
Victor Stinner 1b2611eb02
bpo-46656: Remove Py_NO_NAN macro (GH-31160)
Building Python now requires support for floating point Not-a-Number
(NaN): remove the Py_NO_NAN macro.
2022-02-25 01:32:57 +01:00
Mark Shannon 2a6ece572c
bpo-45107: Specialize LOAD_METHOD for instances with dict. (GH-31531) 2022-02-24 19:34:57 +00:00
Kumar Aditya 4dc746310b
bpo-46430: Fix memory leak in interned strings of deep-frozen modules (GH-31549) 2022-02-24 17:54:06 +01:00
Victor Stinner 042f31da55
bpo-45459: C API uses type names rather than structure names (GH-31528)
Thanks to the new pytypedefs.h, it becomes to use type names like
PyObject rather like structure names like "struct _object".
2022-02-24 17:51:59 +01:00
Dennis Sweeney a52d2528a4
bpo-46823: Implement LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE superinstruction (GH-31484) 2022-02-24 14:55:59 +00:00
Brandt Bucher 281ea9c391
bpo-44337: Shrink the LOAD_ATTR/STORE_ATTR caches (GH-31517) 2022-02-23 10:53:24 -08:00
Victor Stinner 9bbdde2180
bpo-45412: Add _PY_SHORT_FLOAT_REPR macro (GH-31171)
Remove the HAVE_PY_SET_53BIT_PRECISION macro (moved to the internal
C API).

* Move HAVE_PY_SET_53BIT_PRECISION macro to pycore_pymath.h.
* Replace PY_NO_SHORT_FLOAT_REPR macro with _PY_SHORT_FLOAT_REPR
  macro which is always defined. gcc -Wundef emits a warning when
  using _PY_SHORT_FLOAT_REPR but the macro is not defined, if
  pycore_pymath.h include was forgotten.
2022-02-23 18:16:23 +01:00
Brandt Bucher 375a56bd40
bpo-45885: Don't un-adapt COMPARE_OP when collecting stats (GH-31516) 2022-02-23 11:06:25 +00:00
Brandt Bucher 424023efee
bpo-46329: Fix test failure when Py_STATS is enabled (GH-31511) 2022-02-23 11:00:28 +00:00
Eric Snow 1f455361ec
bpo-46765: Replace Locally Cached Strings with Statically Initialized Objects (gh-31366)
https://bugs.python.org/issue46765
2022-02-22 17:23:51 -07:00
Mark Shannon 09487c11a5
Fix reporting of specialization stats. (GH-31503) 2022-02-22 17:18:10 +00:00
Mark Shannon 9058a35558
Move call specializations from CALL to PRECALL. (GH-31496) 2022-02-22 14:57:01 +00:00
Mark Shannon 59585d6b2e
bpo-46329: Streamline calling sequence a bit. (GH-31465)
* 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
2022-02-21 18:26:47 +00:00
Mark Shannon cf345e945f
bpo-46329: Change calling sequence (again) (GH-31373)
* Change calling sequence: Add PUSH_NULL. Merge PRECALL_FUNCTION and PRECALL_METHOD into PRECALL.
2022-02-18 17:19:08 +00:00
Nikita Sobolev e2c28616ce
bpo-46709: check eval breaker in specialized CALL opcodes (GH-31404) 2022-02-18 12:56:23 +00:00
Brandt Bucher 580cd9ab29
bpo-46072: Add detailed failure stats for BINARY_OP (GH-31289) 2022-02-16 08:49:58 -08:00
Brandt Bucher a9da085015
bpo-46702: Specialize UNPACK_SEQUENCE (GH-31240) 2022-02-16 08:48:16 -08:00
Mark Shannon 3be1a443ca
bpo-46724: Use JUMP_ABSOLUTE for all backward jumps. (GH-31326)
* Make sure all backward jumps use JUMP_ABSOLUTE.

* Add news.

* Fix up news item.

* Make test use consistent style.
2022-02-15 09:35:16 +00:00
Eric Snow 12360aa159
bpo-46541: Discover the global strings. (gh-31346)
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
2022-02-14 17:36:51 -07:00
Brandt Bucher 3b799d7448
Remove unnecessary basic block from comprehensions (GH-31263) 2022-02-14 17:48:45 +00:00
Mark Shannon 0ade875ebe
Add pair counts to stats output and summary. (GH-31324) 2022-02-14 15:53:38 +00:00
Mark Shannon 15ee55528e
Include length in stats for UNPACK_SEQUENCE. (GH-31254) 2022-02-14 10:01:31 +00:00
Petr Viktorin 204946986f
bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)
* Make PyType_GetModuleByDef public (remove underscore)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-02-11 17:22:11 +01:00
Victor Stinner e0bcfd0e4d
bpo-45490: Rename static inline functions (GH-31217)
When a static inline function is wrapped by a macro which casts its
arguments to the expected type, there is no need that the function
has a different name than the macro. Use the same name for the macro
and the function to avoid confusion.

Rename _PyUnicode_get_wstr_length() to PyUnicode_WSTR_LENGTH().

Don't rename static inline _Py_NewRef() and _Py_XNewRef() functions,
since the C API exports Py_NewRef() and Py_XNewRef() functions as
regular functions. The name cannot be reused in this case.
2022-02-11 17:01:10 +01:00
Brandt Bucher d7a5aca982
bpo-45923: Add RESUME_QUICK (GH-31244) 2022-02-10 17:50:02 +00:00