-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
bugneeds-triageA fresh user-reported issue that needs triage (i.e. is not a concrete-issue)A fresh user-reported issue that needs triage (i.e. is not a concrete-issue)
Description
It looks like pfp does not like being given bytes-like objects on Python3.
>>> template='uchar mybyte;'
>>> pfp.parse('a', template)
<pfp.fields.Dom object at 0x10fbdab50>
However...
>>> pfp.parse(b'a', template)
Throws the following error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~/github.com/pfp/pfp/interp.py in _run(self, keep_successfull)
1043 # may change (e.g. compressed data)
-> 1044 res = self._handle_node(self._ast, None, None, self._stream)
1045 except errors.InterpReturn as e:
~/github.com/pfp/pfp/interp.py in _handle_node(self, node, scope, ctxt, stream)
1152
-> 1153 res = self._node_switch[node.__class__](node, scope, ctxt, stream)
1154
~/github.com/pfp/pfp/interp.py in _handle_file_ast(self, node, scope, ctxt, stream)
1168 """
-> 1169 self._root = ctxt = fields.Dom(stream)
1170 ctxt._pfp__scope = scope
~/github.com/pfp/pfp/fields.py in __init__(self, *args, **kwargs)
1217 def __init__(self, *args, **kwargs):
-> 1218 super(self.__class__, self).__init__(*args, **kwargs)
1219
~/github.com/pfp/pfp/fields.py in __init__(self, stream, metadata_processor)
772 if stream is not None:
--> 773 self._pfp__offset = stream.tell()
774
~/github.com/pfp/pfp/bitwrap.py in tell(self)
191 """
--> 192 res = self._stream.tell()
193 if len(self._bits) > 0:
AttributeError: 'bytes' object has no attribute 'tell'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugneeds-triageA fresh user-reported issue that needs triage (i.e. is not a concrete-issue)A fresh user-reported issue that needs triage (i.e. is not a concrete-issue)