Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
72afa83
gh-97933: inline sync list/dict/set comprehensions
carljm Jan 30, 2023
8988234
simplify cell handling code slightly
carljm Jan 31, 2023
22c4a86
clarify comments
carljm Jan 31, 2023
c1b54f0
enable inlining async comprehensions also
carljm Jan 31, 2023
43db9b8
fix typo
carljm Jan 31, 2023
ed3209b
Merge branch 'main' into inlinecomp2
carljm Jan 31, 2023
aceb6c7
fix outer-cell, inner-local case
carljm Jan 31, 2023
e57c354
fix restoring NULL (unbound outer name) followed by load
carljm Jan 31, 2023
795d854
emit 1 x SWAP N+1 instead of N x SWAP 2
carljm Jan 31, 2023
686221a
remove stray dis.dis() call
carljm Jan 31, 2023
ac99697
fix compiler warning about Py_ssize_t -> int conversion
carljm Jan 31, 2023
db208d5
Merge branch 'main' into inlinecomp2
carljm Jan 31, 2023
8b76051
Merge branch 'main' into inlinecomp2
carljm Feb 1, 2023
4620856
add a couple more tests
carljm Feb 1, 2023
8773653
clear comp locals on entry, eval iter expr first
carljm Feb 1, 2023
be3becc
Merge branch 'main' into inlinecomp2
carljm Feb 9, 2023
f0c051e
fix double decref in error case
carljm Feb 9, 2023
142859a
adjust to RETURN_CONST
carljm Feb 9, 2023
568a470
fix up refcounting
carljm Feb 10, 2023
add772e
Merge branch 'main' into inlinecomp2
carljm Feb 10, 2023
17d5d84
improve importlib comment
carljm Feb 10, 2023
b87d209
mark STORE_FAST_MAYBE_NULL as possibly NULLing a local
carljm Feb 10, 2023
36b2917
Merge branch 'main' into inlinecomp2
carljm Feb 10, 2023
ae0bd02
Merge branch 'main' into inlinecomp2
carljm Feb 13, 2023
9f0fc5b
Merge branch 'main' into inlinecomp2
carljm Feb 20, 2023
463c740
add test for NameError/UnboundLocalError
carljm Feb 28, 2023
67f50ba
fix case where iter var is free in outer scope
carljm Feb 28, 2023
73dc0ed
Merge branch 'main' into inlinecomp2
carljm Feb 28, 2023
ecb313c
Merge branch 'main' into inlinecomp2
carljm Mar 6, 2023
4109baa
add inlining of non-function-scope comprehensions
carljm Mar 7, 2023
d8802a1
simplify scope handling
carljm Mar 7, 2023
1c019a7
Merge branch 'main' into inlinecomp2
carljm Mar 7, 2023
24a9d9f
Merge branch 'main' into inlinecomp2
carljm Mar 8, 2023
b6a025b
add tests for comprehensions in class scope
carljm Mar 8, 2023
90b34de
run all listcomp scope tests in module, class, and func scope
carljm Mar 8, 2023
06db319
Merge branch 'main' into inlinecomp2
carljm Mar 8, 2023
b52046b
handle frame locals materialization in class/module scope
carljm Mar 14, 2023
6c5f269
Merge branch 'main' into inlinecomp2
carljm Mar 14, 2023
1a8f4a0
Merge branch 'main' into inlinecomp2
carljm Mar 17, 2023
1274e2b
Merge branch 'main' into inlinecomp2
carljm May 1, 2023
0727d6f
Merge branch 'main' into inlinecomp2
carljm May 2, 2023
51a1294
update comment
carljm May 2, 2023
8a78a36
Merge branch 'main' into inlinecomp2
carljm May 5, 2023
43722b4
review comments
carljm May 5, 2023
bf9e1f1
fix single backticks
carljm May 5, 2023
ca636a5
better nested test
carljm May 5, 2023
46c7a4f
fix u_fasthidden in nested case
carljm May 5, 2023
fb9f89e
fix refleak
carljm May 5, 2023
baacf5f
Merge branch 'main' into inlinecomp2
carljm May 5, 2023
5914d77
remove assumption that class scopes can't have cellvars
carljm May 5, 2023
ffae4e6
Apply suggestions from code review
carljm May 9, 2023
76077cd
Merge branch 'main' into inlinecomp2
carljm May 9, 2023
a8425a6
review comments
carljm May 9, 2023
656e46b
Apply suggestions from code review
carljm May 9, 2023
1402e7a
Apply suggestions from code review
carljm May 9, 2023
95401fe
Merge branch 'main' into inlinecomp2
carljm May 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into inlinecomp2
* main: (82 commits)
  gh-101670: typo fix in PyImport_ExtendInittab() (#101723)
  GH-99293: Document that `Py_TPFLAGS_VALID_VERSION_TAG` shouldn't be used. (#GH-101736)
  no-issue: Add Dong-hee Na as the cjkcodecs codeowner (gh-101731)
  gh-101678: Merge math_1_to_whatever() and math_1() (#101730)
  gh-101678: refactor the math module to use special functions from c11 (GH-101679)
  gh-85984: Remove legacy Lib/pty.py code. (#92365)
  gh-98831: Use opcode metadata for stack_effect() (#101704)
  gh-101283: Version was just released, so should be changed in 3.11.3 (GH-101719)
  gh-101283: Fix use of unbound variable (GH-101712)
  gh-101283: Improved fallback logic for subprocess with shell=True on Windows (GH-101286)
  gh-101277: Port more itertools static types to heap types (#101304)
  gh-98831: Modernize CALL and family (#101508)
  GH-101696: invalidate type version tag in `_PyStaticType_Dealloc` (#101697)
  gh-100221: Fix creating dirs in `make sharedinstall` (GH-100329)
  gh-101670: typo fix in PyImport_AppendInittab() (GH-101672)
  gh-101196: Make isdir/isfile/exists faster on Windows (GH-101324)
  gh-101614: Don't treat python3_d.dll as a Python DLL when checking extension modules for incompatibility (GH-101615)
  gh-100933: Improve `check_element` helper in `test_xml_etree` (#100934)
  GH-101578: Normalize the current exception (GH-101607)
  gh-47937: Note that Popen attributes are read-only (#93070)
  ...
  • Loading branch information
carljm committed Feb 9, 2023
commit be3becca2abd5fa42a3070c75e75f2fa6729aa75
7 changes: 3 additions & 4 deletions Include/internal/pycore_opcode.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Include/opcode.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Lib/importlib/_bootstrap_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ def _write_atomic(path, data, mode=0o666):
# Python 3.12a5 3515 (Embed jump mask in COMPARE_OP oparg)
# Python 3.12a5 3516 (Add COMPARE_AND_BRANCH instruction)
# Python 3.12a5 3517 (Change YIELD_VALUE oparg to exception block depth)
# Python 3.12a5 3518 (Inline sync list/dict/set comprehensions in the calling function)
# Python 3.12a5 3518 (Add RETURN_CONST instruction)
# Python 3.12a5 3519 (Inline sync list/dict/set comprehensions in the calling function)

# Python 3.13 will start with 3550

Expand All @@ -444,7 +445,7 @@ def _write_atomic(path, data, mode=0o666):
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# in PC/launcher.c must also be updated.

MAGIC_NUMBER = (3518).to_bytes(2, 'little') + b'\r\n'
MAGIC_NUMBER = (3519).to_bytes(2, 'little') + b'\r\n'

_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c

Expand Down
70 changes: 0 additions & 70 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1135,78 +1135,8 @@ stack_effect(int opcode, int oparg, int jump)
* if an exception be raised. */
return jump ? 1 : 0;

case WITH_EXCEPT_START:
return 1;

case LOAD_FAST:
case LOAD_FAST_CHECK:
case LOAD_FAST_AND_CLEAR:
return 1;
case STORE_FAST:
case STORE_FAST_MAYBE_NULL:
return -1;
case DELETE_FAST:
return 0;

case RETURN_GENERATOR:
return 0;

case RAISE_VARARGS:
return -oparg;

/* Functions and calls */
case KW_NAMES:
return 0;
case CALL:
return -1-oparg;
case CALL_INTRINSIC_1:
return 0;
case CALL_FUNCTION_EX:
return -2 - ((oparg & 0x01) != 0);
case MAKE_FUNCTION:
return 0 - ((oparg & 0x01) != 0) - ((oparg & 0x02) != 0) -
((oparg & 0x04) != 0) - ((oparg & 0x08) != 0);
case BUILD_SLICE:
if (oparg == 3)
return -2;
else
return -1;

/* Closures */
case MAKE_CELL:
case COPY_FREE_VARS:
return 0;
case LOAD_CLOSURE:
return 1;
case LOAD_DEREF:
case LOAD_CLASSDEREF:
return 1;
case STORE_DEREF:
return -1;
case DELETE_DEREF:
return 0;

/* Iterators and generators */
case GET_AWAITABLE:
return 0;

case BEFORE_ASYNC_WITH:
case BEFORE_WITH:
return 1;
case GET_AITER:
return 0;
case GET_ANEXT:
return 1;
case GET_YIELD_FROM_ITER:
return 0;
case END_ASYNC_FOR:
return -2;
case CLEANUP_THROW:
return -2;
case FORMAT_VALUE:
/* If there's a fmt_spec on the stack, we go from 2->1,
else 1->1. */
return (oparg & FVS_MASK) == FVS_HAVE_SPEC ? -1 : 0;
case LOAD_METHOD:
return 1;
default:
Expand Down
6 changes: 3 additions & 3 deletions Python/opcode_targets.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

You are viewing a condensed version of this merge commit. You can view the full changes here.