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

Method emit_module_def_slots

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

Source from the content-addressed store, hash-verified

1124 self.emit_init_only_func(emitter, module_name, module_prefix)
1125
1126 def emit_module_def_slots(
1127 self, emitter: Emitter, module_prefix: str, module_name: str
1128 ) -> None:
1129 name = f"{module_prefix}_slots"
1130 exec_name = f"CPyExec_{exported_name(module_name)}"
1131
1132 emitter.emit_line(f"static PyModuleDef_Slot {name}[] = {{")
1133 emitter.emit_line(f"{{Py_mod_exec, {exec_name}}},")
1134 if sys.version_info >= (3, 12):
1135 # Multiple interpreter support requires not using any C global state,
1136 # which we don't support yet.
1137 emitter.emit_line(
1138 "{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},"
1139 )
1140 if sys.version_info >= (3, 13):
1141 # Declare support for free-threading to enable experimentation,
1142 # even if we don't properly support it.
1143 emitter.emit_line("{Py_mod_gil, Py_MOD_GIL_NOT_USED},")
1144 emitter.emit_line("{0, NULL},")
1145 emitter.emit_line("};")
1146
1147 def emit_module_methods(
1148 self, emitter: Emitter, module_name: str, module_prefix: str, module: ModuleIR

Callers 1

generate_module_defMethod · 0.95

Calls 2

exported_nameFunction · 0.90
emit_lineMethod · 0.45

Tested by

no test coverage detected