Skip to content

Commit 40e119e

Browse files
author
Adam Hrbac
committed
Add class_getitem to ContextVar.
1 parent c13f7eb commit 40e119e

File tree

1 file changed

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

1 file changed

+8
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/contextvars/ContextVarBuiltins.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,12 @@ Object doError(PContextVar self, Object token, @Cached PRaiseNode raise) {
131131
}
132132
}
133133

134+
@Builtin(name = "__class_getitem__", minNumOfPositionalArgs = 2, isClassmethod = true)
135+
@GenerateNodeFactory
136+
public abstract static class ClassGetItemNode extends PythonBinaryBuiltinNode {
137+
@Specialization
138+
static Object classGetItem(Object cls, Object key) {
139+
return cls; // TODO: use a GenericAlias
140+
}
141+
}
134142
}

0 commit comments

Comments
 (0)