Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support const in typename #1231

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/uproot/interpretation/identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
13 changes: 13 additions & 0 deletions tests/test_1229_const_in_typename.py
Original file line number Diff line number Diff line change
@@ -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)
Loading