[Python-Dev] Strange compiler crash in debug builds.

Thomas Wouters thomas@xs4all.net
Fri, 25 Aug 2000 07:29:53 +0200


On Fri, Aug 25, 2000 at 03:16:56PM +1000, Mark Hammond wrote:

> Something strange is happening in my Windows Debug builds (fresh CVS tree)

> If you remove "urllib.pyc", and execute 'python_d -c "import urllib"',
> Python dies after printing the message:
> 
> FATAL: node type 305, required 311
> 
> It also happens for a number of other files (compileall.py will show you
> :-)

> Further analysis shows this deep in the compiler, and triggered by this
> macro in node.h:

> #define REQ(n, type) \
> 	{ if (TYPE(n) != (type)) { \
> 	    fprintf(stderr, "FATAL: node type %d, required %d\n", \
> 		    TYPE(n), type); \
> 	    abort(); \
> 	} }

> Is this pointing to a deeper problem, or is the assertion incorrect?

At first sight, I would say "yes, the assertion is wrong". That doesn't mean
it shouldn't be fixed ! It's probably caused by augmented assignment or list
comprehensions, though I have used both with Py_DEBUG enabled a few times,
so I don't know for sure. I'm compiling with debug right now, to inspect
this, though.

Another thing that might cause it is an out-of-date graminit.h file
somewhere. The one in the CVS tree is up to date, but maybe you have a copy
stashed somewhere ?

> Does the Linux community ever run with Py_DEBUG defined?  I couldn't even
> find a simple way to turn it on to confirm it also exists on Linux...

There's undoubtedly a good way, but I usually just chicken out and add
'#define Py_DEBUG 1' at the bottom of config.h ;) That also makes sure I
don't keep it around too long, as config.h gets regenerated often enough :)

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!