llvm-project
6a4f6647 - [MLIR][Python] restore `liveModuleMap` (#158506)

Commit
309 days ago
[MLIR][Python] restore `liveModuleMap` (#158506) There are cases where the same module can have multiple references (via `PyModule::forModule` via `PyModule::createFromCapsule`) and thus when `PyModule`s get gc'd `mlirModuleDestroy` can get called multiple times for the same actual underlying `mlir::Module` (i.e., double free). So we do actually need a "liveness map" for modules. Note, if `type_caster<MlirModule>::from_cpp` weren't a thing we could guarantree this never happened except explicitly when users called `PyModule::createFromCapsule`.
Author
Parents
Loading