🤖 AI generated content
1. repr() of a successfully read object can raise. src/rootfilespec/bootstrap/TObject.py:53-63 raises ValueError: Invalid bits set in TObjFlag: 0x… for any bit not in the enum. The class's own docstring (:15-17) quotes the rule that makes this unsatisfiable: "Bits 14 - 23 can be used in different class hierarchies". Reproduced: repr(TObjFlag(0x200)) (TH1::kNoStats, i.e. any histogram after SetStats(0)), TObjFlag(0x800) (a TAxis bit) and TObjFlag(0x100) (TObject::kNoContextMenu, BIT(8), simply missing from the enum) all raise. The read succeeds; print() crashes.
2. Mislabelled members (TObject.py:41-50). These are class-specific bits that happened to show up on TStreamerInfo/TStreamerElement/TList objects, not TObject bits. Reviewers checked the pinned ROOT tree (TVirtualStreamerInfo.h:72-88, TStreamerElement.h:69-78, TObject.h:70-96):
| Member |
Value |
Actually |
kNotSure |
0x10000 |
TStreamerInfo::kIsCompiled (BIT 16); TCollection::kUseRWLock |
kMysteryStreamer |
0x20000 |
TStreamerInfo::kBuildOldUsed (BIT 17) |
kMysteryStreamer2 |
0x1000 |
TStreamerElement::kWrite / TStreamerInfo::kCannotOptimize / TClonesArray::kBypassStreamer (BIT 12) |
kDoNotDelete |
0x2000 |
TObject::kInvalidObject / TStreamerElement::kDoNotDelete / TStreamerInfo::kIgnoreTObjectStreamer (BIT 13) |
kListOfRules |
0x4000 |
TCollection::kIsOwner (BIT 14) — the listOfRules list has it because it is an owner, not because it holds rules |
Three of these are load-bearing in the spec and tested nowhere in the code: kIgnoreTObjectStreamer on a TStreamerInfo (Streamer-driven reading §4.2, see #94), kHasRange = BIT(6) on a TStreamerElement (value 0x40, which the enum calls kCannotPick; needed by #41), and kBypassStreamer on a TClonesArray (Collections §12).
Suggested fix: make __repr__ total (print unknown bits as hex; drop the TODO on :52 about validating at construction — validation is impossible by design). Keep only genuine TObject bits (0–13 plus the private 24–27, adding kNoContextMenu = 0x100, kInvalidObject = 0x2000) in TObjFlag, and define per-class flag enums (TStreamerInfo, TStreamerElement, TCollection, TClonesArray) where the code needs them.
Severity / size: medium (exception from repr on ordinary histograms) / S.
Related: #41 (kHasRange), #94, #101, #110 (read fBits unsigned), #100.
Assisted-by: claude-code:claude-fable-5-1
1.
repr()of a successfully read object can raise.src/rootfilespec/bootstrap/TObject.py:53-63raisesValueError: Invalid bits set in TObjFlag: 0x…for any bit not in the enum. The class's own docstring (:15-17) quotes the rule that makes this unsatisfiable: "Bits 14 - 23 can be used in different class hierarchies". Reproduced:repr(TObjFlag(0x200))(TH1::kNoStats, i.e. any histogram afterSetStats(0)),TObjFlag(0x800)(aTAxisbit) andTObjFlag(0x100)(TObject::kNoContextMenu,BIT(8), simply missing from the enum) all raise. The read succeeds;print()crashes.2. Mislabelled members (
TObject.py:41-50). These are class-specific bits that happened to show up onTStreamerInfo/TStreamerElement/TListobjects, notTObjectbits. Reviewers checked the pinned ROOT tree (TVirtualStreamerInfo.h:72-88,TStreamerElement.h:69-78,TObject.h:70-96):kNotSure0x10000TStreamerInfo::kIsCompiled(BIT 16);TCollection::kUseRWLockkMysteryStreamer0x20000TStreamerInfo::kBuildOldUsed(BIT 17)kMysteryStreamer20x1000TStreamerElement::kWrite/TStreamerInfo::kCannotOptimize/TClonesArray::kBypassStreamer(BIT 12)kDoNotDelete0x2000TObject::kInvalidObject/TStreamerElement::kDoNotDelete/TStreamerInfo::kIgnoreTObjectStreamer(BIT 13)kListOfRules0x4000TCollection::kIsOwner(BIT 14) — thelistOfRuleslist has it because it is an owner, not because it holds rulesThree of these are load-bearing in the spec and tested nowhere in the code:
kIgnoreTObjectStreameron aTStreamerInfo(Streamer-driven reading §4.2, see #94),kHasRange= BIT(6) on aTStreamerElement(value0x40, which the enum callskCannotPick; needed by #41), andkBypassStreameron aTClonesArray(Collections §12).Suggested fix: make
__repr__total (print unknown bits as hex; drop the TODO on:52about validating at construction — validation is impossible by design). Keep only genuineTObjectbits (0–13 plus the private 24–27, addingkNoContextMenu = 0x100,kInvalidObject = 0x2000) inTObjFlag, and define per-class flag enums (TStreamerInfo,TStreamerElement,TCollection,TClonesArray) where the code needs them.Severity / size: medium (exception from
repron ordinary histograms) / S.Related: #41 (
kHasRange), #94, #101, #110 (readfBitsunsigned), #100.Assisted-by: claude-code:claude-fable-5-1