From: Giampaolo Rodola' Date: Sat, 7 May 2011 17:09:34 +0000 (+0200) Subject: merge with 3.1 X-Git-Tag: v3.2.1b1~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=24befa87dcddd95005c82a1c42553856de7dcd08;p=thirdparty%2FPython%2Fcpython.git merge with 3.1 --- 24befa87dcddd95005c82a1c42553856de7dcd08 diff --cc Lib/ftplib.py index 7c398879bcf5,af213f30313f..be1797f62dac --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@@ -245,8 -236,9 +245,9 @@@ class FTP if self.debugging > 1: print('*put urgent*', self.sanitize(line)) self.sock.sendall(line, MSG_OOB) resp = self.getmultiline() - if resp[:3] not in ('426', '225', '226'): + if resp[:3] not in {'426', '225', '226'}: raise error_proto(resp) + return resp def sendcmd(self, cmd): '''Send a command and return the response.''' @@@ -595,196 -582,6 +596,205 @@@ self.file = self.sock = None +try: + import ssl +except ImportError: + pass +else: + class FTP_TLS(FTP): + '''A FTP subclass which adds TLS support to FTP as described + in RFC-4217. + + Connect as usual to port 21 implicitly securing the FTP control + connection before authenticating. + + Securing the data connection requires user to explicitly ask + for it by calling prot_p() method. + + Usage example: + >>> from ftplib import FTP_TLS + >>> ftps = FTP_TLS('ftp.python.org') + >>> ftps.login() # login anonymously previously securing control channel + '230 Guest login ok, access restrictions apply.' + >>> ftps.prot_p() # switch to secure data connection + '200 Protection level set to P' + >>> ftps.retrlines('LIST') # list directory content securely + total 9 + drwxr-xr-x 8 root wheel 1024 Jan 3 1994 . + drwxr-xr-x 8 root wheel 1024 Jan 3 1994 .. + drwxr-xr-x 2 root wheel 1024 Jan 3 1994 bin + drwxr-xr-x 2 root wheel 1024 Jan 3 1994 etc + d-wxrwxr-x 2 ftp wheel 1024 Sep 5 13:43 incoming + drwxr-xr-x 2 root wheel 1024 Nov 17 1993 lib + drwxr-xr-x 6 1094 wheel 1024 Sep 13 19:07 pub + drwxr-xr-x 3 root wheel 1024 Jan 3 1994 usr + -rw-r--r-- 1 root root 312 Aug 1 1994 welcome.msg + '226 Transfer complete.' + >>> ftps.quit() + '221 Goodbye.' + >>> + ''' + ssl_version = ssl.PROTOCOL_TLSv1 + + def __init__(self, host='', user='', passwd='', acct='', keyfile=None, + certfile=None, context=None, + timeout=_GLOBAL_DEFAULT_TIMEOUT): + if context is not None and keyfile is not None: + raise ValueError("context and keyfile arguments are mutually " + "exclusive") + if context is not None and certfile is not None: + raise ValueError("context and certfile arguments are mutually " + "exclusive") + self.keyfile = keyfile + self.certfile = certfile + self.context = context + self._prot_p = False + FTP.__init__(self, host, user, passwd, acct, timeout) + + def login(self, user='', passwd='', acct='', secure=True): + if secure and not isinstance(self.sock, ssl.SSLSocket): + self.auth() + return FTP.login(self, user, passwd, acct) + + def auth(self): + '''Set up secure control connection by using TLS/SSL.''' + if isinstance(self.sock, ssl.SSLSocket): + raise ValueError("Already using TLS") + if self.ssl_version == ssl.PROTOCOL_TLSv1: + resp = self.voidcmd('AUTH TLS') + else: + resp = self.voidcmd('AUTH SSL') + if self.context is not None: + self.sock = self.context.wrap_socket(self.sock) + else: + self.sock = ssl.wrap_socket(self.sock, self.keyfile, + self.certfile, + ssl_version=self.ssl_version) + self.file = self.sock.makefile(mode='r', encoding=self.encoding) + return resp + + def prot_p(self): + '''Set up secure data connection.''' + # PROT defines whether or not the data channel is to be protected. + # Though RFC-2228 defines four possible protection levels, + # RFC-4217 only recommends two, Clear and Private. + # Clear (PROT C) means that no security is to be used on the + # data-channel, Private (PROT P) means that the data-channel + # should be protected by TLS. + # PBSZ command MUST still be issued, but must have a parameter of + # '0' to indicate that no buffering is taking place and the data + # connection should not be encapsulated. + self.voidcmd('PBSZ 0') + resp = self.voidcmd('PROT P') + self._prot_p = True + return resp + + def prot_c(self): + '''Set up clear text data connection.''' + resp = self.voidcmd('PROT C') + self._prot_p = False + return resp + + # --- Overridden FTP methods + + def ntransfercmd(self, cmd, rest=None): + conn, size = FTP.ntransfercmd(self, cmd, rest) + if self._prot_p: + if self.context is not None: + conn = self.context.wrap_socket(conn) + else: + conn = ssl.wrap_socket(conn, self.keyfile, self.certfile, + ssl_version=self.ssl_version) + return conn, size + + def retrbinary(self, cmd, callback, blocksize=8192, rest=None): + self.voidcmd('TYPE I') + conn = self.transfercmd(cmd, rest) + try: + while 1: + data = conn.recv(blocksize) + if not data: + break + callback(data) + # shutdown ssl layer + if isinstance(conn, ssl.SSLSocket): + conn.unwrap() + finally: + conn.close() + return self.voidresp() + + def retrlines(self, cmd, callback = None): + if callback is None: callback = print_line + resp = self.sendcmd('TYPE A') + conn = self.transfercmd(cmd) + fp = conn.makefile('r', encoding=self.encoding) + try: + while 1: + line = fp.readline() + if self.debugging > 2: print('*retr*', repr(line)) + if not line: + break + if line[-2:] == CRLF: + line = line[:-2] + elif line[-1:] == '\n': + line = line[:-1] + callback(line) + # shutdown ssl layer + if isinstance(conn, ssl.SSLSocket): + conn.unwrap() + finally: + fp.close() + conn.close() + return self.voidresp() + + def storbinary(self, cmd, fp, blocksize=8192, callback=None, rest=None): + self.voidcmd('TYPE I') + conn = self.transfercmd(cmd, rest) + try: + while 1: + buf = fp.read(blocksize) + if not buf: break + conn.sendall(buf) + if callback: callback(buf) + # shutdown ssl layer + if isinstance(conn, ssl.SSLSocket): + conn.unwrap() + finally: + conn.close() + return self.voidresp() + + def storlines(self, cmd, fp, callback=None): + self.voidcmd('TYPE A') + conn = self.transfercmd(cmd) + try: + while 1: + buf = fp.readline() + if not buf: break + if buf[-2:] != B_CRLF: + if buf[-1] in B_CRLF: buf = buf[:-1] + buf = buf + B_CRLF + conn.sendall(buf) + if callback: callback(buf) + # shutdown ssl layer + if isinstance(conn, ssl.SSLSocket): + conn.unwrap() + finally: + conn.close() + return self.voidresp() + ++ def abort(self): ++ # overridden as we can't pass MSG_OOB flag to sendall() ++ line = b'ABOR' + B_CRLF ++ self.sock.sendall(line) ++ resp = self.getmultiline() ++ if resp[:3] not in {'426', '225', '226'}: ++ raise error_proto(resp) ++ return resp ++ + __all__.append('FTP_TLS') + all_errors = (Error, IOError, EOFError, ssl.SSLError) + + _150_re = None def parse150(resp): diff --cc Lib/test/test_ftplib.py index 9d2eab7fa3a3,2b2c4cf0a90c..5b69b0abbcbf --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@@ -57,10 -40,10 +57,12 @@@ class DummyDTPHandler(asynchat.async_ch class DummyFTPHandler(asynchat.async_chat): + dtp_handler = DummyDTPHandler + def __init__(self, conn): asynchat.async_chat.__init__(self, conn) + # tells the socket to handle urgent data inline (ABOR command) + self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_OOBINLINE, 1) self.set_terminator(b"\r\n") self.in_buffer = [] self.dtp = None diff --cc Misc/NEWS index da4a46c79f30,751900d6caa5..22a3a67560de --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -10,422 -10,441 +10,424 @@@ What's New in Python 3.2.1 Core and Builtins ----------------- -- Issue #10451: memoryview objects could allow to mutate a readable buffer. - Initial patch by Ross Lagerwall. +- Issue #1856: Avoid crashes and lockups when daemon threads run while the + interpreter is shutting down; instead, these threads are now killed when + they try to take the GIL. -- Issue #10892: Don't segfault when trying to delete __abstractmethods__ from a - class. +- Issue #9756: When calling a method descriptor or a slot wrapper descriptor, + the check of the object type doesn't read the __class__ attribute anymore. + Fix a crash if a class override its __class__ attribute (e.g. a proxy of the + str type). Patch written by Andreas Stührk. -- Issue #8020: Avoid a crash where the small objects allocator would read - non-Python managed memory while it is being modified by another thread. - Patch by Matt Bandy. +- Issue #10914: Initialize correctly the filesystem codec when creating a new + subinterpreter to fix a bootstrap issue with codecs implemented in Python, as + the ISO-8859-15 codec. -- Issue #8278: On Windows and with a NTFS filesystem, os.stat() and os.utime() - can now handle dates after 2038. +- Issue #10517: After fork(), reinitialize the TLS used by the PyGILState_* + APIs, to avoid a crash with the pthread implementation in RHEL 5. Patch + by Charles-François Natali. -- Issue #4236: PyModule_Create2 now checks the import machinery directly - rather than the Py_IsInitialized flag, avoiding a Fatal Python - error in certain circumstances when an import is done in __del__. +- Issue #6780: fix starts/endswith error message to mention that tuples are + accepted too. -- Issue #10596: Fix float.__mod__ to have the same behaviour as - float.__divmod__ with respect to signed zeros. -4.0 % 4.0 should be - 0.0, not -0.0. +- Issue #5057: fix a bug in the peepholer that led to non-portable pyc files + between narrow and wide builds while optimizing BINARY_SUBSCR on non-BMP + chars (e.g. "\U00012345"[0]). -- Issue #5587: add a repr to dict_proxy objects. Patch by David Stanek and - Daniel Urban. +- Issue #11845: Fix typo in rangeobject.c that caused a crash in + compute_slice_indices. Patch by Daniel Urban. -Library -------- +- Issue #11650: PyOS_StdioReadline() retries fgets() if it was interrupted + (EINTR), for example if the program is stopped with CTRL+z on Mac OS X. Patch + written by Charles-Francois Natali. -- Issue #12002: ftplib's abort() method raises TypeError. +- Issue #11395: io.FileIO().write() clamps the data length to 32,767 bytes on + Windows if the file is a TTY to workaround a Windows bug. The Windows console + returns an error (12: not enough space error) on writing into stdout if + stdout mode is binary and the length is greater than 66,000 bytes (or less, + depending on heap usage). -- Issue #11391: Writing to a mmap object created with - ``mmap.PROT_READ|mmap.PROT_EXEC`` would segfault instead of raising a - TypeError. Patch by Charles-François Natali. +- Issue #11320: fix bogus memory management in Modules/getpath.c, leading to + a possible crash when calling Py_SetPath(). -- Issue #11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors - on accept(), send() and recv(). +- Issue #11510: Fixed optimizer bug which turned "a,b={1,1}" into "a,b=(1,1)". -- Issue #10276: Fix the results of zlib.crc32() and zlib.adler32() on buffers - larger than 4GB. Patch by Nadeem Vawda. +- Issue #11432: A bug was introduced in subprocess.Popen on posix systems with + 3.2.0 where the stdout or stderr file descriptor being the same as the stdin + file descriptor would raise an exception. webbrowser.open would fail. fixed. -- Issue #4681: Allow mmap() to work on file sizes and offsets larger than - 4GB, even on 32-bit builds. Initial patch by Ross Lagerwall, adapted for - 32-bit Windows. +- Issue #11450: Don't truncate hg version info in Py_GetBuildInfo() when + there are many tags (e.g. when using mq). Patch by Nadeem Vawda. -- email.header.Header was incorrectly encoding folding white space when - rfc2047-encoding header values with embedded newlines, leaving them - without folding whitespace. It now uses the continuation_ws, as it - does for continuation lines that it creates itself. +- Issue #11246: Fix PyUnicode_FromFormat("%V") to decode the byte string from + UTF-8 (with replace error handler) instead of ISO-8859-1 (in strict mode). + Patch written by Ray Allen. -- Issue #10360: In WeakSet, do not raise TypeErrors when testing for - membership of non-weakrefable objects. +- Issue #11286: Raise a ValueError from calling PyMemoryView_FromBuffer with + a buffer struct having a NULL data pointer. -- Issue #10549: Fix pydoc traceback when text-documenting certain classes. +- Issue #11272: On Windows, input() strips '\r' (and not only '\n'), and + sys.stdin uses universal newline (replace '\r\n' by '\n'). -- Issue #11110: Fix _sqlite to not deref a NULL when module creation fails. +- issue #11828: startswith and endswith don't accept None as slice index. + Patch by Torsten Becker. -- Issue #11089: Fix performance issue limiting the use of ConfigParser() - with large config files. +- Issue #10830: Fix PyUnicode_FromFormatV("%c") for non-BMP characters on + narrow build. -- Issue #8275: Fix passing of callback arguments with ctypes under Win64. - Patch by Stan Mihai. +- Check for NULL result in PyType_FromSpec. -- Issue #11053: Fix IDLE "Syntax Error" windows to behave as in 2.x, - preventing a confusing hung appearance on OS X with the windows - obscured. +- Issue #11386: bytearray.pop() now throws IndexError when the bytearray is + empty, instead of OverflowError. -- Issue #11052: Correct IDLE menu accelerators on Mac OS X for Save - commands. +Library +------- -- Issue #11020: Command-line pyclbr was broken because of missing 2-to-3 - conversion. ++- Issue #12002: ftplib's abort() method raises TypeError. + -- Issue #10974: IDLE no longer crashes if its recent files list includes files - with non-ASCII characters in their path names. +- Issue 11999: fixed sporadic sync failure mailbox.Maildir due to its trying to + detect mtime changes by comparing to the system clock instead of to the + previous value of the mtime. -- Issue #10987: Fix the recursion limit handling in the _pickle module. +- ntpath.samefile failed to notice that "a.txt" and "A.TXT" refer to the same + file on Windows XP. As noticed in issue #10684. -- Issue #10949: Improved robustness of rotating file handlers. +- Issue #12000: When a SSL certificate has a subjectAltName without any + dNSName entry, ssl.match_hostname() should use the subject's commonName. + Patch by Nicolas Bareil. -- Issue #10955: Fix a potential crash when trying to mmap() a file past its - length. Initial patch by Ross Lagerwall. +- Issue #11647: objects created using contextlib.contextmanager now support + more than one call to the function when used as a decorator. Initial patch + by Ysj Ray. -- Issue #10898: Allow compiling the posix module when the C library defines - a symbol named FSTAT. +- logging: don't define QueueListener if Python has no thread support. -- Issue #10916: mmap should not segfault when a file is mapped using 0 as - length and a non-zero offset, and an attempt to read past the end of file - is made (IndexError is raised instead). Patch by Ross Lagerwall. +- functools.cmp_to_key() now works with collections.Hashable(). -- Issue #10899: No function type annotations in the standard library. - Removed function type annotations from _pyio.py. +- Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X to get + around a mmap bug with sparse files. Patch written by Steffen Daode Nurpmeso. -- Issue #10875: Update Regular Expression HOWTO; patch by 'SilentGhost'. +- Issue #11858: configparser.ExtendedInterpolation expected lower-case section + names. -- Issue #10869: Fixed bug where ast.increment_lineno modified the root - node twice. +- Issue #11324: ConfigParser(interpolation=None) now works correctly. -- Issue #5871: email.header.Header.encode now raises an error if any - continuation line in the formatted value has no leading white space - and looks like a header. Since Generator uses Header to format all - headers, this check is made for all headers in any serialized message - at serialization time. This provides protection against header - injection attacks. +- Issue #11763: don't use difflib in TestCase.assertMultiLineEqual if the + strings are too long. -- Issue #7858: Raise an error properly when os.utime() fails under Windows - on an existing file. +- Issue #11236: getpass.getpass responds to ctrl-c or ctrl-z on terminal. -- Issue #3839: wsgiref should not override a Content-Length header set by - the application. Initial patch by Clovis Fabricio. +- Issue #11768: The signal handler of the signal module only calls + Py_AddPendingCall() for the first signal to fix a deadlock on reentrant or + parallel calls. PyErr_SetInterrupt() writes also into the wake up file. -- Issue #10790: email.header.Header.append's charset logic now works correctly - for charsets whose output codec is different from its input codec. +- Issue #11492: fix several issues with header folding in the email package. -- Issue #6643: Reinitialize locks held within the threading module after fork - to avoid a potential rare deadlock or crash on some platforms. +- Issue #11852: Add missing imports and update tests. -- Issue #10806, issue #9905: Fix subprocess pipes when some of the standard - file descriptors (0, 1, 2) are closed in the parent process. Initial - patch by Ross Lagerwall. +- Issue #11875: collections.OrderedDict's __reduce__ was temporarily + mutating the object instead of just working on a copy. -- Issue 10753 - Characters ';','=' and ',' in the PATH_INFO environment - variable won't be quoted when the URI is constructed by the wsgiref.util 's - request_uri method. According to RFC 3986, these characters can be a part of - params in PATH component of URI and need not be quoted. +- Issue #11467: Fix urlparse behavior when handling urls which contains scheme + specific part only digits. Patch by Santoso Wijaya. -- Issue 10738: Fix webbrowser.Opera.raise_opts +- collections.Counter().copy() now works correctly for subclasses. -- Issue 9824: SimpleCookie now encodes , and ; in values to cater to how - browsers actually parse cookies. +- Issue #11474: Fix the bug with url2pathname() handling of '/C|/' on Windows. + Patch by Santoso Wijaya. -- Issue #5258/#10642: if site.py encounters a .pth file that generates an error, - it now prints the filename, line number, and traceback to stderr and skips - the rest of that individual file, instead of stopping processing entirely. +- Issue #9233: Fix json.loads('{}') to return a dict (instead of a list), when + _json is not available. -- Issue #4871: The zipfile module now gives a more useful error message if - an attempt is made to use a string to specify the archive password. +- Issue #11830: Remove unnecessary introspection code in the decimal module. -- Issue #10750: The ``raw`` attribute of buffered IO objects is now read-only. +- Issue #11703: urllib2.geturl() does not return correct url when the original + url contains #fragment. -- Issue #6791: Limit header line length (to 65535 bytes) in http.client - and http.server, to avoid denial of services from the other party. +- Issue #10019: Fixed regression in json module where an indent of 0 stopped + adding newlines and acted instead like 'None'. -- Issue #10404: Use ctl-button-1 on OSX for the context menu in Idle. +- Issue #5162: Treat services like frozen executables to allow child spawning + from multiprocessing.forking on Windows. -- Issue #4188: Avoid creating dummy thread objects when logging operations - from the threading module (with the internal verbose flag activated). +- Issue #11814: Fix likely typo in multiprocessing.Pool._terminate(). -- Issue #9721: Fix the behavior of urljoin when the relative url starts with a - ';' character. Patch by Wes Chow. +- Issue #11747: Fix range formatting in difflib.context_diff() and + difflib.unified_diff(). -- Issue #10714: Limit length of incoming request in http.server to 65536 bytes - for security reasons. Initial patch by Ross Lagerwall. +- Issue #8428: Fix a race condition in multiprocessing.Pool when terminating + worker processes: new processes would be spawned while the pool is being + shut down. Patch by Charles-François Natali. -- Issue #9558: Fix distutils.command.build_ext with VS 8.0. +- Issue #7311: fix html.parser to accept non-ASCII attribute values. -- Issue #10695: passing the port as a string value to telnetlib no longer - causes debug mode to fail. +- Issue #11605: email.parser.BytesFeedParser was incorrectly converting multipart + subpararts with an 8bit CTE into unicode instead of preserving the bytes. -- Issue #1078919: add_header now automatically RFC2231 encodes parameters - that contain non-ascii values. +- Issue #10963: Ensure that subprocess.communicate() never raises EPIPE. -- Issue #10107: Warn about unsaved files in IDLE on OSX. +- Issue #11746: Fix SSLContext.load_cert_chain() to accept elliptic curve + private keys. -- Issue #7904: Changes to urllib.parse.urlsplit to handle schemes as defined by - RFC3986. Anything before :// is considered a scheme and is followed by an - authority (or netloc) and by '/' led path, which is optional. +- sys.getfilesystemencoding() raises a RuntimeError if initfsencoding() was not + called yet: detect bootstrap (startup) issues earlier. -- Issue #10478: Reentrant calls inside buffered IO objects (for example by - way of a signal handler) now raise a RuntimeError instead of freezing the - current process. +- Issue #11618: Fix the timeout logic in threading.Lock.acquire() under Windows. -- Issue #10464: netrc now correctly handles lines with embedded '#' characters. +- Issue #11256: Fix inspect.getcallargs on functions that take only keyword + arguments. -- Issue #1731717: Fixed the problem where subprocess.wait() could cause an - OSError exception when The OS had been told to ignore SIGCLD in our process - or otherwise not wait for exiting child processes. +- Issue #11696: Fix ID generation in msilib. -Extensions ----------- +- Issue #9696: Fix exception incorrectly raised by xdrlib.Packer.pack_int when + trying to pack a negative (in-range) integer. -- Issue #678250: Make mmap flush a noop on ACCESS_READ and ACCESS_COPY. +- Issue #11675: multiprocessing.[Raw]Array objects created from an integer size + are now zeroed on creation. This matches the behaviour specified by the + documentation. -Build ------ +- Issue #7639: Fix short file name generation in bdist_msi -- Issue #11411: Fix 'make DESTDIR=' with a relative destination. +- Issue #11659: Fix ResourceWarning in test_subprocess introduced by #11459. + Patch by Ben Hayden. -- Issue #11184: Fix large-file support on AIX. +- Issue #11635: Don't use polling in worker threads and processes launched by + concurrent.futures. -- Issue #941346: Fix broken shared library build on AIX. +- Issue #11628: cmp_to_key generated class should use __slots__ -- Issue #7716: Under Solaris, don't assume existence of /usr/xpg4/bin/grep in - the configure script but use $GREP instead. Patch by Fabian Groffen. +- Issue #11666: let help() display named tuple attributes and methods + that start with a leading underscore. -- Issue #10475: Don't hardcode compilers for LDSHARED/LDCXXSHARED on NetBSD - and DragonFly BSD. Patch by Nicolas Joly. +- Issue #11662: Make urllib and urllib2 ignore redirections if the + scheme is not HTTP, HTTPS or FTP (CVE-2011-1521). -- Issue #10655: Fix the build on PowerPC on Linux with GCC when building with - timestamp profiling (--with-tsc): the preprocessor test for the PowerPC - support now looks for "__powerpc__" as well as "__ppc__": the latter seems to - only be present on OS X; the former is the correct one for Linux with GCC. +- Issue #5537: Fix time2isoz() and time2netscape() functions of + httplib.cookiejar for expiration year greater than 2038 on 32-bit systems. -Tests ------ +- Issue #11563: Connection:close header is sent by requests using URLOpener + class which helps in closing of sockets after connection is over. Patch + contributions by Jeff McNeil and Nadeem Vawda. -- Issue #10822: Fix test_posix:test_getgroups failure under Solaris. Patch - by Ross Lagerwall. +- Issue #11459: A ``bufsize`` value of 0 in subprocess.Popen() really creates + unbuffered pipes, such that select() works properly on them. -- Issue #6293: Have regrtest.py echo back sys.flags. This is done by default - in whole runs and enabled selectively using ``--header`` when running an - explicit list of tests. Original patch by Collin Winter. +- Issue #5421: Fix misleading error message when one of socket.sendto()'s + arguments has the wrong type. Patch by Nikita Vetoshkin. -- Issue #775964: test_grp now skips YP/NIS entries instead of failing when - encountering them. +- Issue #10979: unittest stdout buffering now works with class and module + setup and teardown. -- Issue #7110: regrtest now sends test failure reports and single-failure - tracebacks to stderr rather than stdout. +- Issue #11577: fix ResourceWarning triggered by improved binhex test coverage +- Issue #11243: fix the parameter querying methods of Message to work if + the headers contain un-encoded non-ASCII data. -What's New in Python 3.1.3? -=========================== +- Issue #11401: fix handling of headers with no value; this fixes a regression + relative to Python2 and the result is now the same as it was in Python2. -*Release date: 2010-11-27* +- Issue #9298: base64 bodies weren't being folded to line lengths less than 78, + which was a regression relative to Python2. Unlike Python2, the last line + of the folded body now ends with a carriage return. -Core and Builtins ------------------ +- Issue #11560: shutil.unpack_archive now correctly handles the format + parameter. Patch by Evan Dandrea. -- Issue #10391: Don't dereference invalid memory in error messages in the ast - module. +- Issue #11133: fix two cases where inspect.getattr_static can trigger code + execution. Patch by Andreas Stührk. -Library -------- +- Issue #11569: use absolute path to the sysctl command in multiprocessing to + ensure that it will be found regardless of the shell PATH. This ensures + that multiprocessing.cpu_count works on default installs of MacOSX. -- Issue #2236: distutils' mkpath ignored the mode parameter. +- Issue #11501: disutils.archive_utils.make_zipfile no longer fails if zlib is + not installed. Instead, the zipfile.ZIP_STORED compression is used to create + the ZipFile. Patch by Natalia B. Bidart. -- Fix typo in one sdist option (medata-check). +- Issue #11554: Fixed support for Japanese codecs; previously the body output + encoding was not done if euc-jp or shift-jis was specified as the charset. -- Issue #10323: itertools.islice() now consumes the minimum number of - inputs before stopping. Formerly, the final state of the underlying - iterator was undefined. +- Issue #11500: Fixed a bug in the os x proxy bypass code for fully qualified + IP addresses in the proxy exception list. -- Issue #10565: The collections.Iterator ABC now checks for both - __iter__ and __next__. +- Issue #11491: dbm.error is no longer raised when dbm.open is called with + the "n" as the flag argument and the file exists. The behavior matches + the documentation and general logic. -- Issue #10561: In pdb, clear the breakpoints by the breakpoint number. +- Issue #11131: Fix sign of zero in decimal.Decimal plus and minus + operations when the rounding mode is ROUND_FLOOR. -- Issue #10459: Update CJK character names to Unicode 5.1. +- Issue #5622: Fix curses.wrapper to raise correct exception if curses + initialization fails. -- Issue #10092: Properly reset locale in calendar.Locale*Calendar classes. +- Issue #11391: Writing to a mmap object created with + ``mmap.PROT_READ|mmap.PROT_EXEC`` would segfault instead of raising a + TypeError. Patch by Charles-François Natali. -- Issue #6098: Don't claim DOM level 3 conformance in minidom. +- Issue #11306: mailbox in certain cases adapts to an inability to open + certain files in read-write mode. Previously it detected this by + checking for EACCES, now it also checks for EROFS. -- Issue #5762: Fix AttributeError raised by ``xml.dom.minidom`` when an empty - XML namespace attribute is encountered. +- Issue #11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors + on accept(), send() and recv(). -- Issue #1710703: Write structures for an empty ZIP archive when a ZipFile is - created in modes 'a' or 'w' and then closed without adding any files. Raise - BadZipfile (rather than IOError) when opening small non-ZIP files. +- Issue #11326: Add the missing connect_ex() implementation for SSL sockets, + and make it work for non-blocking connects. -- Issue #4493: urllib.request adds '/' in front of path components which does not - start with '/. Common behavior exhibited by browsers and other clients. +- Issue #7322: Trying to read from a socket's file-like object after a timeout + occurred now raises an error instead of silently losing data. -- Issue #6378: idle.bat now runs with the appropriate Python version rather than - the system default. Patch by Sridhar Ratnakumar. +- Issue #10956: Buffered I/O classes retry reading or writing after a signal + has arrived and the handler returned successfully. -- Issue #10407: Fix two NameErrors in distutils. +- Issue #11224: Fixed a regression in tarfile that affected the file-like + objects returned by TarFile.extractfile() regarding performance, memory + consumption and failures with the stream interface. -- Issue #10198: fix duplicate header written to wave files when writeframes() - is called without data. +- Issue #11074: Make 'tokenize' so it can be reloaded. -- Issue #10467: Fix BytesIO.readinto() after seeking into a position after the - end of the file. +- Issue #4681: Allow mmap() to work on file sizes and offsets larger than + 4GB, even on 32-bit builds. Initial patch by Ross Lagerwall, adapted for + 32-bit Windows. -- Issue #1682942: configparser supports alternative option/value delimiters. +- Issue #11089: Fix performance issue limiting the use of ConfigParser() + with large config files. -Build ------ +- Issue #10276: Fix the results of zlib.crc32() and zlib.adler32() on buffers + larger than 4GB. Patch by Nadeem Vawda. -- Don't run pgen twice when using make -j. +- Issue #9348: Raise an early error if argparse nargs and metavar don't match. -- Backport r83399 to allow test_distutils to pass on installed versions. +- Issue #8982: Improve the documentation for the argparse Namespace object. -- Issue #1303434: Generate ZIP file containing all PDBs (already done for rc1). +- Issue #9343: Document that argparse parent parsers must be configured before + their children. -- Stop packaging versioncheck tool (already done for rc1). +- Issue #9026: Fix order of argparse sub-commands in help messages. -- Accept Oracle Berkeley DB 4.8, 5.0 and 5.1 as backend for the dbm extension. +- Issue #9347: Fix formatting for tuples in argparse type= error messages. -Tests +Build ----- -- Issue #9424: Replace deprecated assert* methods in the Python test suite. +- Issue #11411: Fix 'make DESTDIR=' with a relative destination. -Documentation -------------- +- Issue #11268: Prevent Mac OS X Installer failure if Documentation + package had previously been installed. -- Issue #10299: List the built-in functions in a table in functions.rst. +IDLE +---- +- Issue #11718: IDLE's open module dialog couldn't find the __init__.py + file in a package. -What's New in Python 3.1.3 release candidate 1? -=============================================== +Tools/Demos +----------- -*Release date: 2010-11-13* +- Issue #11179: Make ccbench work under Python 3.1 and 2.7 again. -Core and Builtins +Extension Modules ----------------- -- Issue #10221: dict.pop(k) now has a key error message that includes the - missing key (same message d[k] returns for missing keys). +- Issue #12017: Fix segfault in json.loads() while decoding highly-nested + objects using the C accelerations. -- Issue #5437: A preallocated MemoryError instance should not hold traceback - data (including local variables caught in the stack trace) alive infinitely. +- Issue #1838: Prevent segfault in ctypes, when _as_parameter_ on a class is set + to an instance of the class. -- Issue #10077: Fix logging of site module errors at startup. +Tests +----- -- Issue #10186: Fix the SyntaxError caret when the offset is equal to the length - of the offending line. +- Issue #11873: Change regex in test_compileall to fix occasional failures when + when the randomly generated temporary path happened to match the regex. -- Issue #9713, #10114: Parser functions (eg. PyParser_ASTFromFile) expects - filenames encoded to the filesystem encoding with surrogateescape error - handler (to support undecodable bytes), instead of UTF-8 in strict mode. +- Issue #10914: Add a minimal embedding test to test_capi. -- Issue #10006: type.__abstractmethods__ now raises an AttributeError. As a - result metaclasses can now be ABCs (see #9533). +- Issue #11790: Fix sporadic failures in test_multiprocessing.WithProcessesTestCondition. -- Issue #9997: Don't let the name "top" have special significance in scope - resolution. +- Fix possible "file already exists" error when running the tests in parallel. -- Issue #9930: Remove bogus subtype check that was causing (e.g.) - float.__rdiv__(2.0, 3) to return NotImplemented instead of the - expected 1.5. +- Issue #11719: Fix message about unexpected test_msilib skip on non-Windows + platforms. Patch by Nadeem Vawda. -- Issue #9804: ascii() now always represents unicode surrogate pairs as - a single ``\UXXXXXXXX``, regardless of whether the character is printable - or not. Also, the "backslashreplace" error handler now joins surrogate - pairs into a single character on UCS-2 builds. +- Issue #11653: fix -W with -j in regrtest. -- Issue #9797: pystate.c wrongly assumed that zero couldn't be a valid - thread-local storage key. +- Issue #11577: improve test coverage of binhex.py. Patch by Arkady Koplyarov. -- Issue #9737: Fix a crash when trying to delete a slice or an item from - a memoryview object. +- Issue #11578: added test for the timeit module. Patch Michael Henry. -- Issue #7415: PyUnicode_FromEncodedObject() now uses the new buffer API - properly. Patch by Stefan Behnel. +- Issue #11503: improve test coverage of posixpath.py. Patch by Evan Dandrea. -- Restore GIL in nis_cat in case of error. +- Issue #11505: improves test coverage of string.py. Patch by Alicia + Arlen. -- Issue #9712: Fix tokenize on identifiers that start with non-ascii names. +- Issue #11548: Improve test coverage of the shutil module. Patch by + Evan Dandrea. -- Issue #9688: __basicsize__ and __itemsize__ must be accessed as Py_ssize_t. +- Issue #11554: Reactivated test_email_codecs. -- Issue #5319: Print an error if flushing stdout fails at interpreter - shutdown. +- Issue #11490: test_subprocess:test_leaking_fds_on_error no longer gives a + false positive if the last directory in the path is inaccessible. -- Issue #8814: function annotations (the ``__annotations__`` attribute) - are now included in the set of attributes copied by default by - functools.wraps and functools.update_wrapper. Patch by Terrence Cole. +- Issue #11223: Fix test_threadsignals to fail, not hang, when the + non-semaphore implementation of locks is used under POSIX. -- Issue #83755: Implicit set-to-frozenset conversion was not thread-safe. +- Issue #10911: Add tests on CGI with non-ASCII characters. Patch written by + Pierre Quentel. -- Issue #10068: Global objects which have reference cycles with their module's - dict are now cleared again. This causes issue #7140 to appear again. +- Issue #9931: Fix hangs in GUI tests under Windows in certain conditions. + Patch by Hirokazu Yamamoto. -- Issue #9416: Fix some issues with complex formatting where the - output with no type specifier failed to match the str output: +- Issue #10826: Prevent sporadic failure in test_subprocess on Solaris due + to open door files. - - format(complex(-0.0, 2.0), '-') omitted the real part from the output, - - format(complex(0.0, 2.0), '-') included a sign and parentheses. +Documentation +------------- -- Issue #7616: Fix copying of overlapping memoryview slices with the Intel - compiler. +- Issue #11818: Fix tempfile examples for Python 3. -- Issue #8271: during the decoding of an invalid UTF-8 byte sequence, only the - start byte and the continuation byte(s) are now considered invalid, instead - of the number of bytes specified by the start byte. - E.g.: '\xf1\x80AB'.decode('utf-8', 'replace') now returns u'\ufffdAB' and - replaces with U+FFFD only the start byte ('\xf1') and the continuation byte - ('\x80') even if '\xf1' is the start byte of a 4-bytes sequence. - Previous versions returned a single u'\ufffd'. -- Issue #6543: Write the traceback in the terminal encoding instead of utf-8. - Fix the encoding of the modules filename. Patch written by Amaury Forgeot - d'Arc. +What's New in Python 3.2? +========================= -- Issue #9058: Remove assertions about INT_MAX in UnicodeDecodeError. +*Release date: 20-Feb-2011* -- Issue #8941: decoding big endian UTF-32 data in UCS-2 builds could crash - the interpreter with characters outside the Basic Multilingual Plane - (higher than 0x10000). +Core and Builtins +----------------- -- In the str.format(), raise a ValueError when indexes to arguments are too - large. +- Issue #11249: Fix potential crashes when using the limited API. -- Issue #8766: Initialize _warnings module before importing the first module. - Fix a crash if an empty directory called "encodings" exists in sys.path. +Build +----- -- PyObject_Dump() encodes unicode objects to utf8 with backslashreplace - (instead of strict) error handler to escape surrogates +- Issue #11222: Fix non-framework shared library build on Mac OS X. -- Issue #8124: PySys_WriteStdout() and PySys_WriteStderr() don't execute - indirectly Python signal handlers anymore because mywrite() ignores - exceptions (KeyboardInterrupt) +- Issue #11184: Fix large-file support on AIX. -- Issue #8092: Fix PyUnicode_EncodeUTF8() to support error handler producing - unicode string (eg. backslashreplace) +- Issue #941346: Fix broken shared library build on AIX. -- Issue #8014: Setting a T_UINT or T_PYSSIZET attribute of an object with - PyMemberDefs could produce an internal error; raise TypeError instead. +Documentation +------------- -- Issue #8417: Raise an OverflowError when an integer larger than sys.maxsize is - passed to bytes or bytearray. +- Issue #10709: Add updated AIX notes in Misc/README.AIX. -- Issue #8329: Don't return the same lists from select.select when no fds are - changed. -- Raise a TypeError when trying to delete a T_STRING_INPLACE struct member. +What's New in Python 3.2 Release Candidate 3? +============================================= -- Issue #8226: sys.setfilesystemencoding() raises a LookupError if the encoding - is unknown +*Release date: 13-Feb-2011* -- Issue #1583863: An str subclass can now override the __str__ method +Core and Builtins +----------------- -- Issue #7072: isspace(0xa0) is true on Mac OS X +- Issue #11134: Add missing fields to typeslots.h. -C-API ------ +- Issue #11135: Remove redundant doc field from PyType_Spec. -- Issue #9834: Don't segfault in PySequence_GetSlice, PySequence_SetSlice, or - PySequence_DelSlice when the object doesn't have any mapping operations - defined. +- Issue #11067: Add PyType_GetFlags, to support PyUnicode_Check in the limited + ABI. -- Issue #5753: A new C API function, :cfunc:`PySys_SetArgvEx`, allows - embedders of the interpreter to set sys.argv without also modifying - sys.path. This helps fix `CVE-2008-5983 - `_. +- Issue #11118: Fix bogus export of None in python3.dll. Library -------