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

Method declare_module

mypyc/codegen/emitmodule.py:1520–1530  ·  view source on GitHub ↗
(self, module_name: str, emitter: Emitter)

Source from the content-addressed store, hash-verified

1518 return emitter.static_name(module_name + "__internal", None, prefix=MODULE_PREFIX)
1519
1520 def declare_module(self, module_name: str, emitter: Emitter) -> None:
1521 # We declare two globals for each compiled module:
1522 # one used internally in the implementation of module init to cache results
1523 # and prevent infinite recursion in import cycles, and one used
1524 # by other modules to refer to it.
1525 if module_name in self.modules:
1526 internal_static_name = self.module_internal_static_name(module_name, emitter)
1527 self.declare_global("CPyModule *", internal_static_name, initializer="NULL")
1528 static_name = emitter.static_name(module_name, None, prefix=MODULE_PREFIX)
1529 self.declare_global("CPyModule *", static_name)
1530 self.simple_inits.append((static_name, "Py_None"))
1531
1532 def declare_imports(self, imps: Iterable[str], emitter: Emitter) -> None:
1533 for imp in imps:

Callers 2

declare_importsMethod · 0.95

Calls 4

declare_globalMethod · 0.95
static_nameMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected