Discussion:
[Python-3000-checkins] r66225 - python/branches/py3k/Parser/tokenizer.c
amaury.forgeotdarc
2008-09-04 22:53:20 UTC
Permalink
Author: amaury.forgeotdarc
Date: Fri Sep 5 00:53:19 2008
New Revision: 66225

Log:
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.


Modified:
python/branches/py3k/Parser/tokenizer.c

Modified: python/branches/py3k/Parser/tokenizer.c
==============================================================================
--- python/branches/py3k/Parser/tokenizer.c (original)
+++ python/branches/py3k/Parser/tokenizer.c Fri Sep 5 00:53:19 2008
@@ -1612,8 +1612,6 @@
encoding = (char *)PyMem_MALLOC(strlen(tok->encoding) + 1);
if (encoding)
strcpy(encoding, tok->encoding);
- else
- PyErr_NoMemory();
}
PyTokenizer_Free(tok);
return encoding;

Loading...