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

Implement exception translators in upstream pybind11

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Story Points:
      4
    • Sprint:
      DRP F16-1, DRP F16-2
    • Team:
      Data Release Production

      Description

      Pybind11 does not currently support translation of custom exceptions. This ticket tracks work done on upstream pybind11 (internal fork https://github.com/lsst-dm/pybind11-1) to implement this functionality. It should support functionality equivalent to (but not necessarily with the same API) as Boost Python exception translators (http://www.boost.org/doc/libs/1_61_0/libs/python/doc/html/reference/high_level_components/boost_python_exception_translato.html).

        Attachments

          Issue Links

            Activity

            Hide
            swinbank John Swinbank added a comment -

            Pim Schellart [X] – I've added an entirely speculative SP count to this story. Please update it to something you think is more reasonable. (Bonus points if you remember to put in SP estimates before starting work in future! )

            Show
            swinbank John Swinbank added a comment - Pim Schellart [X] – I've added an entirely speculative SP count to this story. Please update it to something you think is more reasonable. (Bonus points if you remember to put in SP estimates before starting work in future! )
            Hide
            pschella Pim Schellart [X] (Inactive) added a comment -

            SP look fine (if anything a bit on the high end). I will! Although I think I remember telling you I was going to put this in as a 0 point story and assume the SP were contained by its parent

            Show
            pschella Pim Schellart [X] (Inactive) added a comment - SP look fine (if anything a bit on the high end). I will! Although I think I remember telling you I was going to put this in as a 0 point story and assume the SP were contained by its parent
            Hide
            pschella Pim Schellart [X] (Inactive) added a comment - - edited

            Updated design:

            When an exception is caught, give each registered exception translator a chance to translate it to a Python exception in reverse order of registration.

            A translator may choose to do one of the following:

            • catch the exception and call PyErr_SetString or PyErr_SetObject to set a standard (or custom) Python exception, or
            • do nothing and let the exception fall through to the next translator, or
            • delegate translation to the next translator by throwing a new type of exception.

            The last point is a little tricky, and breaks the ability to mentally view the set of translators as a single block of catch clauses. But it is what Boost does (or seems to do) and may be necessary
            to avoid code duplication.

            Have sent a link to this version to the pybind11 developers. Will now wait for their feedback.
            Assuming the design holds up I intend to use it for DM-6302 and formally it upstream if this suffices.

            Show
            pschella Pim Schellart [X] (Inactive) added a comment - - edited Updated design: When an exception is caught, give each registered exception translator a chance to translate it to a Python exception in reverse order of registration. A translator may choose to do one of the following: catch the exception and call PyErr_SetString or PyErr_SetObject to set a standard (or custom) Python exception, or do nothing and let the exception fall through to the next translator, or delegate translation to the next translator by throwing a new type of exception. The last point is a little tricky, and breaks the ability to mentally view the set of translators as a single block of catch clauses. But it is what Boost does (or seems to do) and may be necessary to avoid code duplication. Have sent a link to this version to the pybind11 developers. Will now wait for their feedback. Assuming the design holds up I intend to use it for DM-6302 and formally it upstream if this suffices.
            Hide
            pschella Pim Schellart [X] (Inactive) added a comment -

            Received very positive feedback on the latest design from the lead pybind11 developer.
            He is keen to accept the code.
            I propose we will attempt DM-6302 with this solution and close this ticket when the design works and is accepted upstream.

            Show
            pschella Pim Schellart [X] (Inactive) added a comment - Received very positive feedback on the latest design from the lead pybind11 developer. He is keen to accept the code. I propose we will attempt DM-6302 with this solution and close this ticket when the design works and is accepted upstream.
            Hide
            pschella Pim Schellart [X] (Inactive) added a comment -

            Merged in upstream.

            Show
            pschella Pim Schellart [X] (Inactive) added a comment - Merged in upstream.

              People

              Assignee:
              pschella Pim Schellart [X] (Inactive)
              Reporter:
              pschella Pim Schellart [X] (Inactive)
              Reviewers:
              Jim Bosch
              Watchers:
              Andy Salnikov, Jim Bosch, John Swinbank, Pim Schellart [X] (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.