[New-bugs-announce] [issue5758] fileinput.hook_compressed returning bytes from gz file

Michael Newman report at bugs.python.org
Wed Apr 15 01:48:02 CEST 2009


New submission from Michael Newman <michael.b.newman at gmail.com>:

The attached ZIP file contains "test.bat" which runs "test.py" with
Python 2.6 and Python 3.0.

Python 2.6 behaves as expected (see "py26.out"), since it returns
strings from both "mike.txt" and "mike.txt.gz". However, the same test
with Python 3.0 returns bytes from "mike.txt.gz", as shown in "py30.out":
Output: Hello from Mike.
Output: This is the second line.
Output: Why did the robot cross the road?
Output: b'Hello from Mike.'
Output: b'This is the second line.'
Output: b'Why did the robot cross the road?'

For reference, I tested this on Python versions:
Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit
(Intel)] on win32

----------
components: Library (Lib)
files: example.zip
messages: 85978
nosy: mnewman
severity: normal
status: open
title: fileinput.hook_compressed returning bytes from gz file
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file13688/example.zip

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5758>
_______________________________________


More information about the New-bugs-announce mailing list