Skip to content

Commit d5ef994

Browse files
committed
expose the __flags__ attribute on types
1 parent 72b6c3c commit d5ef994

File tree

1 file changed

+11
-0
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type

1 file changed

+11
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/TypeBuiltins.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,4 +876,15 @@ Object setNative(@SuppressWarnings("unused") PythonAbstractNativeObject cls, @Su
876876
throw raise(PythonErrorType.RuntimeError, "can't set attributes of native type");
877877
}
878878
}
879+
880+
@Builtin(name = "__flags__", fixedNumOfPositionalArgs = 1, isGetter = true)
881+
@GenerateNodeFactory
882+
static abstract class FlagsNode extends PythonUnaryBuiltinNode {
883+
@Child TypeNodes.GetTypeFlagsNode getFlagsNode = TypeNodes.GetTypeFlagsNode.create();
884+
885+
@Specialization
886+
Object flags(PythonAbstractClass self) {
887+
return getFlagsNode.execute(self);
888+
}
889+
}
879890
}

0 commit comments

Comments
 (0)