Author: guido.van.rossum
Date: Tue Jul 17 01:36:05 2007
New Revision: 56406

Modified:
   python/branches/py3k-struni/Lib/cProfile.py
   python/branches/py3k-struni/Modules/_lsprof.c
Log:
Fix for cProfile.
SF patch# 1755176 by Amaury Forgeot d'Arc.


Modified: python/branches/py3k-struni/Lib/cProfile.py
==============================================================================
--- python/branches/py3k-struni/Lib/cProfile.py (original)
+++ python/branches/py3k-struni/Lib/cProfile.py Tue Jul 17 01:36:05 2007
@@ -153,7 +153,7 @@
 # ____________________________________________________________
 
 def label(code):
-    if isinstance(code, str):
+    if isinstance(code, basestring):
         return ('~', 0, code)    # built-in functions ('~' sorts at the end)
     else:
         return (code.co_filename, code.co_firstlineno, code.co_name)

Modified: python/branches/py3k-struni/Modules/_lsprof.c
==============================================================================
--- python/branches/py3k-struni/Modules/_lsprof.c       (original)
+++ python/branches/py3k-struni/Modules/_lsprof.c       Tue Jul 17 01:36:05 2007
@@ -182,6 +182,9 @@
                if (mod && PyString_Check(mod)) {
                        modname = PyString_AS_STRING(mod);
                }
+               else if (mod && PyUnicode_Check(mod)) {
+                       modname = PyUnicode_AsString(mod);
+               }
                else if (mod && PyModule_Check(mod)) {
                        modname = PyModule_GetName(mod);
                        if (modname == NULL) {
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to