[issue25571] Improve the lltrace feature with the Py_Debug mode

STINNER Victor report at bugs.python.org
Wed Jul 20 07:05:56 EDT 2016


STINNER Victor added the comment:

It would be nice to have unit tests and docs :-)

For unit test, you can use a script like:
---
def func():
    return 1

__ltrace__ = True
func()
---

Run the script with test.support.assert_python_ok(), and check stdout.

To skip the test if Python is compiled in released mode, you can use:
---
# Were we compiled --with-pydebug or with #define Py_DEBUG?
Py_DEBUG = hasattr(sys, 'gettotalrefcount')

...
@unittest.skipUnless(Py_DEBUG, 'need Py_DEBUG')
---

----------

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


More information about the Python-bugs-list mailing list