Skip to content
This repository was archived by the owner on Sep 1, 2021. It is now read-only.
This repository was archived by the owner on Sep 1, 2021. It is now read-only.

CString.sizeof(context) throws "can't calculate size" SizeofError #11

@HazimGazov

Description

@HazimGazov

This seems to be an issue with CString being an adapted RepeatUntil, which always throws an error for sizeof calls.

>>> from construct import *
>>> str = CString("a_string")
>>> str_parsed = str.parse("foo\x00")
>>> print str_parsed
foo
>>> str.sizeof()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/construct-2.06-py2.7.egg/construct/core.py", line 242, in sizeof
    raise SizeofError(e)
construct.core.SizeofError: can't calculate size
>>> str.sizeof(str_parsed)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/construct-2.06-py2.7.egg/construct/core.py", line 242, in sizeof
    raise SizeofError(e)
construct.core.SizeofError: can't calculate size

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions