From 9252287f2c9bc09fdc6bc729e13ac63935e4976e Mon Sep 17 00:00:00 2001 From: Amaury Forgeot d'Arc Date: Thu, 4 Sep 2008 22:53:19 +0000 Subject: [PATCH] Follow-up of #3773: In PyTokenizer_FindEncoding, remove the call to PyErr_NoMemory when PyMem_MALLOC() fails. It is not stritly necessary, the function may already return NULL without an exception set, for example when the file cannot be opened. Discussed with Benjamin Peterson. --- Parser/tokenizer.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index a0406965790..18815aef452 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1612,8 +1612,6 @@ PyTokenizer_FindEncoding(int fd) encoding = (char *)PyMem_MALLOC(strlen(tok->encoding) + 1); if (encoding) strcpy(encoding, tok->encoding); - else - PyErr_NoMemory(); } PyTokenizer_Free(tok); return encoding;