Library

Issue #24748: To resolve a compatibility problem found with py2exe and
pywin32, imp.load_dynamic() once again ignores previously loaded modules
to support Python modules replacing themselves with extension modules.
Patch by Petr Viktorin.

Issue #24635: Fixed a bug in typing.py where isinstance([], typing.Iterable)
would return True once, then False on subsequent calls.

Issue #24989: Fixed buffer overread in BytesIO.readline() if a position is
set beyond size. Based on patch by John Leitch.

Issue #24913: Fix overrun error in deque.index().
Found by John Leitch and Bryce Darling.

IDLE

Issue #23672: Allow Idle to edit and run files with astral chars in name.
Patch by Mohd Sanad Zaki Rizvi.

Issue #24745: Idle editor default font. Switch from Courier to
platform-sensitive TkFixedFont. This should not affect current customized
font selections. If there is a problem, edit $HOME/.idlerc/config-main.cfg
and remove ‘fontxxx’ entries from [Editor Window]. Patch by Mark Roseman.

Issue #21192: Idle editor. When a file is run, put its name in the restart bar.
Do not print false prompts. Original patch by Adnan Umer.

Documentation

Issue #24129: Clarify the reference documentation for name resolution.
This includes removing the assumption that readers will be familiar with the
name resolution scheme Python used prior to the introduction of lexical
scoping for function namespaces. Patch by Ivan Levkivskyi.

Library

Issue #21750: mock_open.read_data can now be read from each instance, as it
could in Python 3.3.

Issue #24552: Fix use after free in an error case of the _pickle module.

Issue #24514: tarfile now tolerates number fields consisting of only
whitespace.

Issue #19176: Fixed doctype() related bugs in C implementation of ElementTree.
A deprecation warning no longer issued by XMLParser subclass with default
doctype() method. Direct call of doctype() now issues a warning. Parser’s
doctype() now is not called if target’s doctype() is called. Based on patch
by Martin Panter.

Issue #15836: assertRaises(), assertRaisesRegex(), assertWarns() and
assertWarnsRegex() assertments now check the type of the first argument
to prevent possible user error. Based on patch by Daniel Wagner-Hall.

Issue #22955: attrgetter, itemgetter and methodcaller objects in the operator
module now support pickling. Added readable and evaluable repr for these
objects. Based on patch by Josh Rosenberg.

Issue #22107: tempfile.gettempdir() and tempfile.mkdtemp() now try again
when a directory with the chosen name already exists on Windows as well as
on Unix. tempfile.mkstemp() now fails early if parent directory is not
valid (not exists or is a file) on Windows.

Issue #23780: Improved error message in os.path.join() with single argument.

Issue #6598: Increased time precision and random number range in
email.utils.make_msgid() to strengthen the uniqueness of the message ID.

Issue #24091: Fixed various crashes in corner cases in C implementation of
ElementTree.

Issue #21931: msilib.FCICreate() now raises TypeError in the case of a bad
argument instead of a ValueError with a bogus FCI error number.
Patch by Jeffrey Armstrong.

Python 3.5.0 alpha 4

Release date: 2015-04-19

Core and Builtins

Issue #22980: Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include
the architecture triplet in the extension name, to make it easy to test builds
for different ABIs in the same working tree. Under OS X, the extension name
now includes PEP 3149-style information.

Issue #23309: Avoid a deadlock at shutdown if a daemon thread is aborted
while it is holding a lock to a buffered I/O object, and the main thread
tries to use the same I/O object (typically stdout or stderr). A fatal
error is emitted instead.

Issue #23342: Add a subprocess.run() function than returns a CalledProcess
instance for a more consistent API than the existing call* functions.

Issue #21217: inspect.getsourcelines() now tries to compute the start and end
lines from the code object, fixing an issue when a lambda function is used as
decorator argument. Patch by Thomas Ballinger and Allison Kaptur.

Issue #23529: Limit the size of decompressed data when reading from
GzipFile, BZ2File or LZMAFile. This defeats denial of service attacks
using compressed bombs (i.e. compressed payloads which decompress to a huge
size). Patch by Martin Panter and Nikolaus Rath.

Issue #23485: select.select() is now retried automatically with the
recomputed timeout when interrupted by a signal, except if the signal handler
raises an exception. This change is part of the PEP 475.

Issue #23752: When built from an existing file descriptor, io.FileIO() now
only calls fstat() once. Before fstat() was called twice, which was not
necessary.

Issue #23704: collections.deque() objects now support __add__, __mul__, and
__imul__().

Issue #23500: Argument Clinic is now smarter about generating the “#ifndef”
(empty) definition of the methoddef macro: it’s only generated once, even
if Argument Clinic processes the same symbol multiple times, and it’s emitted
at the end of all processing rather than immediately after the first use.

Library

Issue #23792: Ignore KeyboardInterrupt when the pydoc pager is active.
This mimics the behavior of the standard unix pagers, and prevents
pipepager from shutting down while the pager itself is still running.

Issue #23775: pprint() of OrderedDict now outputs the same representation
as repr().

Issue #23539: If body is None, http.client.HTTPConnection.request now sets
Content-Length to 0 for PUT, POST, and PATCH headers to avoid 411 errors from
some web servers.

Issue #22351: The nntplib.NNTP constructor no longer leaves the connection
and socket open until the garbage collector cleans them up. Patch by
Martin Panter.

Issue #23704: collections.deque() objects now support methods for index(),
insert(), and copy(). This allows deques to be registered as a
MutableSequence and it improves their substitutablity for lists.

Issue #23715: signal.sigwaitinfo() and signal.sigtimedwait() are
now retried when interrupted by a signal not in the sigset parameter, if
the signal handler does not raise an exception. signal.sigtimedwait()
recomputes the timeout with a monotonic clock when it is retried.

Issue #23646: If time.sleep() is interrupted by a signal, the sleep is now
retried with the recomputed delay, except if the signal handler raises an
exception (PEP 475).

Issue #23136: _strptime now uniformly handles all days in week 0, including
Dec 30 of previous year. Based on patch by Jim Carroll.

Issue #23700: Iterator of NamedTemporaryFile now keeps a reference to
NamedTemporaryFile instance. Patch by Bohuslav Kabrda.

Issue #22903: The fake test case created by unittest.loader when it fails
importing a test module is now picklable.

Issue #22181: On Linux, os.urandom() now uses the new getrandom() syscall if
available, syscall introduced in the Linux kernel 3.17. It is more reliable
and more secure, because it avoids the need of a file descriptor and waits
until the kernel has enough entropy.

Issue #2211: Updated the implementation of the http.cookies.Morsel class.
Setting attributes key, value and coded_value directly now is deprecated.
update() and setdefault() now transform and check keys. Comparing for
equality now takes into account attributes key, value and coded_value.
copy() now returns a Morsel, not a dict. repr() now contains all attributes.
Optimized checking keys and quoting values. Added new tests.
Original patch by Demian Brecht.

Issue #22986: Allow changing an object’s __class__ between a dynamic type and
static type in some cases.

Issue #15859: PyUnicode_EncodeFSDefault(), PyUnicode_EncodeMBCS() and
PyUnicode_EncodeCodePage() now raise an exception if the object is not an
Unicode object. For PyUnicode_EncodeFSDefault(), it was already the case on
platforms other than Windows. Patch written by Campbell Barton.

Issue #21408: The default __ne__() now returns NotImplemented if __eq__()
returned NotImplemented. Original patch by Martin Panter.

Issue #11471: avoid generating a JUMP_FORWARD instruction at the end of
an if-block if there is no else-clause. Original patch by Eugene Toder.

Issue #22215: Now ValueError is raised instead of TypeError when str or bytes
argument contains not permitted null character or byte.

Issue #22258: Fix the internal function set_inheritable() on Illumos.
This platform exposes the function ioctl(FIOCLEX), but calling it fails
with errno is ENOTTY: “Inappropriate ioctl for device”. set_inheritable()
now falls back to the slower fcntl() (F_GETFD and then F_SETFD).

Issue #21389: Displaying the __qualname__ of the underlying function in the
repr of a bound method.

Issue #21897: Fix a crash with the f_locals attribute with closure
variables when frame.clear() has been called.

Issue #21205: Add a new __qualname__ attribute to generator, the
qualified name, and use it in the representation of a generator
(repr(gen)). The default name of the generator (__name__ attribute)
is now get from the function instead of the code. Use gen.gi_code.co_name
to get the name of the code.

Issue #21669: With the aid of heuristics in SyntaxError.__init__, the
parser now attempts to generate more meaningful (or at least more search
engine friendly) error messages when “exec” and “print” are used as
statements.

Issue #21642: If the conditional if-else expression, allow an integer written
with no space between itself and the else keyword (e.g. Trueif42elseFalse) to be valid syntax.

Issue #21523: Fix over-pessimistic computation of the stack effect of
some opcodes in the compiler. This also fixes a quadratic compilation
time issue noticeable when compiling code with a large number of “and”
and “or” operators.

Issue #21418: Fix a crash in the builtin function super() when called without
argument and without current frame (ex: embedded Python).

Issue #19655: The ASDL parser - used by the build process to generate code for
managing the Python AST in C - was rewritten. The new parser is self contained
and does not require to carry long the spark.py parser-generator library;
spark.py was removed from the source base.

Issue #12546: Allow x00 to be used as a fill character when using str, int,
float, and complex __format__ methods.

Issue #23353: Fix the exception handling of generators in
PyEval_EvalFrameEx(). At entry, save or swap the exception state even if
PyEval_EvalFrameEx() is called with throwflag=0. At exit, the exception state
is now always restored or swapped, not only if why is WHY_YIELD or
WHY_RETURN. Patch co-written with Antoine Pitrou.

Issue #14099: Restored support of writing ZIP files to tellable but
non-seekable streams.

Issue #23250: In the http.cookies module, capitalize “HttpOnly” and “Secure”
as they are written in the standard.

Issue #23063: In the disutils’ check command, fix parsing of reST with code or
code-block directives.

Issue #23209, #23225: selectors.BaseSelector.get_key() now raises a
RuntimeError if the selector is closed. And selectors.BaseSelector.close()
now clears its internal reference to the selector mapping to break a
reference cycle. Initial patch written by Martin Richard.

Issue #17911: Provide a way to seed the linecache for a PEP-302 module
without actually loading the code.

Issue #17911: Provide a new object API for traceback, including the ability
to not lookup lines at all until the traceback is actually rendered, without
any trace of the original objects being kept alive.

Issue #19858: pickletools.optimize() now aware of the MEMOIZE opcode, can
produce more compact result and no longer produces invalid output if input
data contains MEMOIZE opcodes together with PUT or BINPUT opcodes.

Issue #22095: Fixed HTTPConnection.set_tunnel with default port. The port
value in the host header was set to “None”. Patch by Demian Brecht.

Issue #23016: A warning no longer produces an AttributeError when the program
is run with pythonw.exe.

Issue #21775: shutil.copytree(): fix crash when copying to VFAT. An exception
handler assumed that that OSError objects always have a ‘winerror’ attribute.
That is not the case, so the exception handler itself raised AttributeError
when run on Linux (and, presumably, any other non-Windows OS).
Patch by Greg Ward.

Issue #16043: Add a default limit for the amount of data xmlrpclib.gzip_decode
will return. This resolves CVE-2013-1753.

Issue #14099: ZipFile.open() no longer reopen the underlying file. Objects
returned by ZipFile.open() can now operate independently of the ZipFile even
if the ZipFile was created by passing in a file-like object as the first
argument to the constructor.

Issue #18216: gettext now raises an error when a .mo file has an
unsupported major version number. Patch by Aaron Hill.

Issue #13918: Provide a locale.delocalize() function which can remove
locale-specific number formatting from a string representing a number,
without then converting it to a specific type. Patch by Cédric Krier.

Issue #22676: Make the pickling of global objects which don’t have a
__module__ attribute less slow.

Issue #9351: Defaults set with set_defaults on an argparse subparser
are no longer ignored when also set on the parent parser.

Issue #7559: unittest test loading ImportErrors are reported as import errors
with their import exception rather than as attribute errors after the import
has already failed.

Issue #19746: Make it possible to examine the errors from unittest
discovery without executing the test suite. The new errors attribute
on TestLoader exposes these non-fatal errors encountered during discovery.

Issue #21991: Make email.headerregistry’s header ‘params’ attributes
be read-only (MappingProxyType). Previously the dictionary was modifiable
but a new one was created on each access of the attribute.

Issue #22638: SSLv3 is now disabled throughout the standard library.
It can still be enabled by instantiating a SSLContext manually.

Issue #22641: In asyncio, the default SSL context for client connections
is now created using ssl.create_default_context(), for stronger security.

Issue #21338: Add silent mode for compileall. quiet parameters of
compile_{dir, file, path} functions now have a multilevel value. Also,
-q option of the CLI now have a multilevel value. Patch by Thomas Kluyver.

Issue #21270: We now override tuple methods in mock.call objects so that
they can be used as normal call attributes.

Issue #16662: load_tests() is now unconditionally run when it is present in
a package’s __init__.py. TestLoader.loadTestsFromModule() still accepts
use_load_tests, but it is deprecated and ignored. A new keyword-only
attribute pattern is added and documented. Patch given by Robert Collins,
tweaked by Barry Warsaw.

Issue #22226: First letter no longer is stripped from the “status” key in
the result of Treeview.heading().

Issue #19524: Fixed resource leak in the HTTP connection when an invalid
response is received. Patch by Martin Panter.

Issue #20421: Add a .version() method to SSL sockets exposing the actual
protocol version in use.

Issue #22051: turtledemo no longer reloads examples to re-run them.
Initialization of variables and gui setup should be done in main(),
which is called each time a demo is run, but not on import.

Issue #21933: Turtledemo users can change the code font size with a menu
selection or control(command) ‘-‘ or ‘+’ or control-mousewheel.
Original patch by Lita Cho.

Issue #21597: The separator between the turtledemo text pane and the drawing
canvas can now be grabbed and dragged with a mouse. The code text pane can
be widened to easily view or copy the full width of the text. The canvas
can be widened on small screens. Original patches by Jan Kanis and Lita Cho.

Issue #18132: Turtledemo buttons no longer disappear when the window is
shrunk. Original patches by Jan Kanis and Lita Cho.

Issue #22043: time.monotonic() is now always available.
threading.Lock.acquire(), threading.RLock.acquire() and socket
operations now use a monotonic clock, instead of the system clock, when a
timeout is used.

Issue #21527: Add a default number of workers to ThreadPoolExecutor equal
to 5 times the number of CPUs. Patch by Claudiu Popa.

Issue #22216: smtplib now resets its state more completely after a quit. The
most obvious consequence of the previous behavior was a STARTTLS failure
during a connect/starttls/quit/connect/starttls sequence.

Issue #22098: ctypes’ BigEndianStructure and LittleEndianStructure now
define an empty __slots__ so that subclasses don’t always get an instance
dict. Patch by Claudiu Popa.

Issue #22185: Fix an occasional RuntimeError in threading.Condition.wait()
caused by mutation of the waiters queue without holding the lock. Patch
by Doug Zongker.

Issue #22287: On UNIX, _PyTime_gettimeofday() now uses
clock_gettime(CLOCK_REALTIME) if available. As a side effect, Python now
depends on the librt library on Solaris and on Linux (only with glibc older
than 2.17).

Issue #22003: When initialized from a bytes object, io.BytesIO() now
defers making a copy until it is mutated, improving performance and
memory use on some use cases. Patch by David Wilson.

Issue #22018: On Windows, signal.set_wakeup_fd() now also supports sockets.
A side effect is that Python depends to the WinSock library.

Issue #22054: Add os.get_blocking() and os.set_blocking() functions to get
and set the blocking mode of a file descriptor (False if the O_NONBLOCK flag
is set, True otherwise). These functions are not available on Windows.

Issue #17172: Make turtledemo start as active on OS X even when run with
subprocess. Patch by Lita Cho.

Issue #19884: readline: Disable the meta modifier key if stdout is not
a terminal to not write the ANSI sequence “033[1034h” into stdout. This
sequence is used on some terminal (ex: TERM=xterm-256color”) to enable
support of 8 bit characters.

Issue #4350: Removed a number of out-of-dated and non-working for a long time
Tkinter methods.

Issue #6167: Scrollbar.activate() now returns the name of active element if
the argument is not specified. Scrollbar.set() now always accepts only 2
arguments.

Issue #21932: os.read() now uses a Py_ssize_t() type instead of
int for the size to support reading more than 2 GB at once. On
Windows, the size is truncted to INT_MAX. As any call to os.read(), the OS
may read less bytes than the number of requested bytes.

Issue #21863: cProfile now displays the module name of C extension functions,
in addition to their own name.

Issue #11453: asyncore: emit a ResourceWarning when an unclosed file_wrapper
object is destroyed. The destructor now closes the file if needed. The
close() method can now be called twice: the second call does nothing.

Issue #21618: The subprocess module could fail to close open fds that were
inherited by the calling process and already higher than POSIX resource
limits would otherwise allow. On systems with a functioning /proc/self/fd
or /dev/fd interface the max is now ignored and all fds are closed.

Issue #20383: Introduce importlib.util.module_from_spec() as the preferred way
to create a new module.

Issue #14315: The zipfile module now ignores extra fields in the central
directory that are too short to be parsed instead of letting a struct.unpack
error bubble up as this “bad data” appears in many real world zip files in
the wild and is ignored by other zip tools.

Issue #17498: Some SMTP servers disconnect after certain errors, violating
strict RFC conformance. Instead of losing the error code when we issue the
subsequent RSET, smtplib now returns the error code and defers raising the
SMTPServerDisconnected error until the next command is issued.

Issue #17826: setting an iterable side_effect on a mock function created by
create_autospec now works. Patch by Kushal Das.

Issue #20879: Delay the initialization of encoding and decoding tables for
base32, ascii85 and base85 codecs in the base64 module, and delay the
initialization of the unquote_to_bytes() table of the urllib.parse module, to
not waste memory if these modules are not used.

Issue #19157: Include the broadcast address in the usuable hosts for IPv6
in ipaddress.

Issue #11599: When an external command (e.g. compiler) fails, distutils now
prints out the whole command line (instead of just the command name) if the
environment variable DISTUTILS_DEBUG is set.

Issue #20817: Fix inspect.getcallargs() to fail correctly if more
than 3 arguments are missing. Patch by Jeremiah Lowin.

Issue #6676: Ensure a meaningful exception is raised when attempting
to parse more than one XML document per pyexpat xmlparser instance.
(Original patches by Hirokazu Yamamoto and Amaury Forgeot d’Arc, with
suggested wording by David Gutteridge)

Issue #21117: Fix inspect.signature to better support functools.partial.
Due to the specifics of functools.partial implementation,
positional-or-keyword arguments passed as keyword arguments become
keyword-only.

Issue #20334: inspect.Signature and inspect.Parameter are now hashable.
Thanks to Antony Lee for bug reports and suggestions.

Issue #15916: doctest.DocTestSuite returns an empty unittest.TestSuite instead
of raising ValueError if it finds no tests

Issue #21209: Fix asyncio.tasks.CoroWrapper to workaround a bug
in yield-from implementation in CPythons prior to 3.4.1.

Issue #23302: Default to TCP_NODELAY=1 upon establishing an HTTPConnection.
Removed use of hard-coded MSS as it’s an optimization that’s no longer needed
with Nagle disabled.

IDLE

Issue #20577: Configuration of the max line length for the FormatParagraph
extension has been moved from the General tab of the Idle preferences dialog
to the FormatParagraph tab of the Config Extensions dialog.
Patch by Tal Einat.

Issue #3068: Add Idle extension configuration dialog to Options menu.
Changes are written to HOME/.idlerc/config-extensions.cfg.
Original patch by Tal Einat.

Issue #16233: A module browser (File : Class Browser, Alt+C) requires a
editor window with a filename. When Class Browser is requested otherwise,
from a shell, output window, or ‘Untitled’ editor, Idle no longer displays
an error box. It now pops up an Open Module box (Alt+M). If a valid name
is entered and a module is opened, a corresponding browser is also opened.

Issue #4832: Save As to type Python files automatically adds .py to the
name you enter (even if your system does not display it). Some systems
automatically add .txt when type is Text files.

Issue #21986: Code objects are not normally pickled by the pickle module.
To match this, they are no longer pickled when running under Idle.

Issue #18104: Add idlelib/idle_test/htest.py with a few sample tests to begin
consolidating and improving human-validated tests of Idle. Change other files
as needed to work with htest. Running the module as __main__ runs all tests.

Issue #21958: Define HAVE_ROUND when building with Visual Studio 2013 and
above. Patch by Zachary Turner.

Issue #18093: the programs that embed the CPython runtime are now in a
separate “Programs” directory, rather than being kept in the Modules
directory.

Issue #15759: “make suspicious”, “make linkcheck” and “make doctest” in Doc/
now display special message when and only when there are failures.

Issue #21141: The Windows build process no longer attempts to find Perl,
instead relying on OpenSSL source being configured and ready to build. The
PCbuild\build_ssl.py script has been re-written and re-named to
PCbuild\prepare_ssl.py, and takes care of configuring OpenSSL source
for both 32 and 64 bit platforms. OpenSSL sources obtained from
svn.python.org will always be pre-configured and ready to build.

Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(),
PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) is now using
calloc() instead of malloc() for large objects which is faster and
use less memory.

Issue #20942: PyImport_ImportFrozenModuleObject() no longer sets __file__ to
match what importlib does; this affects _frozen_importlib as well as any
module loaded using imp.init_frozen().

Documentation

Issue #19548: Update the codecs module documentation to better cover the
distinction between text encodings and other codecs, together with other
clarifications. Patch by Martin Panter.

Issue #22394: Doc/Makefile now supports makevenvPYTHON=../python to
create a venv for generating the documentation, e.g.,
makehtmlPYTHON=venv/bin/python3.

Issue #21514: The documentation of the json module now refers to new JSON RFC
7159 instead of obsoleted RFC 4627.

Issue #21777: The binary sequence methods on bytes and bytearray are now
documented explicitly, rather than assuming users will be able to derive
the expected behaviour from the behaviour of the corresponding str methods.

Issue #19407: New package installation and distribution guides based on
the Python Packaging Authority tools. Existing guides have been retained
as legacy links from the distutils docs, as they still contain some
required reference material for tool developers that isn’t recorded
anywhere else.

Issue #18492: All resources are now allowed when tests are not run by
regrtest.py.

Issue #21634: Fix pystone micro-benchmark: use floor division instead of true
division to benchmark integers instead of floating point numbers. Set pystone
version to 1.2. Patch written by Lennart Regebro.

Issue #22120: For functions using an unsigned integer return converter,
Argument Clinic now generates a cast to that type for the comparison
to -1 in the generated code. (This supresses a compilation warning.)

Windows

The bundled version of Tcl/Tk has been updated to 8.6.3. The most visible
result of this change is the addition of new native file dialogs when
running on Windows Vista or newer. See Tcl/Tk’s TIP 432 for more
information. Also, this version of Tcl/Tk includes support for Windows 10.

Issue #17896: The Windows build scripts now expect external library sources
to be in PCbuild\..\externals rather than PCbuild\..\...

Issue #17717: The Windows build scripts now use a copy of NASM pulled from
svn.python.org to build OpenSSL.

Issue #21907: Improved the batch scripts provided for building Python.

Issue #22644: The bundled version of OpenSSL has been updated to 1.0.1j.

asyncio: Refactoring and fixes: BaseEventLoop.sock_connect() raises an
error if the address is not resolved; use __slots__ in Handle and
TimerHandle; as_completed() and wait() raise TypeError if the passed
list of Futures is a single Future; call_soon() and other ‘call_*()’
functions raise TypeError if the passed callback is a coroutine
function; _ProactorBasePipeTransport uses _FlowControlMixin;
WriteTransport.set_write_buffer_size() calls _maybe_pause_protocol()
to consider pausing receiving if the watermark limits have changed;
fix _check_resolved_address() for IPv6 address; and other minor
improvements, along with multiple documentation updates.

Issue #20684: Fix inspect.getfullargspec() to not to follow __wrapped__
chains. Make its behaviour consistent with bound methods first argument.
Patch by Nick Coghlan and Yury Selivanov.

Issue #19744: the ensurepip installation step now just prints a warning to
stderr rather than failing outright if SSL/TLS is unavailable. This allows
local installation of POSIX builds without SSL/TLS support.

Issue #20404: io.TextIOWrapper (and hence the open() builtin) now uses the
internal codec marking system added for issue #19619 to throw LookupError
for known non-text encodings at stream construction time. The existing
output type checks remain in place to deal with unmarked third party
codecs.

Issue #14983: email.generator now always adds a line end after each MIME
boundary marker, instead of doing so only when there is an epilogue. This
fixes an RFC compliance bug and solves an issue with signed MIME parts.

Issue #20540: Fix a performance regression (vs. Python 3.2) when layering
a multiprocessing Connection over a TCP socket. For small payloads, Nagle’s
algorithm would introduce idle delays before the entire transmission of a
message.

Issue #16983: the new email header parsing code will now decode encoded words
that are (incorrectly) surrounded by quotes, and register a defect.

Issue #19772: email.generator no longer mutates the message object when
doing a down-transform from 8bit to 7bit CTEs.

Issue #18805: the netmask/hostmask parsing in ipaddress now more reliably
filters out illegal values and correctly allows any valid prefix length.

Issue #20481: For at least Python 3.4, the statistics module will require
that all inputs for a single operation be of a single consistent type, or
else a mixed of ints and a single other consistent type. This avoids
some interoperability issues that arose with the previous approach of
coercing to a suitable common type.

Issue #20478: the statistics module now treats collections.Counter inputs
like any other iterable.

Issue #17369: get_filename was raising an exception if the filename
parameter’s RFC2231 encoding was broken in certain ways. This was
a regression relative to python2.

Issue #20013: Some imap servers disconnect if the current mailbox is
deleted, and imaplib did not handle that case gracefully. Now it
handles the ‘bye’ correctly.

Issue #20531: Revert 3.4 version of fix for #19063, and apply the 3.3
version. That is, do not raise an error if unicode is passed to
email.message.Message.set_payload.

Issue #20476: If a non-compat32 policy is used with any of the email parsers,
EmailMessage is now used as the factory class. The factory class should
really come from the policy; that will get fixed in 3.5.

Issue #19920: TarFile.list() no longer fails when outputs a listing
containing non-encodable characters. Based on patch by Vajrasky Kok.

Issue #20311, #20452: poll and epoll now round the timeout away from zero,
instead of rounding towards zero, in select and selectors modules:
select.epoll.poll(), selectors.PollSelector.poll() and
selectors.EpollSelector.poll(). For example, a timeout of one microsecond
(1e-6) is now rounded to one millisecondi (1e-3), instead of being rounded to
zero. However, the granularity property and asyncio’s resolution feature
were removed again.

asyncio: Some refactoring; various fixes; add write flow control to
unix pipes; Future.set_exception() instantiates the exception
argument if it is a class; improved proactor pipe transport; support
wait_for(f, None); don’t log broken/disconnected pipes; use
ValueError instead of assert for forbidden subprocess_{shell,exec}
arguments; added a convenience API for subprocess management; added
StreamReader.at_eof(); properly handle duplicate coroutines/futures
in gather(), wait(), as_completed(); use a bytearray for buffering
in StreamReader; and more.

Tools/Demos

Issue #20530: Argument Clinic’s signature format has been revised again.
The new syntax is highly human readable while still preventing false
positives. The syntax also extends Python syntax to denote “self” and
positional-only parameters, allowing inspect.Signature objects to be
totally accurate for all supported builtins in Python 3.4.

Issue #20456: Argument Clinic now observes the C preprocessor conditional
compilation statements of the C files it parses. When a Clinic block is
inside a conditional code, it adjusts its output to match, including
automatically generating an empty methoddef macro.

Issue #20456: Cloned functions in Argument Clinic now use the correct
name, not the name of the function they were cloned from, for text
strings inside generated code.

Issue #20326: Argument Clinic now generates separate checksums for the
input and output sections of the block, allowing external tools to verify
that the input has not changed (and thus the output is not out-of-date).

Issue #2382: SyntaxError cursor “^” is now written at correct position in most
cases when multibyte characters are in line (before “^”). This still not
works correctly with wide East Asian characters.

Issue #18960: The first line of Python script could be executed twice when
the source encoding was specified on the second line. Now the source encoding
declaration on the second line isn’t effective if the first line contains
anything except a comment. ‘python -x’ works now again with files with the
source encoding declarations, and can be used to make Python batch files
on Windows.

Library

asyncio: Various improvements and small changes not all covered by
issues listed below. E.g. wait_for() now cancels the inner task if
the timeout occcurs; tweaked the set of exported symbols; renamed
Empty/Full to QueueEmpty/QueueFull; “with (yield from lock)” now
uses a separate context manager; readexactly() raises if not enough
data was read; PTY support tweaks.

Issue #20311: asyncio: Add a granularity attribute to BaseEventLoop: maximum
between the resolution of the BaseEventLoop.time() method and the resolution
of the selector. The granuarility is used in the scheduler to round time and
deadline.

Issue #20189: unittest.mock now no longer assumes that any object for
which it could get an inspect.Signature is a callable written in Python.
Fix courtesy of Michael Foord.

Issue #20317: ExitStack.__exit__ could create a self-referential loop if an
exception raised by a cleanup operation already had its context set
correctly (for example, by the @contextmanager decorator). The infinite
loop this caused is now avoided by checking if the expected context is
already set before trying to fix it.

Issues #20206 and #5803: Fix edge case in email.quoprimime.encode where it
truncated lines ending in a character needing encoding but no newline by
using a more efficient algorithm that doesn’t have the bug.

Issue #19082: Working xmlrpc.server and xmlrpc.client examples. Both in
modules and in documentation. Initial patch contributed by Vajrasky Kok.

Issue #20138: The wsgiref.application_uri() and wsgiref.request_uri()
functions now conform to PEP 3333 when handle non-ASCII URLs.

Issue #19097: Raise the correct Exception when cgi.FieldStorage is given an
invalid fileobj.

Tools/Demos

Issue #20390: Argument Clinic’s “class” directive syntax has been extended
with two new required arguments: “typedef” and “type_object”.

Issue #20390: Argument Clinic: If __new__ or __init__ functions didn’t use
kwargs (or args), the PyArg_NoKeywords (or PyArg_NoPositional) calls
generated are only run when the type object is an exact match.

Issue #20390: Argument Clinic now fails if you have required parameters after
optional parameters.

Issue #20390: Argument Clinic converters now have a new template they can
inject code into: “modifiers”. Code put there is run in the parsing
function after argument parsing but before the call to the impl.

Issue #20381: Argument Clinic now sanity checks the default argument when
c_default is also specified, providing a nice failure message for
disallowed values.

Issue #20189: Argument Clinic now ensures that parser functions for
__new__ are always of type newfunc, the type of the tp_new slot.
Similarly, parser functions for __init__ are now always of type initproc,
the type of tp_init.

Issue #20189: Argument Clinic now suppresses the docstring for __new__
and __init__ functions if no docstring is provided in the input.

Issue #20189: Argument Clinic now suppresses the “self” parameter in the
impl for @staticmethod functions.

Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them. Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don’t provide command line interface. Fixed
shebang lines in the unittestgui and checkpip scripts.

Python 3.4.0 Beta 2

Core and Builtins

Issue #19526: Exclude all new API from the stable ABI. Exceptions can be
made if a need is demonstrated.

Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if “%c”
argument is not in range [0; 255].

Issue #19995: %c, %o, %x, and %X now issue a DeprecationWarning on non-integer
input; reworded docs to clarify that an integer type should define both __int__
and __index__.

Issue #19787: PyThread_set_key_value() now always set the value. In Python
3.3, the function did nothing if the key already exists (if the current value
is a non-NULL pointer).

Issue #14432: Remove the thread state field from the frame structure. Fix a
crash when a generator is created in a C thread that is destroyed while the
generator is still used. The issue was that a generator contains a frame, and
the frame kept a reference to the Python state of the destroyed C thread. The
crash occurs when a trace function is setup.

Issue #19576: PyGILState_Ensure() now initializes threads. At startup, Python
has no concrete GIL. If PyGILState_Ensure() is called from a new thread for
the first time and PyEval_InitThreads() was not called yet, a GIL needs to be
created.

Issue #19855: uuid.getnode() on Unix now looks on the PATH for the
executables used to find the mac address, with /sbin and /usr/sbin as
fallbacks.

Issue #20007: HTTPResponse.read(0) no more prematurely closes connection.
Original patch by Simon Sapin.

Issue #19946: multiprocessing now uses runpy to initialize __main__ in
child processes when necessary, allowing it to correctly handle scripts
without suffixes and submodules that use explicit relative imports or
otherwise rely on parent modules being correctly imported prior to
execution.

Issue #19921: When Path.mkdir() is called with parents=True, any missing
parent is created with the default permissions, ignoring the mode argument
(mimicking the POSIX “mkdir -p” command).

Issue #19946: multiprocessing.spawn now raises ImportError when the module to
be used as the main module cannot be imported.

Issue #17919: select.poll.register() again works with poll.POLLNVAL on AIX.
Fixed integer overflow in the eventmask parameter.

Issue #19063: if a Charset’s body_encoding was set to None, the email
package would generate a message claiming the Content-Transfer-Encoding
was 7bit, and produce garbage output for the content. This now works.
A couple of other set_payload mishandlings of non-ASCII are also fixed.
In addition, calling set_payload with a string argument without
specifying a charset now raises an error (this is a new error in 3.4).

Issue #17429: platform.linux_distribution() now decodes files from the UTF-8
encoding with the surrogateescape error handler, instead of decoding from the
locale encoding in strict mode. It fixes the function on Fedora 19 which is
probably the first major distribution release with a non-ASCII name. Patch
written by Toshio Kuratomi.

Issue #19827: On UNIX, setblocking() and settimeout() methods of
socket.socket can now avoid a second syscall if the ioctl() function can be
used, or if the non-blocking flag of the socket is unchanged.

Issue #19785: smtplib now supports SSLContext.check_hostname and server name
indication for TLS/SSL connections.

Issue #19784: poplib now supports SSLContext.check_hostname and server name
indication for TLS/SSL connections.

Issue #19783: nntplib now supports SSLContext.check_hostname and server name
indication for TLS/SSL connections.

Issue #19782: imaplib now supports SSLContext.check_hostname and server name
indication for TLS/SSL connections.

Tools/Demos

Python 3.4.0 Beta 1

Release date: 2013-11-24

Core and Builtins

Use the repr of a module name in more places in import, especially
exceptions.

Issue #19619: str.encode, bytes.decode and bytearray.decode now use an
internal API to throw LookupError for known non-text encodings, rather
than attempting the encoding or decoding operation and then throwing a
TypeError for an unexpected output type. (The latter mechanism remains
in place for third party non-text encodings)

Issue #12892: The utf-16* and utf-32* encoders no longer allow surrogate code
points (U+D800-U+DFFF) to be encoded. The utf-32* decoders no longer decode
byte sequences that correspond to surrogate code points. The surrogatepass
error handler now works with the utf-16* and utf-32* codecs. Based on
patches by Victor Stinner and Kang-Hao (Kenny) Lu.

Issue #17806: Added keyword-argument support for “tabsize” to
str/bytes.expandtabs().

Issue #17828: Output type errors in str.encode(), bytes.decode() and
bytearray.decode() now direct users to codecs.encode() or codecs.decode()
as appropriate.

Issue #17828: The interpreter now attempts to chain errors that occur in
codec processing with a replacement exception of the same type that
includes the codec name in the error message. It ensures it only does this
when the creation of the replacement exception won’t lose any information.

Issue #19466: Clear the frames of daemon threads earlier during the
Python shutdown to call objects destructors. So “unclosed file” resource
warnings are now corretly emitted for daemon threads.

Issue #18408: Add a new PyFrame_FastToLocalsWithError() function to handle
exceptions when merging fast locals into f_locals of a frame.
PyEval_GetLocals() now raises an exception and return NULL on failure.

Issue #19735: Implement private function ssl._create_stdlib_context() to
create SSLContext objects in Python’s stdlib module. It provides a single
configuration point and makes use of SSLContext.load_default_certs().

Issue #16203: Add re.fullmatch() function and regex.fullmatch() method,
which anchor the pattern at both ends of the string to match.
Original patch by Matthew Barnett.

Issue #19634: time.strftime(“%y”) now raises a ValueError on AIX when given a
year before 1900.

Fix test.support.bind_port() to not cause an error when Python was compiled
on a system with SO_REUSEPORT defined in the headers but run on a system
with an OS kernel that does not support that reasonably new socket option.

Fix compilation error under gcc of the ctypes module bundled libffi for arm.

Issue #19448: Add private API to SSL module to lookup ASN.1 objects by OID,
NID, short name and long name.

Issue #19378: Renamed the “dis.Bytecode.display_code” method to
“dis.Bytecode.dis” and converted it to returning a string rather than
printing output.

Issue #19378: the “line_offset” parameter in the new “dis.get_instructions”
API has been renamed to “first_line” (and the default value and usage
changed accordingly). This should reduce confusion with the more common use
of “offset” in the dis docs to refer to bytecode offsets.

Issue #18678: Corrected spwd struct member names in spwd module:
sp_nam->sp_namp, and sp_pwd->sp_pwdp. The old names are kept as extra
structseq members, for backward compatibility.

Issue #6157: Fixed tkinter.Text.debug(). tkinter.Text.bbox() now raises
TypeError instead of TclError on wrong number of arguments. Original patch
by Guilherme Polo.

Issue #10197: Rework subprocess.get[status]output to use subprocess
functionality and thus to work on Windows. Patch by Nick Coghlan

Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of
integers instead of a string. Based on patch by Guilherme Polo.

Issue #16039: CVE-2013-1752: Change use of readline in imaplib module to limit
line length. Patch by Emil Lind.

Issue #19330: the unnecessary wrapper functions have been removed from the
implementations of the new contextlib.redirect_stdout and
contextlib.suppress context managers, which also ensures they provide
reasonable help() output on instances

Issue #19393: Fix symtable.symtable function to not be confused when there are
functions or classes named “top”.

Tests

Issue #19664: test_userdict’s repr test no longer depends on the order
of dict elements.

Issue #19440: Clean up test_capi by removing an unnecessary __future__
import, converting from test_main to unittest.main, and running the
_testcapi module tests as subTests of a unittest TestCase method.

Issue #19378: the main dis module tests are now run with both stdout
redirection and passing an explicit file parameter

Issue #19649: On OS X, the same set of file names are now installed
in bin directories for all configurations: non-framework vs framework,
and single arch vs universal builds. pythonx.y-32 is now always
installed for 64-bit/32-bit universal builds. The obsolete and
undocumented pythonw* symlinks are no longer installed anywhere.

Issue #19553: PEP 453 - “make install” and “make altinstall” now install or
upgrade pip by default, using the bundled pip provided by the new ensurepip
module. A new configure option, –with-ensurepip[=upgrade|install|no], is
available to override the default ensurepip “–upgrade” option. The option
can also be set with “make [alt]install ENSUREPIP=[upgrade|installno]”.

Issue #15663: Revert OS X installer built-in Tcl/Tk support for 3.4.0b1.
Some third-party projects, such as Matplotlib and PIL/Pillow,
depended on being able to build with Tcl and Tk frameworks in
/Library/Frameworks.

Tools/Demos

Issue #19730: Argument Clinic now supports all the existing PyArg
“format units” as legacy converters, as well as two new features:
“self converters” and the “version” directive.

Issue #19552: pyvenv now bootstraps pip into virtual environments by
default (pass –without-pip to request the old behaviour)

Issue #18810: Shift stat calls in importlib.machinery.FileFinder such that
the code is optimistic that if something exists in a directory named exactly
like the possible package being searched for that it’s in actuality a
directory.

Issue #18416: importlib.machinery.PathFinder now treats ‘’ as the cwd and
importlib.machinery.FileFinder no longer special-cases ‘’ to ‘.’. This leads
to modules imported from cwd to now possess an absolute file path for
__file__ (this does not affect modules specified by path on the CLI but it
does affect -m/runpy). It also allows FileFinder to be more consistent by not
having an edge case.

Issue #4555: All exported C symbols are now prefixed with either
“Py” or “_Py”.

Issue #16742: The result of the C callback PyOS_ReadlineFunctionPointer must
now be a string allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL
if an error occurred), instead of a string allocated by PyMem_Malloc() or
PyMem_Realloc().

Issue #19262: Initial check in of the ‘asyncio’ package (a.k.a. Tulip,
a.k.a. PEP 3156). There are no docs yet, and the PEP is slightly
out of date with the code. This module will have provisional status
in Python 3.4.

Issue #19266: Rename the new-in-3.4 contextlib.ignore context manager
to contextlib.suppress in order to be more consistent with existing
descriptions of that operation elsewhere in the language and standard
library documentation (Patch by Zero Piraeus).

Issue #5845: In site.py, only load readline history from ~/.python_history
if no history has been read already. This avoids double writes to the
history file at shutdown.

Properly initialize all fields of a SSL object after allocation.

Issue #19095: SSLSocket.getpeercert() now raises ValueError when the
SSL handshake hasn’t been done.

Issue #4366: Fix building extensions on all platforms when –enable-shared
is used.

Issue #19030: Fixed inspect.getmembers and inspect.classify_class_attrs
to attempt activating descriptors before falling back to a __dict__ search
for faulty descriptors. inspect.classify_class_attrs no longer returns
Attributes whose home class is None.

C API

Issue #1772673: The type of char* arguments now changed to constchar*.

Issue #19019: Change the OS X installer build script to use CFLAGS instead
of OPT for special build options. By setting OPT, some compiler-specific
options like -fwrapv were overridden and thus not used, which could result
in broken interpreters when building with clang.

Python 3.4.0 Alpha 3

Release date: 2013-09-29

Core and Builtins

Issue #18818: The “encodingname” part of PYTHONIOENCODING is now optional.

Issue #19098: Prevent overflow in the compiler when the recursion limit is set
absurdly high.

Library

Issue #18929: inspect.classify_class_attrs() now correctly finds class
attributes returned by dir() that are located in the metaclass.

Issue #18950: Fix miscellaneous bugs in the sunau module.
Au_read.readframes() now updates current file position and reads correct
number of frames from multichannel stream. Au_write.writeframesraw() now
correctly updates current file position. Au_read.getnframes() now returns an
integer (as in Python 2). Au_read and Au_write now correctly works with file
object if start file position is not a zero.

Issue #18594: The fast path for collections.Counter() was never taken
due to an over-restrictive type check.

Issue #19053: ZipExtFile.read1() with non-zero argument no more returns empty
bytes until end of data.

logging: added support for Unix domain sockets to SocketHandler and
DatagramHandler.

Issue #19037: The mailbox module now makes all changes to maildir files
before moving them into place, to avoid race conditions with other programs
that may be accessing the maildir directory.

Issue #14984: On POSIX systems, when netrc is called without a filename
argument (and therefore is reading the user’s $HOME/.netrc file), it now
enforces the same security rules as typical ftp clients: the .netrc file must
be owned by the user that owns the process and must not be readable by any
other user.

IDLE

Issue #18988: The “Tab” key now works when a word is already autocompleted.

Documentation

Issue #17003: Unified the size argument names in the io module with common
practice.

Build

Issue #18596: Support the use of address sanity checking in recent versions
of clang and GCC by appropriately marking known false alarms in the small
object allocator. Patch contributed by Dhiru Kholia.

Library

Issue #18808: Thread.join() now waits for the underlying thread state to
be destroyed before returning. This prevents unpredictable aborts in
Py_EndInterpreter() when some non-daemon threads are still running.

Issue #18458: Prevent crashes with newer versions of libedit. Its readline
emulation has changed from 0-based indexing to 1-based like gnu readline.

Issue #18852: Handle case of readline.__doc__ being None in the new
readline activation code in site.py.

Issue #12015: The tempfile module now uses a suffix of 8 random characters
instead of 6, to reduce the risk of filename collision. The entropy was
reduced when uppercase letters were removed from the charset used to generate
random characters.

Tests

Issue #15507: test_subprocess’s test_send_signal could fail if the test
runner were run in an environment where the process inherited an ignore
setting for SIGINT. Restore the SIGINT handler to the desired
KeyboardInterrupt raising one during that test.

Build

Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+ 64-/32-bit
installer. It is no longer necessary to install a third-party version of
Tcl/Tk 8.5 to work around the problems in the Apple-supplied Tcl/Tk 8.5
shipped in OS X 10.6 and later releases.

Tools/Demos

Issue #18922: Now The Lib/smtpd.py and Tools/i18n/msgfmt.py scripts write
their version strings to stdout, and not to sderr.

Issue #7330: Implement width and precision (ex: “%5.3s”) for the format
string of PyUnicode_FromFormat() function, original patch written by Ysj Ray.

Issue #1545463: Global variables caught in reference cycles are now
garbage-collected at shutdown.

Issue #17094: Clear stale thread states after fork(). Note that this
is a potentially disruptive change since it may release some system
resources which would otherwise remain perpetually alive (e.g. database
connections kept in thread-local storage).

Issue #17408: Avoid using an obsolete instance of the copyreg module when
the interpreter is shutdown and then started again.

Issue #5845: Enable tab-completion in the interactive interpreter by
default, thanks to a new sys.__interactivehook__.

Issue #17115,17116: Module initialization now includes setting __package__ and
__loader__ attributes to None.

Issue #17853: Ensure locals of a class that shadow free variables always win
over the closures.

Issue #17863: In the interactive console, don’t loop forever if the encoding
can’t be fetched from stdin.

Issue #17867: Raise an ImportError if __import__ is not found in __builtins__.

Issue #18698: Ensure importlib.reload() returns the module out of sys.modules.

Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3,
such as was shipped with Centos 5 and Mac OS X 10.4.

Issue #17413: sys.settrace callbacks were being passed a string instead of an
exception instance for the ‘value’ element of the arg tuple if the exception
originated from C code; now an exception instance is always provided.

Issue #17782: Fix undefined behaviour on platforms where
structtimespec‘s “tv_nsec” member is not a C long.

Issue #14850: Now a charmap decoder treats U+FFFE as “undefined mapping”
in any mapping, not only in a string.

Issue #16613: Add m argument to collections.Chainmap.new_child to
allow the new child map to be specified explicitly.

Issue #16730: importlib.machinery.FileFinder now no longers raises an
exception when trying to populate its cache and it finds out the directory is
unreadable or has turned into a file. Reported and diagnosed by
David Pritchard.

Issue #16906: Fix a logic error that prevented most static strings from being
cleared.

Issue #16619: Create NameConstant AST class to represent None, True, and False
literals. As a result, these constants are never loaded at runtime from
builtins.

Issue #16455: On FreeBSD and Solaris, if the locale is C, the
ASCII/surrogateescape codec is now used (instead of the locale encoding) to
decode the command line arguments. This change fixes inconsistencies with
os.fsencode() and os.fsdecode(), because these operating systems announce an
ASCII locale encoding, but actually use the ISO-8859-1 encoding in practice.

Issue #16290: A float return value from the __complex__ special method is no
longer accepted in the complex() constructor.

Issue #16416: On Mac OS X, operating system data are now always
encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding
(which may be ASCII if no locale environment variable is set), to avoid
inconsistencies with os.fsencode() and os.fsdecode() functions which are
already using UTF-8/surrogateescape.

Issue #8271: the utf-8 decoder now outputs the correct number of U+FFFD
characters when used with the ‘replace’ error handler on invalid utf-8
sequences. Patch by Serhiy Storchaka, tests by Ezio Melotti.

Issue #5765: Apply a hard recursion limit in the compiler instead of
blowing the stack and segfaulting. Initial patch by Andrea Griffini.

Issue #16402: When slicing a range, fix shadowing of exceptions from
__index__.

Issue #18393: The private module _gestalt and private functions
platform._mac_ver_gestalt, platform._mac_ver_lookup and
platform._bcd2str have been removed. This does not affect the public
interface of the platform module.

Issue #17482: functools.update_wrapper (and functools.wraps) now set the
__wrapped__ attribute correctly even if the underlying function has a
__wrapped__ attribute set.

Issue #18432: The sched module’s queue method was incorrectly returning
an iterator instead of a list.

Issue #18044: The new email header parser was mis-parsing encoded words where
an encoded character immediately followed the ‘?’ that follows the CTE
character, resulting in a decoding failure. They are now decoded correctly.

Issue #18101: Tcl.split() now process strings nested in a tuple as it
do with byte strings.

Issue #18116: getpass was always getting an error when testing /dev/tty,
and thus was always falling back to stdin, and would then raise an exception
if stdin could not be used (such as /dev/null). It also leaked an open file.
All of these issues are now fixed.

Issue #17198: Fix a NameError in the dbm module. Patch by Valentina
Mukhamedzhanova.

Issue #18240: The HMAC module is no longer restricted to bytes and accepts
any bytes-like object, e.g. memoryview. Original patch by Jonas Borgström.

Issue #18224: Removed pydoc script from created venv, as it causes problems
on Windows and adds no value over and above python -m pydoc ...

Issue #18155: The csv module now correctly handles csv files that use
a delimter character that has a special meaning in regexes, instead of
throwing an exception.

Issue #14360: encode_quopri can now be successfully used as an encoder
when constructing a MIMEApplication object.

Issue #11390: Add -o and -f command line options to the doctest CLI to
specify doctest options (and convert it to using argparse).

Issue #18135: ssl.SSLSocket.write() now raises an OverflowError if the input
string in longer than 2 gigabytes, and ssl.SSLContext.load_cert_chain()
raises a ValueError if the password is longer than 2 gigabytes. The ssl
module does not support partial write.

subprocess: Prevent a possible double close of parent pipe fds when the
subprocess exec runs into an error. Prevent a regular multi-close of the
/dev/null fd when any of stdin, stdout and stderr was set to DEVNULL.

Issue #18194: Introduce importlib.util.cache_from_source() and
source_from_cache() while documenting the equivalent functions in imp as
deprecated.

Issue #17907: Document imp.new_module() as deprecated in favour of
types.ModuleType.

Issue #16795: On the ast.arguments object, unify vararg with varargannotation
and kwarg and kwargannotation. Change the column offset of ast.Attribute to be
at the attribute name.

Issue #17434: Properly raise a SyntaxError when a string occurs between future
imports.

Issue #17117: Import and @importlib.util.set_loader now set __loader__ when
it has a value of None or the attribute doesn’t exist.

Issue #17032: The “global” in the “NameError: global name ‘x’ is not defined”
error message has been removed. Patch by Ram Rachum.

Issue #18080: When building a C extension module on OS X, if the compiler
is overriden with the CC environment variable, use the new compiler as
the default for linking if LDSHARED is not also overriden. This restores
Distutils behavior introduced in 3.2.3 and inadvertently dropped in 3.3.0.

Issue #5713: smtplib now handles 421 (closing connection) error codes when
sending mail by closing the socket and reporting the 421 error code via the
exception appropriate to the command that received the error response.

Issue #16997: unittest.TestCase now provides a subTest() context manager
to procedurally generate, in an easy way, small test instances.

Issue #17485: Also delete the Request Content-Length header if the data
attribute is deleted. (Follow on to issue Issue #16464).

Issue #17192: Update the ctypes module’s libffi to v3.0.13. This
specifically addresses a stack misalignment issue on x86 and issues on
some more recent platforms.

Issue #8862: Fixed curses cleanup when getkey is interrputed by a signal.

Issue #17443: imaplib.IMAP4_stream was using the default unbuffered IO
in subprocess, but the imap code assumes buffered IO. In Python2 this
worked by accident. IMAP4_stream now explicitly uses buffered IO.

Issue #17476: Fixed regression relative to Python2 in undocumented pydoc
‘allmethods’; it was missing unbound methods on the class.

Issue #14645: The email generator classes now produce output using the
specified linesep throughout. Previously if the prolog, epilog, or
body were stored with a different linesep, that linesep was used. This
fix corrects an RFC non-compliance issue with smtplib.send_message.

Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when
the list is being resized concurrently.

Issue #16962: Use getdents64 instead of the obsolete getdents syscall
in the subprocess module on Linux.

Issue #16935: unittest now counts the module as skipped if it raises SkipTest,
instead of counting it as an error. Patch by Zachary Ware.

Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR.

Issue #13773: sqlite3.connect() gets a new uri parameter to pass the
filename as a URI, allowing to pass custom options.

Issue #16564: Fixed regression relative to Python2 in the operation of
email.encoders.encode_noop when used with binary data.

Issue #10355: The mode, name, encoding and newlines properties now work on
SpooledTemporaryFile objects even when they have not yet rolled over.
Obsolete method xreadline (which has never worked in Python 3) has been
removed.

Issue #16686: Fixed a lot of bugs in audioop module. Fixed crashes in
avgpp(), maxpp() and ratecv(). Fixed an integer overflow in add(), bias(),
and ratecv(). reverse(), lin2lin() and ratecv() no more lose precision for
32-bit samples. max() and rms() no more returns a negative result and
various other functions now work correctly with 32-bit sample -0x80000000.

Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying
stream or a decoder produces data of an unexpected type (i.e. when
io.TextIOWrapper initialized with text stream or use bytes-to-bytes codec).

Issue #17015: When it has a spec, a Mock object now inspects its signature
when matching calls, so that arguments can be matched positionally or
by name.

Issue #15633: httplib.HTTPResponse is now mark closed when the server
sends less than the advertised Content-Length.

Issue #12268: The io module file object write methods no longer abort early
when one of its write system calls is interrupted (EINTR).

Have py_compile use importlib as much as possible to avoid code duplication.
Code now raises FileExistsError if the file path to be used for the
byte-compiled file is a symlink or non-regular file as a warning that import
will not keep the file path type if it writes to that path.

Issue #16972: Have site.addpackage() consider already known paths even when
none are explicitly passed in. Bug report and fix by Kirill.

Issue #16957: shutil.which() no longer searches a bare file name in the
current directory on Unix and no longer searches a relative file path with
a directory part in PATH directories. Patch by Thomas Kluyver.

Issue #1159051: GzipFile now raises EOFError when reading a corrupted file
with truncated header or footer.

Issue #16993: shutil.which() now preserves the case of the path and extension
on Windows.

Issue #15031: Refactor some .pyc management code to cut down on code
duplication. Thanks to Ronan Lamy for the report and taking an initial stab
at the problem.

Issue #16398: Optimize deque.rotate() so that it only moves pointers
and doesn’t touch the underlying data with increfs and decrefs.

Issue #16900: Issue a ResourceWarning when an ssl socket is left unclosed.

Issue #13899: A, Z, and B now correctly match the A, Z, and B literals
when used inside character classes (e.g. ‘[A]’). Patch by Matthew Barnett.

Issue #15545: Fix regression in sqlite3’s iterdump method where it was
failing if the connection used a row factory (such as sqlite3.Row) that
produced unsortable objects. (Regression was introduced by fix for 9750).

Issue #16357: fix calling accept() on a SSLSocket created through
SSLContext.wrap_socket(). Original patch by Jeff McNeil.

Issue #16409: The reporthook callback made by the legacy
urllib.request.urlretrieve API now properly supplies a constant non-zero
block_size as it did in Python 3.2 and 2.7. This matches the behavior of
urllib.request.URLopener.retrieve.

Issue #16431: Use the type information when constructing a Decimal subtype
from a Decimal argument.

Issue #16350: zlib.decompressobj().decompress() now accumulates data from
successive calls after EOF in unused_data, instead of only saving the argument
to the last call. decompressobj().flush() now correctly sets unused_data and
unconsumed_tail. A bug in the handling of MemoryError when setting the
unconsumed_tail attribute has also been fixed. Patch by Serhiy Storchaka.

Issue #12759: sre_parse now raises a proper error when the name of the group
is missing. Initial patch by Serhiy Storchaka.

Issue #16152: fix tokenize to ignore whitespace at the end of the code when
no newline is found. Patch by Ned Batchelder.

Issue #16114: The subprocess module no longer provides a misleading error
message stating that args[0] did not exist when either the cwd or executable
keyword arguments specified a path that did not exist.

Issue #12776, issue #11839: Call argparse type function (specified by
add_argument) only once. Before, the type function was called twice in the
case where the default was specified and the argument was given as well. This
was especially problematic for the FileType type, as a default file would
always be opened, even if a file argument was specified on the command line.

Issue #15906: Fix a regression in argparse caused by the preceding change,
when action='append', type='str' and default=[].

Issue #16113: Added sha3 module based on the Keccak reference implementation
3.2. The hashlib module has four additional hash algorithms: sha3_224,
sha3_256, sha3_384 and sha3_512. As part of the patch some common
code was moved from _hashopenssl.c to hashlib.h.

ctypes.call_commethod was removed, since its only usage was in the defunct
samples directory.

IDLE

Issue #18429: Format / Format Paragraph, now works when comment blocks
are selected. As with text blocks, this works best when the selection
only includes complete lines.

Issue #18226: Add docstrings and unittests for FormatParagraph.py.
Original patches by Todd Rovito and Phil Webster.

Issue #18279: Format - Strip trailing whitespace no longer marks a file as
changed when it has not been changed. This fix followed the addition of a
test file originally written by Phil Webster (the issue’s main goal).

Build

Issue #18257: Fix readlink usage in python-config. Install the python
version again on Darwin.

Issue #18481: Add C coverage reporting with gcov and lcov. A new make target
“coverage-report” creates an instrumented Python build, runs unit tests
and creates a HTML. The report can be updated with “make coverage-lcov”.

Issue #17845: Clarified the message printed when some module are not built.

Issue #16754: Fix the incorrect shared library extension on linux. Introduce
two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of
SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4.

Issue #5033: Fix building of the sqlite3 extension module when the
SQLite library version has “beta” in it. Patch by Andreas Pelme.

Issue #15833: Fix a regression in 3.3 that resulted in exceptions being
raised if importlib failed to write byte-compiled files. This affected
attempts to build Python out-of-tree from a read-only source directory.

Issue #15923: Fix a mistake in asdl_c.py that resulted in a TypeError
after 2801bf875a24 (see #15801).

Issue #16086: PyTypeObject.tp_flags and PyType_Spec.flags are now unsigned
(unsigned long and unsigned int) to avoid an undefined behaviour with
Py_TPFLAGS_TYPE_SUBCLASS ((1 << 31). PyType_GetFlags() result type is
now unsigned too (unsigned long, instead of long).

Documentation

Issue #23006: Improve the documentation and indexing of dict.__missing__.
Add an entry in the language datamodel special methods section.
Revise and index its discussion in the stdtypes mapping/dict section.

Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py. Now
pindent.py works with a “with” statement. pindent.py no longer produces
improper indentation. pindent.py now works with continued lines broken after
“class” or “def” keywords and with continuations at the start of line.