Skip to content

TArray family: TArrayL / TArrayL64 missing (generated fallback is one byte too long), TArrayC read unsigned #107

Description

@nsmith-

🤖 AI generated content

src/rootfilespec/bootstrap/array.py hardcodes only TArrayC/S/I/F/D.

  1. TArrayL and TArrayL64 are missing. TArray §1 "Layout" lists seven classes; TArrayL is 8 bytes per element on disk (not sizeof(long)), as is TArrayL64.
  2. The fallback is actively wrong, not merely absent. TArray §2: a recorded streamer info for a concrete TArray describes a layout one byte longer than the bytes (a kOffsetP presence flag that TArray::Streamer never writes). Because the two classes are not in BOOTSTRAP_TYPES, a file carrying their info gets a generated class; the reviewer printed class_definition() for the TArrayF info in data/classes/tarray-histogram.root and got BasicArray('>f', 'fN') with haspad defaulting to True (src/rootfilespec/container.py:59) — exactly the too-long reader. The hardcoded classes pass haspad=False (array.py:24-51) and are correct; that deserves a comment.
  3. TArrayC is read unsigned — array.py:24 uses ">B"/np.uint8. Char_t is signed; the spec's fixture asserts the elements as i8 (reference/root-io-spec/gen/cases/classes/tarray/case.toml). Values ≥ 128 come out positive.
  4. fN < 0 is not rejected (TArray §5 invariant 1) and would reach np.frombuffer(count=n) (container.py:48).

Evidence: reference/root-io-spec/data/classes/tarray.root → records /l and /q unreadable (Unknown type). data/serialization/version-zero.root → TH1L is generated as class TH1L(TArrayL64, TH1) with TArrayL64 falling back to Uninterpreted, and the read dies with TypeError: TH1L.__init__() missing 36 required positional arguments (error also reported as Class TH1L depends on TArrayL64 which is missing). No skhep_testdata file carries a TArrayL64 info.

Suggested fix: add TArrayL and TArrayL64 (both ">q", haspad=False) to array.py and bootstrap.__all__; change TArrayC to ">b"/np.int8; assert fN >= 0.

Severity / size: high for TH1L/TH2L and TArrayL* records from current ROOT, low for the TArrayC sign / S.

Related: #101, #102, #111 (version-zero.root also trips that).

Assisted-by: claude-code:claude-fable-5-1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions