From: Antoine Pitrou Date: Wed, 22 Feb 2012 17:08:30 +0000 (+0100) Subject: Issue #14084: Fix a file descriptor leak when importing a module with a bad encoding. X-Git-Tag: v3.3.0a1~89 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cf1c8339f94544e8fd04a85ed575efcfa5f36833;p=python Issue #14084: Fix a file descriptor leak when importing a module with a bad encoding. --- cf1c8339f94544e8fd04a85ed575efcfa5f36833 diff --cc Misc/NEWS index e1024042c9,eeab400741..047f272386 --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -10,17 -10,13 +10,20 @@@ What's New in Python 3.3 Alpha 1 Core and Builtins ----------------- + - Issue #14084: Fix a file descriptor leak when importing a module with a + bad encoding. + -- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED - environment variable, to provide an opt-in way to protect against denial of - service attacks due to hash collisions within the dict and set types. Patch - by David Malcolm, based on work by Victor Stinner. +- Upgrade Unicode data to Unicode 6.1. + +- Issue #14040: Remove rarely used file name suffixes for C extensions + (under POSIX mainly). + +- Issue #14051: Allow arbitrary attributes to be set of classmethod and + staticmethod. + +- Issue #13703: oCERT-2011-003: Randomize hashes of str and bytes to protect + against denial of service attacks due to hash collisions within the dict and + set types. Patch by David Malcolm, based on work by Victor Stinner. - Issue #13020: Fix a reference leak when allocating a structsequence object fails. Patch by Suman Saha. diff --cc Python/import.c index 8bd7a61722,f443ab8511..4871b99a93 --- a/Python/import.c +++ b/Python/import.c @@@ -3636,12 -3191,12 +3634,13 @@@ call_find_module(PyObject *name, PyObje } if (fd != -1) { if (strchr(fdp->mode, 'b') == NULL) { - /* PyTokenizer_FindEncoding() returns PyMem_MALLOC'ed + /* PyTokenizer_FindEncodingFilename() returns PyMem_MALLOC'ed memory. */ - found_encoding = PyTokenizer_FindEncoding(fd); + found_encoding = PyTokenizer_FindEncodingFilename(fd, pathobj); lseek(fd, 0, 0); /* Reset position */ if (found_encoding == NULL && PyErr_Occurred()) { + Py_XDECREF(pathobj); + close(fd); return NULL; } encoding = (found_encoding != NULL) ? found_encoding :