Update of /cvsroot/python/python/dist/src/Tools/freeze In directory sc8-pr-cvs1:/tmp/cvs-serv10952 Modified Files: modulefinder.py Log Message: Add a note that this file should be kept compatible with Python 1.5.2, per PEP 291 (although there are currently string methods used). This patch makes it compatible with 2.2, at least, by detecting universal newline support. Index: modulefinder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/modulefinder.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** modulefinder.py 14 Nov 2002 18:45:11 -0000 1.23 --- modulefinder.py 25 Nov 2002 20:21:59 -0000 1.24 *************** *** 1,4 **** --- 1,6 ---- """Find modules used by a script, using introspection.""" + # This module should be kept compatible with Python 1.5.2, see PEP 291. + import dis import imp *************** *** 128,132 **** def run_script(self, pathname): self.msg(2, "run_script", pathname) ! fp = open(pathname, "U") stuff = ("", "r", imp.PY_SOURCE) self.load_module('__main__', fp, pathname, stuff) --- 130,137 ---- def run_script(self, pathname): self.msg(2, "run_script", pathname) ! if hasattr(sys.stdout, "newlines"): # detect universal newline support ! fp = open(pathname, "U") ! else: ! fp = open(pathname, "r") stuff = ("", "r", imp.PY_SOURCE) self.load_module('__main__', fp, pathname, stuff) *************** *** 135,139 **** dir, name = os.path.split(pathname) name, ext = os.path.splitext(name) ! fp = open(pathname, "U") stuff = (ext, "r", imp.PY_SOURCE) self.load_module(name, fp, pathname, stuff) --- 140,147 ---- dir, name = os.path.split(pathname) name, ext = os.path.splitext(name) ! if hasattr(sys.stdout, "newlines"): ! fp = open(pathname, "U") ! else: ! fp = open(pathname, "r") stuff = (ext, "r", imp.PY_SOURCE) self.load_module(name, fp, pathname, stuff)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4