Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit 1efaf64

Browse files
authored
[MLIR][Python] MLIR Enum Python bindings infinite recursion (#151584) (#151588)
Fixes an infinite recursion bug when using I32BitEnumAttrCaseGroup with python bindings. For more info, see issue: - llvm/llvm-project#151584
1 parent 3686811 commit 1efaf64

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mlir/tools/mlir-tblgen/EnumPythonBindingGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static void emitEnumClass(EnumInfo enumInfo, raw_ostream &os) {
6464
if (enumInfo.isBitEnum()) {
6565
os << formatv(" def __iter__(self):\n"
6666
" return iter([case for case in type(self) if "
67-
"(self & case) is case])\n");
67+
"(self & case) is case and self is not case])\n");
6868
os << formatv(" def __len__(self):\n"
6969
" return bin(self).count(\"1\")\n");
7070
os << "\n";

0 commit comments

Comments
 (0)