Uploaded image for project: 'Request For Comments'
  1. Request For Comments
  2. RFC-227

Remove long from afw schema aliases

    XMLWordPrintable

Details

    • RFC
    • Status: Implemented
    • Resolution: Done
    • DM
    • None

    Description

      In python 3 all integers are 64 bit "long" integers, while in python 2, 32 and 64 bit integers are differentiated by the int and long types respectively. This causes confusion when adding a new field to a schema using addField in afw/table/Base.i in python 3, where the python type is converted into a C++ type using a dictionary

      aliases = {
          long: "L",
          int: "I",
          float: "D",
          str: "String",
          futurestr: "String",
          numpy.uint16: "U",
          numpy.int32: "I",
          numpy.int64: "L",
          numpy.float32: "F",
          numpy.float64: "D",
          Angle: "Angle",
      }
      

      So in python 3 all integers are truncated to the 32 bits in C++. The user can specify a suffix, for example "L" or "I", which will allow the code to work as expected, so it would be useful to remove the long key from aliases to prevent unexpected behavior in python 3, in other words

      aliases = {
          int: "I",
          float: "D",
          str: "String",
          futurestr: "String",
          numpy.uint16: "U",
          numpy.int32: "I",
          numpy.int64: "L",
          numpy.float32: "F",
          numpy.float64: "D",
          Angle: "Angle",
      }
      

      All existing code using `type=long` will need to be updated as part of this ticket.

      Attachments

        Issue Links

          Activity

            Fair enough, I can do that.

            fred3m Fred Moolekamp added a comment - Fair enough, I can do that.

            Since we've agreed on this change, opened a ticket to track it (DM-8078) and made the changes in the pybind11 stack (DM-7056), is it ok to mark this RFC adopted, or do I have to wait until DM-8078 is closed?

            fred3m Fred Moolekamp added a comment - Since we've agreed on this change, opened a ticket to track it ( DM-8078 ) and made the changes in the pybind11 stack ( DM-7056 ), is it ok to mark this RFC adopted, or do I have to wait until DM-8078 is closed?
            tjenness Tim Jenness added a comment -

            You can definitely mark it as Adopted once consensus is reached (which does seem to have happened). You mark it Implemented when the code is on master and the documentation (if any) have been updated.

            tjenness Tim Jenness added a comment - You can definitely mark it as Adopted once consensus is reached (which does seem to have happened). You mark it Implemented when the code is on master and the documentation (if any) have been updated.
            tjenness Tim Jenness added a comment -

            All triggered tickets have been closed. Should this RFC be marked implemented now?

            tjenness Tim Jenness added a comment - All triggered tickets have been closed. Should this RFC be marked implemented now?

            Good point tjenness.

            fred3m Fred Moolekamp added a comment - Good point tjenness .

            People

              fred3m Fred Moolekamp
              fred3m Fred Moolekamp
              Fred Moolekamp, Jim Bosch, John Parejko, Pim Schellart [X] (Inactive), Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Planned End:

                Jenkins

                  No builds found.