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

Function has_managed_dict

mypyc/codegen/emitclass.py:1283–1292  ·  view source on GitHub ↗

Should the class get the Py_TPFLAGS_MANAGED_DICT flag?

(cl: ClassIR, emitter: Emitter)

Source from the content-addressed store, hash-verified

1281
1282
1283def has_managed_dict(cl: ClassIR, emitter: Emitter) -> bool:
1284 """Should the class get the Py_TPFLAGS_MANAGED_DICT flag?"""
1285 # On 3.11 and earlier the flag doesn't exist and we use
1286 # tp_dictoffset instead. If a class inherits from Exception, the
1287 # flag conflicts with tp_dictoffset set in the base class.
1288 return (
1289 emitter.capi_version >= (3, 12)
1290 and cl.has_dict
1291 and cl.builtin_base != "PyBaseExceptionObject"
1292 )
1293
1294
1295def native_class_doc_initializer(cl: ClassIR) -> str:

Callers 3

generate_classFunction · 0.85
generate_clear_for_classFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…