From 5c90b481ace60ca803bf3e4498dd3f1e1a1f5130 Mon Sep 17 00:00:00 2001 From: Luis Obis Date: Mon, 24 Oct 2022 14:11:13 +0200 Subject: [PATCH] fix: initialize empty `TObject` members on `to_TObjString` --- src/uproot/writing/identify.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/uproot/writing/identify.py b/src/uproot/writing/identify.py index 837edc022..322faf6f2 100644 --- a/src/uproot/writing/identify.py +++ b/src/uproot/writing/identify.py @@ -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