MCPcopy Index your code
hub / github.com/python/mypy / LoadStatic

Class LoadStatic

mypyc/ir/ops.py:975–1012  ·  view source on GitHub ↗

Load a static name (name :: static). Load a C static variable/pointer. The namespace for statics is shared for the entire compilation group. You can optionally provide a module name and a sub-namespace identifier for additional namespacing to avoid name conflicts. The static namespa

Source from the content-addressed store, hash-verified

973
974@final
975class LoadStatic(RegisterOp):
976 """Load a static name (name :: static).
977
978 Load a C static variable/pointer. The namespace for statics is shared
979 for the entire compilation group. You can optionally provide a module
980 name and a sub-namespace identifier for additional namespacing to avoid
981 name conflicts. The static namespace does not overlap with other C names,
982 since the final C name will get a prefix, so conflicts only must be
983 avoided with other statics.
984 """
985
986 error_kind = ERR_NEVER
987 is_borrowed = True
988
989 def __init__(
990 self,
991 type: RType,
992 identifier: str,
993 module_name: str | None = None,
994 namespace: str = NAMESPACE_STATIC,
995 line: int = -1,
996 ann: object = None,
997 ) -> None:
998 super().__init__(line)
999 self.identifier = identifier
1000 self.module_name = module_name
1001 self.namespace = namespace
1002 self.type = type
1003 self.ann = ann # An object to pretty print with the load
1004
1005 def sources(self) -> list[Value]:
1006 return []
1007
1008 def set_sources(self, new: list[Value]) -> None:
1009 assert not new
1010
1011 def accept(self, visitor: OpVisitor[T]) -> T:
1012 return visitor.visit_load_static(self)
1013
1014
1015@final

Callers 8

load_type_varMethod · 0.90
load_globals_dictMethod · 0.90
get_defaultFunction · 0.90
allocate_classFunction · 0.90
load_static_checkedMethod · 0.90
load_moduleMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…