diff options
Diffstat (limited to 'Modules/_lsprof.c')
| -rw-r--r-- | Modules/_lsprof.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index 1fd660b..cc412bf 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -1,7 +1,5 @@ #include "Python.h" -#include "compile.h" #include "frameobject.h" -#include "structseq.h" #include "rotatingtree.h" #if !defined(HAVE_LONG_LONG) @@ -180,7 +178,16 @@ normalizeUserObj(PyObject *obj) PyObject *mod = fn->m_module; const char *modname; if (mod && PyUnicode_Check(mod)) { + /* XXX: The following will truncate module names with embedded + * null-characters. It is unlikely that this can happen in + * practice and the concequences are not serious enough to + * introduce extra checks here. + */ modname = _PyUnicode_AsString(mod); + if (modname == NULL) { + modname = "<encoding error>"; + PyErr_Clear(); + } } else if (mod && PyModule_Check(mod)) { modname = PyModule_GetName(mod); |
