Ensure the strerror() function returns None when there are no failures. #20

Merged
merged 1 commit into from Apr 8, 2016

Projects

None yet

2 participants

@gmazzola
gmazzola commented Apr 8, 2016

Calling the strerror() function on an uncorrupted RAR file throws a traceback:

>>> rarfp = rarfile.RarFile('foo.rar')
>>> rarfp.strerror()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/site-packages/rarfile.py", line 725, in strerror
    return self._parse_error
AttributeError: 'RarFile' object has no attribute '_parse_error'
>>>

This is because the self._parse_error variable is not defined in the RarFile constructor. The fix is simple: initialize that variable to None.

@markokr markokr merged commit 27f3b59 into markokr:master Apr 8, 2016
@markokr
Owner
markokr commented Apr 8, 2016

Good catch.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment