MCPcopy Create free account
hub / github.com/Nuitka/Nuitka / withObjectCodeTemporaryAssignment2

Function withObjectCodeTemporaryAssignment2

nuitka/code_generation/CodeHelpers.py:246–266  ·  view source on GitHub ↗

Converting to the target type, provide temporary object value name only if necessary.

(
    to_name, value_name, needs_conversion_check, emit, context
)

Source from the content-addressed store, hash-verified

244
245@contextmanager
246def withObjectCodeTemporaryAssignment2(
247 to_name, value_name, needs_conversion_check, emit, context
248):
249 """Converting to the target type, provide temporary object value name only if necessary."""
250
251 if to_name.c_type == "PyObject *":
252 value_name = to_name
253 else:
254 value_name = context.allocateTempName(value_name)
255
256 yield value_name
257
258 if to_name is not value_name:
259 # This is also tasked to release value_name.
260 to_name.getCType().emitAssignConversionCode(
261 to_name=to_name,
262 value_name=value_name,
263 needs_check=needs_conversion_check,
264 emit=emit,
265 context=context,
266 )
267
268
269@contextmanager

Callers 1

Calls 3

allocateTempNameMethod · 0.45
getCTypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…