Message394286
The patch for this change has broken code that relied on the old behavior. For example:
```
import fileinput
import bz2
import pathlib
target = pathlib.Path('data.bz2')
target.write_bytes(bz2.compress(b'Foo\nBar\nBiz'))
inp = fileinput.FileInput([str(target)], openhook=fileinput.hook_compressed)
for line in inp:
print(line.decode().strip())
```
That code passes on Python3.10a6 but on 3.10b1 fails with:
```
Traceback (most recent call last):
File "/Users/jaraco/code/main/cmdix/text.py", line 10, in <module>
print(line.decode().strip())
AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?
```
I encountered this issue in [this function and its test](https://github.com/jaraco/cmdix/blob/dc5fac3817ff9815b2f8d9a1dfad4258c14b1693/cmdix/lib.py#L165-L193).
I'm struggling with how to adapt the code to provide a uniform interface on Python 3.6+. Perhaps a backport of hook_compressed is in order. |
|
Date |
User |
Action |
Args |
2021-05-25 02:32:44 | jaraco | set | recipients:
+ jaraco, amaury.forgeotdarc, eric.araujo, r.david.murray, mnewman, methane, tati_alchueyr |
2021-05-25 02:32:44 | jaraco | set | messageid: <1621909964.23.0.0406319425118.issue5758@roundup.psfhosted.org> |
2021-05-25 02:32:44 | jaraco | link | issue5758 messages |
2021-05-25 02:32:43 | jaraco | create | |
|