diff --git a/src/uproot/interpretation/identify.py b/src/uproot/interpretation/identify.py index 26daafbd9..d6724e967 100644 --- a/src/uproot/interpretation/identify.py +++ b/src/uproot/interpretation/identify.py @@ -577,6 +577,8 @@ def _parse_node(tokens, i, typename, file, quote, header, inner_header): if tokens[i].group(0) == ",": _parse_error(tokens[i].start() + 1, typename, file) + elif tokens[i].group(0) == "const": + return _parse_node(tokens, i + 1, typename, file, quote, header, inner_header) elif tokens[i].group(0) == "Bool_t": return i + 1, _parse_maybe_quote('numpy.dtype("?")', quote) elif tokens[i].group(0) == "bool": diff --git a/tests/test_1229_const_in_typename.py b/tests/test_1229_const_in_typename.py new file mode 100644 index 000000000..ac1085c7c --- /dev/null +++ b/tests/test_1229_const_in_typename.py @@ -0,0 +1,13 @@ +# BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE + +import pytest +import skhep_testdata + +from uproot.containers import AsPointer +from uproot.interpretation.identify import parse_typename +from uproot.models.TH import Model_TH1I + + +def test_const_in_typename(): + assert parse_typename("TH1I*") == AsPointer(Model_TH1I) + assert parse_typename("const TH1I*") == AsPointer(Model_TH1I)