summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* gh-108444: Remove _PyLong_AsInt() function (#108461)Victor Stinner2023-08-251-1/+1
| | | | * Update Parser/asdl_c.py to regenerate Python/Python-ast.c. * Remove _PyLong_AsInt() alias to PyLong_AsInt().
* gh-106581: Split CALL_BOUND_METHOD_EXACT_ARGS into uops (#108462)Guido van Rossum2023-08-254-20/+143
| | | Instead of using `GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS)` we just add the macro elements of the latter to the macro for the former. This requires lengthening the uops array in struct opcode_macro_expansion. (It also required changes to stacking.py that were merged already.)
* gh-106320: Remove private _PyTraceback functions (#108453)Victor Stinner2023-08-241-3/+2
| | | | | | Move private functions to the internal C API (pycore_traceback.h): * _Py_DisplaySourceLine() * _PyTraceback_Add()
* gh-107265: Ensure _PyCode_Quicken does not handle ENTER_EXECUTOR (gh-108460)Dong-hee Na2023-08-241-0/+2
|
* gh-108444: Replace _PyLong_AsInt() with PyLong_AsInt() (#108459)Victor Stinner2023-08-245-10/+10
| | | | | | Change generated by the command: sed -i -e 's!_PyLong_AsInt!PyLong_AsInt!g' \ $(find -name "*.c" -o -name "*.h")
* gh-108444: Argument Clinic uses PyLong_AsInt() (#108458)Victor Stinner2023-08-247-37/+37
| | | | Argument Clinic now uses the new public PyLong_AsInt(), rather than the old name _PyLong_AsInt().
* gh-106320: Remove private _PySys functions (#108452)Victor Stinner2023-08-245-1/+7
| | | | | | | | | | Move private functions to the internal C API (pycore_sysmodule.h): * _PySys_GetAttr() * _PySys_GetSizeOf() No longer export most of these functions. Fix also a typo in Include/cpython/optimizer.h: add a missing space.
* gh-106320: Remove private _PyDict functions (#108449)Victor Stinner2023-08-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Move private functions to the internal C API (pycore_dict.h): * _PyDictView_Intersect() * _PyDictView_New() * _PyDict_ContainsId() * _PyDict_DelItemId() * _PyDict_DelItem_KnownHash() * _PyDict_GetItemIdWithError() * _PyDict_GetItem_KnownHash() * _PyDict_HasSplitTable() * _PyDict_NewPresized() * _PyDict_Next() * _PyDict_Pop() * _PyDict_SetItemId() * _PyDict_SetItem_KnownHash() * _PyDict_SizeOf() No longer export most of these functions. Move also the _PyDictViewObject structure to the internal C API. Move dict_getitem_knownhash() function from _testcapi to the _testinternalcapi extension. Update test_capi.test_dict for this change.
* gh-106581: Fix two bugs in the code generator's copy optimization (#108380)Guido van Rossum2023-08-241-3/+0
| | | | | | | | | | | | | | | | | | I was comparing the last preceding poke with the *last* peek, rather than the *first* peek. Unfortunately this bug obscured another bug: When the last preceding poke is UNUSED, the first peek disappears, leaving the variable unassigned. This is how I fixed it: - Rename CopyEffect to CopyItem. - Change CopyItem to contain StackItems instead of StackEffects. - Update those StackItems when adjusting the manager higher or lower. - Assert that those StackItems' offsets are equivalent. - Other clever things. --------- Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* gh-106320: Remove private PyLong C API functions (#108429)Victor Stinner2023-08-241-2/+3
| | | | | | | | | | | | | | | | Remove private PyLong C API functions: * _PyLong_AsByteArray() * _PyLong_DivmodNear() * _PyLong_Format() * _PyLong_Frexp() * _PyLong_FromByteArray() * _PyLong_FromBytes() * _PyLong_GCD() * _PyLong_Lshift() * _PyLong_Rshift() Move these functions to the internal C API. No longer export _PyLong_FromBytes() function.
* gh-108308: Remove _PyDict_GetItemStringWithError() function (#108426)Victor Stinner2023-08-243-30/+36
| | | | | | | | Remove the internal _PyDict_GetItemStringWithError() function. It can now be replaced with the new public PyDict_ContainsString() and PyDict_GetItemStringRef() functions. getargs.c now now uses a strong reference for current_arg. find_keyword() returns a strong reference.
* gh-108314: Add PyDict_ContainsString() function (#108323)Victor Stinner2023-08-242-13/+19
|
* gh-108308: config_dict_get() uses PyDict_GetItemRef() (#108371)Victor Stinner2023-08-231-6/+19
| | | | Replace _PyDict_GetItemStringWithError() with PyDict_GetItemRef() in config_dict_get() to get a strong reference to the item.
* gh-108308: Replace _PyDict_GetItemStringWithError() (#108372)Victor Stinner2023-08-233-24/+22
| | | | | | | Replace _PyDict_GetItemStringWithError() calls with PyDict_GetItemStringRef() which returns a strong reference to the item. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-105481: remove regen-opcode. Generated _PyOpcode_Caches in regen-cases. ↵Irit Katriel2023-08-238-9/+13
| | | | (#108367)
* gh-107265: Ensure de_instrument does not handle ENTER_EXECUTOR (#108366)Dong-hee Na2023-08-231-0/+1
|
* gh-108308: Replace PyDict_GetItem() with PyDict_GetItemRef() (#108309)Victor Stinner2023-08-234-32/+105
| | | | | | | | | Replace PyDict_GetItem() calls with PyDict_GetItemRef() or PyDict_GetItemWithError() to handle errors. * Replace PyLong_AS_LONG() with _PyLong_AsInt() and check for errors. * Check for PyDict_Contains() error. * pycore_init_builtins() checks for _PyType_Lookup() failure.
* gh-108113: Make it possible to optimize an AST (#108282)Irit Katriel2023-08-233-32/+47
|
* gh-106320: Remove _PyDict_GetItemStringWithError() function (#108313)Victor Stinner2023-08-224-1/+5
| | | | | | | | | Remove private _PyDict_GetItemStringWithError() function of the public C API: the new PyDict_GetItemStringRef() can be used instead. * Move private _PyDict_GetItemStringWithError() to the internal C API. * _testcapi get_code_extra_index() uses PyDict_GetItemStringRef(). Avoid using private functions in _testcapi which tests the public C API.
* Ignore _Py_write_noraise() result: cast to (void) (#108291)Victor Stinner2023-08-223-7/+7
| | | | Code using _Py_write_noraise() usually cannot report. Ignore errors is the least surprising behavior for users.
* gh-107901: Fix missing line number on BACKWARD_JUMP at the end of a for loop ↵Irit Katriel2023-08-211-1/+1
| | | | (#108242)
* gh-108113: Make it possible to create an optimized AST (#108154)Irit Katriel2023-08-212-0/+28
|
* gh-107916: Save the error code before decoding the filename in ↵Serhiy Storchaka2023-08-211-0/+8
| | | | PyErr_SetFromErrnoWithFilename() etc (GH-107929)
* gh-107526: Revert "gh-100357: Convert several functions in bltinsmodule to ↵Nikita Sobolev2023-08-212-303/+99
| | | | AC" (#107542)
* 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.