Kaydet (Commit) 1c5a98a3 authored tarafından Guido van Rossum's avatar Guido van Rossum

Fix for cProfile.

SF patch# 1755176 by Amaury Forgeot d'Arc.
üst d77d6992
...@@ -153,7 +153,7 @@ class Profile(_lsprof.Profiler): ...@@ -153,7 +153,7 @@ class Profile(_lsprof.Profiler):
# ____________________________________________________________ # ____________________________________________________________
def label(code): def label(code):
if isinstance(code, str): if isinstance(code, basestring):
return ('~', 0, code) # built-in functions ('~' sorts at the end) return ('~', 0, code) # built-in functions ('~' sorts at the end)
else: else:
return (code.co_filename, code.co_firstlineno, code.co_name) return (code.co_filename, code.co_firstlineno, code.co_name)
......
...@@ -182,6 +182,9 @@ normalizeUserObj(PyObject *obj) ...@@ -182,6 +182,9 @@ normalizeUserObj(PyObject *obj)
if (mod && PyString_Check(mod)) { if (mod && PyString_Check(mod)) {
modname = PyString_AS_STRING(mod); modname = PyString_AS_STRING(mod);
} }
else if (mod && PyUnicode_Check(mod)) {
modname = PyUnicode_AsString(mod);
}
else if (mod && PyModule_Check(mod)) { else if (mod && PyModule_Check(mod)) {
modname = PyModule_GetName(mod); modname = PyModule_GetName(mod);
if (modname == NULL) { if (modname == NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment