Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-26849

astshim incompatible with pybind11 2.5

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: astshim
    • Labels:
    • Team:
      Alert Production
    • Urgent?:
      No

      Description

      I get errors testing astshim with pybind11 2.5.

      ______________________________ ERROR collecting tests/test_rateMap.py ______________________________
      ImportError while importing test module '/lsstsw/build/astshim/tests/test_rateMap.py'.
      Hint: make sure your test modules/packages have valid Python names.
      Traceback:
      tests/test_rateMap.py:6: in <module>
          import astshim as ast
      python/astshim/__init__.py:43: in <module>
          from .fitsChanContinued import *
      python/astshim/fitsChanContinued.py:3: in <module>
          from .fitsChan import CardType, FitsChan, FitsKeyState
      E   ImportError: generic_type: type "FitsKeyState" is already registered!
      

      Note that FitsKeyState is an "enum class" type, and includes an export_values() call in the declaration for pybind11.

      There is a note in the developer guide about using .export_values with that type, which I'm not sure if it's applicable in this instance, which reads:
       
      Add .export_values() if (and only if) you need to export the values into the class scope (so they can be reached as ExampleOne.RED, in addition to ExampleOne.State.Red).

      Never do this for new style scoped enum class types, since that will give them different symantics in C++ and Python.

        Attachments

          Issue Links

            Activity

            Hide
            tjenness Tim Jenness added a comment -

            Which of the four options is triggering this? The first (ie all of them)?

            Can you dump the native form of the AST object to see what is really inside it (rather than what the python interface thinks is inside it). You can do that with cmp3simp.show().

            Show
            tjenness Tim Jenness added a comment - Which of the four options is triggering this? The first (ie all of them)? Can you dump the native form of the AST object to see what is really inside it (rather than what the python interface thinks is inside it). You can do that with cmp3simp.show().
            Hide
            bvan Brian Van Klaveren added a comment -

            I apologize - this is actually with starlink 9.2.1. The error may be there.

            Show
            bvan Brian Van Klaveren added a comment - I apologize - this is actually with starlink 9.2.1. The error may be there.
            Hide
            tjenness Tim Jenness added a comment -

            I believe there were some changes to simplification, so that's why I asked about versions. Seems like a bug report is needed for upstream.

            Show
            tjenness Tim Jenness added a comment - I believe there were some changes to simplification, so that's why I asked about versions. Seems like a bug report is needed for upstream.
            Hide
            bvan Brian Van Klaveren added a comment -

            I dropped to previous version of starlink-ast and it built fine, so the pybind11 issue is just the enum values being duplicated.

            Show
            bvan Brian Van Klaveren added a comment - I dropped to previous version of starlink-ast and it built fine, so the pybind11 issue is just the enum values being duplicated.
            Hide
            tjenness Tim Jenness added a comment -

            Thanks. Are you going to report the AST simplify problem?

            Show
            tjenness Tim Jenness added a comment - Thanks. Are you going to report the AST simplify problem?

              People

              Assignee:
              bvan Brian Van Klaveren
              Reporter:
              bvan Brian Van Klaveren
              Reviewers:
              Tim Jenness
              Watchers:
              Brian Van Klaveren, Jim Bosch, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.