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

parse_typename fails on const pointer members #1229

Open
veprbl opened this issue Jun 10, 2024 · 0 comments · May be fixed by #1231
Open

parse_typename fails on const pointer members #1229

veprbl opened this issue Jun 10, 2024 · 0 comments · May be fixed by #1231
Labels
bug (unverified) The problem described would be a bug, but needs to be triaged

Comments

@veprbl
Copy link
Contributor

veprbl commented Jun 10, 2024

wget -O uproot-issue-XXX.root https://github.com/scikit-hep/scikit-hep-testdata/raw/7387822903e0c0de02cee4b98dbb9677f7bfba2a/src/skhep_testdata/data/uproot-issue-1229.root
>>> import uproot
>>> uproot.__version__
'5.3.7'
>>> uproot.open("uproot-issue-XXX.root")["tree"]["branch/pointer"].typename
'TFooMember*'
>>> uproot.open("uproot-issue-XXX.root")["tree"]["branch/const_pointer"].typename
Traceback (most recent call last):
  File "/nix/store/bz0s89q09d1jxb96bcpjad38sqw6nimk-python3.11-uproot-5.3.7/lib/python3.11/site-packages/uproot/interpretation/identify.py", line 385, in interpretation_of
    from_dtype = _leaf_to_dtype(leaf, getdims=False).newbyteorder(">")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/bz0s89q09d1jxb96bcpjad38sqw6nimk-python3.11-uproot-5.3.7/lib/python3.11/site-packages/uproot/interpretation/identify.py", line 103, in _leaf_to_dtype
    return numpy.dtype((_ftype_to_dtype(leaf.member("fType")), dims))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/bz0s89q09d1jxb96bcpjad38sqw6nimk-python3.11-uproot-5.3.7/lib/python3.11/site-packages/uproot/interpretation/identify.py", line 61, in _ftype_to_dtype
    raise NotNumerical()
uproot.interpretation.identify.NotNumerical

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/bz0s89q09d1jxb96bcpjad38sqw6nimk-python3.11-uproot-5.3.7/lib/python3.11/site-packages/uproot/behaviors/TBranch.py", line 1942, in typename
    if self.interpretation is None:
       ^^^^^^^^^^^^^^^^^^^
  File "/nix/store/bz0s89q09d1jxb96bcpjad38sqw6nimk-python3.11-uproot-5.3.7/lib/python3.11/site-packages/uproot/behaviors/TBranch.py", line 1926, in interpretation
    self._interpretation = uproot.interpretation.identify.interpretation_of(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/bz0s89q09d1jxb96bcpjad38sqw6nimk-python3.11-uproot-5.3.7/lib/python3.11/site-packages/uproot/interpretation/identify.py", line 467, in interpretation_of
    model_cls = parse_typename(
                ^^^^^^^^^^^^^^^
  File "/nix/store/bz0s89q09d1jxb96bcpjad38sqw6nimk-python3.11-uproot-5.3.7/lib/python3.11/site-packages/uproot/interpretation/identify.py", line 1134, in parse_typename
    _parse_error(tokens[i].start(), typename, file)
  File "/nix/store/bz0s89q09d1jxb96bcpjad38sqw6nimk-python3.11-uproot-5.3.7/lib/python3.11/site-packages/uproot/interpretation/identify.py", line 537, in _parse_error
    raise ValueError(
ValueError: invalid C++ type name syntax at char 6

    const TFooMember*
----------^
in file uproot-issue-XXX.root
@veprbl veprbl added the bug (unverified) The problem described would be a bug, but needs to be triaged label Jun 10, 2024
veprbl added a commit to veprbl/scikit-hep-testdata that referenced this issue Jun 10, 2024
veprbl added a commit to veprbl/scikit-hep-testdata that referenced this issue Jun 10, 2024
jpivarski pushed a commit to scikit-hep/scikit-hep-testdata that referenced this issue Jul 16, 2024
* feat: for scikit-hep/uproot5#1229

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (unverified) The problem described would be a bug, but needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant