[Backport r51222 | neal.norwitz -- if you hack the code to set r=NULL, you find that Python does print "MemoryError". There's no traceback and no indication of which line of code is responsible, but it's better than a segfault.]
Handle NULL nodes while parsing. I'm not entirely sure this is correct. There might be something else that needs to be done to setup the error.