diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-08-01 18:12:51 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-08-01 18:12:51 (GMT) |
commit | 98516a6930acdd39f74c609817cbf19be6c4a7df (patch) | |
tree | 89a0cac4c60cb0414c644cb1cc8e52d6096b9e8b /Tools/scripts/pysource.py | |
parent | 7c7ea62e6c20ed3a91dbac1ea922141975d0100f (diff) | |
download | cpython-98516a6930acdd39f74c609817cbf19be6c4a7df.zip cpython-98516a6930acdd39f74c609817cbf19be6c4a7df.tar.gz cpython-98516a6930acdd39f74c609817cbf19be6c4a7df.tar.bz2 |
Fix findnocoding.p and pysource.py scripts
I suppose that these scripts didn't work since Python 3.0.
Diffstat (limited to 'Tools/scripts/pysource.py')
-rwxr-xr-x | Tools/scripts/pysource.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Tools/scripts/pysource.py b/Tools/scripts/pysource.py index c7dbe60..7348a68 100755 --- a/Tools/scripts/pysource.py +++ b/Tools/scripts/pysource.py @@ -22,7 +22,7 @@ __all__ = ["has_python_ext", "looks_like_python", "can_be_compiled", "walk_pytho import os, re -binary_re = re.compile('[\x00-\x08\x0E-\x1F\x7F]') +binary_re = re.compile(br'[\x00-\x08\x0E-\x1F\x7F]') debug = False @@ -42,7 +42,7 @@ def _open(fullpath): return None try: - return open(fullpath) + return open(fullpath, "rb") except IOError as err: # Access denied, or a special file - ignore it print_debug("%s: access denied: %s" % (fullpath, err)) return None @@ -65,7 +65,7 @@ def looks_like_python(fullpath): if fullpath.endswith(".py") or fullpath.endswith(".pyw"): return True - elif "python" in line: + elif b"python" in line: # disguised Python script (e.g. CGI) return True |