Skip to content

Commit bef5b4c

Browse files
committed
Move builtin rewrite assert
1 parent d9d49e9 commit bef5b4c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/GraalPythonModuleBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,21 +390,21 @@ public synchronized PFunction convertToBuiltin(PFunction func) {
390390
Signature signature = func.getSignature();
391391
PFunction builtinFunc;
392392
FunctionRootNode functionRootNode = (FunctionRootNode) func.getFunctionRootNode();
393-
assert !functionRootNode.isPythonInternal() : "a function cannot be annotated as builtin twice";
394-
functionRootNode.setPythonInternal(true);
395393
if (signature.getParameterIds().length > 0 && signature.getParameterIds()[0].equals("self")) {
396394
/*
397395
* If the first parameter is called self, we assume the function does explicitly
398396
* declare the module argument
399397
*/
400398
builtinFunc = func;
399+
functionRootNode.setPythonInternal(true);
401400
} else {
402401
/*
403402
* Otherwise, we create a new function with a signature that requires one extra
404403
* argument in front. We actually modify the function's AST here, so the original
405404
* PFunction cannot be used anymore (its signature won't agree with it's indexed
406405
* parameter reads).
407406
*/
407+
assert !functionRootNode.isPythonInternal() : "a function cannot be rewritten as builtin twice";
408408
functionRootNode = functionRootNode.rewriteWithNewSignature(signature.createWithSelf(), new NodeVisitor() {
409409

410410
public boolean visit(Node node) {

0 commit comments

Comments
 (0)