summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-107915: Handle errors in C API functions PyErr_Set*() and PyErr_Format() ↵Serhiy Storchaka2023-08-191-8/+29
| | | | | | | | (GH-107918) Such C API functions as PyErr_SetString(), PyErr_Format(), PyErr_SetFromErrnoWithFilename() and many others no longer crash or ignore errors if it failed to format the error message or decode the filename. Instead, they keep a corresponding error.
* gh-108014: Add Py_IsFinalizing() function (#108032)Victor Stinner2023-08-182-2/+2
| | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-107944: Improve error message for function calls with bad keyword ↵Pablo Galindo Salgado2023-08-172-10/+35
| | | | arguments (#107969)
* gh-106581: Project through calls (#108067)Guido van Rossum2023-08-177-64/+264
| | | | 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.
* GH-108035: Remove the `_PyCFrame` struct as it is no longer needed for ↵Mark Shannon2023-08-1713-67/+51
| | | | performance. (GH-108036)
* gh-106581: Split `CALL_PY_EXACT_ARGS` into uops (#107760)Guido van Rossum2023-08-168-58/+273
| | | | | | | | | | | | * Split `CALL_PY_EXACT_ARGS` into uops This is only the first step for doing `CALL` in Tier 2. The next step involves tracing into the called code object and back. After that we'll have to do the remaining `CALL` specialization. Finally we'll have to deal with `KW_NAMES`. Note: this moves setting `frame->return_offset` directly in front of `DISPATCH_INLINED()`, to make it easier to move it into `_PUSH_FRAME`.
* gh-105481: generate op IDs from bytecode.c instead of hard coding them in ↵Irit Katriel2023-08-162-168/+166
| | | | opcode.py (#107971)
* gh-105724: Add location information to `assert` errors (GH-105935)Nikita Sobolev2023-08-161-1/+1
|
* gh-107557: Setup abstract interpretation (#107847)Ken Jin2023-08-155-4/+814
| | | | Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com> Co-authored-by: Jules <57632293+juliapoo@users.noreply.github.com>
* gh-106242: Minor fixup to avoid compiler warnings (GH-107983)Steve Dower2023-08-151-1/+1
|
* gh-103082: remove assumption that INSTRUMENTED_LINE is the last instrumented ↵Irit Katriel2023-08-151-2/+2
| | | | opcode (#107978)
* gh-106242: Fix path truncation in os.path.normpath (GH-106816)Finn Womack2023-08-151-8/+21
|
* gh-103082: use IS_VALID_OPCODE instead of _PyOpcode_OpName to check if an ↵Irit Katriel2023-08-141-4/+4
| | | | opcode is defined (#107882)
* gh-106797: Remove warning logs from Python/generated_cases.c.h and ↵Dong-hee Na2023-08-122-4/+4
| | | | | executor_cases.c.h (gh-107889) gh-106797: Remove warning logs from Python/generated_cases.c.h
* GH-107674: Avoid allocating boxed ints for `sys.settrace` line events ↵Mark Shannon2023-08-101-6/+38
| | | | (GH-107780)
* gh-106149: move CFG and basicblock definitions into flowgraph.c, use them as ↵Irit Katriel2023-08-102-404/+465
| | | | opaque types in compile.c (#107639)
* GH-107774: Add missing audit event for PEP 669 (GH-107775)Mark Shannon2023-08-101-0/+3
|
* GH-106485: Dematerialize instance dictionaries when possible (GH-106539)Brandt Bucher2023-08-094-19/+42
|
* GH-105848: Simplify the arrangement of CALL's stack (GH-107788)Brandt Bucher2023-08-096-626/+567
|
* GH-107724: Fix the signature of `PY_THROW` callback functions. (GH-107725)Mark Shannon2023-08-093-14/+4
|
* GH-107596: Specialize str[int] (GH-107597)Brandt Bucher2023-08-085-28/+94
|
* gh-107758: Improvements to lltrace feature (#107757)Guido van Rossum2023-08-083-8/+30
| | | | | | | | | - The `dump_stack()` method could call a `__repr__` method implemented in Python, causing (infinite) recursion. I rewrote it to only print out the values for some fundamental types (`int`, `str`, etc.); for everything else it just prints `<type_name @ 0xdeadbeef>`. - The lltrace-like feature for uops wrote to `stderr`, while the one in `ceval.c` writes to `stdout`; I changed the uops to write to stdout as well.
* gh-107630: Initialize Each Interpreter's refchain Properly (gh-107733)Eric Snow2023-08-072-0/+3
| | | This finishes fixing the crashes in Py_TRACE_REFS builds. We missed this part in gh-107567.
* gh-106608: make uop trace variable length (#107531)Ivin Lee2023-08-051-13/+4
| | | Executors are now more like tuples.
* GH-84436: Skip refcounting for known immortals (GH-107605)Brandt Bucher2023-08-044-4/+4
|
* gh-106812: Refactor cases_generator to allow uops with array stack effects ↵Guido van Rossum2023-08-042-695/+1110
| | | | | (#107564) Introducing a new file, stacking.py, that takes over several responsibilities related to symbolic evaluation of push/pop operations, with more generality.
* Add some GC stats to Py_STATS (GH-107581)Mark Shannon2023-08-041-1/+17
|
* GH-107263: Increase C stack limit for most functions, except ↵Mark Shannon2023-08-047-15/+14
| | | | | | `_PyEval_EvalFrameDefault()` (GH-107535) * Set C recursion limit to 1500, set cost of eval loop to 2 frames, and compiler mutliply to 2.
* gh-107080: Fix Py_TRACE_REFS Crashes Under Isolated Subinterpreters (gh-107567)Eric Snow2023-08-031-4/+4
| | | The linked list of objects was a global variable, which broke isolation between interpreters, causing crashes. To solve this, we've moved the linked list to each interpreter.
* gh-107471: Fix Refleaks in test_import (gh-107569)Eric Snow2023-08-021-0/+1
| | | | | | | gh-107184 introduced a refleak in test_import.SubinterpImportTests (specifically test_singlephase_check_with_setting_and_override and test_single_init_extension_compat). We fix it here by making sure _testsinglephase is removed from sys.modules whenever we clear the runtime's internal state for the module. The underlying problem is strictly contained in the internal function _PyImport_ClearExtension() (AKA _testinternalcapi.clear_extension()), which is only used in tests. (This also fixes an intermittent segfault introduced in the same place, in test_disallowed_reimport.)
* GH-100964: Break cycles involving exception state when returning from ↵Mark Shannon2023-08-021-0/+1
| | | | generator (GH-107563)
* gh-105481: combine regen-opcode-targets with regen-opcode to avoid ↵Irit Katriel2023-08-011-56/+0
| | | | calculating the specialized opcodes in two places (#107540)
* Use tstate->interp to get the interpreter state in bytecodes.c (GH-107506)Brandt Bucher2023-07-313-8/+8
|
* GH-104584: Fix incorrect uoperands (GH-107513)Brandt Bucher2023-07-311-1/+2
|
* GH-104909: Move unused cache entries from uops to macros (#107444)Guido van Rossum2023-07-313-21/+7
| | | | | | There's no need to use a dummy uop to skip unused cache entries. The macro syntax lets you write `unused/1` instead. Similarly, move `unused/5` from op `_LOAD_ATTR_INSTANCE_VALUE` to macro `LOAD_ATTR_INSTANCE_VALUE`.
* no-issue: Fix typo in import.c (gh-107498)Georg Brandl2023-07-311-1/+1
|
* gh-105699: Use a _Py_hashtable_t for the PyModuleDef Cache (gh-106974)Eric Snow2023-07-282-171/+122
| | | | | | | This fixes a crasher due to a race condition, triggered infrequently when two isolated (own GIL) subinterpreters simultaneously initialize their sys or builtins modules. The crash happened due the combination of the "detached" thread state we were using and the "last holder" logic we use for the GIL. It turns out it's tricky to use the same thread state for different threads. Who could have guessed? We solve the problem by eliminating the one object we were still sharing between interpreters. We replace it with a low-level hashtable, using the "raw" allocator to avoid tying it to the main interpreter. We also remove the accommodations for "detached" thread states, which were a dubious idea to start with.
* gh-101524: Only Use Public C-API in the _xxsubinterpreters Module (gh-107359)Eric Snow2023-07-271-1/+1
| | | The _xxsubinterpreters module should not rely on internal API. Some of the functions it uses were recently moved there however. Here we move them back (and expose them properly).
* gh-104621: Check for Incompatible Extensions in import_find_extension() ↵Eric Snow2023-07-271-10/+11
| | | | | (gh-107184) This fixes a bug where incompatible modules could still be imported if attempted multiple times.
* gh-106931: Intern Statically Allocated Strings Globally (gh-107272)Eric Snow2023-07-271-0/+7
| | | | | We tried this before with a dict and for all interned strings. That ran into problems due to interpreter isolation. However, exclusively using a per-interpreter cache caused some inconsistency that can eliminate the benefit of interning. Here we circle back to using a global cache, but only for statically allocated strings. We also use a more-basic _Py_hashtable_t for that global cache instead of a dict. Ideally we would only have the global cache, but the optional isolation of each interpreter's allocator means that a non-static string object must not outlive its interpreter. Thus we would have to store a copy of each such interned string in the global cache, tied to the main interpreter.
* GH-106898: Add the exception as an argument to the `PY_UNWIND` event ↵Mark Shannon2023-07-272-3/+23
| | | | callback function. (GH-107347)
* gh-107196: Remove _PyArg_VaParseTupleAndKeywordsFast() function (#107197)Victor Stinner2023-07-271-14/+0
| | | | Remove the private _PyArg_VaParseTupleAndKeywordsFast() function: it is no longer used.
* GH-106895: Raise a `ValueError` when attempting to disable events that ↵Mark Shannon2023-07-275-50/+63
| | | | cannot be disabled. (GH-107337)
* GH-106897: Add `RERAISE` event to `sys.monitoring`. (GH-107291)Mark Shannon2023-07-274-3/+30
| | | * Ensures that exception handling events are balanced. Each [re]raise event has a matching unwind/handled event.
* gh-106149: fix comment on stackdepth of generators (#107321)Irit Katriel2023-07-261-2/+3
|
* gh-107015: Remove async_hacks from the tokenizer (#107018)Pablo Galindo Salgado2023-07-261-3/+0
|
* gh-106149: Simplify stack depth calculation. Replace asserts by exceptions. ↵Irit Katriel2023-07-262-36/+72
| | | | (#107255)
* gh-107082: Fix instruction size computation for ENTER_EXECUTOR (#107256)Guido van Rossum2023-07-251-0/+7
| | | | Co-authored-by: Victor Stinner <vstinner@python.org>
* Remove unused internal _PyImport_GetModuleId() function (#107235)Victor Stinner2023-07-251-11/+0
|
* gh-106869: Use new PyMemberDef constant names (#106871)Victor Stinner2023-07-258-68/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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)