http://alioth.debian.org/scm/loggerhead/pkg-python/python3-defaults-
debian/revision/83/debpython/tools.py
=== modified file 'debpython/tools.py'
--- debpython/tools.py 2010-12-24 00:06:55 +0000
+++ debpython/tools.py 2011-01-14 21:54:02 +0000
@@ -97,9 +97,12 @@
:returns: pair of Python interpreter string and Python version
"""
try:
- with open(fname) as fp:
+ with open(fname, 'rb') as fp:
data = fp.read(32)
- match = SHEBANG_RE.match(data)
+ if b"\0" in data:
+ # binary file
+ return None
+ match = SHEBANG_RE.match(str(data, 'utf-8'))
if not match:
return None
res = match.groups()
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]