Fix for cProfile.
SF patch# 1755176 by Amaury Forgeot d'Arc.
This commit is contained in:
parent
d77d6992a5
commit
1c5a98a360
|
@ -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)
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue