Tian Gao
057bc72490
gh-109052: Use the base opcode when comparing code objects (gh-109107)
2023-09-09 10:24:49 +09:00
Mark Shannon
15d4c9fabc
GH-108716: Turn off deep-freezing of code objects. (GH-108722)
2023-09-08 10:34:40 +01:00
Dong-hee Na
3bfa24e29f
gh-107265: Remove all ENTER_EXECUTOR when execute _Py_Instrument (gh-108539)
2023-09-07 09:53:54 +09:00
Serhiy Storchaka
6f3c138dfa
gh-108751: Add copy.replace() function (GH-108752)
...
It creates a modified copy of an object by calling the object's
__replace__() method.
It is a generalization of dataclasses.replace(), named tuple's _replace()
method and replace() methods in various classes, and supports all these
stdlib classes.
2023-09-06 23:55:42 +03:00
Irit Katriel
72119d16a5
gh-105481: remove regen-opcode. Generated _PyOpcode_Caches in regen-cases. ( #108367 )
2023-08-23 18:39:00 +01:00
Dong-hee Na
e6db23f66d
gh-107265: Fix code_hash for ENTER_EXECUTOR case ( #108188 )
2023-08-21 14:22:18 -07:00
Dong-hee Na
4fdf3fda0f
gh-107265: Fix code_richcompare for ENTER_EXECUTOR case (gh-108165)
2023-08-21 05:50:09 +00:00
Guido van Rossum
61c7249759
gh-106581: Project through calls ( #108067 )
...
This finishes the work begun in gh-107760. When, while projecting a superblock, we encounter a call to a short, simple function, the superblock will now enter the function using `_PUSH_FRAME`, continue through it, and leave it using `_POP_FRAME`, and then continue through the original code. Multiple frame pushes and pops are even possible. It is also possible to stop appending to the superblock in the middle of a called function, when running out of space or encountering an unsupported bytecode.
2023-08-17 11:29:58 -07:00
Irit Katriel
665a4391e1
gh-105481: generate op IDs from bytecode.c instead of hard coding them in opcode.py ( #107971 )
2023-08-16 22:25:18 +00:00
Serhiy Storchaka
0e6e32fb84
gh-86457: Fix signature for code.replace() (GH-23199)
...
Also add support of @text_signature in Argument Clinic.
2023-08-07 23:34:53 +03:00
Victor Stinner
1a3faba9f1
gh-106869: Use new PyMemberDef constant names ( #106871 )
...
* Remove '#include "structmember.h"'.
* If needed, add <stddef.h> to get offsetof() function.
* Update Parser/asdl_c.py to regenerate Python/Python-ast.c.
* Replace:
* T_SHORT => Py_T_SHORT
* T_INT => Py_T_INT
* T_LONG => Py_T_LONG
* T_FLOAT => Py_T_FLOAT
* T_DOUBLE => Py_T_DOUBLE
* T_STRING => Py_T_STRING
* T_OBJECT => _Py_T_OBJECT
* T_CHAR => Py_T_CHAR
* T_BYTE => Py_T_BYTE
* T_UBYTE => Py_T_UBYTE
* T_USHORT => Py_T_USHORT
* T_UINT => Py_T_UINT
* T_ULONG => Py_T_ULONG
* T_STRING_INPLACE => Py_T_STRING_INPLACE
* T_BOOL => Py_T_BOOL
* T_OBJECT_EX => Py_T_OBJECT_EX
* T_LONGLONG => Py_T_LONGLONG
* T_ULONGLONG => Py_T_ULONGLONG
* T_PYSSIZET => Py_T_PYSSIZET
* T_NONE => _Py_T_NONE
* READONLY => Py_READONLY
* PY_AUDIT_READ => Py_AUDIT_READ
* READ_RESTRICTED => Py_AUDIT_READ
* PY_WRITE_RESTRICTED => _Py_WRITE_RESTRICTED
* RESTRICTED => (READ_RESTRICTED | _Py_WRITE_RESTRICTED)
2023-07-25 15:28:30 +02:00
Victor Stinner
5e4af2a3e9
gh-106320: Move private _PySet API to the internal API ( #107041 )
...
* Add pycore_setobject.h header file.
* Move the following API to the internal C API:
* _PySet_Dummy
* _PySet_NextEntry()
* _PySet_Update()
2023-07-22 17:04:34 +02:00
Serhiy Storchaka
3c70d467c1
Fix possible refleak in CodeType.replace() (GH-106243)
...
A reference to c_code was leaked if PySys_Audit() failed.
2023-06-29 17:22:15 +03:00
Mark Shannon
581619941e
GH-104584: Assorted fixes for the optimizer API. (GH-105683)
...
* Add test for long loops
* Clear ENTER_EXECUTOR when deopting code objects.
2023-06-19 10:32:20 +01:00
Mark Shannon
7199584ac8
GH-100987: Allow objects other than code objects as the "executable" of an internal frame. (GH-105727)
...
* Add table describing possible executable classes for out-of-process debuggers.
* Remove shim code object creation code as it is no longer needed.
* Make lltrace a bit more robust w.r.t. non-standard frames.
2023-06-14 13:46:37 +01:00
Mark Shannon
4bfa01b9d9
GH-104584: Plugin optimizer API (GH-105100)
2023-06-02 11:46:18 +01:00
Victor Stinner
ef300937c2
gh-92536: Remove PyUnicode_READY() calls ( #105210 )
...
Since Python 3.12, PyUnicode_READY() does nothing and always
returns 0.
2023-06-02 01:33:17 +02:00
Mark Shannon
411b169281
GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython (GH-103083)
...
* The majority of the monitoring code is in instrumentation.c
* The new instrumentation bytecodes are in bytecodes.c
* legacy_tracing.c adapts the new API to the old sys.setrace and sys.setprofile APIs
2023-04-12 12:04:55 +01:00
Nikita Sobolev
2a721258a1
gh-101865: Deprecate `co_lnotab` from code objects as per PEP 626 ( #101866 )
...
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-04-03 17:35:04 +02:00
Carl Meyer
1e703a4733
gh-102381: don't call watcher callback with dead object ( #102382 )
...
Co-authored-by: T. Wouters <thomas@python.org>
2023-03-07 17:10:58 -07:00
Petr Viktorin
6b2d7c0ddb
gh-101101: Unstable C API tier (PEP 689) (GH-101102)
2023-02-28 09:31:01 +01:00
Steve Dower
a99eb5cd99
gh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (GH-101912)
...
* gh-101907: Removes use of non-standard C++ extension from Include/cpython/code.h
* Make cases_generator correct on Windows
2023-02-20 14:56:48 +00:00
Brandt Bucher
f07daaf4f7
GH-100117: Make `co_lines` more efficient (GH-100447)
2023-01-10 10:56:53 +00:00
Mark Shannon
15aecf8dd7
GH-100719: Remove the `co_nplaincellvars` field from code objects. (GH-100721)
2023-01-04 15:41:39 +00:00
Dennis Sweeney
a98d9ea56e
gh-94155: Reduce hash collisions for code objects ( #100183 )
...
* Uses a better hashing algorithm to get better dispersion and remove commutativity.
* Incorporates `co_firstlineno`, `Py_SIZE(co)`, and bytecode instructions.
* This is now the entire set of criteria used in `code_richcompare`, except for `_PyCode_ConstantKey` (which would incorporate the types of `co_consts` rather than just their values).
2022-12-23 13:15:47 -05:00
Itamar Ostricher
ae83c78215
GH-100000: Cleanup and polish various watchers code (GH-99998)
...
* Initialize `type_watchers` array to `NULL`s
* Optimize code watchers notification
* Optimize func watchers notification
2022-12-14 19:14:16 +00:00
Mark Shannon
6997e77bdf
GH-100222: Redefine _Py_CODEUNIT as a union to clarify structure of code unit. (GH-100223)
2022-12-14 11:12:53 +00:00
Mark Shannon
fb713b2183
GH-98522: Add version number to code objects. (GH-98525)
...
* Add version number to code object for better versioning of functions.
* Improves specialization for closures and list comprehensions.
2022-12-09 12:18:45 +00:00
Itamar Ostricher
3c137dc613
GH-91054: Add code object watchers API (GH-99859)
...
* Add API to allow extensions to set callback function on creation and destruction of PyCodeObject
Co-authored-by: Ye11ow-Flash <janshah@cs.stonybrook.edu>
2022-12-02 17:28:27 +00:00
Victor Stinner
74d5f61ebd
gh-99845: Clean up _PyObject_VAR_SIZE() usage ( #99847 )
...
* code_sizeof() now uses an unsigned type (size_t) to compute the result.
* Fix _PyObject_ComputedDictPointer(): cast _PyObject_VAR_SIZE() to
Py_ssize_t, rather than long: it's a different type on 64-bit Windows.
* Clarify that _PyObject_VAR_SIZE() uses an unsigned type (size_t).
2022-11-29 12:15:21 +01:00
Victor Stinner
c0feb99187
gh-99300: Use Py_NewRef() in Objects/ directory ( #99332 )
...
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in C files of the Objects/ directory.
2022-11-10 16:27:32 +01:00
Mark Shannon
1e197e63e2
GH-96421: Insert shim frame on entry to interpreter (GH-96319)
...
* Adds EXIT_INTERPRETER instruction to exit PyEval_EvalDefault()
* Simplifies RETURN_VALUE, YIELD_VALUE and RETURN_GENERATOR instructions as they no longer need to check for entry frames.
2022-11-10 12:34:57 +00:00
Brandt Bucher
276d77724f
GH-98686: Quicken everything (GH-98687)
2022-11-02 10:42:57 -07:00
Ken Jin
7ec2e279fe
gh-95756: Free and NULL-out code caches when needed (GH-98181)
2022-10-11 23:11:46 +08:00
Ken Jin
b399115ef1
gh-95756: Lazily created cached co_* attrs (GH-97791)
2022-10-11 11:26:08 +08:00
Brandt Bucher
0ff8fd6583
GH-97779: Ensure that *all* frame objects are backed by "complete" frames (GH-97845)
2022-10-04 17:30:03 -07:00
Nikita Sobolev
e990c6af08
gh-94808: `_PyLineTable_StartsLine` was not used (GH-96609)
2022-10-03 19:35:43 +01:00
Pablo Galindo Salgado
16ebae4cd4
GH-96187: Prevent _PyCode_GetExtra to return garbage for negative indexes (GH-96188)
2022-08-23 11:13:53 +01:00
Ken Jin
42b102bbf9
gh-94936: C getters: co_varnames, co_cellvars, co_freevars ( #95008 )
2022-08-04 06:53:31 -07:00
Brandt Bucher
c7e5bbaee8
GH-95150: Use position and exception tables for code hashing and equality (GH-95509)
2022-08-01 11:02:56 -07:00
Brandt Bucher
e402b26b7f
GH-95113: Don't use EXTENDED_ARG_QUICK in unquickened code (GH-95121)
2022-07-22 11:04:20 -07:00
Ken Jin
a6daaf2a13
Fix PyCode_Addr2Location when addrq < 0 (GH-95091)
2022-07-21 14:49:49 +01:00
Mark Shannon
544531de23
GH-94262: Don't create frame objects for frames that aren't yet complete. (GH-94371)
2022-07-01 11:08:20 +01:00
Pablo Galindo Salgado
c485ec014c
gh-88116: Avoid undefined behavior when decoding varints in code objects ( #94375 )
2022-06-28 14:24:54 +01:00
Ken Jin
50a5ab2c0b
gh-93382: Sync up `co_code` changes with 3.11 (GH-94227)
...
Sync up co_code changes with 3.11 commit 852b4d4bcd
.
2022-06-25 01:55:18 +08:00
Irit Katriel
1603a1029f
GH-93249: relax overly strict assertion on bounds->ar_start (GH-93961)
2022-06-20 17:13:39 +01:00
Mark Shannon
ab0e601016
GH-93516: Speedup line number checks when tracing. (GH-93763)
...
* Use a lookup table to reduce overhead of getting line numbers during tracing.
2022-06-20 13:00:42 +01:00
Mark Shannon
45e62a2bc1
GH-93897: Store frame size in code object and de-opt if insufficient space on thread frame stack. (GH-93908)
2022-06-20 12:59:25 +01:00
Mark Shannon
3cd1a5d3ec
GH-93516: Store offset of first traceable instruction in code object (GH-93769)
2022-06-14 11:09:30 +01:00
Kumar Aditya
8f728e5baa
gh-93728: fix memory leak in deepfrozen code objects (GH-93729)
2022-06-12 22:42:18 +08:00