Skip to content

Commit aa1b872

Browse files
DinoVfacebook-github-bot
authored andcommitted
Update kw args after ** args to not use BUILD_CONST_KEY_MAP
Summary: 3.14 no longer has BUILD_CONST_KEY_MAP so we just need a version of `compiler_subkwargs` which never attempts to use it. Reviewed By: alexmalyshev Differential Revision: D81360794 fbshipit-source-id: 6da67891e0a9b35ffbaf175cfbbf5b5e8cb4dbd1
1 parent 9dd8942 commit aa1b872

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

cinderx/PythonLib/cinderx/compiler/pycodegen.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6083,6 +6083,21 @@ def _fastcall_helper(
60836083
else:
60846084
self.emit("CALL", argcnt + len(args) + len(kwargs))
60856085

6086+
def compiler_subkwargs(
6087+
self, kwargs: list[ast.keyword], begin: int, end: int
6088+
) -> None:
6089+
nkwargs = end - begin
6090+
big = (nkwargs * 2) > STACK_USE_GUIDELINE
6091+
if big:
6092+
self.emit_noline("BUILD_MAP", 0)
6093+
for i in range(begin, end):
6094+
self.emit("LOAD_CONST", kwargs[i].arg)
6095+
self.visit(kwargs[i].value)
6096+
if big:
6097+
self.emit_noline("MAP_ADD", 1)
6098+
if not big:
6099+
self.emit("BUILD_MAP", nkwargs)
6100+
60866101
def emit_noopt_call(self, node: ast.Call) -> None:
60876102
self.visit(node.func)
60886103
self.graph.emit_with_loc("PUSH_NULL", 0, node.func)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def f():
2+
x(**x, x=1, y=2)

0 commit comments

Comments
 (0)