assert(blah blah) in the C code base
Greetings! I'm working on Issue19995, and I'm seeing stuff like this: assert(PyLong_Check(val)); My question is: Are these asserts in final production code? My possible scenarios are: - the assert isn't in place - the assert isn't working correctly - PyLong_Check isn't working correctly - the non-ints are being converted before the function containing the assert is called The fourth possibility is the most likely, but since I don't know how assert() works in C I can't be sure. Any quick pointers? -- ~Ethan~
On 12/27/2013 7:53 PM, Ethan Furman wrote:
Greetings!
I'm working on Issue19995, and I'm seeing stuff like this:
assert(PyLong_Check(val));
My question is: Are these asserts in final production code?
My possible scenarios are:
- the assert isn't in place - the assert isn't working correctly - PyLong_Check isn't working correctly - the non-ints are being converted before the function containing the assert is called
The fourth possibility is the most likely, but since I don't know how assert() works in C I can't be sure.
Any quick pointers?
http://www.cplusplus.com/reference/cassert/assert/ They should be completely removed in a non-debug build (when NDEBUG is defined). Eric.
Yes, looks like NDEBUG is not defined only when you run ./configure --with-pydebug if test "$Py_DEBUG" = 'true'; then : else OPT="-DNDEBUG $OPT" fi - Gennadiy <gennad.zlobin@gmail.com> On Sat, Dec 28, 2013 at 5:45 AM, Eric V. Smith <eric@trueblade.com> wrote:
On 12/27/2013 7:53 PM, Ethan Furman wrote:
Greetings!
I'm working on Issue19995, and I'm seeing stuff like this:
assert(PyLong_Check(val));
My question is: Are these asserts in final production code?
My possible scenarios are:
- the assert isn't in place - the assert isn't working correctly - PyLong_Check isn't working correctly - the non-ints are being converted before the function containing the assert is called
The fourth possibility is the most likely, but since I don't know how assert() works in C I can't be sure.
Any quick pointers?
http://www.cplusplus.com/reference/cassert/assert/
They should be completely removed in a non-debug build (when NDEBUG is defined).
Eric.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/gennad.zlobin%40gmail.com
2013/12/27 Ethan Furman <ethan@stoneleaf.us>:
Greetings!
I'm working on Issue19995, and I'm seeing stuff like this:
assert(PyLong_Check(val));
My question is: Are these asserts in final production code?
They are compiled in when --with-pydebug is passed to configure. They should "never" fail. -- Regards, Benjamin
participants (4)
-
Benjamin Peterson
-
Eric V. Smith
-
Ethan Furman
-
Gennadiy Zlobin