Issue 21977:  Minor improvements to the regexes in the tokenizer example.
Call PyErr_NoMemory() when PyMem_Malloc() fails.