]> granicus.if.org Git - python/commitdiff
Follow-up of #3773: In PyTokenizer_FindEncoding, remove the call to PyErr_NoMemory...
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Thu, 4 Sep 2008 22:53:19 +0000 (22:53 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Thu, 4 Sep 2008 22:53:19 +0000 (22:53 +0000)
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

index a0406965790d57c1549ee46f2549f75dd30c45d9..18815aef4529d5f3f9bc39ab2f44d136d17da998 100644 (file)
@@ -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;