Skip to content

regression with 0.11 version: hardcoded super() breaks the python3 class extensibility #1262

@sem-geologist

Description

@sem-geologist

I actually am not sure if this is regression introduced by kaitaistruct python runtime or rather kaitaistruct python compiler.

I was happily using kaitaistruct 0.10 python runtime for few years. However after trying to update my environment to kaitaistruct 0.11 runtime, and my initial ksy recompiled through web-ide of kaitaistruct for kaitaistruct 0.11, the parser no more works. Parser source ksy code is here:
https://github.com/sem-geologist/peaksight-binary-parser

The error I am running into after running this:

import cameca
qtifile = cameca.Cameca.from_file('Apatite_F-LTAP.qtiSet')

is this:

---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
/tmp/ipykernel_13843/3962983913.py in <module>
      3 import cameca
----> 4 qtifile = cameca.Cameca.from_file('../RE-qtiset/Apatite_F-LTAP.qtiSet')

~/[redacted]/kaitaistruct.py in from_file(cls, filename)
     43         f = open(filename, 'rb')
     44         try:
---> 45             return cls(KaitaiStream(f))
     46         except Exception:
     47             # close file descriptor, then reraise the exception

~/[redacted]/cameca.py in __init__(self, _io, _parent, _root)
    193         self._parent = _parent
    194         self._root = _root or self
--> 195         self._read()
    196 
    197     def _read(self):

~/[redacted]/cameca.py in _read(self)
    196 
    197     def _read(self):
--> 198         self.header = Cameca.SxfHeader(self._io, self, self._root)
    199         _on = self.header.file_type
    200         if _on == Cameca.FileType.calibration_results:

~/[redacted]/cameca.py in __init__(self, _io, _parent, _root)
   2201             self._parent = _parent
   2202             self._root = _root
-> 2203             self._read()
   2204 
   2205         def _read(self):

~/[redacted]/cameca.py in _read(self)
   2209                 raise kaitaistruct.ValidationNotEqualError(b"\x66\x78\x73", self.magic, self._io, u"/types/sxf_header/seq/1")
   2210             self.sxf_version = self._io.read_u4le()
-> 2211             self.comment = Cameca.CSharpString(self._io, self, self._root)
   2212             self.reserved_0 = self._io.read_bytes(24)
   2213             if self.sxf_version >= 3:

~/[redacted]/cameca.py in __init__(self, _io, _parent, _root)
    314     class CSharpString(KaitaiStruct):
    315         def __init__(self, _io, _parent=None, _root=None):
--> 316             super(Cameca.CSharpString, self).__init__(_io)
    317             self._parent = _parent
    318             self._root = _root

... last 1 frames repeated, from the frame below ...

~/[redacted]/cameca.py in __init__(self, _io, _parent, _root)
    314     class CSharpString(KaitaiStruct):
    315         def __init__(self, _io, _parent=None, _root=None):
--> 316             super(Cameca.CSharpString, self).__init__(_io)
    317             self._parent = _parent
    318             self._root = _root

RecursionError: maximum recursion depth exceeded while calling a Python object

I am attaching zipped binary file.

python 3.10.12
Apatite_F-LTAP.qtiSet.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions