From a6e426ed8943233b97ee17ca95e51c6d42cb6a54 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Mon, 9 Oct 2023 16:39:16 +0200 Subject: [PATCH] fix: update cppyy module (#2747) --- src/awkward/cppyy.py | 6 ++++-- src/awkward/highlevel.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/awkward/cppyy.py b/src/awkward/cppyy.py index 9a350d4e9a..36e15bfabb 100644 --- a/src/awkward/cppyy.py +++ b/src/awkward/cppyy.py @@ -1,6 +1,6 @@ # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE -import awkward as ak +import packaging.version _has_checked_version = False @@ -25,7 +25,9 @@ def register_and_check(): ) from err if not _has_checked_version: - if ak._util.parse_version(cppyy.__version__) < ak._util.parse_version("3.0.1"): + if packaging.version.Version(cppyy.__version__) < packaging.version.Version( + "3.0.1" + ): raise ImportError( "Awkward Array can only work with cppyy 3.0.1 or later " f"(you have version {cppyy.__version__})" diff --git a/src/awkward/highlevel.py b/src/awkward/highlevel.py index 4cde8e2b17..5e94cca762 100644 --- a/src/awkward/highlevel.py +++ b/src/awkward/highlevel.py @@ -1548,10 +1548,12 @@ def cpp_type(self): See [cppyy documentation](https://cppyy.readthedocs.io/en/latest/index.html) on types and signatures. """ - ak.cppyy.register_and_check() + ak.cppyy.register_and_check() # noqa: F823 import cppyy + import awkward._connect.cling # noqa: F401 + if self._cpp_type is None: self._generator = ak._connect.cling.togenerator( self.layout.form, flatlist_as_rvec=False