diff --git a/src/uproot/writing/_cascadetree.py b/src/uproot/writing/_cascadetree.py index bf5491cec..66569c2c1 100644 --- a/src/uproot/writing/_cascadetree.py +++ b/src/uproot/writing/_cascadetree.py @@ -585,7 +585,9 @@ def extend(self, file, sink, data): ): kk = self._counter_name(k) vv = numpy.asarray(awkward.num(v, axis=1), dtype=">u4") - if kk in provided and not numpy.array_equal(vv, provided[kk]): + if kk in provided and not numpy.array_equal( + vv, awkward.to_numpy(provided[kk]) + ): raise ValueError( f"branch {kk!r} provided both as an explicit array and generated as a counter, and they disagree" ) diff --git a/tests/test_1318_dont_compare_big_endian_in_awkward.py b/tests/test_1318_dont_compare_big_endian_in_awkward.py new file mode 100644 index 000000000..4fdf0b4ed --- /dev/null +++ b/tests/test_1318_dont_compare_big_endian_in_awkward.py @@ -0,0 +1,18 @@ +# BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE + +import os + +import pytest +import awkward as ak + +import uproot + + +def test(tmp_path): + filename = os.path.join(tmp_path, "whatever.root") + + nMuon_pt = ak.Array([1, 2, 3]) + Muon_pt = ak.Array([[1.1], [2.2, 3.3], [4.4, 5.5, 6.6]]) + + with uproot.recreate(filename) as file: + file["tree"] = {"nMuon_pt": nMuon_pt, "Muon_pt": Muon_pt}