[pypy-commit] pypy default: new module is deprecated, use types

bdkearns noreply at buildbot.pypy.org
Wed Apr 30 21:18:51 CEST 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r71104:c4c478a2375b
Date: 2014-04-30 15:18 -0400
http://bitbucket.org/pypy/pypy/changeset/c4c478a2375b/

Log:	new module is deprecated, use types

diff --git a/lib-python/2.7/cProfile.py b/lib-python/2.7/cProfile.py
--- a/lib-python/2.7/cProfile.py
+++ b/lib-python/2.7/cProfile.py
@@ -161,7 +161,7 @@
 # ____________________________________________________________
 
 def main():
-    import os, sys, new
+    import os, sys, types
     from optparse import OptionParser
     usage = "cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ..."
     parser = OptionParser(usage=usage)
@@ -184,7 +184,7 @@
         sys.path.insert(0, os.path.dirname(progname))
         with open(progname, 'rb') as fp:
             code = compile(fp.read(), progname, 'exec')
-        mainmod = new.module('__main__')
+        mainmod = types.ModuleType('__main__')
         mainmod.__file__ = progname
         mainmod.__package__ = None
         runctx(code, mainmod.__dict__, None, options.outfile, options.sort)


More information about the pypy-commit mailing list