Skip to content

Commit

Permalink
fix: initialize empty TObject members on to_TObjString
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis committed Oct 24, 2022
1 parent baa82c9 commit 5c90b48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/uproot/writing/identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,12 +735,16 @@ def to_TObjString(string):
This function is for developers to create TObjString objects that can be
written to ROOT files, to implement conversion routines.
"""
tobject = uproot.models.TObject.Model_TObject.empty()
tobject._members["@fUniqueID"] = 0
tobject._members["@fBits"] = 0

tobjstring = uproot.models.TObjString.Model_TObjString(str(string))
tobjstring._deeply_writable = True
tobjstring._cursor = None
tobjstring._parent = None
tobjstring._members = {}
tobjstring._bases = (uproot.models.TObject.Model_TObject(),)
tobjstring._bases = [tobject]
tobjstring._num_bytes = len(string) + (1 if len(string) < 255 else 5) + 16
tobjstring._instance_version = 1
return tobjstring
Expand Down

0 comments on commit 5c90b48

Please sign in to comment.