[issue6697] Check that _PyUnicode_AsString() result is not NULL

Alexander Belopolsky report at bugs.python.org
Fri Jan 14 00:05:32 CET 2011


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

I am replacing issue6697-lsprof.diff with a (hopefully) more carefully written version that addresses the issues that Victor noted.

Victor,

I take your comment as +1 for adding PyModule_GetNameObject().


I started looking into adding unit tests that would exercise this code, but is does not seem possible to trigger the fn->m_self == NULL condition.  According to the comment in the code, this is supposed to be the case when fn is a builtin function, but I observe the following in the debugger when running test_cprofile:

(gdb) pyo fn
object  : <built-in function exec>
type    : builtin_function_or_method
refcount: 4
address : 0x10038c678
$5 = void
(gdb) pyo fn->m_self 
object  : <module 'builtins' (built-in)>
type    : module
refcount: 51
address : 0x100388ee8
$6 = void

----------
Added file: http://bugs.python.org/file20397/issue6697-lsprof.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6697>
_______________________________________


More information about the Python-bugs-list mailing list