Gregory P. Smith
052f53d65d
gh-39615: Add warnings.warn() skip_file_prefixes support ( #100840 )
...
`warnings.warn()` gains the ability to skip stack frames based on code
filename prefix rather than only a numeric `stacklevel=` via a new
`skip_file_prefixes=` keyword argument.
2023-01-27 18:35:14 -08:00
Виталий Дмитриев
37f15a5efa
Fix typos in pystate.c file ( #101348 )
2023-01-26 15:04:11 -08:00
Irit Katriel
b400219df5
gh-98831: rewrite RAISE_VARARGS in the instruction definition DSL ( #101306 )
2023-01-25 22:29:56 +00:00
Irit Katriel
19f90d6b97
gh-98831: add variable stack effect support to cases generator ( #101309 )
2023-01-25 20:41:03 +00:00
Guido van Rossum
498598e8c2
Fix some comments in ceval.c and fix lltrace output ( #101297 )
...
The comment at the top was rather outdated. :-)
Also added a note about the dangers of dump_stack().
2023-01-24 14:58:18 -08:00
Irit Katriel
1a9d8c750b
gh-98831: rewrite pattern matching opcodes in the instruction definition DSL ( #101287 )
2023-01-24 22:39:13 +00:00
Mark Shannon
f02fa64bf2
GH-100762: Don't call `gen.throw()` in `gen.close()`, unless necessary. (GH-101013)
...
* Store exception stack depth in YIELD_VALUE's oparg and use it avoid expensive gen.throw() in gen.close() where possible.
2023-01-24 17:25:37 +00:00
Irit Katriel
8c183cddd3
gh-98831: rewrite CHECK_EG_MATCH opcode in the instruction definition DSL ( #101269 )
2023-01-24 09:43:16 +00:00
Eric Snow
7b20a0f55a
gh-59956: Allow the "Trashcan" Mechanism to Work Without a Thread State (gh-101209)
...
We've factored out a struct from the two PyThreadState fields. This accomplishes two things:
* make it clear that the trashcan-related code doesn't need any other parts of PyThreadState
* allows us to use the trashcan mechanism even when there isn't a "current" thread state
We still expect the caller to hold the GIL.
https://github.com/python/cpython/issues/59956
2023-01-23 08:30:20 -07:00
Ikko Eltociear Ashimine
4510fbb216
Fix typo in comment in compile.c ( #101194 )
2023-01-20 18:34:36 +00:00
Nikita Sobolev
8be6992620
gh-101181: Fix `unused-variable` warning in `pystate.c` ( #101188 )
...
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-20 23:31:30 +05:30
Eric Snow
f30c94024f
gh-59956: Fix Function Groupings in pystate.c (gh-101172)
...
This is a follow-up to gh-101161. The objective is to make it easier to read Python/pystate.c by grouping the functions there in a consistent way. This exclusively involves moving code around and adding various kinds of comments.
https://github.com/python/cpython/issues/59956
2023-01-19 17:23:53 -07:00
Irit Katriel
9ec9b203ea
gh-101169: reduce the implementation of except* by one bytecode instruction ( #101170 )
2023-01-19 23:30:49 +00:00
Eric Snow
6036c3e856
gh-59956: Clarify GILState-related Code (gh-101161)
...
The objective of this change is to help make the GILState-related code easier to understand. This mostly involves moving code around and some semantically equivalent refactors. However, there are a also a small number of slight changes in structure and behavior:
* tstate_current is moved out of _PyRuntimeState.gilstate
* autoTSSkey is moved out of _PyRuntimeState.gilstate
* autoTSSkey is initialized earlier
* autoTSSkey is re-initialized (after fork) earlier
https://github.com/python/cpython/issues/59956
2023-01-19 16:04:14 -07:00
Irit Katriel
e9ccfe4a63
gh-100712: make it possible to disable specialization (for debugging) ( #100713 )
2023-01-19 18:14:55 +00:00
Guido van Rossum
1f0d0a432c
GH-98831: Move assorted macros from ceval.h to a new header ( #101116 )
2023-01-18 10:41:07 -08:00
Guido van Rossum
80e3e3423c
GH-98831: Implement array support in cases generator ( #100912 )
...
You can now write things like this:
```
inst(BUILD_STRING, (pieces[oparg] -- str)) { ... }
inst(LIST_APPEND, (list, unused[oparg-1], v -- list, unused[oparg-1])) { ... }
```
Note that array output effects are only partially supported (they must be named `unused` or correspond to an input effect).
2023-01-17 15:59:19 -08:00
Mark Shannon
7b14c2ef19
GH-100982: Add `COMPARE_AND_BRANCH` instruction (GH-100983)
2023-01-16 12:35:21 +00:00
Kumar Aditya
f6307d4416
GH-100892: consolidate `HEAD_LOCK/HEAD_UNLOCK` macros ( #100953 )
2023-01-15 20:39:26 +05:30
Guido van Rossum
5134ef4878
GH-98831: Identify instructions that don't use oparg ( #100957 )
...
For these the instr_format field uses IX instead of IB.
Register instructions use IX, IB, IBBX, IBBB, etc.
Also: Include the closing '}' in Block.tokens, for completeness
2023-01-13 17:06:45 -08:00
Steve Dower
b5d4347950
gh-86682: Adds sys._getframemodulename as an alternative to using _getframe (GH-99520)
...
Also updates calls in collections, doctest, enum, and typing modules to use _getframemodulename first when available.
2023-01-13 11:31:06 +00:00
Mark Shannon
6e4e14d98f
GH-100923: Embed jump mask in `COMPARE_OP` oparg (GH-100924)
2023-01-11 20:40:43 +00:00
Guido van Rossum
3f3c78e32f
GH-98831: Refactor instr format code and change to enum ( #100895 )
2023-01-09 15:53:01 -08:00
Brandt Bucher
61762b9387
GH-100126: Skip incomplete frames in more places (GH-100613)
2023-01-09 12:20:04 -08:00
Nikita Sobolev
bc0a686f82
gh-87447: Fix walrus comprehension rebind checking ( #100581 )
...
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-01-08 15:51:29 -07:00
Benjamin Peterson
11f99323c2
Update copyright years to 2023. (gh-100848)
2023-01-08 09:13:25 -06:00
Nnarol
0741da8d28
GH-90829: Fix empty iterable error message in min/max ( #31181 )
2023-01-08 19:21:20 +05:30
Shantanu
a2141882f2
gh-100776: Fix misleading default value in help(input) ( #100788 )
2023-01-08 13:27:41 +05:30
Carl Meyer
7116030a25
gh-88696: clean up dead argument to compiler_make_closure (GH-100806)
2023-01-07 12:20:48 +00:00
Irit Katriel
15c44789bb
gh-100758: Refactor initialisation of frame headers into a single function (_PyFrame_Initialize) (GH-100759)
2023-01-06 14:55:56 +00:00
Mark Shannon
78068126a1
GH-99005: More intrinsics (GH-100774)
...
* Remove UNARY_POSITIVE, LIST_TO_TUPLE and ASYNC_GEN_WRAP, replacing them with intrinsics.
2023-01-06 14:47:57 +00:00
Zachary Ware
af5149f30b
gh-98831: Regenerate Python/opcode_metadata.h (GH-100778)
2023-01-05 15:47:18 -06:00
Guido van Rossum
14b7f00fdf
GH-98831: Update generate_cases.py: register inst, opcode_metadata.h ( #100735 )
...
(These aren't used yet, but may be coming soon,
and it's easier to keep this tool the same between branches.)
Added a sanity check for all this to compile.c.
Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
2023-01-05 13:01:07 -08:00
Mark Shannon
28187141cc
GH-99005: Add `CALL_INTRINSIC_1` instruction (GH-100771)
...
* Remove PRINT_EXPR instruction
* Remove STOPITERATION_ERROR instruction
* Remove IMPORT_STAR instruction
2023-01-05 16:05:51 +00:00
Mark Shannon
f20c553a45
GH-100288: Remove LOAD_ATTR_METHOD_WITH_DICT instruction. (GH-100753)
2023-01-05 12:20:09 +00:00
Irit Katriel
52017dbe16
gh-100747: some compiler macros use c instead of C to access the compiler ( #100748 )
2023-01-04 20:19:20 +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
L. A. F. Pereira
e6d4440782
gh-100146: Steal references from stack when building a list ( #100147 )
...
When executing the BUILD_LIST opcode, steal the references from the stack,
in a manner similar to the BUILD_TUPLE opcode. Implement this by offloading
the logic to a new private API, _PyList_FromArraySteal(), that works similarly
to _PyTuple_FromArraySteal().
This way, instead of performing multiple stack pointer adjustments while the
list is being initialized, the stack is adjusted only once and a fast memory
copy operation is performed in one fell swoop.
2023-01-03 10:49:49 -08:00
Éric
46521826cb
gh-95778: add doc missing in some places (GH-100627)
2022-12-30 13:21:15 -08:00
Nikita Sobolev
5e1adb4f88
gh-100577: Replace `assert(0)` with `Py_UNREACHABLE` in `symtable.c` ( #100579 )
2022-12-28 21:01:53 +05:30
Guido van Rossum
08e5594cf3
GH-98831: Modernize a ton of simpler instructions ( #100545 )
...
* load_const and load_fast aren't families for now
* Don't decref unmoved names
* Modernize GET_ANEXT
* Modernize GET_AWAITABLE
* Modernize ASYNC_GEN_WRAP
* Modernize YIELD_VALUE
* Modernize POP_EXCEPT (in more than one way)
* Modernize PREP_RERAISE_STAR
* Modernize LOAD_ASSERTION_ERROR
* Modernize LOAD_BUILD_CLASS
* Modernize STORE_NAME
* Modernize LOAD_NAME
* Modernize LOAD_CLASSDEREF
* Modernize LOAD_DEREF
* Modernize STORE_DEREF
* Modernize COPY_FREE_VARS (mark it as done)
* Modernize LIST_TO_TUPLE
* Modernize LIST_EXTEND
* Modernize SET_UPDATE
* Modernize SETUP_ANNOTATIONS
* Modernize DICT_UPDATE
* Modernize DICT_MERGE
* Modernize MAP_ADD
* Modernize IS_OP
* Modernize CONTAINS_OP
* Modernize CHECK_EXC_MATCH
* Modernize IMPORT_NAME
* Modernize IMPORT_STAR
* Modernize IMPORT_FROM
* Modernize JUMP_FORWARD (mark it as done)
* Modernize JUMP_BACKWARD (mark it as done)
2022-12-27 17:11:03 -08:00
Nikita Sobolev
bdfb694386
gh-100357: Convert several functions in `bltinsmodule` to AC ( #100358 )
2022-12-24 06:45:47 -08:00
Sebastian Berg
474220e3a5
gh-99947: Ensure unreported errors are chained for SystemError during import (GH-99946)
2022-12-23 15:43:19 -08:00
Raymond Hettinger
5d84966cce
GH-100425: Improve accuracy of builtin sum() for float inputs (GH-100426)
2022-12-23 14:35:58 -08:00
Ken Jin
36d358348d
Revert "gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)" ( #100468 )
...
This reverts commit c3c7848a48
.
2022-12-24 01:48:43 +08:00
Ken Jin
c3c7848a48
gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)
2022-12-24 00:26:42 +08:00
Irit Katriel
2659036c75
GH-100459: fix copy-paste errors in specialization stats (GH-100460)
2022-12-23 14:42:24 +00:00
Brandt Bucher
09edde95f4
GH-99554: Trim trailing whitespace (GH-100435)
...
Automerge-Triggered-By: GH:brandtbucher
2022-12-22 12:13:51 -08:00
penguin_wwy
a02161286a
GH-99770: Make the correct call specialization fail kind show up in the stats (GH-99771)
2022-12-22 12:44:59 +00:00
Pieter Eendebak
2b82c36f17
gh-99761: Add `_PyLong_IsPositiveSingleDigit` function to check for single digit integers ( #100064 )
2022-12-22 17:00:18 +05:30