]> granicus.if.org Git - python/commitdiff
Fix for cProfile.
authorGuido van Rossum <guido@python.org>
Mon, 16 Jul 2007 23:36:05 +0000 (23:36 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 16 Jul 2007 23:36:05 +0000 (23:36 +0000)
SF patch# 1755176 by Amaury Forgeot d'Arc.

Lib/cProfile.py
Modules/_lsprof.c

index fb434bd3cddca5f3b2c2856767be6d18cec3b536..d10b7ab9f7b4bd93cf4d0e1a53abe3763bbb23a9 100755 (executable)
@@ -153,7 +153,7 @@ class Profile(_lsprof.Profiler):
 # ____________________________________________________________
 
 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)
index d665f83e3f1949005b1544ed61d8841d3546a05d..6de65b755a94657e98566730fc6f0eb4a774d6bc 100644 (file)
@@ -182,6 +182,9 @@ normalizeUserObj(PyObject *obj)
                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) {