Skip to content

Return type of Decoder.read changed between 2.8.0 to 3.0.0 #297

@radon-at-beeper

Description

@radon-at-beeper

I noticed that tests for https://github.com/m1stadev/PyIMG4 were failing on Arch: https://aur.archlinux.org/packages/python-pyimg4. Upon investigating, I saw the reason was that python-asn1 was upgraded from 2.8.0 to 3.0.0 and PyIMG4 encounters an error with the new API.

However, on checking https://github.com/andrivet/python-asn1/releases/tag/v3.0.0 I see that this release was supposed to be backwards-compatible, so I figure the change in behavior might have been unintentional?

Here is a test file: https://github.com/m1stadev/PyIMG4/blob/master/tests/bin/IM4M

>>> data = open("IM4M", "rb").read()
>>> dec = asn1.Decoder()
>>> dec.start(data)

Then on version 3.x:

>>> type(dec.read()[1])
<class 'list'>

Whereas on version 2.x:

>>> type(dec.read()[1])
<class 'bytes'>

The change in return type results in an error because PyIMG4 expects a binary stream to be returned. Is this a bug or should PyIMG4 be updated to handle both cases?

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