Uploaded image for project: 'Instrument control development'
  1. Instrument control development
  2. INSTRM-1690

Fix opscore.protocol.types formatting for python 3.8+

    XMLWordPrintable

    Details

      Description

      python 3.8 changes the way class _str methods are resolved. For class objects, obj.str now resolves to object.str; for instances obj.str resolves to obj.class.str_, which is what used to happen in both cases.

      Because of the way metaclasses are used in opscore types, the basic opscore.protocol.types (Int, Float, etc) use the class _str under normal circumstances, which now resolves to object.str instead of, say float.str_. And which returns, say, "Float(1.23)" instead of the desired "1.23".

      This is a problem when formatting MHS typed objects.

      I think the answer is simply to instantiate the base object in _str_(), except for String (i.e. baseType=str) objects. Testing now.

        Attachments

          Activity

            People

            • Assignee:
              cloomis cloomis
              Reporter:
              cloomis cloomis
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: