Issue #21951: Fix AsObj() of the _tkinter module: raise MemoryError on memory
allocation failure