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):
# ____________________________________________________________
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)
......
......@@ -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) {
......
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