[pypy-svn] pypy default: Add the module name to the _lsprof.Profile class

amauryfa commits-noreply at bitbucket.org
Thu Feb 10 14:43:14 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r41772:40e1fca7c494
Date: 2011-02-10 13:12 +0100
http://bitbucket.org/pypy/pypy/changeset/40e1fca7c494/

Log:	Add the module name to the _lsprof.Profile class This may fix
	CPython's test_cprofile.py

diff --git a/pypy/module/_lsprof/interp_lsprof.py b/pypy/module/_lsprof/interp_lsprof.py
--- a/pypy/module/_lsprof/interp_lsprof.py
+++ b/pypy/module/_lsprof/interp_lsprof.py
@@ -309,6 +309,7 @@
 
 W_Profiler.typedef = TypeDef(
     'Profiler',
+    __module__ = '_lsprof',
     __new__ = interp2app(descr_new_profile),
     enable = interp2app(W_Profiler.enable),
     disable = interp2app(W_Profiler.disable),

diff --git a/pypy/module/_lsprof/test/test_cprofile.py b/pypy/module/_lsprof/test/test_cprofile.py
--- a/pypy/module/_lsprof/test/test_cprofile.py
+++ b/pypy/module/_lsprof/test/test_cprofile.py
@@ -10,6 +10,10 @@
         cls.space = space
         cls.w_file = space.wrap(__file__)
 
+    def test_repr(self):
+        import _lsprof
+        assert repr(_lsprof.Profiler) == "<type '_lsprof.Profiler'>"
+
     def test_direct(self):
         import _lsprof
         def getticks():


More information about the Pypy-commit mailing list