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

Function generate_dunder_wrapper

mypyc/codegen/emitwrapper.py:290–301  ·  view source on GitHub ↗

Generates a wrapper for native __dunder__ methods to be able to fit into the mapping protocol slot. This specifically means that the arguments are taken as *PyObjects and returned as *PyObjects.

(cl: ClassIR, fn: FuncIR, emitter: Emitter)

Source from the content-addressed store, hash-verified

288
289
290def generate_dunder_wrapper(cl: ClassIR, fn: FuncIR, emitter: Emitter) -> str:
291 """Generates a wrapper for native __dunder__ methods to be able to fit into the mapping
292 protocol slot. This specifically means that the arguments are taken as *PyObjects and returned
293 as *PyObjects.
294 """
295 gen = WrapperGenerator(cl, emitter)
296 gen.set_target(fn)
297 gen.emit_header()
298 gen.emit_arg_processing()
299 gen.emit_call()
300 gen.finish()
301 return gen.wrapper_name()
302
303
304def generate_ipow_wrapper(cl: ClassIR, fn: FuncIR, emitter: Emitter) -> str:

Callers

nothing calls this directly

Calls 7

set_targetMethod · 0.95
emit_headerMethod · 0.95
emit_arg_processingMethod · 0.95
emit_callMethod · 0.95
finishMethod · 0.95
wrapper_nameMethod · 0.95
WrapperGeneratorClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…