From python-3000-checkins at python.org Mon Dec 1 00:43:36 2008 From: python-3000-checkins at python.org (raymond.hettinger) Date: Mon, 1 Dec 2008 00:43:36 +0100 (CET) Subject: [Python-3000-checkins] r67462 - python/branches/py3k/Objects/setobject.c Message-ID: <20081130234336.829D21E4002@bag.python.org> Author: raymond.hettinger Date: Mon Dec 1 00:43:36 2008 New Revision: 67462 Log: Update copyright for recent changes. Modified: python/branches/py3k/Objects/setobject.c Modified: python/branches/py3k/Objects/setobject.c ============================================================================== --- python/branches/py3k/Objects/setobject.c (original) +++ python/branches/py3k/Objects/setobject.c Mon Dec 1 00:43:36 2008 @@ -3,7 +3,7 @@ Written and maintained by Raymond D. Hettinger Derived from Lib/sets.py and Objects/dictobject.c. - Copyright (c) 2003-2007 Python Software Foundation. + Copyright (c) 2003-2008 Python Software Foundation. All rights reserved. */ From nnorwitz at gmail.com Mon Dec 1 02:40:11 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 30 Nov 2008 20:40:11 -0500 Subject: [Python-3000-checkins] Python Regression Test Failures doc (1) Message-ID: <20081201014011.GA14740@python.psfb.org> svn update tools/sphinx At revision 67462. svn update tools/docutils At revision 67462. svn update tools/jinja At revision 67462. svn update tools/pygments At revision 67462. mkdir -p build/html build/doctrees python2.5 tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Extension error: Could not import extension pyspecific (exception: No module named writers.text) make: *** [build] Error 1 From python-3000-checkins at python.org Mon Dec 1 05:38:53 2008 From: python-3000-checkins at python.org (martin.v.loewis) Date: Mon, 1 Dec 2008 05:38:53 +0100 (CET) Subject: [Python-3000-checkins] r67464 - in python/branches/py3k: Demo/distutils/test2to3/setup.py Lib/distutils/command/build_py.py Lib/distutils/command/build_scripts.py Lib/distutils/util.py Misc/NEWS Message-ID: <20081201043853.0881D1E4002@bag.python.org> Author: martin.v.loewis Date: Mon Dec 1 05:38:52 2008 New Revision: 67464 Log: Issue #4073: Add 2to3 support to build_scripts, refactor that support in build_py. Modified: python/branches/py3k/Demo/distutils/test2to3/setup.py python/branches/py3k/Lib/distutils/command/build_py.py python/branches/py3k/Lib/distutils/command/build_scripts.py python/branches/py3k/Lib/distutils/util.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Demo/distutils/test2to3/setup.py ============================================================================== --- python/branches/py3k/Demo/distutils/test2to3/setup.py (original) +++ python/branches/py3k/Demo/distutils/test2to3/setup.py Mon Dec 1 05:38:52 2008 @@ -6,6 +6,11 @@ except ImportError: from distutils.command.build_py import build_py +try: + from distutils.command.build_scripts import build_scripts_2to3 as build_scripts +except ImportError: + from distutils.command.build_scripts import build_scripts + setup( name = "test2to3", version = "1.0", @@ -14,5 +19,8 @@ author_email = "python-dev at python.org", license = "PSF license", packages = ["test2to3"], - cmdclass = {'build_py':build_py} + scripts = ["maintest.py"], + cmdclass = {'build_py':build_py, + 'build_scripts':build_scripts, + } ) Modified: python/branches/py3k/Lib/distutils/command/build_py.py ============================================================================== --- python/branches/py3k/Lib/distutils/command/build_py.py (original) +++ python/branches/py3k/Lib/distutils/command/build_py.py Mon Dec 1 05:38:52 2008 @@ -9,7 +9,7 @@ from distutils.core import Command from distutils.errors import * -from distutils.util import convert_path +from distutils.util import convert_path, Mixin2to3 from distutils import log class build_py (Command): @@ -384,19 +384,7 @@ byte_compile(files, optimize=self.optimize, force=self.force, prefix=prefix, dry_run=self.dry_run) -from lib2to3.refactor import RefactoringTool, get_fixers_from_package -class DistutilsRefactoringTool(RefactoringTool): - def log_error(self, msg, *args, **kw): - # XXX ignores kw - log.error(msg, *args) - - def log_message(self, msg, *args): - log.info(msg, *args) - - def log_debug(self, msg, *args): - log.debug(msg, *args) - -class build_py_2to3(build_py): +class build_py_2to3(build_py, Mixin2to3): def run(self): self.updated_files = [] @@ -408,12 +396,7 @@ self.build_package_data() # 2to3 - fixers = get_fixers_from_package('lib2to3.fixes') - options = dict(fix=[], list_fixes=[], - print_function=False, verbose=False, - write=True) - r = DistutilsRefactoringTool(fixers, options) - r.refactor(self.updated_files, write=True) + self.run_2to3(self.updated_files) # Remaining base class code self.byte_compile(self.get_outputs(include_bytecode=0)) Modified: python/branches/py3k/Lib/distutils/command/build_scripts.py ============================================================================== --- python/branches/py3k/Lib/distutils/command/build_scripts.py (original) +++ python/branches/py3k/Lib/distutils/command/build_scripts.py Mon Dec 1 05:38:52 2008 @@ -9,7 +9,7 @@ from distutils import sysconfig from distutils.core import Command from distutils.dep_util import newer -from distutils.util import convert_path +from distutils.util import convert_path, Mixin2to3 from distutils import log # check if Python is called on the first line with this expression @@ -59,6 +59,7 @@ """ self.mkpath(self.build_dir) outfiles = [] + updated_files = [] for script in self.scripts: adjust = False script = convert_path(script) @@ -92,6 +93,7 @@ if adjust: log.info("copying and adjusting %s -> %s", script, self.build_dir) + updated_files.append(outfile) if not self.dry_run: outf = open(outfile, "w") if not sysconfig.python_build: @@ -112,6 +114,7 @@ else: if f: f.close() + updated_files.append(outfile) self.copy_file(script, outfile) if os.name == 'posix': @@ -125,3 +128,13 @@ log.info("changing mode of %s from %o to %o", file, oldmode, newmode) os.chmod(file, newmode) + # XXX should we modify self.outfiles? + return outfiles, updated_files + +class build_scripts_2to3(build_scripts, Mixin2to3): + + def copy_scripts(self): + outfiles, updated_files = build_scripts.copy_scripts(self) + if not self.dry_run: + self.run_2to3(updated_files) + return outfiles, updated_files Modified: python/branches/py3k/Lib/distutils/util.py ============================================================================== --- python/branches/py3k/Lib/distutils/util.py (original) +++ python/branches/py3k/Lib/distutils/util.py Mon Dec 1 05:38:52 2008 @@ -531,3 +531,51 @@ lines = [x.strip() for x in header.split('\n')] sep = '\n' + 8*' ' return sep.join(lines) + +# 2to3 support + +def run_2to3(files, fixer_names=None, options=None, explicit=None): + """Invoke 2to3 on a list of Python files. + The files should all come from the build area, as the + modification is done in-place. To reduce the build time, + only files modified since the last invocation of this + function should be passed in the files argument.""" + + if not files: + return + + # Make this class local, to delay import of 2to3 + from lib2to3.refactor import RefactoringTool, get_fixers_from_package + class DistutilsRefactoringTool(RefactoringTool): + def log_error(self, msg, *args, **kw): + log.error(msg, *args) + + def log_message(self, msg, *args): + log.info(msg, *args) + + def log_debug(self, msg, *args): + log.debug(msg, *args) + + if fixer_names is None: + fixer_names = get_fixers_from_package('lib2to3.fixes') + r = DistutilsRefactoringTool(fixer_names, options=options) + r.refactor(files, write=True) + +class Mixin2to3: + '''Mixin class for commands that run 2to3. + To configure 2to3, setup scripts may either change + the class variables, or inherit from individual commands + to override how 2to3 is invoked.''' + + # provide list of fixers to run; + # defaults to all from lib2to3.fixers + fixer_names = None + + # options dictionary + options = None + + # list of fixers to invoke even though they are marked as explicit + explicit = None + + def run_2to3(self, files): + return run_2to3(files, self.fixer_names, self.options, self.explicit) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Mon Dec 1 05:38:52 2008 @@ -24,6 +24,9 @@ Library ------- +- Issue #4073: Add 2to3 support to build_scripts, refactor that support + in build_py. + - IDLE would print a "Unhandled server exception!" message when internal debugging is enabled. From python-3000-checkins at python.org Mon Dec 1 05:44:46 2008 From: python-3000-checkins at python.org (martin.v.loewis) Date: Mon, 1 Dec 2008 05:44:46 +0100 (CET) Subject: [Python-3000-checkins] r67465 - python/branches/py3k/Demo/distutils/test2to3/maintest.py Message-ID: <20081201044446.1F5BC1E4002@bag.python.org> Author: martin.v.loewis Date: Mon Dec 1 05:44:45 2008 New Revision: 67465 Log: Add script forgotten in r67464. Added: python/branches/py3k/Demo/distutils/test2to3/maintest.py (contents, props changed) Added: python/branches/py3k/Demo/distutils/test2to3/maintest.py ============================================================================== --- (empty file) +++ python/branches/py3k/Demo/distutils/test2to3/maintest.py Mon Dec 1 05:44:45 2008 @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +# The above line should get replaced with the path to the Python +# interpreter; the block below should get 2to3-converted. + +try: + from test2to3.hello import hello +except ImportError, e: + print "Import failed", e +hello() From nnorwitz at gmail.com Mon Dec 1 14:40:09 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 1 Dec 2008 08:40:09 -0500 Subject: [Python-3000-checkins] Python Regression Test Failures doc (1) Message-ID: <20081201134009.GA4143@python.psfb.org> svn update tools/sphinx At revision 67467. svn update tools/docutils At revision 67467. svn update tools/jinja At revision 67467. svn update tools/pygments At revision 67467. mkdir -p build/html build/doctrees python2.5 tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Extension error: Could not import extension pyspecific (exception: No module named writers.text) make: *** [build] Error 1 From jeremy at alum.mit.edu Mon Dec 1 15:21:04 2008 From: jeremy at alum.mit.edu (Jeremy Hylton) Date: Mon, 1 Dec 2008 09:21:04 -0500 Subject: [Python-3000-checkins] r67460 - in python/branches/py3k: Lib/http/client.py In-Reply-To: <20081130221530.35E191E4002@bag.python.org> References: <20081130221530.35E191E4002@bag.python.org> Message-ID: Thanks! I was going to look at porting this change over the long weekend, but the weekend part got the better of me :-). Jeremy On Sun, Nov 30, 2008 at 5:15 PM, benjamin.peterson wrote: > Author: benjamin.peterson > Date: Sun Nov 30 23:15:29 2008 > New Revision: 67460 > > Log: > Merged revisions 67442 via svnmerge from > svn+ssh://pythondev at svn.python.org/python/trunk > > ........ > r67442 | jeremy.hylton | 2008-11-28 19:09:35 -0600 (Fri, 28 Nov 2008) | 18 lines > > Send HTTP headers and message body in a single send() call. > > This change addresses part of issue 4336. > > Change endheaders() to take an optional message_body argument > that is sent along with the headers. Change xmlrpclib and > httplib's other methods to use this new interface. > > It is more efficient to make a single send() call, which should > get the entire client request into one packet (assuming it is > smaller than the MTU) and will avoid the long pause for delayed > ack following timeout. > > Also: > - Add a comment about the buffer size for makefile(). > - Extract _set_content_length() method and fix whitespace issues there. > ........ > > > Modified: > python/branches/py3k/ (props changed) > python/branches/py3k/Lib/http/client.py > > Modified: python/branches/py3k/Lib/http/client.py > ============================================================================== > --- python/branches/py3k/Lib/http/client.py (original) > +++ python/branches/py3k/Lib/http/client.py Sun Nov 30 23:15:29 2008 > @@ -693,7 +693,7 @@ > """ > self._buffer.append(s) > > - def _send_output(self): > + def _send_output(self, message_body=None): > """Send the currently buffered request and clear the buffer. > > Appends an extra \\r\\n to the buffer. > @@ -701,6 +701,11 @@ > self._buffer.extend((b"", b"")) > msg = b"\r\n".join(self._buffer) > del self._buffer[:] > + # If msg and message_body are sent in a single send() call, > + # it will avoid performance problems caused by the interaction > + # between delayed ack and the Nagle algorithim. > + if message_body is not None: > + msg += message_body > self.send(msg) > > def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): > @@ -830,15 +835,20 @@ > header = header + b': ' + value > self._output(header) > > - def endheaders(self): > - """Indicate that the last header line has been sent to the server.""" > + def endheaders(self, message_body=None): > + """Indicate that the last header line has been sent to the server. > > + This method sends the request to the server. The optional > + message_body argument can be used to pass message body > + associated with the request. The message body will be sent in > + the same packet as the message headers if possible. The > + message_body should be a string. > + """ > if self.__state == _CS_REQ_STARTED: > self.__state = _CS_REQ_SENT > else: > raise CannotSendHeader() > - > - self._send_output() > + self._send_output(message_body) > > def request(self, method, url, body=None, headers={}): > """Send a complete request to the server.""" > @@ -851,6 +861,24 @@ > # try one more time > self._send_request(method, url, body, headers) > > + def _set_content_length(self, body): > + # Set the content-length based on the body. > + thelen = None > + try: > + thelen = str(len(body)) > + except TypeError as te: > + # If this is a file-like object, try to > + # fstat its file descriptor > + import os > + try: > + thelen = str(os.fstat(body.fileno()).st_size) > + except (AttributeError, OSError): > + # Don't send a length if this failed > + if self.debuglevel > 0: print("Cannot stat!!") > + > + if thelen is not None: > + self.putheader('Content-Length', thelen) > + > def _send_request(self, method, url, body, headers): > # honour explicitly requested Host: and Accept-Encoding headers > header_names = dict.fromkeys([k.lower() for k in headers]) > @@ -863,28 +891,15 @@ > self.putrequest(method, url, **skips) > > if body and ('content-length' not in header_names): > - thelen = None > - try: > - thelen = str(len(body)) > - except TypeError as te: > - # If this is a file-like object, try to > - # fstat its file descriptor > - import os > - try: > - thelen = str(os.fstat(body.fileno()).st_size) > - except (AttributeError, OSError): > - # Don't send a length if this failed > - if self.debuglevel > 0: print("Cannot stat!!") > - > - if thelen is not None: > - self.putheader('Content-Length',thelen) > + self._set_content_length(body) > for hdr, value in headers.items(): > self.putheader(hdr, value) > - self.endheaders() > - > - if body: > - if isinstance(body, str): body = body.encode('ascii') > - self.send(body) > + if isinstance(body, str): > + self.endheaders(body.encode('ascii')) > + else: > + self.endheaders() > + if body: # when body is a file rather than a string > + self.send(body) > > def getresponse(self): > """Get the response from the server.""" > _______________________________________________ > Python-3000-checkins mailing list > Python-3000-checkins at python.org > http://mail.python.org/mailman/listinfo/python-3000-checkins > From musiccomposition at gmail.com Mon Dec 1 19:39:51 2008 From: musiccomposition at gmail.com (Benjamin Peterson) Date: Mon, 1 Dec 2008 12:39:51 -0600 Subject: [Python-3000-checkins] r67460 - in python/branches/py3k: Lib/http/client.py In-Reply-To: References: <20081130221530.35E191E4002@bag.python.org> Message-ID: <1afaf6160812011039i6299e5cn4eb40df69267353f@mail.gmail.com> On Mon, Dec 1, 2008 at 8:21 AM, Jeremy Hylton wrote: > Thanks! I was going to look at porting this change over the long > weekend, but the weekend part got the better of me :-). There didn't seem to be any changed needed for xmlrpclib. Is this correct? -- Cheers, Benjamin Peterson "There's nothing quite as beautiful as an oboe... except a chicken stuck in a vacuum cleaner." From jeremy at alum.mit.edu Mon Dec 1 22:40:27 2008 From: jeremy at alum.mit.edu (Jeremy Hylton) Date: Mon, 1 Dec 2008 16:40:27 -0500 Subject: [Python-3000-checkins] r67460 - in python/branches/py3k: Lib/http/client.py In-Reply-To: <1afaf6160812011039i6299e5cn4eb40df69267353f@mail.gmail.com> References: <20081130221530.35E191E4002@bag.python.org> <1afaf6160812011039i6299e5cn4eb40df69267353f@mail.gmail.com> Message-ID: On Mon, Dec 1, 2008 at 1:39 PM, Benjamin Peterson wrote: > On Mon, Dec 1, 2008 at 8:21 AM, Jeremy Hylton wrote: >> Thanks! I was going to look at porting this change over the long >> weekend, but the weekend part got the better of me :-). > > There didn't seem to be any changed needed for xmlrpclib. Is this correct? That's right xmlrpclib aka xmlrpc.client uses the HTTPConnection interface in Python 3.x. Jeremy > > > > -- > Cheers, > Benjamin Peterson > "There's nothing quite as beautiful as an oboe... except a chicken > stuck in a vacuum cleaner." > From python-3000-checkins at python.org Tue Dec 2 00:02:51 2008 From: python-3000-checkins at python.org (georg.brandl) Date: Tue, 2 Dec 2008 00:02:51 +0100 (CET) Subject: [Python-3000-checkins] r67468 - in python/branches/py3k: Doc/tools/sphinxext/pyspecific.py Message-ID: <20081201230251.C4CC31E400C@bag.python.org> Author: georg.brandl Date: Tue Dec 2 00:02:51 2008 New Revision: 67468 Log: Merged revisions 67467 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67467 | benjamin.peterson | 2008-12-01 13:52:51 +0100 (Mon, 01 Dec 2008) | 1 line let people using SVN Sphinx still build the docs ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/tools/sphinxext/pyspecific.py Modified: python/branches/py3k/Doc/tools/sphinxext/pyspecific.py ============================================================================== --- python/branches/py3k/Doc/tools/sphinxext/pyspecific.py (original) +++ python/branches/py3k/Doc/tools/sphinxext/pyspecific.py Tue Dec 2 00:02:51 2008 @@ -46,7 +46,11 @@ from docutils.io import StringOutput from docutils.utils import new_document from sphinx.builder import Builder -from sphinx.writers.text import TextWriter + +try: + from sphinx.writers.text import TextWriter +except ImportError: + from sphinx.textwriter import TextWriter class PydocTopicsBuilder(Builder): name = 'pydoc-topics' From python-3000-checkins at python.org Tue Dec 2 01:56:25 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Tue, 2 Dec 2008 01:56:25 +0100 (CET) Subject: [Python-3000-checkins] r67469 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081202005625.AEFDC1E4029@bag.python.org> Author: guido.van.rossum Date: Tue Dec 2 01:56:25 2008 New Revision: 67469 Log: Checkpoint. Added some stuff. Mostly XXX notes for myself. :-) Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Tue Dec 2 01:56:25 2008 @@ -1,9 +1,11 @@ **************************** - What's New in Python 3.0 + What's New In Python 3.0 **************************** .. XXX add trademark info for Apple, Microsoft, SourceForge. +.. XXX turn all PEP references into :pep:`NNN` markup. + :Author: Guido van Rossum :Release: |release| :Date: |today| @@ -50,10 +52,12 @@ This saves the maintainer the effort of going through the SVN log when researching a change. -This article explains the new features in Python 3.0, comparing to 2.6. -In some cases it will also summarize changes since 2.5, with a reference -to "What's New in Python 2.6" for the details. Python 2.6 was released -on October 1 2008. Python 3.0 will be released in December 2008. +This article explains the new features in Python 3.0, compared to 2.6. +Python 3.0 is the first ever *intentionally incompatible* release. +There are more changes than in a typical release, and more that are +important for all Python users. Nevertheless, after digesting the +changes, you'll find that Python really hasn't changed all that much +-- by and large, we're merely fixing well-known annoyances and warts. This article doesn't attempt to provide a complete specification of the new features, but instead provides a convenient overview. For @@ -75,70 +79,124 @@ Common Stumbling Blocks ======================= -This section briefly lists the changes that are more likely to trip -people up, without necessarily raising obvious errors. These are all -explained in more detail below. (I'm not listing syntactic changes -and removed or renamed features here, since those tend to produce hard -and fast errors; it's the subtle behavioral changes in code that -remains syntactically valid that trips people up. I'm also omitting -changes to rarely used features.) +This section briefly lists a few changes that are more likely to trip +people up, without necessarily raising obvious errors. Most issues +are explained in more detail in later sections. + +Print Is A Function +------------------- + +The ``print`` statement has been replaced with a :func:`print` function, +with keyword arguments to replace most of the special syntax of the +old ``print`` statement (PEP 3105). Examples:: + + Old: print "The answer is", 2*2 + New: print("The answer is", 2*2) + + Old: print x, # Trailing comma suppresses newline + New: print(x, end=" ") # Appends a space instead of a newline + + Old: print # Prints a newline + New: print() # You must call the function! + + Old: print >>sys.stderr, "fatal error" + New: print("fatal error", file=sys.stderr) + + Old: print (x, y) # prints repr((x, y)) + New: print((x, y)) # Not the same as print(x, y)! + +You can also customize the separator between items, e.g.:: + + print("There are <", 2**32, "> possibilities!", sep="") + +which produces:: -* The ``print`` statement has been replaced with a :func:`print` function, - with keyword arguments to replace most of the special syntax of the - old ``print`` statement (PEP 3105). Examples:: + There are <4294967296> possibilities! - Old: print "The answer is", 2*2 - New: print("The answer is", 2*2) +Note: - Old: print x, # Trailing comma suppresses newline - New: print(x, end=" ") # Appends a space instead of a newline +* The :func:`print` function doesn't support the "softspace" feature of + the old ``print`` statement. For example, in Python 2.x, + ``print "A\n", "B"`` would write ``"A\nB\n"``; but in Python 3.0, + ``print("A\n", "B")`` writes ``"A\n B\n"``. - Old: print # Prints a newline - New: print() # You must call the function! +* Initially, you'll be finding yourself typing the old ``print x`` + a lot in interactive mode. Time to retrain your fingers to type + ``print(x)`` instead! - Old: print >>sys.stderr, "fatal error" - New: print("fatal error", file=sys.stderr) +* When using the ``2to3`` source-to-source conversion tool, all + ``print`` statements are automatically converted to :func:`print` + function calls, so this is mostly a non-issue for larger projects. - Old: print (x, y) # prints repr((x, y)) - New: print((x, y)) # Not the same as print(x, y)! +Text Strings Vs. Bytes +---------------------- - You can also customize the separator between items, e.g.:: +Everything you thought you knew about binary data and Unicode has +changed: - print("There are <", 2**32, "> possibilities!", sep="") +* Python 3.0 uses *strings* and *bytes* instead of *Unicode strings* + and *8-bit strings*. The difference is that any attempt to mix + strings and bytes in Python 3.0 raises a TypeError exception, + whereas if you were to mix Unicode and 8-bit strings in Python 2.x, + you would only get an exception if the 8-bit string contained + non-ASCII values. As a consequence, pretty much all code that + uses Unicode, encodings or binary data most likely has to change. + The change is for the better, as in the 2.x world there were + numerous bugs having to do with mixing encoded and unencoded text. - which produces:: +* Files opened as text files (still the default mode for :func:`open`) + always use an encoding to map between strings (in memory) and bytes + (on disk). Binary files (opened with a ``b`` in the mode argument) + always use bytes in memory. This means that if a file is opened + using an incorrect mode or encoding, I/O will likely fail. There is + a platform-dependent default encoding, which on Unixy platforms can + be set with the ``LANG`` environment variable (and sometimes also + with some other platform-specific locale-related environment + variables). In many cases, but not all, the system default is + UTF-8; you should never could on this default. Any application + reading or writing more than pure ASCII text should probably have a + way to override the encoding. - There are <4294967296> possibilities! +* XXX More below? - Notes about the :func:`print` function: +* See also the *Unicode HOWTO*. (XXX How to make this a link?) + (XXX Move to longer section below?) - * The :func:`print` function doesn't support the "softspace" feature of - the old ``print`` statement. For example, in Python 2.x, - ``print "A\n", "B"`` would write ``"A\nB\n"``; but in Python 3.0, - ``print("A\n", "B")`` writes ``"A\n B\n"``. +Views And Interators Instead Of Lists +------------------------------------- + +Some well-known APIs no longer return lists: + +* :class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` and + :meth:`dict.values` return "views" instead of lists. For example, + this no longer works: ``k = d.keys(); k.sort()``. Use ``k = + sorted(d)`` instead. + +* Also, the :meth:`dict.iterkeys`, :meth:`dict.iteritems` and + :meth:`dict.itervalues` methods are no longer supported. + +* :func:`map` and :func:`filter` return iterators. A quick fix is e.g. + ``list(map(...))``, but a better fix is often to use a list + comprehension (especially when the original code uses :keyword:`lambda`). + Particularly tricky is :func:`map` invoked for the side effects of the + function; the correct transformation is to use a for-loop. - * Initially, you'll be finding yourself typing the old ``print x`` - a lot in interactive mode. Time to retrain your fingers to type - ``print(x)`` instead! +* :func:`range` now behaves like :func:`xrange` used to behave. + The latter no longer exists. - * When using the ``2to3`` source-to-source conversion tool, all - ``print`` statements are automatically converted to :func:`print` - function calls, so this is mostly a non-issue for larger projects. +* :func:`zip` now returns an iterator. -* Python 3.0 uses strings and bytes instead of the Unicode strings and - 8-bit strings. This means that pretty much all code that uses - Unicode, encodings or binary data in any way has to change. The - change is for the better, as in the 2.x world there were numerous - bugs having to do with mixing encoded and unencoded text. +* XXX More below? -* Text files enforce an encoding; binary files use bytes. This means - that if a file is opened using an incorrect mode or encoding, I/O - will likely fail. +Ordering Comparisons +-------------------- + +Python 3.0 has simplified the rules for ordering comparisons: * The ordering comparison operators (``<``, ``<=``, ``>=``, ``>``) raise a TypeError exception when the operands don't have a meaningful natural ordering. Thus, expressions like ``1 < ''``, ``0 - > None`` or ``len < len`` are no longer valid. A corollary is that + > None`` or ``len <= len`` are no longer valid. A corollary is that sorting a heterogeneous list no longer makes sense -- all the elements must be comparable to each other. Note that this does not apply to the ``==`` and ``!=`` operators: objects of different @@ -146,36 +204,145 @@ object always compares equal to itself (i.e., ``x is y`` implies ``x = y``; this is true even for ``NaN``). -* :func:`map` and :func:`filter` return iterators. A quick fix is e.g. - ``list(map(...))``, but a better fix is often to use a list - comprehension (especially when the original code uses :keyword:`lambda`). - Particularly tricky is :func:`map` invoked for the side effects of the - function; the correct transformation is to use a for-loop. - -* :class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` and - :meth:`dict.values` return views instead of lists. For example, this no - longer works: ``k = d.keys(); k.sort()``. Use ``k = sorted(d)`` instead. - * :meth:`builtin.sorted` and :meth:`list.sort` no longer accept the *cmp* argument providing a comparison function. Use the *key* argument instead. N.B. the *key* and *reverse* arguments are now "keyword-only". -* The :meth:`__cmp__` special method is no longer supported. Use :meth:`__lt__` - for sorting, :meth:`__eq__` with :meth:`__hash__`, and other rich comparisons - as needed. +* The :func:`cmp` function is gone, and the :meth:`__cmp__` special + method is no longer supported. Use :meth:`__lt__` for sorting, + :meth:`__eq__` with :meth:`__hash__`, and other rich comparisons as + needed. if you really need the :func:`cmp` functionality, the + expression ``(a > b) - (a < b)`` is equivalent to ``cmp(a, b)``. -* ``1/2`` returns a float. Use ``1//2`` to get the truncating behavior. +* XXX More below? -.. XXX move the next one to a later point, it's not a common stumbling block. +Integers +-------- + +* We unified the :class:`int` and :class:`long` types. All integers + are now of type :class:`int`. + +* ``1/2`` returns a float. Use ``1//2`` to get the truncating behavior. + (The latter syntax has existed for years, at least since Python 2.2.) * The :func:`repr` of a long integer doesn't include the trailing ``L`` anymore, so code that unconditionally strips that character will chop off the last digit instead. +* The :data:`sys.maxint` constant was removed, since there is no + longer a limit to the value of ints. However, :data:`sys.maxsize` + can be used as an integer larger than any practical list or string + index. It conforms to the implementation's "natural" integer size + and is typically the same as :data:`sys.maxint` in previous releases + on the same platform (assuming the same build options). + +* XXX More below? + + +Overview Of Syntactic Changes +============================= + +This section gives a brief overview of every *syntactic* change. +Several of these are discussed at greater length later. + +XXX Did I get everything? + +Additions +--------- -Strings and Bytes +* Function argument and return value annotations (see below). XXX + +* A lone ``*`` in a formal parameter list implies that any following + arguments *must* be specified in keyword form. (XXX Didn't this make + it into 2.6 as well?) + +* Keyword arguments are allowed after the list of base classes in a + class definition. This is used by the new convention for specifying + a metaclass, but can be used for other purposes as well, as long as + the metaclass supports it. + +* Tuple-unpacking assignment now has a *wildcard* syntax, e.g.:: + + (a, b, *rest) = range(5) + + This sets *a* to 0, *b* to 1, and *rest to ``[2, 3, 4]``. + +* Dictionary comprehensions: ``{k: v for k, v in stuff}`` means the + same thing as ``dict(stuff)`` but is more flexible. + +* Set literals, e.g. ``{1, 2}``. Note that ``{}`` is an empty + dictionary; use ``set()`` for an empty set. Set comprehensions + are also supported; ``{x for x in stuff}`` means the same thing + as ``set(stuff)`` but is more flexible. + +* New octal literals, e.g. ``0o720`` (already in 2.6). The old octal + literals (``0720`` are gone. + +* New binary literals, e.g. ``0b1010`` (already in 2.6). + +* Bytes literals are introduced with a leading ``b`` or ``B``. + +Changes +------- + +* New :keyword:`raise` statement syntax: ``raise [expr [from expr]]``. + +* New keywords: :keyword:`as`, :keyword:`with` (already in 2.6), + :keyword:`None` (partially enforced in 2.6), :keyword:`True`, + :keyword:`False` (these were built-ins previously), and + :keyword:`nonlocal` (for the new ``nonlocal`` statement). + +* Change from ``except exc, var:`` to ``except exc as var:``. XXX + +* *Very* subtle changes in the syntax for list comprehensions, + generator expressions, :keyword:`lambda expression and :keyword:`if` + expressions. For example, this is valid in Python 2.6:: + + [ x for x in lambda: True, lambda: False if x() ] + + In Python 3.0 you'll have to add parentheses, like this:: + + [ x for x in (lambda: True, lambda: False) if x() ] + +* The *ellipsis* (``...``) can be used as an atomic expression anywhere. + (Previously it was only allowed in slices.) + +Removals +-------- + +* Tuple parameter unpacking removed. XXX + +* Removal of backticks. XXX + +* Removal of ``<>``. Use ``!=`` instead. XXX + +* Removed keyword: :func:`exec` is no longer a keyword; it remains as + a function. (Fortunately the function syntax was also accepted in + 2.x.) + +* Integer literals no longer support a trailing ``l`` or ``L``. + +* String literals no longer support a leading ``u`` or ``U``. + +* The *ellipsis* must now be spelled as ``...``; previously it could + (by a mere accident of the grammar) also be spelled as ``. . .``. + + +Changes Already Present In Python 2.6 +===================================== + +This section reminds the reader of new features that were originally +designed for Python 3.0 but that were already introduced in Python +2.6. The descriptions in "What's New in Python 2.6" are hereby +included by reference. + +* XXX List each of those briefly. + +Strings And Bytes ================= +This section discusses the many changes in string + * There is only one string type; its name is :class:`str` but its behavior and implementation are like :class:`unicode` in 2.x. @@ -209,7 +376,7 @@ -PEP 3101: A New Approach to String Formatting +PEP 3101: A New Approach To String Formatting ============================================= * A new system for built-in string formatting operations replaces the @@ -223,7 +390,8 @@ PEP 3106: Revamping dict :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict.values` ====================================================================================== -.. XXX expand this +.. XXX expand this (but note that the "pitfalls" section currently has +.. XXX more detail :-) * The :meth:`dict.iterkeys`, :meth:`dict.itervalues` and :meth:`dict.iteritems` methods have been removed. @@ -244,10 +412,15 @@ Exception Stuff =============== -* PEP 352: Exceptions must derive from :exc:`BaseException`. This is the root - of the exception hierarchy. +* PEP 352: All exceptions must be derived (directly or indirectly) + from :exc:`BaseException`. This is the root of the exception + hierarchy. Most exceptions should actually be derived from + :exc:`Exception`. This is not a new recommendation, but the + *requirement* to inherit from :exc:`BaseException` is new. (Python + 2.6 still allowed classic classes to be raised, and placed no + restriction on what you can catch.) -* :exc:`StandardError` was removed (already in 2.6). +* :exc:`StandardError` was removed (in 2.6, actually). * Dropping sequence behavior (slicing!) and :attr:`message` attribute of exception instances. @@ -258,15 +431,14 @@ * PEP 3110: Catching exceptions. You must now use ``except SomeException as identifier:`` instead of ``except Exception, identifier:`` -* PEP 3134: Exception chaining. (The :attr:`__context__` feature from the PEP - hasn't been implemented yet in 3.0a2.) +* PEP 3134: Exception chaining. * A few exception messages are improved when Windows fails to load an extension module. For example, ``error code 193`` is now ``%1 is not a valid Win32 application``. Strings now deal with non-English locales. -New Class and Metaclass Stuff +New Class And Metaclass Stuff ============================= * Classic classes are gone. @@ -303,7 +475,8 @@ :class:`long` type, with the exception that the literal suffix ``L`` is neither supported by the parser nor produced by :func:`repr` anymore. :data:`sys.maxint` was also removed since the int type has no maximum value - anymore. + anymore. Use :data:`sys.maxsize` instead. + XXX Is this a dupe from the intro section on integers? * PEP 238: int division returns a float. @@ -374,8 +547,6 @@ * Renamed the boolean conversion C-level slot and method: ``nb_nonzero`` is now ``nb_bool`` and :meth:`__nonzero__` is now :meth:`__bool__`. -* Removed :data:`sys.maxint`. Use :data:`sys.maxsize`. - .. ====================================================================== @@ -385,15 +556,14 @@ * Detailed changes are listed here. -The net result of the 3.0 generalizations is that Python 3.0 runs the pystone -benchmark around 33% slower than Python 2.5. There's room for improvement; we -expect to be optimizing string and integer operations significantly before the -final 3.0 release! +The net result of the 3.0 generalizations is that Python 3.0 runs the +pystone benchmark around a third slower than Python 2.5. There's room +for improvement, but it will happen after 3.0 is released! .. ====================================================================== -New, Improved, and Deprecated Modules +New, Improved, And Deprecated Modules ===================================== As usual, Python's standard library received a number of enhancements and bug @@ -431,7 +601,7 @@ .. ====================================================================== -Build and C API Changes +Build And C API Changes ======================= Changes to Python's build process and to the C API include: @@ -465,7 +635,7 @@ .. _30section-other: -Other Changes and Fixes +Other Changes And Fixes ======================= As usual, there were a bunch of other improvements and bugfixes @@ -480,7 +650,7 @@ .. ====================================================================== -Porting to Python 3.0 +Porting To Python 3.0 ===================== This section lists previously described changes that may require @@ -491,15 +661,8 @@ * Developers can include :file:`intobject.h` after :file:`Python.h` for some ``PyInt_`` aliases. -.. ====================================================================== - - -.. _acks: +* XXX Mention 2to3. -Acknowledgements -================ - -The author would like to thank the following people for offering -suggestions, corrections and assistance with various drafts of this -article: Georg Brandl. +* XXX Reference external doc about porting extensions? +.. ====================================================================== From python-3000-checkins at python.org Tue Dec 2 02:12:04 2008 From: python-3000-checkins at python.org (benjamin.peterson) Date: Tue, 2 Dec 2008 02:12:04 +0100 (CET) Subject: [Python-3000-checkins] r67470 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081202011204.B2F771E4002@bag.python.org> Author: benjamin.peterson Date: Tue Dec 2 02:12:04 2008 New Revision: 67470 Log: fix markup Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Tue Dec 2 02:12:04 2008 @@ -265,7 +265,7 @@ (a, b, *rest) = range(5) - This sets *a* to 0, *b* to 1, and *rest to ``[2, 3, 4]``. + This sets *a* to 0, *b* to 1, and \*rest to ``[2, 3, 4]``. * Dictionary comprehensions: ``{k: v for k, v in stuff}`` means the same thing as ``dict(stuff)`` but is more flexible. From guido at python.org Tue Dec 2 03:04:00 2008 From: guido at python.org (Guido van Rossum) Date: Mon, 1 Dec 2008 18:04:00 -0800 Subject: [Python-3000-checkins] r67470 - python/branches/py3k/Doc/whatsnew/3.0.rst In-Reply-To: <20081202011204.B2F771E4002@bag.python.org> References: <20081202011204.B2F771E4002@bag.python.org> Message-ID: Thanks for fixing this. I saw the error message but it pointed to two lines earlier. Is this a known issue, or am I blind, or what? On Mon, Dec 1, 2008 at 5:12 PM, benjamin. peterson wrote: > Author: benjamin.peterson > Date: Tue Dec 2 02:12:04 2008 > New Revision: 67470 > > Log: > fix markup > > Modified: > python/branches/py3k/Doc/whatsnew/3.0.rst > > Modified: python/branches/py3k/Doc/whatsnew/3.0.rst > ============================================================================== > --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) > +++ python/branches/py3k/Doc/whatsnew/3.0.rst Tue Dec 2 02:12:04 2008 > @@ -265,7 +265,7 @@ > > (a, b, *rest) = range(5) > > - This sets *a* to 0, *b* to 1, and *rest to ``[2, 3, 4]``. > + This sets *a* to 0, *b* to 1, and \*rest to ``[2, 3, 4]``. > > * Dictionary comprehensions: ``{k: v for k, v in stuff}`` means the > same thing as ``dict(stuff)`` but is more flexible. > _______________________________________________ > Python-3000-checkins mailing list > Python-3000-checkins at python.org > http://mail.python.org/mailman/listinfo/python-3000-checkins > -- --Guido van Rossum (home page: http://www.python.org/~guido/) From musiccomposition at gmail.com Tue Dec 2 04:14:03 2008 From: musiccomposition at gmail.com (Benjamin Peterson) Date: Mon, 1 Dec 2008 21:14:03 -0600 Subject: [Python-3000-checkins] r67470 - python/branches/py3k/Doc/whatsnew/3.0.rst In-Reply-To: References: <20081202011204.B2F771E4002@bag.python.org> Message-ID: <1afaf6160812011914n70ab469bvfdec605034385d22@mail.gmail.com> On Mon, Dec 1, 2008 at 8:04 PM, Guido van Rossum wrote: > Thanks for fixing this. I saw the error message but it pointed to two > lines earlier. Is this a known issue, or am I blind, or what? It's pointing to the right line for me. Maybe your editor is out of whack? -- Cheers, Benjamin Peterson "There's nothing quite as beautiful as an oboe... except a chicken stuck in a vacuum cleaner." From python-3000-checkins at python.org Tue Dec 2 04:34:24 2008 From: python-3000-checkins at python.org (alexandre.vassalotti) Date: Tue, 2 Dec 2008 04:34:24 +0100 (CET) Subject: [Python-3000-checkins] r67471 - python/branches/py3k/Misc/NEWS Message-ID: <20081202033424.539E41E4002@bag.python.org> Author: alexandre.vassalotti Date: Tue Dec 2 04:34:24 2008 New Revision: 67471 Log: Fix docutils parsing errors in Misc/NEWS. Modified: python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Tue Dec 2 04:34:24 2008 @@ -1120,7 +1120,7 @@ - intobject.h is no longer included by Python.h. The remains were moved to longobject.h. It still exists to define several aliases - from PyInt_ to PyLong_ functions. + from PyInt to PyLong functions. - Removed sys.maxint, use sys.maxsize instead. @@ -1146,7 +1146,7 @@ What's New in Python 3.0a1? -========================== +=========================== *Release date: 31-Aug-2007* @@ -1269,13 +1269,14 @@ - Integer division always returns a float. The -Q option is no more. All the following are gone: - * PyNumber_Divide and PyNumber_InPlaceDivide - * __div__, __rdiv__, and __idiv__ - * nb_divide, nb_inplace_divide - * operator.div, operator.idiv, operator.__div__, operator.__idiv__ - (Only __truediv__ and __floordiv__ remain, not sure how to handle them - if we want to re-use __div__ and friends. If we do, it will make - it harder to write code for both 2.x and 3.x.) + + * PyNumber_Divide and PyNumber_InPlaceDivide + * __div__, __rdiv__, and __idiv__ + * nb_divide, nb_inplace_divide + * operator.div, operator.idiv, operator.__div__, operator.__idiv__ + (Only __truediv__ and __floordiv__ remain, not sure how to handle + them if we want to re-use __div__ and friends. If we do, it will + make it harder to write code for both 2.x and 3.x.) - 'as' and 'with' are keywords. From python-3000-checkins at python.org Tue Dec 2 07:00:15 2008 From: python-3000-checkins at python.org (martin.v.loewis) Date: Tue, 2 Dec 2008 07:00:15 +0100 (CET) Subject: [Python-3000-checkins] r67472 - in python/branches/py3k: Lib/email/test/test_email.py Lib/test/test_binascii.py Lib/test/test_descr.py Lib/test/test_zlib.py Misc/NEWS Modules/binascii.c Message-ID: <20081202060015.CC2D61E4002@bag.python.org> Author: martin.v.loewis Date: Tue Dec 2 07:00:15 2008 New Revision: 67472 Log: Issue #4387: binascii now refuses to accept str as binary input. Modified: python/branches/py3k/Lib/email/test/test_email.py python/branches/py3k/Lib/test/test_binascii.py python/branches/py3k/Lib/test/test_descr.py python/branches/py3k/Lib/test/test_zlib.py python/branches/py3k/Misc/NEWS python/branches/py3k/Modules/binascii.c Modified: python/branches/py3k/Lib/email/test/test_email.py ============================================================================== --- python/branches/py3k/Lib/email/test/test_email.py (original) +++ python/branches/py3k/Lib/email/test/test_email.py Tue Dec 2 07:00:15 2008 @@ -2279,7 +2279,7 @@ eq(charsets[0], 'utf-8') charset = Charset(charsets[0]) eq(charset.get_body_encoding(), 'base64') - msg.set_payload('hello world', charset=charset) + msg.set_payload(b'hello world', charset=charset) eq(msg.get_payload(), 'aGVsbG8gd29ybGQ=\n') eq(msg.get_payload(decode=True), b'hello world') eq(msg['content-transfer-encoding'], 'base64') @@ -2539,7 +2539,7 @@ def test_len(self): eq = self.assertEqual eq(base64mime.header_length('hello'), - len(base64mime.body_encode('hello', eol=''))) + len(base64mime.body_encode(b'hello', eol=''))) for size in range(15): if size == 0 : bsize = 0 elif size <= 3 : bsize = 4 @@ -2556,19 +2556,19 @@ def test_encode(self): eq = self.assertEqual - eq(base64mime.body_encode(''), '') - eq(base64mime.body_encode('hello'), 'aGVsbG8=\n') + eq(base64mime.body_encode(b''), b'') + eq(base64mime.body_encode(b'hello'), 'aGVsbG8=\n') # Test the binary flag - eq(base64mime.body_encode('hello\n'), 'aGVsbG8K\n') + eq(base64mime.body_encode(b'hello\n'), 'aGVsbG8K\n') # Test the maxlinelen arg - eq(base64mime.body_encode('xxxx ' * 20, maxlinelen=40), """\ + eq(base64mime.body_encode(b'xxxx ' * 20, maxlinelen=40), """\ eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg eHh4eCB4eHh4IA== """) # Test the eol argument - eq(base64mime.body_encode('xxxx ' * 20, maxlinelen=40, eol='\r\n'), + eq(base64mime.body_encode(b'xxxx ' * 20, maxlinelen=40, eol='\r\n'), """\ eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r @@ -2734,7 +2734,7 @@ eq('hello w=F6rld', c.body_encode('hello w\xf6rld')) # Try a charset with Base64 body encoding c = Charset('utf-8') - eq('aGVsbG8gd29ybGQ=\n', c.body_encode('hello world')) + eq('aGVsbG8gd29ybGQ=\n', c.body_encode(b'hello world')) # Try a charset with None body encoding c = Charset('us-ascii') eq('hello world', c.body_encode('hello world')) Modified: python/branches/py3k/Lib/test/test_binascii.py ============================================================================== --- python/branches/py3k/Lib/test/test_binascii.py (original) +++ python/branches/py3k/Lib/test/test_binascii.py Tue Dec 2 07:00:15 2008 @@ -121,7 +121,7 @@ self.assertRaises(binascii.Error, binascii.a2b_hex, t[:-1]) self.assertRaises(binascii.Error, binascii.a2b_hex, t[:-1] + b'q') - self.assertEqual(binascii.hexlify('a'), b'61') + self.assertEqual(binascii.hexlify(b'a'), b'61') def test_qp(self): # A test for SF bug 534347 (segfaults without the proper fix) @@ -166,7 +166,15 @@ f(b'') except SystemError as err: self.fail("%s(b'') raises SystemError: %s" % (n, err)) - binascii.crc_hqx('', 0) + binascii.crc_hqx(b'', 0) + + def test_no_binary_strings(self): + # b2a_ must not accept strings + for f in (binascii.b2a_uu, binascii.b2a_base64, + binascii.b2a_hqx, binascii.b2a_qp, + binascii.hexlify, binascii.rlecode_hqx, + binascii.crc_hqx, binascii.crc32): + self.assertRaises(TypeError, f, "test") def test_main(): support.run_unittest(BinASCIITest) Modified: python/branches/py3k/Lib/test/test_descr.py ============================================================================== --- python/branches/py3k/Lib/test/test_descr.py (original) +++ python/branches/py3k/Lib/test/test_descr.py Tue Dec 2 07:00:15 2008 @@ -3097,22 +3097,14 @@ import binascii # SF bug [#470040] ParseTuple t# vs subclasses. - class MyStr(str): + class MyBytes(bytes): pass - base = 'abc' - m = MyStr(base) + base = b'abc' + m = MyBytes(base) # b2a_hex uses the buffer interface to get its argument's value, via # PyArg_ParseTuple 't#' code. self.assertEqual(binascii.b2a_hex(m), binascii.b2a_hex(base)) - # It's not clear that unicode will continue to support the character - # buffer interface, and this test will fail if that's taken away. - class MyUni(str): - pass - base = 'abc' - m = MyUni(base) - self.assertEqual(binascii.b2a_hex(m), binascii.b2a_hex(base)) - class MyInt(int): pass m = MyInt(42) @@ -3129,7 +3121,7 @@ class octetstring(str): def __str__(self): - return binascii.b2a_hex(self).decode("ascii") + return binascii.b2a_hex(self.encode('ascii')).decode("ascii") def __repr__(self): return self + " repr" Modified: python/branches/py3k/Lib/test/test_zlib.py ============================================================================== --- python/branches/py3k/Lib/test/test_zlib.py (original) +++ python/branches/py3k/Lib/test/test_zlib.py Tue Dec 2 07:00:15 2008 @@ -48,11 +48,11 @@ self.assertEqual(zlib.adler32('spam'), 72286642) def test_same_as_binascii_crc32(self): - foo = 'abcdefghijklmnop' + foo = b'abcdefghijklmnop' crc = 2486878355 self.assertEqual(binascii.crc32(foo), crc) self.assertEqual(zlib.crc32(foo), crc) - self.assertEqual(binascii.crc32('spam'), zlib.crc32('spam')) + self.assertEqual(binascii.crc32(b'spam'), zlib.crc32(b'spam')) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Tue Dec 2 07:00:15 2008 @@ -24,6 +24,8 @@ Library ------- +- Issue #4387: binascii now refuses to accept str as binary input. + - Issue #4073: Add 2to3 support to build_scripts, refactor that support in build_py. Modified: python/branches/py3k/Modules/binascii.c ============================================================================== --- python/branches/py3k/Modules/binascii.c (original) +++ python/branches/py3k/Modules/binascii.c Tue Dec 2 07:00:15 2008 @@ -282,7 +282,7 @@ PyObject *rv; Py_ssize_t bin_len; - if ( !PyArg_ParseTuple(args, "s*:b2a_uu", &pbin) ) + if ( !PyArg_ParseTuple(args, "y*:b2a_uu", &pbin) ) return NULL; bin_data = pbin.buf; bin_len = pbin.len; @@ -478,7 +478,7 @@ PyObject *rv; Py_ssize_t bin_len; - if ( !PyArg_ParseTuple(args, "s*:b2a_base64", &pbuf) ) + if ( !PyArg_ParseTuple(args, "y*:b2a_base64", &pbuf) ) return NULL; bin_data = pbuf.buf; bin_len = pbuf.len; @@ -618,7 +618,7 @@ unsigned char ch; Py_ssize_t in, inend, len; - if ( !PyArg_ParseTuple(args, "s*:rlecode_hqx", &pbuf) ) + if ( !PyArg_ParseTuple(args, "y*:rlecode_hqx", &pbuf) ) return NULL; in_data = pbuf.buf; len = pbuf.len; @@ -684,7 +684,7 @@ PyObject *rv; Py_ssize_t len; - if ( !PyArg_ParseTuple(args, "s*:b2a_hqx", &pbin) ) + if ( !PyArg_ParseTuple(args, "y*:b2a_hqx", &pbin) ) return NULL; bin_data = pbin.buf; len = pbin.len; @@ -856,7 +856,7 @@ unsigned int crc; Py_ssize_t len; - if ( !PyArg_ParseTuple(args, "s*i:crc_hqx", &pin, &crc) ) + if ( !PyArg_ParseTuple(args, "y*i:crc_hqx", &pin, &crc) ) return NULL; bin_data = pin.buf; len = pin.len; @@ -883,7 +883,7 @@ Py_ssize_t len; int signed_val; - if (!PyArg_ParseTuple(args, "s*|I:crc32", &pbuf, &crc32val)) + if (!PyArg_ParseTuple(args, "y*|I:crc32", &pbuf, &crc32val)) return NULL; buf = (Byte*)pbuf.buf; len = pbuf.len; @@ -1047,7 +1047,7 @@ char* retbuf; Py_ssize_t i, j; - if (!PyArg_ParseTuple(args, "s*:b2a_hex", &parg)) + if (!PyArg_ParseTuple(args, "y*:b2a_hex", &parg)) return NULL; argbuf = parg.buf; arglen = parg.len; @@ -1300,7 +1300,7 @@ int crlf = 0; unsigned char *p; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|iii", kwlist, &pdata, + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|iii", kwlist, &pdata, "etabs, &istext, &header)) return NULL; data = pdata.buf; From python-3000-checkins at python.org Tue Dec 2 12:55:30 2008 From: python-3000-checkins at python.org (walter.doerwald) Date: Tue, 2 Dec 2008 12:55:30 +0100 (CET) Subject: [Python-3000-checkins] r67474 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081202115530.648911E4319@bag.python.org> Author: walter.doerwald Date: Tue Dec 2 12:55:30 2008 New Revision: 67474 Log: Fix typo. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Tue Dec 2 12:55:30 2008 @@ -153,7 +153,7 @@ be set with the ``LANG`` environment variable (and sometimes also with some other platform-specific locale-related environment variables). In many cases, but not all, the system default is - UTF-8; you should never could on this default. Any application + UTF-8; you should never count on this default. Any application reading or writing more than pure ASCII text should probably have a way to override the encoding. From python-3000-checkins at python.org Tue Dec 2 12:58:09 2008 From: python-3000-checkins at python.org (walter.doerwald) Date: Tue, 2 Dec 2008 12:58:09 +0100 (CET) Subject: [Python-3000-checkins] r67475 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081202115809.A13581E4014@bag.python.org> Author: walter.doerwald Date: Tue Dec 2 12:58:09 2008 New Revision: 67475 Log: Add missing bracket. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Tue Dec 2 12:58:09 2008 @@ -276,7 +276,7 @@ as ``set(stuff)`` but is more flexible. * New octal literals, e.g. ``0o720`` (already in 2.6). The old octal - literals (``0720`` are gone. + literals (``0720``) are gone. * New binary literals, e.g. ``0b1010`` (already in 2.6). From python-3000-checkins at python.org Tue Dec 2 18:31:14 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Tue, 2 Dec 2008 18:31:14 +0100 (CET) Subject: [Python-3000-checkins] r67476 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081202173114.6F5661E4002@bag.python.org> Author: guido.van.rossum Date: Tue Dec 2 18:31:14 2008 New Revision: 67476 Log: Another checkpoint to switch machines. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Tue Dec 2 18:31:14 2008 @@ -333,10 +333,72 @@ This section reminds the reader of new features that were originally designed for Python 3.0 but that were already introduced in Python -2.6. The descriptions in "What's New in Python 2.6" are hereby -included by reference. +2.6. The descriptions in "What's New in Python 2.6" should be +consulted for longer descriptions. + +XXX How to cross-link? + +* PEP 343: The :keyword:`with` statement is now a standard feature and + no longer needs to be imported from the ``__future__``. + +* PEP 366: Explicit relative imports from a main module inside a package. + This enhances the usefulness of the :option:`-m` option. + +* PEP 370: Per-user ``site-packages`` directory. + +* PEP 371: The ``multiprocessing`` package. XXX Did anything change here? + +* PEP 3101: Advanced string formatting. Note: the 2.6 description + mentions the :method:`format` method for both 8-bit and Unicode + strings. In 3.0, only the :class:`str` type (text strings with + Unicode support) supports this method; the :class:`bytes` type does + not. + +* PEP 3105: Print as a function. This is now a standard feature and + no longer needs to be imported from the ``__future__``. + +* PEP 3110: Exception-handling changes. The ``except exc as var:`` + syntax is now standard and ``except exc, var:`` is no longer supported. + (Of course, the ``as var`` part is still optional.) + +* PEP 3112: Byte literals. The ``b"..."`` string literal notation + (and its variants like ``b'...'``, ``b"""...""", and ``br'...`'') + now produces a literal of type :class:`bytes`. More about :class:`bytes` + below. + +* PEP 3116: New I/O library. The :module:`io` module is now the + standard way of doing file I/O, and the initial values of + ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are now instances + of :class:`io.TextIOBase`. The builtin :func:`open` function is + now an alias for ``io.open`` and has additional keyword arguments: + ``encoding``, ``errors``, ``newline`` and ``closefd``. + +* PEP 3118: Revised buffer protocol. The old builtin + :function:`buffer` is no more; the new builtin + :function:`memoryview` provides (mostly) similar functionality. + +* PEP 3119: Abstract Base Classes (ABCs). These play a slightly more + prominent role in the language now, and builtin collection types like + :class:`dict` and :class:`list` conform to the :class:`Mapping` and + :class:`Sequence` protocol, correspondingly. + +* PEP 3127: Integer literal suport and syntax. As mentioned above, + the new octal literal notation is the only one supported, and binary + literals have been added. + +* PEP 3129: Class decorators. This speaks for itself. + +* PEP 3141: A type hierarchy for numbers. This is another new use of + ABCs, defining Python's "numeric tower". + +* XXX More. + + +Library Changes +=============== + +XXX Brief overview of what's changed in the library. -* XXX List each of those briefly. Strings And Bytes ================= From python-3000-checkins at python.org Tue Dec 2 21:59:48 2008 From: python-3000-checkins at python.org (raymond.hettinger) Date: Tue, 2 Dec 2008 21:59:48 +0100 (CET) Subject: [Python-3000-checkins] r67477 - python/branches/py3k/Python/traceback.c Message-ID: <20081202205948.381C81E4002@bag.python.org> Author: raymond.hettinger Date: Tue Dec 2 21:59:48 2008 New Revision: 67477 Log: Bug #4495: Fix signed/unsigned warning (both namelen and tailen should be signed, not just namelen). Modified: python/branches/py3k/Python/traceback.c Modified: python/branches/py3k/Python/traceback.c ============================================================================== --- python/branches/py3k/Python/traceback.c (original) +++ python/branches/py3k/Python/traceback.c Tue Dec 2 21:59:48 2008 @@ -171,7 +171,7 @@ if (!PyUnicode_Check(v)) continue; path = _PyUnicode_AsStringAndSize(v, &len); - if (len + 1 + taillen >= (Py_ssize_t)namelen - 1) + if (len + 1 + (Py_ssize_t)taillen >= (Py_ssize_t)namelen - 1) continue; /* Too long */ strcpy(namebuf, path); if (strlen(namebuf) != len) From python-3000-checkins at python.org Tue Dec 2 22:33:45 2008 From: python-3000-checkins at python.org (raymond.hettinger) Date: Tue, 2 Dec 2008 22:33:45 +0100 (CET) Subject: [Python-3000-checkins] r67478 - in python/branches/py3k: Lib/test/list_tests.py Misc/NEWS Objects/listobject.c Message-ID: <20081202213345.3D9BD1E4002@bag.python.org> Author: raymond.hettinger Date: Tue Dec 2 22:33:45 2008 New Revision: 67478 Log: Issue 3689: list_reverseiterator should support __length_hint__ instead of __len__. Modified: python/branches/py3k/Lib/test/list_tests.py python/branches/py3k/Misc/NEWS python/branches/py3k/Objects/listobject.c Modified: python/branches/py3k/Lib/test/list_tests.py ============================================================================== --- python/branches/py3k/Lib/test/list_tests.py (original) +++ python/branches/py3k/Lib/test/list_tests.py Tue Dec 2 22:33:45 2008 @@ -93,6 +93,8 @@ self.assertRaises(StopIteration, next, r) self.assertEqual(list(reversed(self.type2test())), self.type2test()) + # Bug 3689: make sure list-reversed-iterator doesn't have __len__ + self.assertRaises(TypeError, len, reversed([1,2,3])) def test_setitem(self): a = self.type2test([0, 1]) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Tue Dec 2 22:33:45 2008 @@ -16,6 +16,9 @@ interpreter to abort ("Fatal Python error: Could not reset the stack!") instead of throwing a MemoryError. +- Issue #3689: The list reversed iterator now supports __length_hint__ + instead of __len__. Behavior now matches other reversed iterators. + - Issue #4367: Python would segfault during compiling when the unicodedata module couldn't be imported and \N escapes were present. Modified: python/branches/py3k/Objects/listobject.c ============================================================================== --- python/branches/py3k/Objects/listobject.c (original) +++ python/branches/py3k/Objects/listobject.c Tue Dec 2 22:33:45 2008 @@ -2736,11 +2736,11 @@ static void listreviter_dealloc(listreviterobject *); static int listreviter_traverse(listreviterobject *, visitproc, void *); static PyObject *listreviter_next(listreviterobject *); -static Py_ssize_t listreviter_len(listreviterobject *); +static PyObject *listreviter_len(listreviterobject *); -static PySequenceMethods listreviter_as_sequence = { - (lenfunc)listreviter_len, /* sq_length */ - 0, /* sq_concat */ +static PyMethodDef listreviter_methods[] = { + {"__length_hint__", (PyCFunction)listreviter_len, METH_NOARGS, length_hint_doc}, + {NULL, NULL} /* sentinel */ }; PyTypeObject PyListRevIter_Type = { @@ -2756,7 +2756,7 @@ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ - &listreviter_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ @@ -2772,6 +2772,7 @@ 0, /* tp_weaklistoffset */ PyObject_SelfIter, /* tp_iter */ (iternextfunc)listreviter_next, /* tp_iternext */ + listreviter_methods, /* tp_methods */ 0, }; @@ -2827,12 +2828,12 @@ return NULL; } -static Py_ssize_t +static PyObject * listreviter_len(listreviterobject *it) { Py_ssize_t len = it->it_index + 1; if (it->it_seq == NULL || PyList_GET_SIZE(it->it_seq) < len) - return 0; - return len; + len = 0; + return PyLong_FromSsize_t(len); } From python-3000-checkins at python.org Tue Dec 2 23:34:15 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Tue, 2 Dec 2008 23:34:15 +0100 (CET) Subject: [Python-3000-checkins] r67479 - in python/branches/py3k/Doc: howto/unicode.rst whatsnew/2.6.rst whatsnew/3.0.rst Message-ID: <20081202223415.E1C981E4002@bag.python.org> Author: guido.van.rossum Date: Tue Dec 2 23:34:15 2008 New Revision: 67479 Log: Another checkpoint. More XXXes added... Also add some labels to 2.6.rst and howto/unicode.rst so I can refer to them. (Somehow a label named 'module-contextlib' couldn't be referenced -- why???) Modified: python/branches/py3k/Doc/howto/unicode.rst python/branches/py3k/Doc/whatsnew/2.6.rst python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/howto/unicode.rst ============================================================================== --- python/branches/py3k/Doc/howto/unicode.rst (original) +++ python/branches/py3k/Doc/howto/unicode.rst Tue Dec 2 23:34:15 2008 @@ -1,3 +1,5 @@ +.. _unicode-howto: + ***************** Unicode HOWTO ***************** Modified: python/branches/py3k/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/2.6.rst (original) +++ python/branches/py3k/Doc/whatsnew/2.6.rst Tue Dec 2 23:34:15 2008 @@ -1,3 +1,5 @@ +.. _whats-new-in-2.6: + **************************** What's New in Python 2.6 **************************** @@ -244,6 +246,8 @@ The underlying reStructuredText parser and toolset. +.. _pep-0343: + PEP 343: The 'with' statement ============================= @@ -424,7 +428,7 @@ # return False -.. _module-contextlib: +.. _new-module-contextlib: The contextlib module --------------------- Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Tue Dec 2 23:34:15 2008 @@ -2,9 +2,9 @@ What's New In Python 3.0 **************************** -.. XXX add trademark info for Apple, Microsoft, SourceForge. +.. XXX Add trademark info for Apple, Microsoft. -.. XXX turn all PEP references into :pep:`NNN` markup. +.. XXX Remove duplicates; just put info in the most relevant section. :Author: Guido van Rossum :Release: |release| @@ -53,11 +53,12 @@ when researching a change. This article explains the new features in Python 3.0, compared to 2.6. -Python 3.0 is the first ever *intentionally incompatible* release. -There are more changes than in a typical release, and more that are -important for all Python users. Nevertheless, after digesting the -changes, you'll find that Python really hasn't changed all that much --- by and large, we're merely fixing well-known annoyances and warts. +Python 3.0, also known as "Python 3000" or "Py3k", is the first ever +*intentionally incompatible* release. There are more changes than in +a typical release, and more that are important for all Python users. +Nevertheless, after digesting the changes, you'll find that Python +really hasn't changed all that much -- by and large, we're merely +fixing well-known annoyances and warts. This article doesn't attempt to provide a complete specification of the new features, but instead provides a convenient overview. For @@ -79,16 +80,15 @@ Common Stumbling Blocks ======================= -This section briefly lists a few changes that are more likely to trip -people up, without necessarily raising obvious errors. Most issues -are explained in more detail in later sections. +This section lists those few changes that are most likely to trip you +up if you're used to Python 2.5. Print Is A Function ------------------- -The ``print`` statement has been replaced with a :func:`print` function, -with keyword arguments to replace most of the special syntax of the -old ``print`` statement (PEP 3105). Examples:: +The :keyword:`print` statement has been replaced with a :func:`print` +function, with keyword arguments to replace most of the special syntax +of the old :keyword:`print` statement (:pep:`3105`). Examples:: Old: print "The answer is", 2*2 New: print("The answer is", 2*2) @@ -116,7 +116,7 @@ Note: * The :func:`print` function doesn't support the "softspace" feature of - the old ``print`` statement. For example, in Python 2.x, + the old :keyword:`print` statement. For example, in Python 2.x, ``print "A\n", "B"`` would write ``"A\nB\n"``; but in Python 3.0, ``print("A\n", "B")`` writes ``"A\n B\n"``. @@ -125,14 +125,16 @@ ``print(x)`` instead! * When using the ``2to3`` source-to-source conversion tool, all - ``print`` statements are automatically converted to :func:`print` - function calls, so this is mostly a non-issue for larger projects. + :keyword:`print` statements are automatically converted to + :func:`print` function calls, so this is mostly a non-issue for + larger projects. Text Strings Vs. Bytes ---------------------- Everything you thought you knew about binary data and Unicode has -changed: +changed. There's a longer section below; here's a summary of the +changes: * Python 3.0 uses *strings* and *bytes* instead of *Unicode strings* and *8-bit strings*. The difference is that any attempt to mix @@ -157,10 +159,12 @@ reading or writing more than pure ASCII text should probably have a way to override the encoding. -* XXX More below? +* The builtin :class:`basestring` abstract type was removed. Use + :class:`str` instead. The :class:`str` and :class:`bytes` types + don't have functionality enough in common to warrant a shared base + class. -* See also the *Unicode HOWTO*. (XXX How to make this a link?) - (XXX Move to longer section below?) +* See also the :ref:`unicode-howto`, which was updated for Python 3.0. Views And Interators Instead Of Lists ------------------------------------- @@ -219,15 +223,13 @@ Integers -------- -* We unified the :class:`int` and :class:`long` types. All integers - are now of type :class:`int`. - -* ``1/2`` returns a float. Use ``1//2`` to get the truncating behavior. - (The latter syntax has existed for years, at least since Python 2.2.) +* :pep:`0237`: :class:`long` renamed to :class:`int`. That is, there + is only one built-in integral type, named :class:`int`; but it + behaves mostly like the old :class:`long` type. * The :func:`repr` of a long integer doesn't include the trailing ``L`` anymore, so code that unconditionally strips that character will - chop off the last digit instead. + chop off the last digit instead. (Use :func:`str` instead.) * The :data:`sys.maxint` constant was removed, since there is no longer a limit to the value of ints. However, :data:`sys.maxsize` @@ -236,7 +238,9 @@ and is typically the same as :data:`sys.maxint` in previous releases on the same platform (assuming the same build options). -* XXX More below? +* ``1/2`` returns a float. Use ``1//2`` to get the truncating behavior. + (The latter syntax has existed for years, at least since Python 2.2.) + See :pep:`0238`. Overview Of Syntactic Changes @@ -245,35 +249,42 @@ This section gives a brief overview of every *syntactic* change. Several of these are discussed at greater length later. -XXX Did I get everything? - Additions --------- * Function argument and return value annotations (see below). XXX -* A lone ``*`` in a formal parameter list implies that any following - arguments *must* be specified in keyword form. (XXX Didn't this make - it into 2.6 as well?) +* :pep:`3102`: Keyword-only arguments. Named parameters occurring + after ``*args`` in the parameter list *must* be specified using + keyword syntax in the call. You can also use a bare ``*`` in the + parameter list to indicate that you don't accept a variable-length + argument list, but you do have keyword-only arguments. * Keyword arguments are allowed after the list of base classes in a class definition. This is used by the new convention for specifying a metaclass, but can be used for other purposes as well, as long as the metaclass supports it. -* Tuple-unpacking assignment now has a *wildcard* syntax, e.g.:: +* :pep:`3104`: :keyword:`nonlocal` statement. Using ``nonlocal x`` + you can now assign directly to a variable in an outer (but + non-global) scope. :keyword:`nonlocal` is a new reserved word. + +* :pep:`3132`: Extended Iterable Unpacking. You can now write things + like ``a, b, *rest = some_sequence``. And even ``*rest, a = + stuff``. The ``rest`` object is always a (possibly empty) list; the + right-hand side may be any iterable. Example:: - (a, b, *rest) = range(5) + (a, *rest, b) = range(5) - This sets *a* to 0, *b* to 1, and \*rest to ``[2, 3, 4]``. + This sets *a* to ``0``, *b* to ``4``, and \*rest to ``[1, 2, 3]``. * Dictionary comprehensions: ``{k: v for k, v in stuff}`` means the same thing as ``dict(stuff)`` but is more flexible. * Set literals, e.g. ``{1, 2}``. Note that ``{}`` is an empty - dictionary; use ``set()`` for an empty set. Set comprehensions - are also supported; ``{x for x in stuff}`` means the same thing - as ``set(stuff)`` but is more flexible. + dictionary; use ``set()`` for an empty set. Set comprehensions are + also supported; ``{x for x in stuff}`` means the same thing as + ``set(stuff)`` but is more flexible. * New octal literals, e.g. ``0o720`` (already in 2.6). The old octal literals (``0720``) are gone. @@ -286,118 +297,169 @@ ------- * New :keyword:`raise` statement syntax: ``raise [expr [from expr]]``. + Also note that string exceptions are no longer legal (:pep:`0352`). -* New keywords: :keyword:`as`, :keyword:`with` (already in 2.6), - :keyword:`None` (partially enforced in 2.6), :keyword:`True`, - :keyword:`False` (these were built-ins previously), and - :keyword:`nonlocal` (for the new ``nonlocal`` statement). - -* Change from ``except exc, var:`` to ``except exc as var:``. XXX - -* *Very* subtle changes in the syntax for list comprehensions, - generator expressions, :keyword:`lambda expression and :keyword:`if` - expressions. For example, this is valid in Python 2.6:: - - [ x for x in lambda: True, lambda: False if x() ] +* :keyword:`as` and :keyword:`with` are now reserved words. (Since + 2.6, actually.) - In Python 3.0 you'll have to add parentheses, like this:: - - [ x for x in (lambda: True, lambda: False) if x() ] - -* The *ellipsis* (``...``) can be used as an atomic expression anywhere. - (Previously it was only allowed in slices.) +* :keyword:`True`, :keyword:`False`, and :keyword:`None` are reserved + words. (2.6 partially enforced the restrictions on :keyword:`None` + already.) + +* Change from :keyword:`except` *exc*, *var* to + :keyword:`except` *exc* :keyword:`as` *var*. See :pep:`3110`. + +* List comprehensions no longer support the syntactic form + ``[... for var in item1, item2, ...]``. Use + ``[... for var in (item1, item2, ...)]`` instead. + Also note that list comprehensions have different semantics: they + are closer to syntactic sugar for a generator expression inside a + :func:`list` constructor, and in particular the loop control + variables are no longer leaked into the surrounding scope. + +* The *ellipsis* (``...``) can be used as an atomic expression + anywhere. (Previously it was only allowed in slices.) Also, it + *must* now be spelled as ``...``. (Previously it could also be + spelled as ``. . .``, by a mere accident of the grammar.) Removals -------- -* Tuple parameter unpacking removed. XXX +* :pep:`3113`: Tuple parameter unpacking removed. You can no longer + write ``def foo(a, (b, c)): ...``. + Use ``def foo(a, b_c): b, c = b_c`` instead. -* Removal of backticks. XXX +* Removed backticks (use :func:`repr` instead). -* Removal of ``<>``. Use ``!=`` instead. XXX +* Removed ``<>`` (use ``!=`` instead). * Removed keyword: :func:`exec` is no longer a keyword; it remains as a function. (Fortunately the function syntax was also accepted in - 2.x.) + 2.x.) Also note that :func:`exec` no longer takes a stream argument; + instead of ``exec(f)`` you can use ``exec(f.read())``. * Integer literals no longer support a trailing ``l`` or ``L``. * String literals no longer support a leading ``u`` or ``U``. -* The *ellipsis* must now be spelled as ``...``; previously it could - (by a mere accident of the grammar) also be spelled as ``. . .``. +* The :keyword:`from` *module* :keyword:`import` ``*`` syntax is only + allowed at the module level, no longer inside functions. + +* The only acceptable syntax for relative imports is :keyword:`from` + ``.``[*module*] :keyword:`import` *name*; :keyword:`import` forms + not starting with ``.`` are always interpreted as absolute imports. + (:pep:`0328`) + Changes Already Present In Python 2.6 ===================================== -This section reminds the reader of new features that were originally -designed for Python 3.0 but that were already introduced in Python -2.6. The descriptions in "What's New in Python 2.6" should be +Since many users presumably make the jump straight from Python 2.5 to +Python 3.0, this section reminds the reader of new features that were +originally designed for Python 3.0 but that were back-ported to Python +2.6. The corresponding sections in :ref:`whats-new-in-2.6` should be consulted for longer descriptions. -XXX How to cross-link? +* :ref:`pep-0343`. The :keyword:`with` statement is now a standard + feature and no longer needs to be imported from the ``__future__``. + Also check out :ref:`new-26-context-managers` and + :ref:`new-module-contextlib`. + +* :ref:`pep-0366`. This enhances the usefulness of the :option:`-m` + option when the referenced module lives in a package. + +* :ref:`pep-0370`. + +* :ref:`pep-0371`. + +* :ref:`pep-3101`. Note: the 2.6 description mentions the + :meth:`format` method for both 8-bit and Unicode strings. In 3.0, + only the :class:`str` type (text strings with Unicode support) + supports this method; the :class:`bytes` type does not. The plan is + to eventually make this the only API for string formatting, and to + start deprecating the ``%`` operator in Python 3.1. + +* :ref:`pep-3105`. This is now a standard feature and no longer needs + to be imported from :mod:`__future__`. + +* :ref:`pep-3110`. The :keyword:`except` *exc* :keyword:`as` *var* + syntax is now standard and :keyword:`except` *exc*, *var* is no + longer supported. (Of course, the :keyword:`as` *var* part is still + optional.) + +* :ref:`pep-3112`. The ``b"..."`` string literal notation (and its + variants like ``b'...'``, ``b"""..."""``, and ``br"..."``) now + produces a literal of type :class:`bytes`. More about + :class:`bytes` below. + +* :ref:`pep-3116`. The :mod:`io` module is now the standard way of + doing file I/O, and the initial values of :data:`sys.stdin`, + :data:`sys.stdout` and :data:`sys.stderr` are now instances of + :class:`io.TextIOBase`. The builtin :func:`open` function is now an + alias for :func:`io.open` and has additional keyword arguments + *encoding*, *errors*, *newline* and *closefd*. Also note that an + invalid *mode* argument now raises :exc:`ValueError`, not + :exc:`IOError`. + +* :ref:`pep-3118`. The old builtin :func:`buffer` is now really gone; + the new builtin :func:`memoryview` provides (mostly) similar + functionality. + +* :ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in the + :mod:`collections` module plays a slightly more prominent role in + the language now, and builtin collection types like :class:`dict` + and :class:`list` conform to the :class:`collections.MutableMapping` + and :class:`collections.MutableSequence` ABC, respectively. + +* :ref:`pep-3127`. As mentioned above, the new octal literal + notation is the only one supported, and binary literals have been + added. + +* :ref:`pep-3129`. This speaks for itself. + +* :ref:`pep-3141`. The :mod:`numbers` module is another new use of + ABCs, defining Python's "numeric tower". Also note the new + :mod:`fractions` module. -* PEP 343: The :keyword:`with` statement is now a standard feature and - no longer needs to be imported from the ``__future__``. -* PEP 366: Explicit relative imports from a main module inside a package. - This enhances the usefulness of the :option:`-m` option. +Library Changes +=============== -* PEP 370: Per-user ``site-packages`` directory. +XXX Brief overview of what's changed in the library. -* PEP 371: The ``multiprocessing`` package. XXX Did anything change here? +* :pep:`3108`: stdlib reorganization. -* PEP 3101: Advanced string formatting. Note: the 2.6 description - mentions the :method:`format` method for both 8-bit and Unicode - strings. In 3.0, only the :class:`str` type (text strings with - Unicode support) supports this method; the :class:`bytes` type does - not. +* Killed :mod:`sets`. Use the builtin :func:`set` function. -* PEP 3105: Print as a function. This is now a standard feature and - no longer needs to be imported from the ``__future__``. +* XXX macfs, new, reconvert, stringold, xmllib, pcre, pypcre, strop -* PEP 3110: Exception-handling changes. The ``except exc as var:`` - syntax is now standard and ``except exc, var:`` is no longer supported. - (Of course, the ``as var`` part is still optional.) +* XXX :pep:`4` -* PEP 3112: Byte literals. The ``b"..."`` string literal notation - (and its variants like ``b'...'``, ``b"""...""", and ``br'...`'') - now produces a literal of type :class:`bytes`. More about :class:`bytes` - below. +* XXX lib-old: Para, addpack, cmp, cmpcache, codehack, dircmp, dump, + find, fmt, grep, lockfile, newdir, ni, packmail, poly, rand, + statcache, tb, tzparse, util, whatsound, whrandom, zmod -* PEP 3116: New I/O library. The :module:`io` module is now the - standard way of doing file I/O, and the initial values of - ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are now instances - of :class:`io.TextIOBase`. The builtin :func:`open` function is - now an alias for ``io.open`` and has additional keyword arguments: - ``encoding``, ``errors``, ``newline`` and ``closefd``. +* XXX Removed sys.exitfunc -* PEP 3118: Revised buffer protocol. The old builtin - :function:`buffer` is no more; the new builtin - :function:`memoryview` provides (mostly) similar functionality. +* XXX Removed sys.exc_clear -* PEP 3119: Abstract Base Classes (ABCs). These play a slightly more - prominent role in the language now, and builtin collection types like - :class:`dict` and :class:`list` conform to the :class:`Mapping` and - :class:`Sequence` protocol, correspondingly. +* XXX Removed sys.exc_type, exc_value, exc_traceback. (sys.last_type + etc. remain.) -* PEP 3127: Integer literal suport and syntax. As mentioned above, - the new octal literal notation is the only one supported, and binary - literals have been added. +* XXX array.read, array.write -* PEP 3129: Class decorators. This speaks for itself. +* XXX operator.sequenceIncludes -* PEP 3141: A type hierarchy for numbers. This is another new use of - ABCs, defining Python's "numeric tower". +* XXX thread.acquire_lock and thread.release_lock -* XXX More. +* XXX UserXXX -> XXXMixin? +* XXX removed random.jumpahead API -Library Changes -=============== +* XXX cookie module revamps -XXX Brief overview of what's changed in the library. +* XXX heapq revamp Strings And Bytes @@ -411,25 +473,30 @@ * The :class:`basestring` superclass has been removed. The ``2to3`` tool replaces every occurrence of :class:`basestring` with :class:`str`. -* PEP 3137: There is a new type, :class:`bytes`, to represent binary data (and - encoded text, which is treated as binary data until you decide to decode it). - The :class:`str` and :class:`bytes` types cannot be mixed; you must always - explicitly convert between them, using the :meth:`str.encode` (str -> bytes) - or :meth:`bytes.decode` (bytes -> str) methods. +* :pep:`3137`: There is a new type, :class:`bytes`, to represent + binary data (and encoded text, which is treated as binary data until + you decide to decode it). The :class:`str` and :class:`bytes` types + cannot be mixed; you must always explicitly convert between them, + using the :meth:`str.encode` (str -> bytes) or :meth:`bytes.decode` + (bytes -> str) methods. + +.. XXX add bytearray * All backslashes in raw strings are interpreted literally. This means that ``'\U'`` and ``'\u'`` escapes in raw strings are not treated specially. -.. XXX add bytearray +* :pep:`3138`: :func:`repr` of a string no longer escapes all + non-ASCII characters. XXX -* PEP 3112: Bytes literals, e.g. ``b"abc"``, create :class:`bytes` instances. +* :pep:`3112`: Bytes literals, e.g. ``b"abc"``, create :class:`bytes` + instances. -* PEP 3120: UTF-8 default source encoding. +* :pep:`3120`: UTF-8 default source encoding. -* PEP 3131: Non-ASCII identifiers. (However, the standard library remains +* :pep:`3131`: Non-ASCII identifiers. (However, the standard library remains ASCII-only with the exception of contributor names in comments.) -* PEP 3116: New I/O Implementation. The API is nearly 100% backwards +* :pep:`3116`: New I/O Implementation. The API is nearly 100% backwards compatible, but completely reimplemented (currently mostly in Python). Also, binary files use bytes instead of strings. @@ -438,8 +505,8 @@ -PEP 3101: A New Approach To String Formatting -============================================= +:pep:`3101`: A New Approach To String Formatting +================================================ * A new system for built-in string formatting operations replaces the ``%`` string formatting operator. (However, the ``%`` operator is @@ -449,8 +516,8 @@ .. XXX expand this -PEP 3106: Revamping dict :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict.values` -====================================================================================== +:pep:`3106`: Revamping dict :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict.values` +========================================================================================= .. XXX expand this (but note that the "pitfalls" section currently has .. XXX more detail :-) @@ -463,8 +530,8 @@ referred to as *dictionary views*. -PEP 3107: Function Annotations -============================== +:pep:`3107`: Function Annotations +================================= .. XXX expand this @@ -474,7 +541,7 @@ Exception Stuff =============== -* PEP 352: All exceptions must be derived (directly or indirectly) +* :pep:`0352`: All exceptions must be derived (directly or indirectly) from :exc:`BaseException`. This is the root of the exception hierarchy. Most exceptions should actually be derived from :exc:`Exception`. This is not a new recommendation, but the @@ -487,13 +554,13 @@ * Dropping sequence behavior (slicing!) and :attr:`message` attribute of exception instances. -* PEP 3109: Raising exceptions. You must now use ``raise Exception(args)`` +* :pep:`3109`: Raising exceptions. You must now use ``raise Exception(args)`` instead of ``raise Exception, args``. -* PEP 3110: Catching exceptions. You must now use ``except SomeException as +* :pep:`3110`: Catching exceptions. You must now use ``except SomeException as identifier:`` instead of ``except Exception, identifier:`` -* PEP 3134: Exception chaining. +* :pep:`3134`: Exception chaining. XXX * A few exception messages are improved when Windows fails to load an extension module. For example, ``error code 193`` is now ``%1 is not a valid Win32 @@ -505,110 +572,105 @@ * Classic classes are gone. -* PEP 3115: New Metaclass Syntax. +* :pep:`3115`: New Metaclass Syntax. -* PEP 3119: Abstract Base Classes (ABCs); ``@abstractmethod`` and +* :pep:`3119`: Abstract Base Classes (ABCs); ``@abstractmethod`` and ``@abstractproperty`` decorators; collection ABCs. -* PEP 3129: Class decorators. +* :pep:`3129`: Class decorators. -* PEP 3141: Numeric ABCs. +* :pep:`3141`: Numeric ABCs. Other Language Changes ====================== -Here are most of the changes that Python 3.0 makes to the core Python -language and built-in functions. - -* Removed backticks (use :func:`repr` instead). - -* Removed ``<>`` (use ``!=`` instead). +* Moved :func:`intern` to :func:`sys.intern`. * ``!=`` now returns the opposite of ``==``, unless ``==`` returns ``NotImplemented``. -* :keyword:`as` and :keyword:`with` are keywords. - -* ``True``, ``False``, and ``None`` are keywords. - -* PEP 237: :class:`long` renamed to :class:`int`. That is, there is only one - built-in integral type, named :class:`int`; but it behaves like the old - :class:`long` type, with the exception that the literal suffix ``L`` is - neither supported by the parser nor produced by :func:`repr` anymore. - :data:`sys.maxint` was also removed since the int type has no maximum value - anymore. Use :data:`sys.maxsize` instead. - XXX Is this a dupe from the intro section on integers? - -* PEP 238: int division returns a float. - -* The ordering operators behave differently: for example, ``x < y`` where ``x`` - and ``y`` have incompatible types raises :exc:`TypeError` instead of returning - a pseudo-random boolean. - -* :meth:`__getslice__` and friends killed. The syntax ``a[i:j]`` now translates - to ``a.__getitem__(slice(i, j))`` (or :meth:`__setitem__` or - :meth:`__delitem__`, depending on context). - -* PEP 3102: Keyword-only arguments. Named parameters occurring after ``*args`` - in the parameter list *must* be specified using keyword syntax in the call. - You can also use a bare ``*`` in the parameter list to indicate that you don't - accept a variable-length argument list, but you do have keyword-only - arguments. - -* PEP 3104: :keyword:`nonlocal` statement. Using ``nonlocal x`` you can now - assign directly to a variable in an outer (but non-global) scope. - -* PEP 3111: :func:`raw_input` renamed to :func:`input`. That is, the new - :func:`input` function reads a line from :data:`sys.stdin` and returns it with - the trailing newline stripped. It raises :exc:`EOFError` if the input is - terminated prematurely. To get the old behavior of :func:`input`, use - ``eval(input())``. - -* :func:`xrange` renamed to :func:`range`, so :func:`range` will no longer - produce a list but an iterable yielding integers when iterated over. - -* PEP 3113: Tuple parameter unpacking removed. You can no longer write ``def - foo(a, (b, c)): ...``. Use ``def foo(a, b_c): b, c = b_c`` instead. - -* PEP 3114: ``.next()`` renamed to :meth:`__next__`, new builtin :func:`next` to - call the :meth:`__next__` method on an object. - -* PEP 3127: New octal literals; binary literals and :func:`bin`. Instead of - ``0666``, you write ``0o666``. The :func:`oct` function is modified - accordingly. Also, ``0b1010`` equals 10, and ``bin(10)`` returns - ``"0b1010"``. ``0666`` is now a :exc:`SyntaxError`. - -* PEP 3132: Extended Iterable Unpacking. You can now write things like ``a, b, - *rest = some_sequence``. And even ``*rest, a = stuff``. The ``rest`` object - is always a list; the right-hand side may be any iterable. - -* PEP 3135: New :func:`super`. You can now invoke :func:`super` without - arguments and the right class and instance will automatically be chosen. With - arguments, its behavior is unchanged. +* The concept of "unbound methods" was removed from the language. + When referencing a method as a class attribute, you now get a plain + function object. + +* :meth:`__getslice__`, :meth:`__setslice__` and :meth:`__delslice__` + were killed. The syntax ``a[i:j]`` now translates to + ``a.__getitem__(slice(i, j))`` (or :meth:`__setitem__` or + :meth:`__delitem__`, when used as an assignment or deletion target, + respectively). + +* :pep:`3111`: :func:`raw_input` renamed to :func:`input`. That is, + the new :func:`input` function reads a line from :data:`sys.stdin` + and returns it with the trailing newline stripped. It raises + :exc:`EOFError` if the input is terminated prematurely. To get the + old behavior of :func:`input`, use ``eval(input())``. + +* :func:`xrange` renamed to :func:`range`, so :func:`range` will no + longer produce a list but an iterable yielding integers when + iterated over. XXX dupe + +* :pep:`3114`: ``.next()`` renamed to :meth:`__next__`, new builtin + :func:`next` to call the :meth:`__next__` method on an object. + +* :pep:`3135`: New :func:`super`. You can now invoke :func:`super` + without arguments and the right class and instance will + automatically be chosen. With arguments, its behavior is unchanged. * :func:`zip`, :func:`map` and :func:`filter` return iterators. * :data:`string.letters` and its friends (:data:`string.lowercase` and - :data:`string.uppercase`) are gone. Use :data:`string.ascii_letters` - etc. instead. + :data:`string.uppercase`) are gone. Use + :data:`string.ascii_letters` etc. instead. (The reason for the + removal is that :data:string.letters` and friends had + locale-specific behavior, which is a bad idea for such + attractively-named global "constants".) + +* Removed: :func:`apply`. Instead of ``apply(f, args)`` use + ``f(*args)``. + +* Removed :func:`callable`. Instead of ``callable(f)`` you can use + ``hasattr(f, '__call__')``. The :func:`operator.isCallable` function + is also gone. + +* Removed :func:`coerce`. This function no longer serves a purpose + now that classic classes are gone. + +* Removed :func:`execfile`. Instead of ``execfile(fn)`` use + ``exec(open(fn).read())``. -* Removed: :func:`apply`, :func:`callable`, :func:`coerce`, :func:`execfile`, - :func:`file`, :func:`reduce`, :func:`reload`. +* Removed :class:`file`. Use :func:`open`. -* Removed: :meth:`dict.has_key` -- use the ``in`` operator instead. +* Removed :func:`reduce`. Use :func:`functools.reduce` if you really + need it; however, 99 percent of the time an explicit :keyword:`for` + loop is more readable. -* :func:`exec` is now a function. +* Removed :func:`reload`. Use :func:`imp.reload`. -* The :meth:`__oct__` and :meth:`__hex__` special methods are removed -- - :func:`oct` and :func:`hex` use :meth:`__index__` now to convert the argument - to an integer. +* Removed. :meth:`dict.has_key` -- use the :keyword:`in` operator + instead. -* Support is removed for :attr:`__members__` and :attr:`__methods__`. +* The :meth:`__oct__` and :meth:`__hex__` special methods are removed + -- :func:`oct` and :func:`hex` use :meth:`__index__` now to convert + the argument to an integer. -* Renamed the boolean conversion C-level slot and method: ``nb_nonzero`` is now - ``nb_bool`` and :meth:`__nonzero__` is now :meth:`__bool__`. +* Removed support for :attr:`__members__` and :attr:`__methods__`. +* Renamed the boolean conversion C-level slot and method: + ``nb_nonzero`` is now ``nb_bool`` and :meth:`__nonzero__` is now + :meth:`__bool__`. + +* Renamed module :mod:`__builtin__` to :mod:`builtins` (removing the + underscores, adding an 's'). The :data:`__builtins__` variable + found in most global namespaces is unchanged. To modify a builtin, + you should use :mod:`builtins`, not :data:`__builtins__`! + +* Renamed function attributes :attr:`func_whatever` to + :attr:`__whatever__`. XXX list every single one. + +* Removed :exc:`StandardError`. + +* Removed METH_OLDARGS and WITH_CYCLE_GC. XXX more. .. ====================================================================== @@ -616,11 +678,11 @@ Optimizations ------------- -* Detailed changes are listed here. - The net result of the 3.0 generalizations is that Python 3.0 runs the -pystone benchmark around a third slower than Python 2.5. There's room -for improvement, but it will happen after 3.0 is released! +pystone benchmark around 10% slower than Python 2.5. Most likely the +biggest cause is the removal of special-casing for small integers. +There's room for improvement, but it will happen after 3.0 is +released! .. ====================================================================== @@ -668,11 +730,11 @@ Changes to Python's build process and to the C API include: -* PEP 3118: New Buffer API. +* :pep:`3118`: New Buffer API. XXX -* PEP 3121: Extension Module Initialization & Finalization. +* :pep:`3121`: Extension Module Initialization & Finalization. XXX -* PEP 3123: Making :cmacro:`PyObject_HEAD` conform to standard C. +* :pep:`3123`: Making :cmacro:`PyObject_HEAD` conform to standard C. XXX * No more C API support for restricted execution. @@ -689,8 +751,9 @@ Port-Specific Changes --------------------- -Platform-specific changes go here. +XXX Platform-specific changes go here. +* XXX BeOS, RISCOS, Irix, Tru64 support .. ====================================================================== @@ -705,9 +768,9 @@ logs finds there were XXX patches applied and YYY bugs fixed between Python 2.6 and 3.0. Both figures are likely to be underestimates. -Some of the more notable changes are: +XXX Some of the more notable changes are: -* Details go here. +* XXX Details go here. .. ====================================================================== From python-3000-checkins at python.org Tue Dec 2 23:58:37 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Tue, 2 Dec 2008 23:58:37 +0100 (CET) Subject: [Python-3000-checkins] r67480 - in python/branches/py3k/Doc: howto/cporting.rst whatsnew/3.0.rst Message-ID: <20081202225837.027F31E4002@bag.python.org> Author: guido.van.rossum Date: Tue Dec 2 23:58:36 2008 New Revision: 67480 Log: Finished the "porting to 3.0" section. Had to add a label to howto/cporting.rst. Modified: python/branches/py3k/Doc/howto/cporting.rst python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/howto/cporting.rst ============================================================================== --- python/branches/py3k/Doc/howto/cporting.rst (original) +++ python/branches/py3k/Doc/howto/cporting.rst Tue Dec 2 23:58:36 2008 @@ -1,5 +1,7 @@ .. highlightlang:: c +.. _cporting-howto: + ******************************** Porting Extension Modules to 3.0 ******************************** Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Tue Dec 2 23:58:36 2008 @@ -426,6 +426,9 @@ Library Changes =============== +Due to time constraints, this document does not exhaustively cover +the very extensive changes to the library. + XXX Brief overview of what's changed in the library. * :pep:`3108`: stdlib reorganization. @@ -778,16 +781,35 @@ Porting To Python 3.0 ===================== -This section lists previously described changes that may require -changes to your code: - -* Everything is all in the details! +For porting existing Python 2.5 or 2.6 source code to Python 3.0, the +best strategy is the following: -* Developers can include :file:`intobject.h` after :file:`Python.h` for - some ``PyInt_`` aliases. +0. (Prerequisite:) Start with excellent test coverage. -* XXX Mention 2to3. +1. Port to Python 2.6. This should be no more work than the average + port from Python 2.x to Python 2.(x+1). Make sure all your tests + pass. + +2. (Still using 2.6:) Turn on the :option:`-3` command line switch. + This enables warnings about features that will be removed (or + change) in 3.0. Run your test suite again, and fix code that you + get warnings about until there are no warnings left, and all your + tests still pass. + +3. Run the ``2to3`` source-to-source translator over your source code + tree. (See :ref:`2to3-reference` for more on this tool.) Run the + result of the translation under Python 3.0. Manually fix up any + remaining issues, fixing problems until all tests pass again. + +It is not recommended to try to write source code that runs unchanged +under both Python 2.6 and 3.0; you'd have to use a very contorted +coding style, e.g. avoiding :keyword:`print` statements, metaclasses, +and much more. If you are maintaining a library that needs to support +both Python 2.6 and Python 3.0, the best approach is to modify step 3 +above by editing the 2.6 version of the source code and running the +``2to3`` translator again, rather than editing the 3.0 version of the +source code. -* XXX Reference external doc about porting extensions? +For porting C extensions to Python 3.0, please see :ref:`cporting-howto`. .. ====================================================================== From python-3000-checkins at python.org Wed Dec 3 00:46:46 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Wed, 3 Dec 2008 00:46:46 +0100 (CET) Subject: [Python-3000-checkins] r67481 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081202234646.A5E1A1E4002@bag.python.org> Author: guido.van.rossum Date: Wed Dec 3 00:46:46 2008 New Revision: 67481 Log: Finished what I'm going to write about the standard library. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 00:46:46 2008 @@ -53,7 +53,7 @@ when researching a change. This article explains the new features in Python 3.0, compared to 2.6. -Python 3.0, also known as "Python 3000" or "Py3k", is the first ever +Python 3.0, also known as "Python 3000" or "Py3K", is the first ever *intentionally incompatible* release. There are more changes than in a typical release, and more that are important for all Python users. Nevertheless, after digesting the changes, you'll find that Python @@ -247,7 +247,6 @@ ============================= This section gives a brief overview of every *syntactic* change. -Several of these are discussed at greater length later. Additions --------- @@ -426,49 +425,105 @@ Library Changes =============== -Due to time constraints, this document does not exhaustively cover -the very extensive changes to the library. +Due to time constraints, this document does not exhaustively cover the +very extensive changes to the standard library. :pep:`3108` is the +reference for the major changes to the library. Here's a capsule +review: + +* Many old modules were removed. Some, like :mod:`gopherlib` (no + longer used) and :mod:`md5` (replaced by :mod:`hashlib`), were + already deprecated by :pep:`0004`. Others were removed as a result + of the removal of support for various platforms such as Irix, BeOS + and Mac OS 9 (see :pep:`0011`). Some modules were also selected for + removal in Python 3.0 due to lack of use or because a better + replacement exists. See :pep:`3108` for an exhaustive list. + +* The :mod:`bsddb3` package was removed because its presence in the + core standard library has proved over time to be a particular burden + for the core developers due to testing instability and Berlekey DB's + release schedule. However, the package is alive and well, + externally maintained at http://www.jcea.es/programacion/pybsddb.htm. + +* Some modules were renamed because their old name flaunted + :pep:`0008`, or for various other reasons: + + ======================= ======================= + Old Name New Name + ======================= ======================= + _winreg winreg + ConfigParser configparser + copy_reg copyreg + Queue queue + SocketServer socketserver + markupbase _markupbase + repr reprlib + test.test_support test.support + ======================= ======================= + +* A common pattern in Python 2.x is to have one version of a module + implemented in pure Python, with an optional accelerated version + implemented as a C extension; for example, :mod:`pickle` and + :mod:`cPickle`. This places the burden of importing the accelerated + version and falling back on the pure Python version on each user of + these modules. In Python 3.0, the accelerated versions are + considered implementation details of the pure Python versions. + Users should always import the standard version, which attempts to + import the accelerated version and falls back to the pure Python + version. The :mod:`pickle` module received this treatment. The + :mod:`profile` module is on the list for 3.1. The :mod:`StringIO` + module has been turned into a class in the :mod:`io` module. + +* Some related modules have been grouped into packages, and usually + the submodule names have been simplified. The resulting new + packages are: + + * :mod:`dbm` (:mod:`anydbm`, :mod:`dbhash`, :mod:`dbm`, + :mod:`dumbdbm`, :mod:`gdbm`, :mod:`whichdb`). + + * :mod:`html` (:mod:`HTMLParser`, :mod:`htmlentitydefs`). + + * :mod:`http` (:mod:`httplib`, :mod:`BaseHTTPServer`, + :mod:`CGIHTTPServer`, :mod:`SimpleHTTPServer`, :mod:`Cookie`, + :mod:`cookielib`). + + * :mod:`tkinter` (all :mod:`Tkinter`-related modules except + :mod:`turtle`). The target audience of :mod:`turtle` doesn't + really care about :mod:`tkinter`. Also note that as of Python + 2.6, the functionality of :mod:`turtle` has been greatly enhanced. -XXX Brief overview of what's changed in the library. + * :mod:`urllib` (:mod:`urllib`, :mod:`urllib`2, :mod:`urlparse`, + :mod:`robotparse`). -* :pep:`3108`: stdlib reorganization. + * :mod:`xmlrpc` (:mod:`xmlrpclib`, :mod:`DocXMLRPCServer`, + :mod:`SimpleXMLRPCServer`). -* Killed :mod:`sets`. Use the builtin :func:`set` function. - -* XXX macfs, new, reconvert, stringold, xmllib, pcre, pypcre, strop - -* XXX :pep:`4` - -* XXX lib-old: Para, addpack, cmp, cmpcache, codehack, dircmp, dump, - find, fmt, grep, lockfile, newdir, ni, packmail, poly, rand, - statcache, tb, tzparse, util, whatsound, whrandom, zmod - -* XXX Removed sys.exitfunc +Some other library changes (not covered by :pep:`3108`): -* XXX Removed sys.exc_clear +* Killed :mod:`sets`. Use the builtin :func:`set` function. -* XXX Removed sys.exc_type, exc_value, exc_traceback. (sys.last_type +* Cleanup of the :mod:`sys` module: removed :func:`sys.exitfunc`, + :func:`sys.exc_clear`, :data:`sys.exc_type`, :data:`sys.exc_value`, + :data:`sys.exc_traceback`. (Note that :data:`sys.last_type` etc. remain.) -* XXX array.read, array.write - -* XXX operator.sequenceIncludes - -* XXX thread.acquire_lock and thread.release_lock - -* XXX UserXXX -> XXXMixin? - -* XXX removed random.jumpahead API +* Cleanup of the :class:`array.array` type: the :meth:`read` and + :meth:`write` methods are gone; use :meth:`fromfile` and + :meth:`tofile` instead. + +* Cleanup of the :mod:`operator` module: removed + :func:`sequenceIncludes` and :func:`isCallable`. + +* Cleanup of the :mod:`thread` module: :func:`acquire_lock` and + :func:`release_lock` are gone; use :func:`acquire` and + :func:`release` instead. -* XXX cookie module revamps - -* XXX heapq revamp +* Cleanup of the :mod:`random` module: removed the :func:`jumpahead` API. Strings And Bytes ================= -This section discusses the many changes in string +This section discusses the many changes in string XXX * There is only one string type; its name is :class:`str` but its behavior and implementation are like :class:`unicode` in 2.x. @@ -761,23 +816,6 @@ .. ====================================================================== -.. _30section-other: - -Other Changes And Fixes -======================= - -As usual, there were a bunch of other improvements and bugfixes -scattered throughout the source tree. A search through the change -logs finds there were XXX patches applied and YYY bugs fixed between -Python 2.6 and 3.0. Both figures are likely to be underestimates. - -XXX Some of the more notable changes are: - -* XXX Details go here. - -.. ====================================================================== - - Porting To Python 3.0 ===================== From python-3000-checkins at python.org Wed Dec 3 00:52:53 2008 From: python-3000-checkins at python.org (gregory.p.smith) Date: Wed, 3 Dec 2008 00:52:53 +0100 (CET) Subject: [Python-3000-checkins] r67482 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081202235253.8B81D1E4002@bag.python.org> Author: gregory.p.smith Date: Wed Dec 3 00:52:53 2008 New Revision: 67482 Log: interators -> iterators (thanks Taggnostr) Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 00:52:53 2008 @@ -166,7 +166,7 @@ * See also the :ref:`unicode-howto`, which was updated for Python 3.0. -Views And Interators Instead Of Lists +Views And Iterators Instead Of Lists ------------------------------------- Some well-known APIs no longer return lists: From python-3000-checkins at python.org Wed Dec 3 01:54:52 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Wed, 3 Dec 2008 01:54:52 +0100 (CET) Subject: [Python-3000-checkins] r67485 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081203005452.590BF1E4002@bag.python.org> Author: guido.van.rossum Date: Wed Dec 3 01:54:52 2008 New Revision: 67485 Log: Another checkpoint. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 01:54:52 2008 @@ -146,6 +146,9 @@ The change is for the better, as in the 2.x world there were numerous bugs having to do with mixing encoded and unencoded text. +* You no longer need to use ``u"..."`` literals for Unicode text. + However, you must use ``b"..."`` literals for binary data. + * Files opened as text files (still the default mode for :func:`open`) always use an encoding to map between strings (in memory) and bytes (on disk). Binary files (opened with a ``b`` in the mode argument) @@ -174,7 +177,8 @@ * :class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict.values` return "views" instead of lists. For example, this no longer works: ``k = d.keys(); k.sort()``. Use ``k = - sorted(d)`` instead. + sorted(d)`` instead (this works in Python 2.5 too, and is just + as efficient). * Also, the :meth:`dict.iterkeys`, :meth:`dict.iteritems` and :meth:`dict.itervalues` methods are no longer supported. @@ -185,13 +189,12 @@ Particularly tricky is :func:`map` invoked for the side effects of the function; the correct transformation is to use a for-loop. -* :func:`range` now behaves like :func:`xrange` used to behave. - The latter no longer exists. +* :func:`range` now behaves like :func:`xrange` used to behave, except + it works with values of arbitrary size. The latter no longer + exists. * :func:`zip` now returns an iterator. -* XXX More below? - Ordering Comparisons -------------------- @@ -215,21 +218,20 @@ * The :func:`cmp` function is gone, and the :meth:`__cmp__` special method is no longer supported. Use :meth:`__lt__` for sorting, :meth:`__eq__` with :meth:`__hash__`, and other rich comparisons as - needed. if you really need the :func:`cmp` functionality, the - expression ``(a > b) - (a < b)`` is equivalent to ``cmp(a, b)``. - -* XXX More below? + needed. (If you really need the :func:`cmp` functionality, you + could use the expression ``(a > b) - (a < b)`` as the equivalent for + ``cmp(a, b)``.) Integers -------- -* :pep:`0237`: :class:`long` renamed to :class:`int`. That is, there - is only one built-in integral type, named :class:`int`; but it - behaves mostly like the old :class:`long` type. - -* The :func:`repr` of a long integer doesn't include the trailing ``L`` - anymore, so code that unconditionally strips that character will - chop off the last digit instead. (Use :func:`str` instead.) +* :pep:`0237`: Essentially, :class:`long` renamed to :class:`int`. + That is, there is only one built-in integral type, named + :class:`int`; but it behaves mostly like the old :class:`long` type. + +* :pep:`0238`: An expression like ``1/2`` returns a float. Use + ``1//2`` to get the truncating behavior. (The latter syntax has + existed for years, at least since Python 2.2.) * The :data:`sys.maxint` constant was removed, since there is no longer a limit to the value of ints. However, :data:`sys.maxsize` @@ -238,20 +240,29 @@ and is typically the same as :data:`sys.maxint` in previous releases on the same platform (assuming the same build options). -* ``1/2`` returns a float. Use ``1//2`` to get the truncating behavior. - (The latter syntax has existed for years, at least since Python 2.2.) - See :pep:`0238`. +* The :func:`repr` of a long integer doesn't include the trailing ``L`` + anymore, so code that unconditionally strips that character will + chop off the last digit instead. (Use :func:`str` instead.) +* Octal literals are no longer of the form ``0720``; use ``0o720`` + instead. -Overview Of Syntactic Changes -============================= -This section gives a brief overview of every *syntactic* change. +Overview Of Syntax Changes +========================== + +This section gives a brief overview of every *syntactic* change in +Python 3.0. Additions --------- -* Function argument and return value annotations (see below). XXX +* :pep:`3107`: Function argument and return value annotations. This + provides a standardized way of annotating a function's parameters + and return value. There are no semantics attached to such + annotations except that they can be introspected at runtime using + the :attr:`__annotations__` attribute. The intent is to encourage + experimentation through metaclasses, decorators or frameworks. * :pep:`3102`: Keyword-only arguments. Named parameters occurring after ``*args`` in the parameter list *must* be specified using @@ -261,8 +272,8 @@ * Keyword arguments are allowed after the list of base classes in a class definition. This is used by the new convention for specifying - a metaclass, but can be used for other purposes as well, as long as - the metaclass supports it. + a metaclass (see :pep:`3115`), but can be used for other purposes as + well, as long as the metaclass supports it. * :pep:`3104`: :keyword:`nonlocal` statement. Using ``nonlocal x`` you can now assign directly to a variable in an outer (but @@ -278,11 +289,12 @@ This sets *a* to ``0``, *b* to ``4``, and \*rest to ``[1, 2, 3]``. * Dictionary comprehensions: ``{k: v for k, v in stuff}`` means the - same thing as ``dict(stuff)`` but is more flexible. + same thing as ``dict(stuff)`` but is more flexible. (This is + :pep:`0274` vindicated. :-) * Set literals, e.g. ``{1, 2}``. Note that ``{}`` is an empty dictionary; use ``set()`` for an empty set. Set comprehensions are - also supported; ``{x for x in stuff}`` means the same thing as + also supported; e.g., ``{x for x in stuff}`` means the same thing as ``set(stuff)`` but is more flexible. * New octal literals, e.g. ``0o720`` (already in 2.6). The old octal @@ -588,14 +600,6 @@ referred to as *dictionary views*. -:pep:`3107`: Function Annotations -================================= - -.. XXX expand this - -* A standardized way of annotating a function's parameters and return values. - - Exception Stuff =============== @@ -664,10 +668,6 @@ :exc:`EOFError` if the input is terminated prematurely. To get the old behavior of :func:`input`, use ``eval(input())``. -* :func:`xrange` renamed to :func:`range`, so :func:`range` will no - longer produce a list but an iterable yielding integers when - iterated over. XXX dupe - * :pep:`3114`: ``.next()`` renamed to :meth:`__next__`, new builtin :func:`next` to call the :meth:`__next__` method on an object. From python-3000-checkins at python.org Wed Dec 3 01:55:34 2008 From: python-3000-checkins at python.org (christian.heimes) Date: Wed, 3 Dec 2008 01:55:34 +0100 (CET) Subject: [Python-3000-checkins] r67487 - in python/branches/py3k: Modules/_ctypes/callproc.c Message-ID: <20081203005534.2D0941E4002@bag.python.org> Author: christian.heimes Date: Wed Dec 3 01:55:34 2008 New Revision: 67487 Log: Merged revisions 67484 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67484 | christian.heimes | 2008-12-03 01:53:18 +0100 (Wed, 03 Dec 2008) | 2 lines Issue #4025 again Converted a C99 style comment to a C89 style comment (found by MAL). ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Modules/_ctypes/callproc.c Modified: python/branches/py3k/Modules/_ctypes/callproc.c ============================================================================== --- python/branches/py3k/Modules/_ctypes/callproc.c (original) +++ python/branches/py3k/Modules/_ctypes/callproc.c Wed Dec 3 01:55:34 2008 @@ -216,7 +216,7 @@ n = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, code, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ (LPWSTR) &lpMsgBuf, 0, NULL); From python-3000-checkins at python.org Wed Dec 3 03:03:20 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Wed, 3 Dec 2008 03:03:20 +0100 (CET) Subject: [Python-3000-checkins] r67488 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081203020320.283061E4002@bag.python.org> Author: guido.van.rossum Date: Wed Dec 3 03:03:19 2008 New Revision: 67488 Log: Another checkpoint -- some stuff I managed to do on the train. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 03:03:19 2008 @@ -129,25 +129,29 @@ :func:`print` function calls, so this is mostly a non-issue for larger projects. -Text Strings Vs. Bytes ----------------------- +Text Vs. Data Instead Of Unicode Vs. 8-bit +------------------------------------------ Everything you thought you knew about binary data and Unicode has -changed. There's a longer section below; here's a summary of the -changes: +changed: -* Python 3.0 uses *strings* and *bytes* instead of *Unicode strings* - and *8-bit strings*. The difference is that any attempt to mix - strings and bytes in Python 3.0 raises a TypeError exception, - whereas if you were to mix Unicode and 8-bit strings in Python 2.x, - you would only get an exception if the 8-bit string contained - non-ASCII values. As a consequence, pretty much all code that - uses Unicode, encodings or binary data most likely has to change. - The change is for the better, as in the 2.x world there were - numerous bugs having to do with mixing encoded and unencoded text. +XXX HIRO -* You no longer need to use ``u"..."`` literals for Unicode text. - However, you must use ``b"..."`` literals for binary data. +* Python 3.0 uses the concepts of *text* and (binary) *data* instead + of Unicode strings and 8-bit strings. All text is Unicode; however + *encoded* Unicode is represented as binary data. The type used to + hold text is :class:`str`, the type used to hold data is + :class:`bytes`. The difference is that any attempt to mix text and + data in Python 3.0 raises a TypeError exception, whereas if you were + to mix Unicode and 8-bit strings in Python 2.x, you would only get + an exception if the 8-bit string contained non-ASCII values. As a + consequence, pretty much all code that uses Unicode, encodings or + binary data most likely has to change. The change is for the + better, as in the 2.x world there were numerous bugs having to do + with mixing encoded and unencoded text. + +* You no longer use ``u"..."`` literals for Unicode text. However, + you must use ``b"..."`` literals for binary data. * Files opened as text files (still the default mode for :func:`open`) always use an encoding to map between strings (in memory) and bytes @@ -167,6 +171,50 @@ don't have functionality enough in common to warrant a shared base class. +* All backslashes in raw strings are interpreted literally. This + means that ``'\U'`` and ``'\u'`` escapes in raw strings are not + treated specially. + +XXX Deal with dupes below + +* There is only one text string type; its name is :class:`str` but its + behavior and implementation are like :class:`unicode` in 2.x. + +* The :class:`basestring` superclass has been removed. The ``2to3`` + tool (see below) replaces every occurrence of :class:`basestring` + with :class:`str`. + +* :pep:`3137`: There is a new type, :class:`bytes`, to represent + binary data (and encoded text, which is treated as binary data until + it is decoded). The :class:`str` and :class:`bytes` types cannot be + mixed; you must always explicitly convert between them, using the + :meth:`str.encode` (str -> bytes) or :meth:`bytes.decode` (bytes -> + str) methods. + +* Like :class:`str`, the :class:`bytes` type is immutable. There is a + separate *mutable* type to hold buffered binary data, + :class:`bytearray`. Nearly all APIs that accept :class:`bytes` also + accept :class:`bytearray`. The mutable API is based on + :class:`collections.MutableSequence`. + +* :pep:`3138`: The :func:`repr` of a string no longer escapes + non-ASCII characters. It still escapes control characters and code + points with non-printable status in the Unicode standard, however. + +* :pep:`3120`: The default source encoding is now UTF-8. + +* :pep:`3131`: Non-ASCII letters are now allowed in identifiers. + (However, the standard library remains ASCII-only with the exception + of contributor names in comments.) + +* :pep:`3116`: New I/O implementation. The API is nearly 100% + backwards compatible, but completely reimplemented (currently largely + in Python). Also, binary files use bytes instead of strings. + +* The :mod:`StringIO` and :mod:`cStringIO` modules are gone. Instead, + import :class:`io.StringIO` or :class:`io.BytesIO`, for text and + data respectively. + * See also the :ref:`unicode-howto`, which was updated for Python 3.0. Views And Iterators Instead Of Lists @@ -254,8 +302,8 @@ This section gives a brief overview of every *syntactic* change in Python 3.0. -Additions ---------- +New Syntax +---------- * :pep:`3107`: Function argument and return value annotations. This provides a standardized way of annotating a function's parameters @@ -304,8 +352,8 @@ * Bytes literals are introduced with a leading ``b`` or ``B``. -Changes -------- +Changed Syntax +-------------- * New :keyword:`raise` statement syntax: ``raise [expr [from expr]]``. Also note that string exceptions are no longer legal (:pep:`0352`). @@ -333,8 +381,8 @@ *must* now be spelled as ``...``. (Previously it could also be spelled as ``. . .``, by a mere accident of the grammar.) -Removals --------- +Removed Syntax +-------------- * :pep:`3113`: Tuple parameter unpacking removed. You can no longer write ``def foo(a, (b, c)): ...``. @@ -362,7 +410,6 @@ (:pep:`0328`) - Changes Already Present In Python 2.6 ===================================== @@ -401,8 +448,7 @@ * :ref:`pep-3112`. The ``b"..."`` string literal notation (and its variants like ``b'...'``, ``b"""..."""``, and ``br"..."``) now - produces a literal of type :class:`bytes`. More about - :class:`bytes` below. + produces a literal of type :class:`bytes`. * :ref:`pep-3116`. The :mod:`io` module is now the standard way of doing file I/O, and the initial values of :data:`sys.stdin`, @@ -411,14 +457,17 @@ alias for :func:`io.open` and has additional keyword arguments *encoding*, *errors*, *newline* and *closefd*. Also note that an invalid *mode* argument now raises :exc:`ValueError`, not - :exc:`IOError`. + :exc:`IOError`. The binary file object underlying a text file + object can be accessed as :attr:`f.buffer` (but beware that the + text object maintains a buffer of itself in order to speed up + the encoding and decoding operations). * :ref:`pep-3118`. The old builtin :func:`buffer` is now really gone; the new builtin :func:`memoryview` provides (mostly) similar functionality. * :ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in the - :mod:`collections` module plays a slightly more prominent role in + :mod:`collections` module plays a somewhat more prominent role in the language now, and builtin collection types like :class:`dict` and :class:`list` conform to the :class:`collections.MutableMapping` and :class:`collections.MutableSequence` ABC, respectively. @@ -427,11 +476,11 @@ notation is the only one supported, and binary literals have been added. -* :ref:`pep-3129`. This speaks for itself. +* :ref:`pep-3129`. * :ref:`pep-3141`. The :mod:`numbers` module is another new use of ABCs, defining Python's "numeric tower". Also note the new - :mod:`fractions` module. + :mod:`fractions` module which implements :class:`numbers.Rational`. Library Changes @@ -532,58 +581,14 @@ * Cleanup of the :mod:`random` module: removed the :func:`jumpahead` API. -Strings And Bytes -================= - -This section discusses the many changes in string XXX - -* There is only one string type; its name is :class:`str` but its behavior and - implementation are like :class:`unicode` in 2.x. - -* The :class:`basestring` superclass has been removed. The ``2to3`` tool - replaces every occurrence of :class:`basestring` with :class:`str`. - -* :pep:`3137`: There is a new type, :class:`bytes`, to represent - binary data (and encoded text, which is treated as binary data until - you decide to decode it). The :class:`str` and :class:`bytes` types - cannot be mixed; you must always explicitly convert between them, - using the :meth:`str.encode` (str -> bytes) or :meth:`bytes.decode` - (bytes -> str) methods. - -.. XXX add bytearray - -* All backslashes in raw strings are interpreted literally. This means that - ``'\U'`` and ``'\u'`` escapes in raw strings are not treated specially. - -* :pep:`3138`: :func:`repr` of a string no longer escapes all - non-ASCII characters. XXX - -* :pep:`3112`: Bytes literals, e.g. ``b"abc"``, create :class:`bytes` - instances. - -* :pep:`3120`: UTF-8 default source encoding. - -* :pep:`3131`: Non-ASCII identifiers. (However, the standard library remains - ASCII-only with the exception of contributor names in comments.) - -* :pep:`3116`: New I/O Implementation. The API is nearly 100% backwards - compatible, but completely reimplemented (currently mostly in Python). Also, - binary files use bytes instead of strings. - -* The :mod:`StringIO` and :mod:`cStringIO` modules are gone. Instead, import - :class:`io.StringIO` or :class:`io.BytesIO`. - - - :pep:`3101`: A New Approach To String Formatting ================================================ * A new system for built-in string formatting operations replaces the ``%`` string formatting operator. (However, the ``%`` operator is still supported; it will be deprecated in Python 3.1 and removed - from the language at some later time.) - -.. XXX expand this + from the language at some later time.) Read :pep:`3101` for the full + scoop. :pep:`3106`: Revamping dict :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict.values` @@ -632,16 +637,24 @@ New Class And Metaclass Stuff ============================= +XXX Move to new syntax section??? + * Classic classes are gone. -* :pep:`3115`: New Metaclass Syntax. +* :pep:`3115`: New Metaclass Syntax. Instead of:: + + class C: + __metaclass__ = M + ... -* :pep:`3119`: Abstract Base Classes (ABCs); ``@abstractmethod`` and - ``@abstractproperty`` decorators; collection ABCs. + you now use:: -* :pep:`3129`: Class decorators. + class C(metaclass=M): + ... -* :pep:`3141`: Numeric ABCs. + The module-global :data:`__metaclass__` variable is no longer supported. + (It was a crutch to make it easier to default to new-style classes + without deriving every class from :class:`object`.) Other Language Changes From python-3000-checkins at python.org Wed Dec 3 03:31:31 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Wed, 3 Dec 2008 03:31:31 +0100 (CET) Subject: [Python-3000-checkins] r67489 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081203023131.C6A1B1E4002@bag.python.org> Author: guido.van.rossum Date: Wed Dec 3 03:31:31 2008 New Revision: 67489 Log: Another checkpoint. (A bit of a mess, a previous submit apparently didn't go through.) Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 03:31:31 2008 @@ -19,7 +19,8 @@ * The maintainer will go through Misc/NEWS periodically and add changes; it's therefore more important to add your changes to - Misc/NEWS than to this file. + Misc/NEWS than to this file. (Note: I didn't get to this for 3.0. + GvR.) * This is not a complete list of every single change; completeness is the purpose of Misc/NEWS. Some changes I consider too small @@ -40,7 +41,8 @@ necessary (especially when a final release is some months away). * Credit the author of a patch or bugfix. Just the name is - sufficient; the e-mail address isn't necessary. + sufficient; the e-mail address isn't necessary. (Due to time + constraints I haven't managed to do this for 3.0. GvR.) * It's helpful to add the bug/patch number as a comment: @@ -50,7 +52,8 @@ (Contributed by P.Y. Developer.) This saves the maintainer the effort of going through the SVN log - when researching a change. + when researching a change. (Again, I didn't get to this for 3.0. + GvR.) This article explains the new features in Python 3.0, compared to 2.6. Python 3.0, also known as "Python 3000" or "Py3K", is the first ever @@ -157,20 +160,38 @@ always use an encoding to map between strings (in memory) and bytes (on disk). Binary files (opened with a ``b`` in the mode argument) always use bytes in memory. This means that if a file is opened - using an incorrect mode or encoding, I/O will likely fail. There is - a platform-dependent default encoding, which on Unixy platforms can - be set with the ``LANG`` environment variable (and sometimes also - with some other platform-specific locale-related environment - variables). In many cases, but not all, the system default is - UTF-8; you should never count on this default. Any application - reading or writing more than pure ASCII text should probably have a - way to override the encoding. + using an incorrect mode or encoding, I/O will likely fail. It also + means that even Unix users will have to specify the correct mode + (text or binary) when opening a file. There is a platform-dependent + default encoding, which on Unixy platforms can be set with the + ``LANG`` environment variable (and sometimes also with some other + platform-specific locale-related environment variables). In many + cases, but not all, the system default is UTF-8; you should never + count on this default. Any application reading or writing more than + pure ASCII text should probably have a way to override the encoding. * The builtin :class:`basestring` abstract type was removed. Use :class:`str` instead. The :class:`str` and :class:`bytes` types don't have functionality enough in common to warrant a shared base class. +* Filenames are passed to and returned from APIs as (Unicode) strings. + This can present platform-specific problems because on some + platforms filenames are arbitrary byte strings. (On the other hand + on Windows, filenames are natively stored as Unicode.) As a + work-around, most APIs (e.g. :func:`open` and many functions in the + :mod:`os` module) that take filenames accept :class:`bytes` objects + as well as strings, and a few APIs have a way to ask for a + :class:`bytes` return value: :func:`os.listdir` returns a + :class:`bytes` instance if the argument is a :class:`bytes` + instance, and :func:`os.getcwdu` returns the current working + directory as a :class:`bytes` instance. + +* Some system APIs like :data:`os.environ` and :data:`sys.argv` can + also present problems when the bytes made available by the system is + not interpretable using the default encoding. Setting the ``LANG`` + variable and rerunning the program is probably the best approach. + * All backslashes in raw strings are interpreted literally. This means that ``'\U'`` and ``'\u'`` escapes in raw strings are not treated specially. @@ -439,7 +460,7 @@ start deprecating the ``%`` operator in Python 3.1. * :ref:`pep-3105`. This is now a standard feature and no longer needs - to be imported from :mod:`__future__`. + to be imported from :mod:`__future__`. More details were given above. * :ref:`pep-3110`. The :keyword:`except` *exc* :keyword:`as` *var* syntax is now standard and :keyword:`except` *exc*, *var* is no From python-3000-checkins at python.org Wed Dec 3 05:15:36 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Wed, 3 Dec 2008 05:15:36 +0100 (CET) Subject: [Python-3000-checkins] r67490 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081203041536.36C701E400C@bag.python.org> Author: guido.van.rossum Date: Wed Dec 3 05:15:35 2008 New Revision: 67490 Log: More cleanup. Moved all Unicode and str/bytes info to the text/data subsection in common pitfalls, rather than spreading it out. Made this the last subsection of common pitfalls. All XXX comments are now gone. I'm sure much is still missing, we'll have to clean that up post 3.0. At least all PEPs and all implemented items in PEP 3100 have at least one mention. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 05:15:35 2008 @@ -4,8 +4,6 @@ .. XXX Add trademark info for Apple, Microsoft. -.. XXX Remove duplicates; just put info in the most relevant section. - :Author: Guido van Rossum :Release: |release| :Date: |today| @@ -132,112 +130,6 @@ :func:`print` function calls, so this is mostly a non-issue for larger projects. -Text Vs. Data Instead Of Unicode Vs. 8-bit ------------------------------------------- - -Everything you thought you knew about binary data and Unicode has -changed: - -XXX HIRO - -* Python 3.0 uses the concepts of *text* and (binary) *data* instead - of Unicode strings and 8-bit strings. All text is Unicode; however - *encoded* Unicode is represented as binary data. The type used to - hold text is :class:`str`, the type used to hold data is - :class:`bytes`. The difference is that any attempt to mix text and - data in Python 3.0 raises a TypeError exception, whereas if you were - to mix Unicode and 8-bit strings in Python 2.x, you would only get - an exception if the 8-bit string contained non-ASCII values. As a - consequence, pretty much all code that uses Unicode, encodings or - binary data most likely has to change. The change is for the - better, as in the 2.x world there were numerous bugs having to do - with mixing encoded and unencoded text. - -* You no longer use ``u"..."`` literals for Unicode text. However, - you must use ``b"..."`` literals for binary data. - -* Files opened as text files (still the default mode for :func:`open`) - always use an encoding to map between strings (in memory) and bytes - (on disk). Binary files (opened with a ``b`` in the mode argument) - always use bytes in memory. This means that if a file is opened - using an incorrect mode or encoding, I/O will likely fail. It also - means that even Unix users will have to specify the correct mode - (text or binary) when opening a file. There is a platform-dependent - default encoding, which on Unixy platforms can be set with the - ``LANG`` environment variable (and sometimes also with some other - platform-specific locale-related environment variables). In many - cases, but not all, the system default is UTF-8; you should never - count on this default. Any application reading or writing more than - pure ASCII text should probably have a way to override the encoding. - -* The builtin :class:`basestring` abstract type was removed. Use - :class:`str` instead. The :class:`str` and :class:`bytes` types - don't have functionality enough in common to warrant a shared base - class. - -* Filenames are passed to and returned from APIs as (Unicode) strings. - This can present platform-specific problems because on some - platforms filenames are arbitrary byte strings. (On the other hand - on Windows, filenames are natively stored as Unicode.) As a - work-around, most APIs (e.g. :func:`open` and many functions in the - :mod:`os` module) that take filenames accept :class:`bytes` objects - as well as strings, and a few APIs have a way to ask for a - :class:`bytes` return value: :func:`os.listdir` returns a - :class:`bytes` instance if the argument is a :class:`bytes` - instance, and :func:`os.getcwdu` returns the current working - directory as a :class:`bytes` instance. - -* Some system APIs like :data:`os.environ` and :data:`sys.argv` can - also present problems when the bytes made available by the system is - not interpretable using the default encoding. Setting the ``LANG`` - variable and rerunning the program is probably the best approach. - -* All backslashes in raw strings are interpreted literally. This - means that ``'\U'`` and ``'\u'`` escapes in raw strings are not - treated specially. - -XXX Deal with dupes below - -* There is only one text string type; its name is :class:`str` but its - behavior and implementation are like :class:`unicode` in 2.x. - -* The :class:`basestring` superclass has been removed. The ``2to3`` - tool (see below) replaces every occurrence of :class:`basestring` - with :class:`str`. - -* :pep:`3137`: There is a new type, :class:`bytes`, to represent - binary data (and encoded text, which is treated as binary data until - it is decoded). The :class:`str` and :class:`bytes` types cannot be - mixed; you must always explicitly convert between them, using the - :meth:`str.encode` (str -> bytes) or :meth:`bytes.decode` (bytes -> - str) methods. - -* Like :class:`str`, the :class:`bytes` type is immutable. There is a - separate *mutable* type to hold buffered binary data, - :class:`bytearray`. Nearly all APIs that accept :class:`bytes` also - accept :class:`bytearray`. The mutable API is based on - :class:`collections.MutableSequence`. - -* :pep:`3138`: The :func:`repr` of a string no longer escapes - non-ASCII characters. It still escapes control characters and code - points with non-printable status in the Unicode standard, however. - -* :pep:`3120`: The default source encoding is now UTF-8. - -* :pep:`3131`: Non-ASCII letters are now allowed in identifiers. - (However, the standard library remains ASCII-only with the exception - of contributor names in comments.) - -* :pep:`3116`: New I/O implementation. The API is nearly 100% - backwards compatible, but completely reimplemented (currently largely - in Python). Also, binary files use bytes instead of strings. - -* The :mod:`StringIO` and :mod:`cStringIO` modules are gone. Instead, - import :class:`io.StringIO` or :class:`io.BytesIO`, for text and - data respectively. - -* See also the :ref:`unicode-howto`, which was updated for Python 3.0. - Views And Iterators Instead Of Lists ------------------------------------- @@ -277,12 +169,13 @@ elements must be comparable to each other. Note that this does not apply to the ``==`` and ``!=`` operators: objects of different uncomparable types always compare unequal to each other, and an - object always compares equal to itself (i.e., ``x is y`` implies ``x - = y``; this is true even for ``NaN``). + object always compares equal to itself (i.e., ``x is y`` implies + ``x == y``; this is true even for *NaN*). -* :meth:`builtin.sorted` and :meth:`list.sort` no longer accept the *cmp* - argument providing a comparison function. Use the *key* argument - instead. N.B. the *key* and *reverse* arguments are now "keyword-only". +* :meth:`builtin.sorted` and :meth:`list.sort` no longer accept the + *cmp* argument providing a comparison function. Use the *key* + argument instead. N.B. the *key* and *reverse* arguments are now + "keyword-only". * The :func:`cmp` function is gone, and the :meth:`__cmp__` special method is no longer supported. Use :meth:`__lt__` for sorting, @@ -316,6 +209,115 @@ * Octal literals are no longer of the form ``0720``; use ``0o720`` instead. +Text Vs. Data Instead Of Unicode Vs. 8-bit +------------------------------------------ + +Everything you thought you knew about binary data and Unicode has +changed. + +* Python 3.0 uses the concepts of *text* and (binary) *data* instead + of Unicode strings and 8-bit strings. All text is Unicode; however + *encoded* Unicode is represented as binary data. The type used to + hold text is :class:`str`, the type used to hold data is + :class:`bytes`. The biggest difference with the 2.x situation is + that any attempt to mix text and data in Python 3.0 raises + :ext:`TypeError`, whereas if you were to mix Unicode and 8-bit + strings in Python 2.x, it would work if the 8-bit string happened to + contain only 7-bit (ASCII) bytes, but you would get + :ext:`UnicodeDecodeError` if it contained non-ASCII values. This + value-specific behavior has caused numerous sad faces over the + years. + +* As a consequence of this change in philosophy, pretty much all code + that uses Unicode, encodings or binary data most likely has to + change. The change is for the better, as in the 2.x world there + were numerous bugs having to do with mixing encoded and unencoded + text. To be prepared in Python 2.x, start using :class:`unicode` + for all unencoded text, and :class:`str` for binary or encoded data + only. Then the ``2to3`` tool will do most of the work for you. + +* You can no longer use ``u"..."`` literals for Unicode text. + However, you must use ``b"..."`` literals for binary data. + +* As the :class:`str` and :class:`bytes` types cannot be mixed, you + must always explicitly convert between them. Use :meth:`str.encode` + to go from :class:`str` to :class:`bytes`, and :meth:`bytes.decode` + to go from :class:`bytes` to :class:`str`. You can also use + ``bytes(s, encoding=...)`` and ``str(b, encoding=...)``, + respectively. + +* Like :class:`str`, the :class:`bytes` type is immutable. There is a + separate *mutable* type to hold buffered binary data, + :class:`bytearray`. Nearly all APIs that accept :class:`bytes` also + accept :class:`bytearray`. The mutable API is based on + :class:`collections.MutableSequence`. + +* All backslashes in raw string literals are interpreted literally. + This means that ``'\U'`` and ``'\u'`` escapes in raw strings are not + treated specially. For example, ``r'\u20ac'`` is a string of 6 + characters in Python 3.0, whereas in 2.6, ``ur'\u20ac'`` was the + single "euro" character. (Of course, this change only affects raw + string literals; the euro character is ``'\u20ac'`` in Python 3.0.) + +* The builtin :class:`basestring` abstract type was removed. Use + :class:`str` instead. The :class:`str` and :class:`bytes` types + don't have functionality enough in common to warrant a shared base + class. The ``2to3`` tool (see below) replaces every occurrence of + :class:`basestring` with :class:`str`. + +* Files opened as text files (still the default mode for :func:`open`) + always use an encoding to map between strings (in memory) and bytes + (on disk). Binary files (opened with a ``b`` in the mode argument) + always use bytes in memory. This means that if a file is opened + using an incorrect mode or encoding, I/O will likely fail loudly, + instead of silently producing incorrect data. It also means that + even Unix users will have to specify the correct mode (text or + binary) when opening a file. There is a platform-dependent default + encoding, which on Unixy platforms can be set with the ``LANG`` + environment variable (and sometimes also with some other + platform-specific locale-related environment variables). In many + cases, but not all, the system default is UTF-8; you should never + count on this default. Any application reading or writing more than + pure ASCII text should probably have a way to override the encoding. + There is no longer any need for using the encoding-aware streams + in the :mod:`codecs` module. + +* Filenames are passed to and returned from APIs as (Unicode) strings. + This can present platform-specific problems because on some + platforms filenames are arbitrary byte strings. (On the other hand, + on Windows filenames are natively stored as Unicode.) As a + work-around, most APIs (e.g. :func:`open` and many functions in the + :mod:`os` module) that take filenames accept :class:`bytes` objects + as well as strings, and a few APIs have a way to ask for a + :class:`bytes` return value. Thus, :func:`os.listdir` returns a + list of :class:`bytes` instances if the argument is a :class:`bytes` + instance, and :func:`os.getcwdu` returns the current working + directory as a :class:`bytes` instance. Note that when + :func:`os.listdir` returns a list of strings, filenames that + cannot be decoded properly are omitted rather than raising + :exc:`UnicodeError`. + +* Some system APIs like :data:`os.environ` and :data:`sys.argv` can + also present problems when the bytes made available by the system is + not interpretable using the default encoding. Setting the ``LANG`` + variable and rerunning the program is probably the best approach. + +* :pep:`3138`: The :func:`repr` of a string no longer escapes + non-ASCII characters. It still escapes control characters and code + points with non-printable status in the Unicode standard, however. + +* :pep:`3120`: The default source encoding is now UTF-8. + +* :pep:`3131`: Non-ASCII letters are now allowed in identifiers. + (However, the standard library remains ASCII-only with the exception + of contributor names in comments.) + +* The :mod:`StringIO` and :mod:`cStringIO` modules are gone. Instead, + import the :mod:`io` module and use :class:`io.StringIO` or + :class:`io.BytesIO` for text and data respectively. + +* See also the :ref:`unicode-howto`, which was updated for Python 3.0. + Overview Of Syntax Changes ========================== @@ -341,8 +343,8 @@ * Keyword arguments are allowed after the list of base classes in a class definition. This is used by the new convention for specifying - a metaclass (see :pep:`3115`), but can be used for other purposes as - well, as long as the metaclass supports it. + a metaclass (see next section), but can be used for other purposes + as well, as long as the metaclass supports it. * :pep:`3104`: :keyword:`nonlocal` statement. Using ``nonlocal x`` you can now assign directly to a variable in an outer (but @@ -376,8 +378,8 @@ Changed Syntax -------------- -* New :keyword:`raise` statement syntax: ``raise [expr [from expr]]``. - Also note that string exceptions are no longer legal (:pep:`0352`). +* :pep:`3109` and :pep:`3134`: new :keyword:`raise` statement syntax: + ``raise [expr [from expr]]``. See below. * :keyword:`as` and :keyword:`with` are now reserved words. (Since 2.6, actually.) @@ -389,6 +391,22 @@ * Change from :keyword:`except` *exc*, *var* to :keyword:`except` *exc* :keyword:`as` *var*. See :pep:`3110`. +* :pep:`3115`: New Metaclass Syntax. Instead of:: + + class C: + __metaclass__ = M + ... + + you must now use:: + + class C(metaclass=M): + ... + + The module-global :data:`__metaclass__` variable is no longer + supported. (It was a crutch to make it easier to default to + new-style classes without deriving every class from + :class:`object`.) + * List comprehensions no longer support the syntactic form ``[... for var in item1, item2, ...]``. Use ``[... for var in (item1, item2, ...)]`` instead. @@ -430,6 +448,8 @@ not starting with ``.`` are always interpreted as absolute imports. (:pep:`0328`) +* Classic classes are gone. + Changes Already Present In Python 2.6 ===================================== @@ -551,9 +571,10 @@ considered implementation details of the pure Python versions. Users should always import the standard version, which attempts to import the accelerated version and falls back to the pure Python - version. The :mod:`pickle` module received this treatment. The - :mod:`profile` module is on the list for 3.1. The :mod:`StringIO` - module has been turned into a class in the :mod:`io` module. + version. The :mod:`pickle` / :mod:`cPickle` pair received this + treatment. The :mod:`profile` module is on the list for 3.1. The + :mod:`StringIO` module has been turned into a class in the :mod:`io` + module. * Some related modules have been grouped into packages, and usually the submodule names have been simplified. The resulting new @@ -579,7 +600,8 @@ * :mod:`xmlrpc` (:mod:`xmlrpclib`, :mod:`DocXMLRPCServer`, :mod:`SimpleXMLRPCServer`). -Some other library changes (not covered by :pep:`3108`): +Some other changes to standard library moduled, not covered by +:pep:`3108`: * Killed :mod:`sets`. Use the builtin :func:`set` function. @@ -601,6 +623,28 @@ * Cleanup of the :mod:`random` module: removed the :func:`jumpahead` API. +* The :mod:`new` module is gone. + +* The functions :func:`os.tmpnam`, :func:`os.tempnam` and + :func:`os.tmpfile` have been removed in favor of the :mod:`tempfile` + module. + +* The :mod:`tokenize` module has been changed to work with bytes. The + main entry point is now :func:`tokenize.tokenize`, instead of + generate_tokens. + +* :data:`string.letters` and its friends (:data:`string.lowercase` and + :data:`string.uppercase`) are gone. Use + :data:`string.ascii_letters` etc. instead. (The reason for the + removal is that :data:string.letters` and friends had + locale-specific behavior, which is a bad idea for such + attractively-named global "constants".) + +* Renamed module :mod:`__builtin__` to :mod:`builtins` (removing the + underscores, adding an 's'). The :data:`__builtins__` variable + found in most global namespaces is unchanged. To modify a builtin, + you should use :mod:`builtins`, not :data:`__builtins__`! + :pep:`3101`: A New Approach To String Formatting ================================================ @@ -612,81 +656,86 @@ scoop. -:pep:`3106`: Revamping dict :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict.values` -========================================================================================= - -.. XXX expand this (but note that the "pitfalls" section currently has -.. XXX more detail :-) - -* The :meth:`dict.iterkeys`, :meth:`dict.itervalues` and :meth:`dict.iteritems` - methods have been removed. - -* :meth:`dict.keys`, :meth:`dict.values` and :meth:`dict.items` return objects - with set behavior that reference the underlying dict; these are often - referred to as *dictionary views*. - +Changes To Exceptions +===================== -Exception Stuff -=============== +The APIs for raising and catching exception have been cleaned up and +new powerful features added: * :pep:`0352`: All exceptions must be derived (directly or indirectly) from :exc:`BaseException`. This is the root of the exception - hierarchy. Most exceptions should actually be derived from - :exc:`Exception`. This is not a new recommendation, but the + hierarchy. This is not new as a recommendation, but the *requirement* to inherit from :exc:`BaseException` is new. (Python 2.6 still allowed classic classes to be raised, and placed no - restriction on what you can catch.) - -* :exc:`StandardError` was removed (in 2.6, actually). - -* Dropping sequence behavior (slicing!) and :attr:`message` attribute of - exception instances. - -* :pep:`3109`: Raising exceptions. You must now use ``raise Exception(args)`` - instead of ``raise Exception, args``. - -* :pep:`3110`: Catching exceptions. You must now use ``except SomeException as - identifier:`` instead of ``except Exception, identifier:`` - -* :pep:`3134`: Exception chaining. XXX - -* A few exception messages are improved when Windows fails to load an extension - module. For example, ``error code 193`` is now ``%1 is not a valid Win32 - application``. Strings now deal with non-English locales. + restriction on what you can catch.) As a consequence, string + exceptions are finally truly and utterly dead. +* Almost all exceptions should actually derive from :exc:`Exception`; + :exc:`BaseException` should only be used as a base class for + exceptions that should only be handled at the top level, such as + :exc:`SystemExit` or :exc:`KeyboardInterrupt`. The recommended + idiom for handling all exceptions except for this latter category is + to use :keyword:`except` :exc:`Exception`. + +* :exc:`StandardError` was removed (in 2.6 already). + +* Exceptions no longer behave as sequences. Use the :attr:`args` + attribute instead. + +* :pep:`3109`: Raising exceptions. You must now use :keyword:`raise` + *Exception*(*args*) instead of :keyword:`raise` *Exception*, *args*. + Additionally, you can no longer explicitly specify a traceback; + instead, if you *have* to do this, you can assign directly to the + :attr:`__traceback__` attribute (see below). + +* :pep:`3110`: Catching exceptions. You must now use + *:keyword:`except` SomeException* :keyword:`as` *variable* instead + *of :keyword:`except` *SomeException*, variable*. Moreover, the + *variable* is explicitly deleted when the :keyword:`except` block + is left. + +* :pep:`3134`: Exception chaining. There are two cases: implicit + chaining and explicit chaining. Implicit chaining happens when an + exception is raised in an :keyword:`except` or :keyword:`finally` + handler block. This usually happens due to a bug in the handler + block; we call this a *secondary* exception. In this case, the + original exception (that was being handled) is saved as the + :attr:`__context__` attribute of the secondary exception. + Explicit chaining is invoked with this syntax:: + + raise SecondaryException() from primary_exception + + (where *primary_exception* is any expression that produces an + exception object, probably an exception that was previously caught). + In this case, the primary exception is stored on the + :attr:`__cause__` attribute of the secondary exception. The + traceback printed when an unhandled exception occurs walks the chain + of :attr:`__cause__` and :attr:`__context__` attributes and prints a + separate traceback for each component of the chain, with the primary + exception at the top. (Java users may recognize this behavior. :-) + +* :pep:`3134`: Exception objects now store their traceback as the + :attr:`__traceback__` attribute. This means that an exception + object now contains all the information pertaining to an exception, + and there are fewer reasons to use :func:`sys.exc_info` (though the + latter is not removed). + +* A few exception messages are improved when Windows fails to load an + extension module. For example, ``error code 193`` is now ``%1 is + not a valid Win32 application``. Strings now deal with non-English + locales. -New Class And Metaclass Stuff -============================= -XXX Move to new syntax section??? +Miscellaneous Other Changes +=========================== -* Classic classes are gone. - -* :pep:`3115`: New Metaclass Syntax. Instead of:: - - class C: - __metaclass__ = M - ... - - you now use:: - - class C(metaclass=M): - ... - - The module-global :data:`__metaclass__` variable is no longer supported. - (It was a crutch to make it easier to default to new-style classes - without deriving every class from :class:`object`.) - - -Other Language Changes -====================== - -* Moved :func:`intern` to :func:`sys.intern`. +Operators And Special Methods +----------------------------- * ``!=`` now returns the opposite of ``==``, unless ``==`` returns - ``NotImplemented``. + :data:`NotImplemented`. -* The concept of "unbound methods" was removed from the language. +* The concept of "unbound methods" has been removed from the language. When referencing a method as a class attribute, you now get a plain function object. @@ -696,27 +745,46 @@ :meth:`__delitem__`, when used as an assignment or deletion target, respectively). -* :pep:`3111`: :func:`raw_input` renamed to :func:`input`. That is, - the new :func:`input` function reads a line from :data:`sys.stdin` - and returns it with the trailing newline stripped. It raises - :exc:`EOFError` if the input is terminated prematurely. To get the - old behavior of :func:`input`, use ``eval(input())``. +* :pep:`3114`: the standard :meth:`next` method has been renamed to + :meth:`__next__`. + +* The :meth:`__oct__` and :meth:`__hex__` special methods are removed + -- :func:`oct` and :func:`hex` use :meth:`__index__` now to convert + the argument to an integer. + +* Removed support for :attr:`__members__` and :attr:`__methods__`. + +* The function attributes named :attr:`func_X` have been renamed to + use the :data:`__X__` form, freeing up these names in the function + attribute namespace for user-defined attributes. To wit, + :attr:`func_closure`, :attr:`func_code`, :attr:`func_defaults`, + :attr:`func_dict`, :attr:`func_doc`, :attr:`func_globals`, + :attr:`func_name` were renamed to :attr:`__closure__`, + :attr:`__code__`, :attr:`__defaults__`, :attr:`__dict__`, + :attr:`__doc__`, :attr:`__globals__`, :attr:`__name__`, + respectively. -* :pep:`3114`: ``.next()`` renamed to :meth:`__next__`, new builtin - :func:`next` to call the :meth:`__next__` method on an object. +* :meth:`__nonzero__` is now :meth:`__bool__`. + +Builtins +-------- * :pep:`3135`: New :func:`super`. You can now invoke :func:`super` - without arguments and the right class and instance will - automatically be chosen. With arguments, its behavior is unchanged. + without arguments and (assuming this is in a regular instance method + defined inside a :keyword:`class` statement) the right class and + instance will automatically be chosen. With arguments, the behavior + of :func:`super` is unchanged. + +* :pep:`3111`: :func:`raw_input` was renamed to :func:`input`. That + is, the new :func:`input` function reads a line from + :data:`sys.stdin` and returns it with the trailing newline stripped. + It raises :exc:`EOFError` if the input is terminated prematurely. + To get the old behavior of :func:`input`, use ``eval(input())``. -* :func:`zip`, :func:`map` and :func:`filter` return iterators. +* A new builtin :func:`next` was added to call the :meth:`__next__` + method on an object. -* :data:`string.letters` and its friends (:data:`string.lowercase` and - :data:`string.uppercase`) are gone. Use - :data:`string.ascii_letters` etc. instead. (The reason for the - removal is that :data:string.letters` and friends had - locale-specific behavior, which is a bad idea for such - attractively-named global "constants".) +* Moved :func:`intern` to :func:`sys.intern`. * Removed: :func:`apply`. Instead of ``apply(f, args)`` use ``f(*args)``. @@ -742,110 +810,49 @@ * Removed. :meth:`dict.has_key` -- use the :keyword:`in` operator instead. -* The :meth:`__oct__` and :meth:`__hex__` special methods are removed - -- :func:`oct` and :func:`hex` use :meth:`__index__` now to convert - the argument to an integer. - -* Removed support for :attr:`__members__` and :attr:`__methods__`. - -* Renamed the boolean conversion C-level slot and method: - ``nb_nonzero`` is now ``nb_bool`` and :meth:`__nonzero__` is now - :meth:`__bool__`. - -* Renamed module :mod:`__builtin__` to :mod:`builtins` (removing the - underscores, adding an 's'). The :data:`__builtins__` variable - found in most global namespaces is unchanged. To modify a builtin, - you should use :mod:`builtins`, not :data:`__builtins__`! - -* Renamed function attributes :attr:`func_whatever` to - :attr:`__whatever__`. XXX list every single one. - -* Removed :exc:`StandardError`. - -* Removed METH_OLDARGS and WITH_CYCLE_GC. XXX more. - .. ====================================================================== -Optimizations -------------- - -The net result of the 3.0 generalizations is that Python 3.0 runs the -pystone benchmark around 10% slower than Python 2.5. Most likely the -biggest cause is the removal of special-casing for small integers. -There's room for improvement, but it will happen after 3.0 is -released! - -.. ====================================================================== - - -New, Improved, And Deprecated Modules -===================================== - -As usual, Python's standard library received a number of enhancements and bug -fixes. Here's a partial list of the most notable changes, sorted alphabetically -by module name. Consult the :file:`Misc/NEWS` file in the source tree for a more -complete list of changes, or look through the Subversion logs for all the -details. - -* The :mod:`cPickle` module is gone. Use :mod:`pickle` instead. Eventually - we'll have a transparent accelerator module. - -* The :mod:`imageop` module is gone. - -* The :mod:`audiodev`, :mod:`Bastion`, :mod:`bsddb185`, :mod:`exceptions`, - :mod:`linuxaudiodev`, :mod:`md5`, :mod:`MimeWriter`, :mod:`mimify`, - :mod:`popen2`, :mod:`rexec`, :mod:`sets`, :mod:`sha`, :mod:`stringold`, - :mod:`strop`, :mod:`sunaudiodev`, :mod:`timing`, and :mod:`xmllib` modules are - gone. - -* The :mod:`bsddb` module is gone. It is being maintained externally - with its own release schedule better mirroring that of BerkeleyDB. - See http://www.jcea.es/programacion/pybsddb.htm. - -* The :mod:`new` module is gone. - -* The functions :func:`os.tmpnam`, :func:`os.tempnam` and :func:`os.tmpfile` - have been removed in favor of the :mod:`tempfile` module. - -* The :mod:`tokenize` module has been changed to work with bytes. The main - entry point is now :func:`tokenize.tokenize`, instead of generate_tokens. - -.. ====================================================================== -.. whole new modules get described in subsections here - -.. ====================================================================== - - -Build And C API Changes +Build and C API Changes ======================= -Changes to Python's build process and to the C API include: +Due to time constraints, here is a *very* incomplete list of changes +to the C API. -* :pep:`3118`: New Buffer API. XXX +* Support for several platforms was dropped, including but not limited + to Mac OS 9, BeOS, RISCOS, Irix, and Tru64. -* :pep:`3121`: Extension Module Initialization & Finalization. XXX +* :pep:`3118`: New Buffer API. -* :pep:`3123`: Making :cmacro:`PyObject_HEAD` conform to standard C. XXX +* :pep:`3121`: Extension Module Initialization & Finalization. + +* :pep:`3123`: Making :cmacro:`PyObject_HEAD` conform to standard C. * No more C API support for restricted execution. -* :cfunc:`PyNumber_Coerce`, :cfunc:`PyNumber_CoerceEx`, :cfunc:`PyMember_Get`, - and :cfunc:`PyMember_Set` C APIs are removed. +* :cfunc:`PyNumber_Coerce`, :cfunc:`PyNumber_CoerceEx`, + :cfunc:`PyMember_Get`, and :cfunc:`PyMember_Set` C APIs are removed. * New C API :cfunc:`PyImport_ImportModuleNoBlock`, works like - :cfunc:`PyImport_ImportModule` but won't block on the import lock (returning - an error instead). + :cfunc:`PyImport_ImportModule` but won't block on the import lock + (returning an error instead). -.. ====================================================================== +* Renamed the boolean conversion C-level slot and method: + ``nb_nonzero`` is now ``nb_bool``. +* Removed ``METH_OLDARGS`` and ``WITH_CYCLE_GC`` from the C API. + +.. ====================================================================== -Port-Specific Changes ---------------------- -XXX Platform-specific changes go here. +Performance +=========== -* XXX BeOS, RISCOS, Irix, Tru64 support +The net result of the 3.0 generalizations is that Python 3.0 runs the +pystone benchmark around 10% slower than Python 2.5. Most likely the +biggest cause is the removal of special-casing for small integers. +There's room for improvement, but it will happen after 3.0 is +released! .. ====================================================================== From python-3000-checkins at python.org Wed Dec 3 05:18:17 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Wed, 3 Dec 2008 05:18:17 +0100 (CET) Subject: [Python-3000-checkins] r67491 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081203041817.CC1A71E4002@bag.python.org> Author: guido.van.rossum Date: Wed Dec 3 05:18:17 2008 New Revision: 67491 Log: Fix bad markup. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 05:18:17 2008 @@ -221,10 +221,10 @@ hold text is :class:`str`, the type used to hold data is :class:`bytes`. The biggest difference with the 2.x situation is that any attempt to mix text and data in Python 3.0 raises - :ext:`TypeError`, whereas if you were to mix Unicode and 8-bit + :exc:`TypeError`, whereas if you were to mix Unicode and 8-bit strings in Python 2.x, it would work if the 8-bit string happened to contain only 7-bit (ASCII) bytes, but you would get - :ext:`UnicodeDecodeError` if it contained non-ASCII values. This + :exc:`UnicodeDecodeError` if it contained non-ASCII values. This value-specific behavior has caused numerous sad faces over the years. From python-3000-checkins at python.org Wed Dec 3 06:39:28 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Wed, 3 Dec 2008 06:39:28 +0100 (CET) Subject: [Python-3000-checkins] r67492 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081203053928.A010C1E4002@bag.python.org> Author: guido.van.rossum Date: Wed Dec 3 06:39:28 2008 New Revision: 67492 Log: Some textual tweaks, and fixed a few typos found by a spell checker. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 06:39:28 2008 @@ -55,17 +55,26 @@ This article explains the new features in Python 3.0, compared to 2.6. Python 3.0, also known as "Python 3000" or "Py3K", is the first ever -*intentionally incompatible* release. There are more changes than in -a typical release, and more that are important for all Python users. -Nevertheless, after digesting the changes, you'll find that Python -really hasn't changed all that much -- by and large, we're merely -fixing well-known annoyances and warts. +*intentionally backwards incompatible* Python release. There are more +changes than in a typical release, and more that are important for all +Python users. Nevertheless, after digesting the changes, you'll find +that Python really hasn't changed all that much -- by and large, we're +mostly fixing well-known annoyances and warts, and removing a lot of +old cruft. This article doesn't attempt to provide a complete specification of -the new features, but instead provides a convenient overview. For -full details, you should refer to the documentation for Python 3.0. If -you want to understand the complete implementation and design -rationale, refer to the PEP for a particular new feature. +all new features, but instead tries to give a convenient overview. +For full details, you should refer to the documentation for Python +3.0, and/or the many PEPs referenced in the text. If you want to +understand the complete implementation and design rationale for a +particular feature, PEPs usually have more details than the regular +documentation; but note that PEPs usually are not kept up-to-date once +a feature has been fully implemented. + +Due to time constraints this document is not as complete as it should +have been. As always for a new release, the ``Misc/NEWS`` file in the +source distribution contains a wealth of detailed information about +every small thing that was changed. .. Compare with previous release in 2 - 3 sentences here. .. add hyperlink when the documentation becomes available online. @@ -144,11 +153,14 @@ * Also, the :meth:`dict.iterkeys`, :meth:`dict.iteritems` and :meth:`dict.itervalues` methods are no longer supported. -* :func:`map` and :func:`filter` return iterators. A quick fix is e.g. - ``list(map(...))``, but a better fix is often to use a list - comprehension (especially when the original code uses :keyword:`lambda`). - Particularly tricky is :func:`map` invoked for the side effects of the - function; the correct transformation is to use a for-loop. +* :func:`map` and :func:`filter` return iterators. If you really need + a list, a quick fix is e.g. ``list(map(...))``, but a better fix is + often to use a list comprehension (especially when the original code + uses :keyword:`lambda`), or rewriting the code so it doesn't need a + list at all. Particularly tricky is :func:`map` invoked for the + side effects of the function; the correct transformation is to use a + regular :keyword:`for` loop (since creating a list would just be + wasteful). * :func:`range` now behaves like :func:`xrange` used to behave, except it works with values of arbitrary size. The latter no longer @@ -164,13 +176,14 @@ * The ordering comparison operators (``<``, ``<=``, ``>=``, ``>``) raise a TypeError exception when the operands don't have a meaningful natural ordering. Thus, expressions like ``1 < ''``, ``0 - > None`` or ``len <= len`` are no longer valid. A corollary is that - sorting a heterogeneous list no longer makes sense -- all the - elements must be comparable to each other. Note that this does not - apply to the ``==`` and ``!=`` operators: objects of different - uncomparable types always compare unequal to each other, and an - object always compares equal to itself (i.e., ``x is y`` implies - ``x == y``; this is true even for *NaN*). + > None`` or ``len <= len`` are no longer valid, and e.g. ``None < + None`` raises :exc:`TypeError` instead of returning + :keyword:`False`. A corollary is that sorting a heterogeneous list + no longer makes sense -- all the elements must be comparable to each + other. Note that this does not apply to the ``==`` and ``!=`` + operators: objects of different incomparable types always compare + unequal to each other, and an object always compares equal to itself + (i.e., ``x is y`` implies ``x == y``; this is true even for *NaN*). * :meth:`builtin.sorted` and :meth:`list.sort` no longer accept the *cmp* argument providing a comparison function. Use the *key* @@ -196,7 +209,7 @@ existed for years, at least since Python 2.2.) * The :data:`sys.maxint` constant was removed, since there is no - longer a limit to the value of ints. However, :data:`sys.maxsize` + longer a limit to the value of integers. However, :data:`sys.maxsize` can be used as an integer larger than any practical list or string index. It conforms to the implementation's "natural" integer size and is typically the same as :data:`sys.maxint` in previous releases @@ -542,7 +555,7 @@ * The :mod:`bsddb3` package was removed because its presence in the core standard library has proved over time to be a particular burden - for the core developers due to testing instability and Berlekey DB's + for the core developers due to testing instability and Berkeley DB's release schedule. However, the package is alive and well, externally maintained at http://www.jcea.es/programacion/pybsddb.htm. @@ -599,8 +612,8 @@ * :mod:`xmlrpc` (:mod:`xmlrpclib`, :mod:`DocXMLRPCServer`, :mod:`SimpleXMLRPCServer`). - -Some other changes to standard library moduled, not covered by +modules +Some other changes to standard library modules, not covered by :pep:`3108`: * Killed :mod:`sets`. Use the builtin :func:`set` function. @@ -840,7 +853,7 @@ * Renamed the boolean conversion C-level slot and method: ``nb_nonzero`` is now ``nb_bool``. -* Removed ``METH_OLDARGS`` and ``WITH_CYCLE_GC`` from the C API. +* Removed :cmacro:`METH_OLDARGS` and :cmacro:`WITH_CYCLE_GC` from the C API. .. ====================================================================== From python-3000-checkins at python.org Wed Dec 3 07:45:00 2008 From: python-3000-checkins at python.org (georg.brandl) Date: Wed, 3 Dec 2008 07:45:00 +0100 (CET) Subject: [Python-3000-checkins] r67493 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081203064500.3A1191E4002@bag.python.org> Author: georg.brandl Date: Wed Dec 3 07:44:59 2008 New Revision: 67493 Log: Use the :mod: role. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 07:44:59 2008 @@ -474,7 +474,7 @@ consulted for longer descriptions. * :ref:`pep-0343`. The :keyword:`with` statement is now a standard - feature and no longer needs to be imported from the ``__future__``. + feature and no longer needs to be imported from the :mod:`__future__`. Also check out :ref:`new-26-context-managers` and :ref:`new-module-contextlib`. From python-3000-checkins at python.org Wed Dec 3 14:39:04 2008 From: python-3000-checkins at python.org (christian.heimes) Date: Wed, 3 Dec 2008 14:39:04 +0100 (CET) Subject: [Python-3000-checkins] r67495 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081203133904.304DF1E4002@bag.python.org> Author: christian.heimes Date: Wed Dec 3 14:39:03 2008 New Revision: 67495 Log: Fixed a warning on whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 14:39:03 2008 @@ -612,7 +612,7 @@ * :mod:`xmlrpc` (:mod:`xmlrpclib`, :mod:`DocXMLRPCServer`, :mod:`SimpleXMLRPCServer`). -modules + Some other changes to standard library modules, not covered by :pep:`3108`: From python-3000-checkins at python.org Wed Dec 3 16:04:01 2008 From: python-3000-checkins at python.org (raymond.hettinger) Date: Wed, 3 Dec 2008 16:04:01 +0100 (CET) Subject: [Python-3000-checkins] r67496 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081203150401.7F91F1E4002@bag.python.org> Author: raymond.hettinger Date: Wed Dec 3 16:04:01 2008 New Revision: 67496 Log: Minor edits. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 16:04:01 2008 @@ -147,7 +147,7 @@ * :class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict.values` return "views" instead of lists. For example, this no longer works: ``k = d.keys(); k.sort()``. Use ``k = - sorted(d)`` instead (this works in Python 2.5 too, and is just + sorted(d)`` instead (this works in Python 2.5 too and is just as efficient). * Also, the :meth:`dict.iterkeys`, :meth:`dict.iteritems` and @@ -386,7 +386,8 @@ * New binary literals, e.g. ``0b1010`` (already in 2.6). -* Bytes literals are introduced with a leading ``b`` or ``B``. +* Bytes literals are introduced with a leading ``b`` or ``B``, and + there is a new corresponding builtin function, :func:`bin`. Changed Syntax -------------- @@ -524,7 +525,7 @@ :mod:`collections` module plays a somewhat more prominent role in the language now, and builtin collection types like :class:`dict` and :class:`list` conform to the :class:`collections.MutableMapping` - and :class:`collections.MutableSequence` ABC, respectively. + and :class:`collections.MutableSequence` ABCs, respectively. * :ref:`pep-3127`. As mentioned above, the new octal literal notation is the only one supported, and binary literals have been From python-3000-checkins at python.org Wed Dec 3 16:24:50 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Wed, 3 Dec 2008 16:24:50 +0100 (CET) Subject: [Python-3000-checkins] r67497 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081203152450.6C3BD1E405F@bag.python.org> Author: guido.van.rossum Date: Wed Dec 3 16:24:50 2008 New Revision: 67497 Log: Remove remark about NaN==NaN, I misunderstood that issue. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Wed Dec 3 16:24:50 2008 @@ -182,8 +182,7 @@ no longer makes sense -- all the elements must be comparable to each other. Note that this does not apply to the ``==`` and ``!=`` operators: objects of different incomparable types always compare - unequal to each other, and an object always compares equal to itself - (i.e., ``x is y`` implies ``x == y``; this is true even for *NaN*). + unequal to each other. * :meth:`builtin.sorted` and :meth:`list.sort` no longer accept the *cmp* argument providing a comparison function. Use the *key* From python-3000-checkins at python.org Wed Dec 3 17:46:15 2008 From: python-3000-checkins at python.org (barry.warsaw) Date: Wed, 3 Dec 2008 17:46:15 +0100 (CET) Subject: [Python-3000-checkins] r67500 - in python/branches/py3k: Doc/license.rst Doc/tutorial/interpreter.rst Doc/tutorial/stdlib.rst Doc/tutorial/stdlib2.rst Include/patchlevel.h LICENSE Lib/distutils/__init__.py Lib/idlelib/idlever.py Misc/HISTORY Misc/NEWS README RELNOTES Message-ID: <20081203164615.4B8C41E400C@bag.python.org> Author: barry.warsaw Date: Wed Dec 3 17:46:14 2008 New Revision: 67500 Log: Prep for Python 3.1! Modified: python/branches/py3k/Doc/license.rst python/branches/py3k/Doc/tutorial/interpreter.rst python/branches/py3k/Doc/tutorial/stdlib.rst python/branches/py3k/Doc/tutorial/stdlib2.rst python/branches/py3k/Include/patchlevel.h python/branches/py3k/LICENSE python/branches/py3k/Lib/distutils/__init__.py python/branches/py3k/Lib/idlelib/idlever.py python/branches/py3k/Misc/HISTORY python/branches/py3k/Misc/NEWS python/branches/py3k/README python/branches/py3k/RELNOTES Modified: python/branches/py3k/Doc/license.rst ============================================================================== --- python/branches/py3k/Doc/license.rst (original) +++ python/branches/py3k/Doc/license.rst Wed Dec 3 17:46:14 2008 @@ -90,7 +90,7 @@ +----------------+--------------+------------+------------+-----------------+ | 2.6 | 2.5 | 2008 | PSF | yes | +----------------+--------------+------------+------------+-----------------+ -| 3.0 | 2.6 | 2007 | PSF | yes | +| 3.0 | 2.6 | 2008 | PSF | yes | +----------------+--------------+------------+------------+-----------------+ .. note:: Modified: python/branches/py3k/Doc/tutorial/interpreter.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/interpreter.rst (original) +++ python/branches/py3k/Doc/tutorial/interpreter.rst Wed Dec 3 17:46:14 2008 @@ -10,11 +10,11 @@ Invoking the Interpreter ======================== -The Python interpreter is usually installed as :file:`/usr/local/bin/python3.0` +The Python interpreter is usually installed as :file:`/usr/local/bin/python3.1` on those machines where it is available; putting :file:`/usr/local/bin` in your Unix shell's search path makes it possible to start it by typing the command :: - python3.0 + python3.1 to the shell. [#]_ Since the choice of the directory where the interpreter lives is an installation option, other places are possible; check with your local @@ -22,11 +22,11 @@ popular alternative location.) On Windows machines, the Python installation is usually placed in -:file:`C:\\Python30`, though you can change this when you're running the +:file:`C:\\Python31`, though you can change this when you're running the installer. To add this directory to your path, you can type the following command into the command prompt in a DOS box:: - set path=%path%;C:\python30 + set path=%path%;C:\python31 Typing an end-of-file character (:kbd:`Control-D` on Unix, :kbd:`Control-Z` on Windows) at the primary prompt causes the interpreter to exit with a zero exit @@ -101,13 +101,13 @@ prints a welcome message stating its version number and a copyright notice before printing the first prompt:: - $ python3.0 - Python 3.0a1 (py3k, Sep 12 2007, 12:21:02) + $ python3.1 + Python 3.1a1 (py3k, Sep 12 2007, 12:21:02) [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> -.. XXX update for final release of Python 3.0 +.. XXX update for final release of Python 3.1 Continuation lines are needed when entering a multi-line construct. As an example, take a look at this :keyword:`if` statement:: @@ -155,7 +155,7 @@ On BSD'ish Unix systems, Python scripts can be made directly executable, like shell scripts, by putting the line :: - #! /usr/bin/env python3.0 + #! /usr/bin/env python3.1 (assuming that the interpreter is on the user's :envvar:`PATH`) at the beginning of the script and giving the file an executable mode. The ``#!`` must be the @@ -243,7 +243,7 @@ .. rubric:: Footnotes -.. [#] On Unix, the 3.0 interpreter is by default not installed with the +.. [#] On Unix, the 3.1 interpreter is by default not installed with the executable named ``python``, so that it does not conflict with a simultaneously installed Python 2.x executable. Modified: python/branches/py3k/Doc/tutorial/stdlib.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/stdlib.rst (original) +++ python/branches/py3k/Doc/tutorial/stdlib.rst Wed Dec 3 17:46:14 2008 @@ -17,7 +17,7 @@ >>> os.system('time 0:02') 0 >>> os.getcwd() # Return the current working directory - 'C:\\Python30' + 'C:\\Python31' >>> os.chdir('/server/accesslogs') Be sure to use the ``import os`` style instead of ``from os import *``. This Modified: python/branches/py3k/Doc/tutorial/stdlib2.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/stdlib2.rst (original) +++ python/branches/py3k/Doc/tutorial/stdlib2.rst Wed Dec 3 17:46:14 2008 @@ -271,7 +271,7 @@ Traceback (most recent call last): File "", line 1, in d['primary'] # entry was automatically removed - File "C:/python30/lib/weakref.py", line 46, in __getitem__ + File "C:/python31/lib/weakref.py", line 46, in __getitem__ o = self.data[key]() KeyError: 'primary' Modified: python/branches/py3k/Include/patchlevel.h ============================================================================== --- python/branches/py3k/Include/patchlevel.h (original) +++ python/branches/py3k/Include/patchlevel.h Wed Dec 3 17:46:14 2008 @@ -17,13 +17,13 @@ /* Version parsed out into numeric values */ /*--start constants--*/ #define PY_MAJOR_VERSION 3 -#define PY_MINOR_VERSION 0 +#define PY_MINOR_VERSION 1 #define PY_MICRO_VERSION 0 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 3 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.0rc3+" +#define PY_VERSION "3.1a0" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository) */ Modified: python/branches/py3k/LICENSE ============================================================================== --- python/branches/py3k/LICENSE (original) +++ python/branches/py3k/LICENSE Wed Dec 3 17:46:14 2008 @@ -56,7 +56,7 @@ 2.5 2.4 2006 PSF yes 2.5.1 2.5 2007 PSF yes 2.6 2.5 2008 PSF yes - 3.0 2.6 2007 PSF yes + 3.0 2.6 2008 PSF yes Footnotes: Modified: python/branches/py3k/Lib/distutils/__init__.py ============================================================================== --- python/branches/py3k/Lib/distutils/__init__.py (original) +++ python/branches/py3k/Lib/distutils/__init__.py Wed Dec 3 17:46:14 2008 @@ -20,5 +20,5 @@ # #--start constants-- -__version__ = "3.0rc3" +__version__ = "3.1a0" #--end constants-- Modified: python/branches/py3k/Lib/idlelib/idlever.py ============================================================================== --- python/branches/py3k/Lib/idlelib/idlever.py (original) +++ python/branches/py3k/Lib/idlelib/idlever.py Wed Dec 3 17:46:14 2008 @@ -1 +1 @@ -IDLE_VERSION = "3.0rc3" +IDLE_VERSION = "3.1a0" Modified: python/branches/py3k/Misc/HISTORY ============================================================================== --- python/branches/py3k/Misc/HISTORY (original) +++ python/branches/py3k/Misc/HISTORY Wed Dec 3 17:46:14 2008 @@ -10,6 +10,1396 @@ ====================================================================== +What's New in Python 3.0 final +============================== + +*Release date: 03-Dec-2008* + +Core and Builtins +----------------- + +- Issue #3996: On Windows, the PyOS_CheckStack function would cause the + interpreter to abort ("Fatal Python error: Could not reset the stack!") + instead of throwing a MemoryError. + +- Issue #3689: The list reversed iterator now supports __length_hint__ + instead of __len__. Behavior now matches other reversed iterators. + +- Issue #4367: Python would segfault during compiling when the unicodedata + module couldn't be imported and \N escapes were present. + +- Fix build failure of _cursesmodule.c building with -D_FORTIFY_SOURCE=2. + +Library +------- + +- Issue #4387: binascii now refuses to accept str as binary input. + +- Issue #4073: Add 2to3 support to build_scripts, refactor that support + in build_py. + +- IDLE would print a "Unhandled server exception!" message when internal + debugging is enabled. + +- Issue #4455: IDLE failed to display the windows list when two windows have + the same title. + +- Issue #3741: DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an + exception. + +- Issue #4433: Fixed an access violation when garbage collecting + _ctypes.COMError instances. + +- Issue #4429: Fixed UnicodeDecodeError in ctypes. + +- Issue #4373: Corrected a potential reference leak in the pickle module and + silenced a false positive ref leak in distutils.tests.test_build_ext. + +- Issue #4382: dbm.dumb did not specify the expected file encoding for opened + files. + +- Issue #4383: When IDLE cannot make the connection to its subprocess, it would + fail to properly display the error message. + +Build +----- + +- Issue #4407: Fix source file that caused the compileall step in Windows installer + to fail. + +Docs +---- + +- Issue #4449: Fixed multiprocessing examples + +- Issue #3799: Document that dbm.gnu and dbm.ndbm will accept string arguments + for keys and values which will be converted to bytes before committal. + + +What's New in Python 3.0 release candidate 3? +============================================= + +*Release date: 20-Nov-2008* + + +Core and Builtins +----------------- + +- Issue #4349: sys.path included a non-existent platform directory because of a + faulty Makefile. + +- Issue #3327: Don't overallocate in the modules_by_index list. + +- Issue #1721812: Binary set operations and copy() returned the input type + instead of the appropriate base type. This was incorrect because set + subclasses would be created without their __init__() method being called. + The corrected behavior brings sets into line with lists and dicts. + +- Issue #4296: Fix PyObject_RichCompareBool so that "x in [x]" evaluates to + True, even when x doesn't compare equal to itself. This was a regression + from 2.6. + +- Issue #3705: Command-line arguments were not correctly decoded when the + terminal does not use UTF8. + +Library +------- + +- Issue #4363: The uuid.uuid1() and uuid.uuid4() functions now work even if + the ctypes module is not present. + +- FileIO's mode attribute now always includes ``"b"``. + +- Issue #3799: Fix dbm.dumb to accept strings as well as bytes for keys. String + keys are now written out in UTF-8. + +- Issue #4338: Fix distutils upload command. + +- Issue #4354: Fix distutils register command. + +- Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__. + +- Issue #4307: The named tuple that ``inspect.getfullargspec()`` returns now + uses ``kwonlydefaults`` instead of ``kwdefaults``. + +- Issue #4298: Fix a segfault when pickle.loads is passed a ill-formed input. + +- Issue #4283: Fix a left-over "iteritems" call in distutils. + +Build +----- + +- Issue #4389: Add icon to the uninstall entry in "add-and-remove-programs". + +- Issue #4289: Remove Cancel button from AdvancedDlg. + +- Issue #1656675: Register a drop handler for .py* files on Windows. + +Tools/Demos +----------- + +- Demos of the socketserver module now work with Python 3. + + +What's New in Python 3.0 release candidate 2 +============================================ + +*Release date: 05-Nov-2008* + +Core and Builtins +----------------- + +- Issue #4211: The __path__ attribute of frozen packages is now a list instead + of a string as required by PEP 302. + +- Issue #3727: Fixed poplib. + +- Issue #3714: Fixed nntplib by using bytes where appropriate. + +- Issue #1210: Fixed imaplib and its documentation. + +- Issue #4233: Changed semantic of ``_fileio.FileIO``'s ``close()`` + method on file objects with closefd=False. The file descriptor is still + kept open but the file object behaves like a closed file. The ``FileIO`` + object also got a new readonly attribute ``closefd``. + +- Issue #3626: On cygwin, starting python with a non-existent script name + would not display anything if the file name is only 1 character long. + +- Issue #4176: Fixed a crash when pickling an object which ``__reduce__`` + method does not return iterators for the 4th and 5th items. + +- Issue #3723: Fixed initialization of subinterpreters. + +- Issue #4213: The file system encoding is now normalized by the + codec subsystem, for example UTF-8 is turned into utf-8. + +- Issue #4200: Changed the atexit module to store its state in its + PyModuleDef atexitmodule. This fixes a bug with multiple subinterpeters. + +- Issue #4237: io.FileIO() was raising invalid warnings caused by + insufficient initialization of PyFileIOObject struct members. + +- Issue #4170: Pickling a collections.defaultdict object would crash the + interpreter. + +- Issue #4146: Compilation on OpenBSD has been restored. + +- Issue #3574: compile() incorrectly handled source code encoded as Latin-1. + +- Issues #2384 and #3975: Tracebacks were not correctly printed when the + source file contains a ``coding:`` header: the wrong line was displayed, and + the encoding was not respected. + +- Issue #3740: Null-initialize module state. + +- Issue #3946: PyObject_CheckReadBuffer crashed on a memoryview object. + +- Issue #1688: On Windows, the input() prompt was not correctly displayed if it + contains non-ascii characters. + +- Bug #3951: Py_USING_MEMORY_DEBUGGER should not be enabled by default. + +Library +------- + +- Issue #3664: The pickle module could segfault if a subclass of Pickler fails + to call the base __init__ method. + +- Issue #3725: telnetlib now works completely in bytes. + +- Issue #4072: Restore build_py_2to3. + +- Issue #4014: Don't claim that Python has an Alpha release status, in addition + to claiming it is Mature. + +- Issue #3187: Add sys.setfilesystemencoding. + +- Issue #3187: Better support for "undecodable" filenames. Code by Victor + Stinner, with small tweaks by GvR. + +- Issue #3965: Allow repeated calls to turtle.Screen, by making it a + true singleton object. + +- Issue #3911: ftplib.FTP.makeport() could give invalid port numbers. + +- Issue #3929: When the database cannot be opened, dbm.open() would incorrectly + raise a TypeError: "'tuple' object is not callable" instead of the expected + dbm.error. + +- Bug #3884: Make the turtle module toplevel again. + +- Issue #3547: Fixed ctypes structures bitfields of varying integer + sizes. + +Extension Modules +----------------- + +- Issue #3659: Subclasses of str didn't work as SQL parameters. + +Build +----- + +- Issue #4120: Exclude manifest from extension modules in VS2008. + +- Issue #4091: Install pythonxy.dll in system32 again. + +- Issue #4018: Disable "for me" installations on Vista. + +- Issue #4204: Fixed module build errors on FreeBSD 4. + +Tools/Demos +----------- + +- Issue #3717: Fix Demo/embed/demo.c. + +- Issue #4072: Add a distutils demo for build_py_2to3. + + +What's New in Python 3.0 release candidate 1 +============================================ + +*Release date: 17-Sep-2008* + +Core and Builtins +----------------- + +- Issue #3827: memoryview lost its size attribute in favor of using len(view). + +- Issue #3813: could not lanch python.exe via symbolic link on cygwin. + +- Issue #3705: fix crash when given a non-ascii value on the command line for + the "-c" and "-m" parameters. Now the behaviour is as expected under Linux, + although under Windows it fails at a later point. + +- Issue #3279: Importing site at interpreter was failing silently because the + site module uses the open builtin which was not initialized at the time. + +- Issue #3660: Corrected a reference leak in str.encode() when the encoder + does not return a bytes object. + +- Issue #3774: Added a few more checks in PyTokenizer_FindEncoding to handle + error conditions. + +- Issue #3594: Fix Parser/tokenizer.c:fp_setreadl() to open the file being + tokenized by either a file path or file pointer for the benefit of + PyTokenizer_FindEncoding(). + +- Issue #3696: Error parsing arguments on OpenBSD <= 4.4 and Cygwin. On + these systems, the mbstowcs() function is slightly buggy and must be + replaced with strlen() for the purpose of counting of number of wide + characters needed to represent the multi-byte character string. + +- Issue #3697: "Fatal Python error: Cannot recover from stack overflow" + could be easily encountered under Windows in debug mode when exercising + the recursion limit checking code, due to bogus handling of recursion + limit when USE_STACKCHEK was enabled. + +- Issue 3639: The _warnings module could segfault the interpreter when + unexpected types were passed in as arguments. + +- Issue #3712: The memoryview object had a reference leak and didn't support + cyclic garbage collection. + +- Issue #3668: Fix a memory leak with the "s*" argument parser in + PyArg_ParseTuple and friends, which occurred when the argument for "s*" + was correctly parsed but parsing of subsequent arguments failed. + +- Issue #3611: An exception __context__ could be cleared in a complex pattern + involving a __del__ method re-raising an exception. + +- Issue #2534: speed up isinstance() and issubclass() by 50-70%, so as to + match Python 2.5 speed despite the __instancecheck__ / __subclasscheck__ + mechanism. In the process, fix a bug where isinstance() and issubclass(), + when given a tuple of classes as second argument, were looking up + __instancecheck__ / __subclasscheck__ on the tuple rather than on each + type object. + +- Issue #3663: Py_None was decref'd when printing SyntaxErrors. + +- Issue #3651: Fix various memory leaks when using the buffer + interface, or when the "s#" code of PyArg_ParseTuple is given a + bytes object. + +- Issue #3657: Fix uninitialized memory read when pickling longs. + Found by valgrind. + +- Apply security patches from Apple. + +- Fix crashes on memory allocation failure found with failmalloc. + +- Fix memory leaks found with valgrind and update suppressions file. + +- Fix compiler warnings in opt mode which would lead to invalid memory reads. + +- Fix problem using wrong name in decimal module reported by pychecker. + +- Issue #3650: Fixed a reference leak in bytes.split('x'). + +- bytes(o) now tries to use o.__bytes__() before using fallbacks. + +- Issue #1204: The configure script now tests for additional libraries + that may be required when linking against readline. This fixes issues + with x86_64 builds on some platforms (a few Linux flavors and OpenBSD). + +C API +----- + +- PyObject_Bytes and PyBytes_FromObject were added. + +Library +------- + +- Issue #3756: make re.escape() handle bytes as well as str. + +- Issue #3800: fix filter() related bug in formatter.py. + +- Issue #874900: fix behaviour of threading module after a fork. + +- Issue #3535: zipfile couldn't read some zip files larger than 2GB. + +- Issue #3776: Deprecate the bsddb package for removal in 3.0. + +- Issue #3762: platform.architecture() fails if python is lanched via + its symbolic link. + +- Issue #3660: fix a memory leak in the C accelerator of the pickle module. + +- Issue #3160: the "bdist_wininst" distutils command didn't work. + +- Issue #1658: tkinter changes dict size during iteration in both + tkinter.BaseWidget and tkinter.scrolledtext.ScrolledText. + +- The bsddb module (and therefore the dbm.bsd module) has been removed. + It is now maintained outside of the standard library at + http://www.jcea.es/programacion/pybsddb.htm. + +- Issue 600362: Relocated parse_qs() and parse_qsl(), from the cgi module + to the urlparse one. Added a DeprecationWarning in the old module, it + will be deprecated in the future. + +- Issue #3719: platform.architecture() fails if there are spaces in the + path to the Python binary. + +- Issue 3602: As part of the merge of r66135, make the parameters on + warnings.catch_warnings() keyword-only. Also remove a DeprecationWarning. + +- The deprecation warnings for the camelCase threading API names were removed. + +- Issue #3110: multiprocessing fails to compiel on solaris 10 due to missing + SEM_VALUE_MAX. + +Extension Modules +----------------- + +- Issue #3782: os.write() must not accept unicode strings. + +- Issue #2975: When compiling several extension modules with Visual Studio 2008 + from the same python interpreter, some environment variables would grow + without limit. + +- Issue #3643: Added a few more checks to _testcapi to prevent segfaults by + exploitation of poor argument checking. + +- bsddb code updated to version 4.7.3pre2. This code is the same than + Python 2.6 one, since the intention is to keep an unified 2.x/3.x codebase. + The Python code is automatically translated using "2to3". Please, do not + update this code in Python 3.0 by hand. Update the 2.6 one and then + do "2to3". + +- The _bytesio and _stringio modules are now compiled into the python binary. + +- Issue #3492 and #3790: Fixed the zlib module and zipimport module uses of + mutable bytearray objects where they should have been using immutable bytes. + +- Issue #3797: Fixed the dbm, marshal, mmap, ossaudiodev, & winreg modules to + return bytes objects instead of bytearray objects. + + +Tools/Demos +----------- + +- Fix Misc/gdbinit so it works. + + +Build +----- + +- Issue #3812: Failed to build python if configure --without-threads. + +- Issue #3791: Remove the bsddb module from the Windows installer, and the + core bsddb library from the Windows build files. + + +What's new in Python 3.0b3? +=========================== + +*Release date: 20-Aug-2008* + +Core and Builtins +----------------- + +- Issue #3653: Fix a segfault when sys.excepthook was called with invalid + arguments. + +- Issue #2394: implement more of the memoryview API, with the caveat that + only one-dimensional contiguous buffers are supported and exercised right + now. Slicing, slice assignment and comparison (equality and inequality) + have been added. Also, the tolist() method has been implemented, but only + for byte buffers. Endly, the API has been updated to return bytes objects + wherever it used to return bytearrays. + +- Issue #3560: clean up the new C PyMemoryView API so that naming is + internally consistent; add macros PyMemoryView_GET_BASE() and + PyMemoryView_GET_BUFFER() to access useful properties of a memory views + without relying on a particular implementation; remove the ill-named + PyMemoryView() function (PyMemoryView_GET_BUFFER() can be used instead). + +- ctypes function pointers that are COM methods have a boolean True + value again. + +- Issue #1819: function calls with several named parameters are now on + average 35% faster (as measured by pybench). + +- The undocumented C APIs PyUnicode_AsString() and + PyUnicode_AsStringAndSize() were made private to the interpreter, in + order to be able to refine their interfaces for Python 3.1. + + If you need to access the UTF-8 representation of a Unicode object + as bytes string, please use PyUnicode_AsUTF8String() instead. + +- Issue #3460: PyUnicode_Join() implementation is 10% to 80% faster thanks + to Python 3.0's stricter semantics which allow to avoid successive + reallocations of the result string (this also affects str.join()). + + +Library +------- + +- Issue #1276: Added temporary aliases for CJK Mac encodings to resolve + a build problem on MacOS with CJK locales. It adds four temporary + mappings to existing legacy codecs that are virtually compatible + with Mac encodings. They will be replaced by codecs correctly + implemented in 3.1. + +- Issue #3614: Corrected a typo in xmlrpc.client, leading to a NameError + "global name 'header' is not defined". + +- Issue #2834: update the regular expression library to match the unicode + standards of py3k. In other words, mixing bytes and unicode strings + (be it as pattern, search string or replacement string) raises a TypeError. + Moreover, the re.UNICODE flag is enabled automatically for unicode patterns, + and can be disabled by specifying a new re.ASCII flag; as for bytes + patterns, ASCII matching is the only option and trying to specify re.UNICODE + for such patterns raises a ValueError. + +- Issue #3300: make urllib.parse.[un]quote() default to UTF-8. + Code contributed by Matt Giuca. quote() now encodes the input + before quoting, unquote() decodes after unquoting. There are + new arguments to change the encoding and errors settings. + There are also new APIs to skip the encode/decode steps. + [un]quote_plus() are also affected. + +- Issue #2235: numbers.Number now blocks inheritance of the default id() + based hash because that hash mechanism is not correct for numeric types. + All concrete numeric types that inherit from Number (rather than just + registering with it) must explicitly provide a hash implementation in + order for their instances to be hashable. + +- Issue #2676: in the email package, content-type parsing was hanging on + pathological input because of quadratic or exponential behaviour of a + regular expression. + +- Issue #3476: binary buffered reading through the new "io" library is now + thread-safe. + +- Issue #1342811: Fix leak in Tkinter.Menu.delete. Commands associated to + menu entries were not deleted. + +- Remove the TarFileCompat class from tarfile.py. + +- Issue #2491: os.fdopen is now almost an alias for the built-in open(), and + accepts the same parameters. It just checks that its first argument is an + integer. + +- Issue #3394: zipfile.writestr sets external attributes when passed a + file name rather than a ZipInfo instance, so files are extracted with + mode 0600 rather than 000 under Unix. + +- Issue #2523: Fix quadratic behaviour when read()ing a binary file without + asking for a specific length. + +Extension Modules +----------------- + +- Bug #3542: Support Unicode strings in _msi module. + +What's new in Python 3.0b2? +=========================== + +*Release date: 17-Jul-2008* + +Core and Builtins +----------------- + +- Issue #3008: the float type has a new instance method 'float.hex' + and a new class method 'float.fromhex' to convert floating-point + numbers to and from hexadecimal strings, respectively. + +- Issue #3083: Add alternate (#) formatting for bin, oct, hex output + for str.format(). This adds the prefix 0b, 0o, or 0x, respectively. + +- Issue #3280: like chr(), the "%c" format now accepts unicode code points + beyond the Basic Multilingual Plane (above 0xffff) on all configurations. On + "narrow Unicode" builds, the result is a string of 2 code units, forming a + UTF-16 surrogate pair. + +- Issue #3282: str.isprintable() should return False for undefined + Unicode characters. + +- Issue #3236: Return small longs from PyLong_FromString. + +- Exception tracebacks now support exception chaining. + +Library +------- + +- Removed the sunaudio module. Use sunau instead. + +- Issue #3554: ctypes.string_at and ctypes.wstring_at did call Python + api functions without holding the GIL, which could lead to a fatal + error when they failed. + +- Issue #799428: Fix Tkinter.Misc._nametowidget to unwrap Tcl command objects. + +- Removed "ast" function aliases from the parser module. + +- Issue #3313: Fixed a crash when a failed dlopen() call does not set + a valid dlerror() message. + +- Issue #3258: Fixed a crash when a ctypes POINTER type to an + incomplete structure was created. + +- Issue #2683: Fix inconsistency in subprocess.Popen.communicate(): the + argument now must be a bytes object in any case. + +- Issue #3145: help("modules whatever") failed when trying to load the source + code of every single module of the standard library, including invalid files + used in the test suite. + +- The gettext library now consistently uses Unicode strings for message ids + and message strings, and ``ugettext()`` and the like don't exist anymore. + +- The traceback module has been expanded to handle chained exceptions. + +C API +----- + +- Issue #3247: the function Py_FindMethod was removed. Modern types should + use the tp_methods slot instead. + +Tools/Demos +----------- + +- The Mac/Demos directory has been removed. + +- All of the Mac scripts have been removed (including BuildApplet.py). + + +What's new in Python 3.0b1? +=========================== + +*Release date: 18-Jun-2008* + +Core and Builtins +----------------- + +- Issue #3211: warnings.warn_explicit() did not guard against its 'registry' + argument being anything other than a dict or None. Also fixed a bug in error + handling when 'message' and 'category' were both set to None, triggering a + bus error. + +- Issue #3100: Corrected a crash on deallocation of a subclassed weakref which + holds the last (strong) reference to its referent. + +- Issue #2630: implement PEP 3138. repr() now returns printable + Unicode characters unescaped, to get an ASCII-only representation + of an object use ascii(). + +- Issue #1342: On windows, Python could not start when installed in a + directory with non-ascii characters. + +- Implement PEP 3121: new module initialization and finalization API. + +- Removed the already-defunct ``-t`` option. + +- Issue #2957: Corrected a ValueError "recursion limit exceeded", when + unmarshalling many code objects, which happens when importing a + large .pyc file (~1000 functions). + +- Issue #2963: fix merging oversight that disabled method cache for + all types. + +- Issue #2964: fix a missing INCREF in instancemethod_descr_get. + +- Issue #2895: Don't crash when given bytes objects as keyword names. + +- Issue #2798: When parsing arguments with PyArg_ParseTuple, the "s" + code now allows any unicode string and returns a utf-8 encoded + buffer, just like the "s#" code already does. The "z" code was + corrected as well. + +- Issue #2863: generators now have a ``gen.__name__`` attribute that + equals ``gen.gi_code.co_name``, like ``func.__name___`` that equals + ``func.func_code.co_name``. The repr() of a generator now also + contains this name. + +- Issue #2831: enumerate() now has a ``start`` argument. + +- Issue #2801: fix bug in the float.is_integer method where a + ValueError was sometimes incorrectly raised. + +- The ``--with-toolbox-glue`` option (and the associated + pymactoolbox.h) have been removed. + +- Issue #2196: hasattr() now lets exceptions which do not inherit + Exception (KeyboardInterrupt, and SystemExit) propagate instead of + ignoring them. + +- #3021 Exception reraising sematics have been significantly improved. However, + f_exc_type, f_exc_value, and f_exc_traceback cannot be accessed from Python + code anymore. + +- Three of PyNumberMethods' members, nb_coerce, nb_hex, and nb_oct, have been + removed. + +Extension Modules +----------------- + +- Renamed ``_winreg`` module to ``winreg``. + +- Support os.O_ASYNC and fcntl.FASYNC if the constants exist on the + platform. + +- Support for Windows 9x has been removed from the winsound module. + +- Issue #2870: cmathmodule.c compile error. + +Library +------- + +- The methods ``is_in_tuple()``, ``is_vararg()``, and ``is_keywordarg()`` of + symtable.Symbol have been removed. + +- Patch #3133: http.server.CGIHTTPRequestHandler did not work on windows. + +- a new ``urllib`` package was created. It consists of code from + ``urllib``, ``urllib2``, ``urlparse``, and ``robotparser``. The old + modules have all been removed. The new package has five submodules: + ``urllib.parse``, ``urllib.request``, ``urllib.response``, + ``urllib.error``, and ``urllib.robotparser``. The + ``urllib.request.urlopen()`` function uses the url opener from + ``urllib2``. (Note that the unittests have not been renamed for the + beta, but they will be renamed in the future.) + +- rfc822 has been removed in favor of the email package. + +- mimetools has been removed in favor of the email package. + +- Patch #2849: Remove use of rfc822 module from standard library. + +- Added C optimized implementation of io.StringIO. + +- The ``pickle`` module is now automatically use an optimized C + implementation of Pickler and Unpickler when available. The + ``cPickle`` module is no longer needed. + +- Removed the ``htmllib`` and ``sgmllib`` modules. + +- The deprecated ``SmartCookie`` and ``SimpleCookie`` classes have + been removed from ``http.cookies``. + +- The ``commands`` module has been removed. Its getoutput() and + getstatusoutput() functions have been moved to the ``subprocess`` module. + +- The ``http`` package was created; it contains the old ``httplib`` + as ``http.client``, ``Cookie`` as ``http.cookies``, ``cookielib`` + as ``http.cookiejar``, and the content of the three ``HTTPServer`` + modules as ``http.server``. + +- The ``xmlrpc`` package was created; it contains the old + ``xmlrpclib`` module as ``xmlrpc.client`` and the content of + the old ``SimpleXMLRPCServer`` and ``DocXMLRPCServer`` modules + as ``xmlrpc.server``. + +- The ``dbm`` package was created, containing the old modules + ``anydbm`` and ``whichdb`` in its ``__init__.py``, and having + ``dbm.gnu`` (was ``gdbm``), ``dbm.bsd`` (was ``dbhash``), + ``dbm.ndbm`` (was ``dbm``) and ``dbm.dumb`` (was ``dumbdbm``) + as submodules. + +- The ``repr`` module has been renamed to ``reprlib``. + +- The ``statvfs`` module has been removed. + +- Issue #1713041: fix pprint's handling of maximum depth. + +- Issue #2250: Exceptions raised during evaluation of names in + rlcompleter's ``Completer.complete()`` method are now caught and + ignored. + +- Patch #2659: Added ``break_on_hyphens`` option to textwrap's + ``TextWrapper`` class. + +- Issue #2487: change the semantics of math.ldexp(x, n) when n is too + large to fit in a C long. ldexp(x, n) now returns a zero (with + suitable sign) if n is large and negative; previously, it raised + OverflowError. + +- The ``ConfigParser`` module has been renamed to ``configparser``. + +- Issue #2865: webbrowser.open() works again in a KDE environment. + +- The ``multifile`` module has been removed. + +- The ``SocketServer`` module has been renamed to ``socketserver``. + +- Fixed the ``__all__`` setting on ``collections`` to include + ``UserList`` and ``UserString``. + +- The sre module has been removed. + +- The Queue module has been renamed to queue. + +- The copy_reg module has been renamed to copyreg. + +- The mhlib module has been removed. + +- The ihooks module has been removed. + +- The fpformat module has been removed. + +- The dircache module has been removed. + +- The Canvas module has been removed. + +- The Decimal module gained the magic methods __round__, __ceil__, + __floor__ and __trunc__, to give support for round, math.ceil, + math.floor and math.trunc. + +- The user module has been removed. + +- The mutex module has been removed. + +- The imputil module has been removed. + +- os.path.walk has been removed in favor of os.walk. + +- pdb gained the "until" command. + +- The test.test_support module has been renamed to test.support. + +- The threading module API was renamed to be PEP 8 compliant. The + old names are still present, but will be removed in the near future. + +Tools/Demos +----------- + +- The bgen tool has been removed. + +Build +----- + + +What's New in Python 3.0a5? +=========================== + +*Release date: 08-May-2008* + +Core and Builtins +----------------- + +- Fixed misbehaviour of PyLong_FromSsize_t on systems where + sizeof(size_t) > sizeof(long). + +- Issue #2221: Corrected a SystemError "error return without exception + set", when the code executed by exec() raises an exception, and + sys.stdout.flush() also raises an error. + +- Bug #2565: The repr() of type objects now calls them 'class', not + 'type' - whether they are builtin types or not. + +- The command line processing was converted to pass Unicode strings + through as unmodified as possible; as a consequence, the C API + related to command line arguments was changed to use wchar_t. + +- All backslashes in raw strings are interpreted literally. This + means that '\u' and '\U' escapes are not treated specially. + +Extension Modules +----------------- + +Library +------- + +- ctypes objects now support the PEP3118 buffer interface. + +- Issue #2682: ctypes callback functions now longer contain a cyclic + reference to themselves. + +- Issue #2058: Remove the buf attribute and add __slots__ to the + TarInfo class in order to reduce tarfile's memory usage. + +- Bug #2606: Avoid calling .sort() on a dict_keys object. + +- The bundled libffi copy is now in sync with the recently released + libffi3.0.5 version, apart from some small changes to + Modules/_ctypes/libffi/configure.ac. + +Build +----- + +- Issue #1496032: On alpha, use -mieee when gcc is the compiler. + +- "make install" is now an alias for "make altinstall", to prevent + accidentally overwriting a Python 2.x installation. Use "make + fullinstall" to force Python 3.0 to be installed as "python". + +- Issue #2544: On HP-UX systems, use 'gcc -shared' for linking when + gcc is used as compiler. + + +What's New in Python 3.0a4? +=========================== + +*Release date: 02-Apr-2008* + +Core and Builtins +----------------- + +- Bug #2301: Don't try decoding the source code into the original + encoding for syntax errors. + +Extension Modules +----------------- + +- The dl module was removed, use the ctypes module instead. + +- Use wchar_t functions in _locale module. + +Library +------- + +- The class distutils.commands.build_py.build_py_2to3 can be used as a + build_py replacement to automatically run 2to3 on modules that are + going to be installed. + +- A new pickle protocol (protocol 3) is added with explicit support + for bytes. This is the default protocol. It intentionally cannot + be unpickled by Python 2.x. + +- When a pickle written by Python 2.x contains an (8-bit) str + instance, this is now decoded to a (Unicode) str instance. The + encoding used to do this defaults to ASCII, but can be overridden + via two new keyword arguments to the Unpickler class. Previously + this would create bytes instances, which is usually wrong: str + instances are often used to pickle attribute names etc., and text is + more common than binary data anyway. + +- Default to ASCII as the locale.getpreferredencoding, if the POSIX + system doesn't support CODESET and LANG isn't set or doesn't allow + deduction of an encoding. + +- Issue #1202: zlib.crc32 and zlib.adler32 now return an unsigned + value. + +- Issue #719888: Updated tokenize to use a bytes API. generate_tokens + has been renamed tokenize and now works with bytes rather than + strings. A new detect_encoding function has been added for + determining source file encoding according to PEP-0263. Token + sequences returned by tokenize always start with an ENCODING token + which specifies the encoding used to decode the file. This token is + used to encode the output of untokenize back to bytes. + + +What's New in Python 3.0a3? +=========================== + +*Release date: 29-Feb-2008* + +Core and Builtins +----------------- + +- Issue #2282: io.TextIOWrapper was not overriding seekable() from + io.IOBase. + +- Issue #2115: Important speedup in setting __slot__ attributes. Also + prevent a possible crash: an Abstract Base Class would try to access + a slot on a registered virtual subclass. + +- Fixed repr() and str() of complex numbers with infinity or nan as + real or imaginary part. + +- Clear all free list during a gc.collect() of the highest generation + in order to allow pymalloc to free more arenas. Python may give back + memory to the OS earlier. + +- Issue #2045: Fix an infinite recursion triggered when printing a + subclass of collections.defaultdict, if its default_factory is set + to a bound method. + +- Fixed a minor memory leak in dictobject.c. The content of the free + list was not freed on interpreter shutdown. + +- Limit free list of method and builtin function objects to 256 + entries each. + +- Patch #1953: Added ``sys._compact_freelists()`` and the C API + functions ``PyInt_CompactFreeList`` and ``PyFloat_CompactFreeList`` + to compact the internal free lists of pre-allocted ints and floats. + +- Bug #1983: Fixed return type of fork(), fork1() and forkpty() calls. + Python expected the return type int but the fork familie returns + pi_t. + +- Issue #1678380: Fix a bug that identifies 0j and -0j when they + appear in the same code unit. + +- Issue #2025: Added tuple.count() and tuple.index() methods to comply + with the collections.Sequence API. + +- Fixed multiple reinitialization of the Python interpreter. The small + int list in longobject.c has caused a seg fault during the third + finalization. + +- Issue #1973: bytes.fromhex('') raised SystemError. + +- Issue #1771: remove cmp parameter from sorted() and list.sort(). + +- Issue #1969: split and rsplit in bytearray are inconsistent. + +- map() no longer accepts None for the first argument. Use zip() + instead. + +- Issue #1769: Now int("- 1") is not allowed any more. + +- Object/longobject.c: long(float('nan')) raises an OverflowError + instead of returning 0. + +- Issue #1762972: __file__ points to the source file instead of the + pyc/pyo file if the py file exists. + +- Issue #1393: object_richcompare() returns NotImplemented instead of + False if the objects aren't equal, to give the other side a chance. + +- Issue #1692: Interpreter was not displaying location of SyntaxError. + +- Improve some exception messages when Windows fails to load an + extension module. Now we get for example '%1 is not a valid Win32 + application' instead of 'error code 193'. Also use Unicode strings + to deal with non-English locales. + +- Issue #1587: Added instancemethod wrapper for PyCFunctions. The + Python C API has gained a new type *PyInstanceMethod_Type* and the + functions *PyInstanceMethod_Check(o)*, *PyInstanceMethod_New(func)* + and *PyInstanceMethod_Function(im)*. + +- Constants gc.DEBUG_OBJECT and gc.DEBUG_INSTANCE have been removed + from the gc module; gc.DEBUG_COLLECTABLE or gc.DEBUG_UNCOLLECTABLE + are now enough to print the corresponding list of objects considered + by the garbage collector. + +- Issue #1573: Improper use of the keyword-only syntax makes the + parser crash. + +- Issue #1564: The set implementation should special-case PyUnicode + instead of PyString. + +- Patch #1031213: Decode source line in SyntaxErrors back to its + original source encoding. + +- inspect.getsource() includes the decorators again. + +- Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a + mountpoint. + +- Fix utf-8-sig incremental decoder, which didn't recognise a BOM when + the first chunk fed to the decoder started with a BOM, but was + longer than 3 bytes. + +Extension Modules +----------------- + +- Code for itertools ifilter(), imap(), and izip() moved to bultins + and renamed to filter(), map(), and zip(). Also, renamed + izip_longest() to zip_longest() and ifilterfalse() to filterfalse(). + +- Issue #1762972: Readded the reload() function as imp.reload(). + +- Bug #2111: mmap segfaults when trying to write a block opened with + PROT_READ. + +- Issue #2063: correct order of utime and stime in os.times() result + on Windows. + +Library +------- + +- Weakref dictionaries now inherit from MutableMapping. + +- Created new UserDict class in collections module. This one inherits + from and complies with the MutableMapping ABC. Also, moved + UserString and UserList to the collections module. The + MutableUserString class was removed. + +- Removed UserDict.DictMixin. Replaced all its uses with + collections.MutableMapping. + +- Issue #1703: getpass() should flush after writing prompt. + +- Issue #1585: IDLE uses non-existent xrange() function. + +- Issue #1578: Problems in win_getpass. + +Build +----- + +- Renamed --enable-unicode configure flag to --with-wide-unicode, + since Unicode strings can't be disabled anymore. + +C API +----- + +- Issue #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, + Py_TYPE and Py_REFCNT. + +- New API PyImport_ImportModuleNoBlock(), works like + PyImport_ImportModule() but won't block on the import lock + (returning an error instead). + + +What's New in Python 3.0a2? +=========================== + +*Release date: 07-Dec-2007* + +(Note: this list is incomplete.) + +Core and Builtins +----------------- + +- str8 now has the same construction signature as bytes. + +- Comparisons between str and str8 now return False/True for ==/!=. + sqlite3 returns str8 when recreating on object from it's __conform__ + value. The struct module returns str8 for all string-related + formats. This was true before this change, but becomes more + apparent thanks to string comparisons always being False. + +- Replaced `PyFile_FromFile()` with `PyFile_FromFd(fd, name. mode, + buffer, encoding, newline)`. + +- Fixed `imp.find_module()` to obey the -*- coding: -*- header. + +- Changed `__file__` and `co_filename` to unicode. The path names are decoded + with `Py_FileSystemDefaultEncoding` and a new API method + `PyUnicode_DecodeFSDefault(char*)` was added. + +- io.open() and _fileio.FileIO have grown a new argument closefd. A + false value disables the closing of the file descriptor. + +- Added a new option -b to issues warnings (-bb for errors) about + certain operations between bytes/buffer and str like str(b'') and + comparison. + +- The standards streams sys.stdin, stdout and stderr may be None when + the when the C runtime library returns an invalid file descriptor + for the streams (fileno(stdin) < 0). For now this happens only for + Windows GUI apps and scripts started with `pythonw.exe`. + +- Added PCbuild9 directory for VS 2008. + +- Renamed structmember.h WRITE_RESTRICTED to PY_WRITE_RESTRICTED to + work around a name clash with VS 2008 on Windows. + +- Unbound methods are gone for good. ClassObject.method returns an + ordinary function object, instance.method still returns a bound + method object. The API of bound methods is cleaned up, too. The + im_class attribute is removed and im_func + im_self are renamed to + __func__ and __self__. The factory PyMethod_New takes only func and + instance as argument. + +- intobject.h is no longer included by Python.h. The remains were + moved to longobject.h. It still exists to define several aliases + from PyInt to PyLong functions. + +- Removed sys.maxint, use sys.maxsize instead. + +Extension Modules +----------------- + +- The `hotshot` profiler has been removed; use `cProfile` instead. + +Library +------- + +- When loading an external file using testfile(), the passed-in + encoding argument was being ignored if __loader__ is defined and + forcing the source to be UTF-8. + +- The methods `os.tmpnam()`, `os.tempnam()` and `os.tmpfile()` have + been removed in favor of the tempfile module. + +- Removed the 'new' module. + +- Removed all types from the 'types' module that are easily accessable + through builtins. + + +What's New in Python 3.0a1? +=========================== + +*Release date: 31-Aug-2007* + +Core and Builtins +----------------- + +- PEP 3131: Support non-ASCII identifiers. + +- PEP 3120: Change default encoding to UTF-8. + +- PEP 3123: Use proper C inheritance for PyObject. + +- Removed the __oct__ and __hex__ special methods and added a bin() + builtin function. + +- PEP 3127: octal literals now start with "0o". Old-style octal + literals are invalid. There are binary literals with a prefix of + "0b". This also affects int(x, 0). + +- None, True, False are now keywords. + +- PEP 3119: isinstance() and issubclass() can be overridden. + +- Remove BaseException.message. + +- Remove tuple parameter unpacking (PEP 3113). + +- Remove the f_restricted attribute from frames. This naturally leads + to the removal of PyEval_GetRestricted() and PyFrame_IsRestricted(). + +- PEP 3132 was accepted. That means that you can do ``a, *b = + range(5)`` to assign 0 to a and [1, 2, 3, 4] to b. + +- range() now returns an iterator rather than a list. Floats are not + allowed. xrange() is no longer defined. + +- Patch #1660500: hide iteration variable in list comps, add set comps + and use common code to handle compilation of iterative expressions. + +- By default, != returns the opposite of ==, unless the latter returns + NotImplemented. + +- Patch #1680961: sys.exitfunc has been removed and replaced with a + private C-level API. + +- PEP 3115: new metaclasses: the metaclass is now specified as a + keyword arg in the class statement, which can now use the full + syntax of a parameter list. Also, the metaclass can implement a + __prepare__ function which will be called to create the dictionary + for the new class namespace. + +- The long-deprecated argument "pend" of PyFloat_FromString() has been + removed. + +- The dir() function has been extended to call the __dir__() method on + its argument, if it exists. If not, it will work like before. This + allows customizing the output of dir() in the presence of a + __getattr__(). + +- Removed support for __members__ and __methods__. + +- Removed indexing/slicing on BaseException. + +- input() became raw_input(): the name input() now implements the + functionality formerly known as raw_input(); the name raw_input() is + no longer defined. + +- Classes listed in an 'except' clause must inherit from + BaseException. + +- PEP 3106: dict.iterkeys(), .iteritems(), .itervalues() are now gone; + and .keys(), .items(), .values() return dict views, which behave + like sets. + +- PEP 3105: print is now a function. Also (not in the PEP) the + 'softspace' attribute of files is now gone (since print() doesn't + use it). A side effect of this change is that you can get + incomplete output lines in interactive sessions: + + >>> print(42, end="") + 42>>> + + We may be able to fix this after the I/O library rewrite. + +- PEP 3102: keyword-only arguments. + +- Int/Long unification is complete. The 'long' built-in type and + literals with trailing 'L' or 'l' have been removed. Performance + may be sub-optimal (haven't really benchmarked). + +- 'except E, V' must now be spelled as 'except E as V' and deletes V + at the end of the except clause; V must be a simple name. + +- Added function annotations per PEP 3107. + +- Added nonlocal declaration from PEP 3104: + + >>> def f(x): + ... def inc(): + ... nonlocal x + ... x += 1 + ... return x + ... return inc + ... + >>> inc = f(0) + >>> inc() + 1 + >>> inc() + 2 + +- Moved intern() to sys.intern(). + +- exec is now a function. + +- Renamed nb_nonzero to nb_bool and __nonzero__ to __bool__. + +- Classic classes are a thing of the past. All classes are new style. + +- Exceptions *must* derive from BaseException. + +- Integer division always returns a float. The -Q option is no more. + All the following are gone: + + * PyNumber_Divide and PyNumber_InPlaceDivide + * __div__, __rdiv__, and __idiv__ + * nb_divide, nb_inplace_divide + * operator.div, operator.idiv, operator.__div__, operator.__idiv__ + (Only __truediv__ and __floordiv__ remain, not sure how to handle + them if we want to re-use __div__ and friends. If we do, it will + make it harder to write code for both 2.x and 3.x.) + +- 'as' and 'with' are keywords. + +- Absolute import is the default behavior for 'import foo' etc. + +- Removed support for syntax: backticks (ie, `x`), <>. + +- Removed these Python builtins: apply(), callable(), coerce(), + execfile(), file(), reduce(), reload(). + +- Removed these Python methods: {}.has_key. + +- Removed these opcodes: BINARY_DIVIDE, INPLACE_DIVIDE, UNARY_CONVERT. + +- Remove C API support for restricted execution. + +- zip(), map() and filter() now return iterators, behaving like their + itertools counterparts. This also affect map()'s behavior on + sequences of unequal length -- it now stops after the shortest one + is exhausted. + +- Additions: set literals, set comprehensions, ellipsis literal. + +- Added class decorators per PEP 3129. + + +Extension Modules +----------------- + +- Removed the imageop module. Obsolete long with its unit tests + becoming useless from the removal of rgbimg and imgfile. + +- Removed these attributes from the operator module: div, idiv, + __div__, __idiv__, isCallable, sequenceIncludes. + +- Removed these attributes from the sys module: exc_clear(), exc_type, + exc_value, exc_traceback. + + +Library +------- + +- Removed the compiler package. Use of the _ast module and (an + eventual) AST -> bytecode mechanism. + +- Removed these modules: audiodev, Bastion, bsddb185, exceptions, + linuxaudiodev, md5, MimeWriter, mimify, popen2, rexec, sets, sha, + stringold, strop, sunaudiodev, timing, xmllib. + +- Moved the toaiff module to Tools/Demos. + +- Removed obsolete IRIX modules: al/AL, cd/CD, cddb, cdplayer, cl/CL, + DEVICE, ERRNO, FILE, fl/FL, flp, fm, GET, gl/GL, GLWS, IN, imgfile, + IOCTL, jpeg, panel, panelparser, readcd, sgi, sv/SV, torgb, WAIT. + +- Removed obsolete functions: commands.getstatus(), os.popen*(). + +- Removed functions in the string module that are also string methods; + Remove string.{letters, lowercase, uppercase}. + +- Removed support for long obsolete platforms: plat-aix3, plat-irix5. + +- Removed xmlrpclib.SlowParser. It was based on xmllib. + +- Patch #1680961: atexit has been reimplemented in C. + +- Add new codecs for UTF-32, UTF-32-LE and UTF-32-BE. + +Build +----- + +C API +----- + +- Removed these Python slots: __coerce__, __div__, __idiv__, __rdiv__. + +- Removed these C APIs: PyNumber_Coerce(), PyNumber_CoerceEx(), + PyMember_Get, PyMember_Set. + +- Removed these C slots/fields: nb_divide, nb_inplace_divide. + +- Removed these macros: staticforward, statichere, PyArg_GetInt, + PyArg_NoArgs, _PyObject_Del. + +- Removed these typedefs: intargfunc, intintargfunc, intobjargproc, + intintobjargproc, getreadbufferproc, getwritebufferproc, + getsegcountproc, getcharbufferproc, memberlist. + +Tests +----- + +- Removed test.testall as test.regrtest replaces it. + +Documentation +------------- + +Mac +--- + +- The cfmfile module was removed. + +Platforms +--------- + +- Support for BeOS and AtheOS was removed (according to PEP 11). + +- Support for RiscOS, Irix, Tru64 was removed (alledgedly). + +Tools/Demos +----------- + + What's New in Python 2.5 release candidate 1? ============================================= Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Wed Dec 3 17:46:14 2008 @@ -4,1394 +4,25 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) -What's New in Python 3.0 final -============================== +What's New in Python 3.1 alpha 0 +================================ *Release date: XX-XXX-2008* Core and Builtins ----------------- -- Issue #3996: On Windows, the PyOS_CheckStack function would cause the - interpreter to abort ("Fatal Python error: Could not reset the stack!") - instead of throwing a MemoryError. - -- Issue #3689: The list reversed iterator now supports __length_hint__ - instead of __len__. Behavior now matches other reversed iterators. - -- Issue #4367: Python would segfault during compiling when the unicodedata - module couldn't be imported and \N escapes were present. - -- Fix build failure of _cursesmodule.c building with -D_FORTIFY_SOURCE=2. Library ------- -- Issue #4387: binascii now refuses to accept str as binary input. - -- Issue #4073: Add 2to3 support to build_scripts, refactor that support - in build_py. - -- IDLE would print a "Unhandled server exception!" message when internal - debugging is enabled. - -- Issue #4455: IDLE failed to display the windows list when two windows have - the same title. - -- Issue #3741: DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an - exception. - -- Issue #4433: Fixed an access violation when garbage collecting - _ctypes.COMError instances. - -- Issue #4429: Fixed UnicodeDecodeError in ctypes. - -- Issue #4373: Corrected a potential reference leak in the pickle module and - silenced a false positive ref leak in distutils.tests.test_build_ext. - -- Issue #4382: dbm.dumb did not specify the expected file encoding for opened - files. - -- Issue #4383: When IDLE cannot make the connection to its subprocess, it would - fail to properly display the error message. Build ----- -- Issue #4407: Fix source file that caused the compileall step in Windows installer - to fail. Docs ---- -- Issue #4449: Fixed multiprocessing examples - -- Issue #3799: Document that dbm.gnu and dbm.ndbm will accept string arguments - for keys and values which will be converted to bytes before committal. - - -What's New in Python 3.0 release candidate 3? -============================================= - -*Release date: 20-Nov-2008* - - -Core and Builtins ------------------ - -- Issue #4349: sys.path included a non-existent platform directory because of a - faulty Makefile. - -- Issue #3327: Don't overallocate in the modules_by_index list. - -- Issue #1721812: Binary set operations and copy() returned the input type - instead of the appropriate base type. This was incorrect because set - subclasses would be created without their __init__() method being called. - The corrected behavior brings sets into line with lists and dicts. - -- Issue #4296: Fix PyObject_RichCompareBool so that "x in [x]" evaluates to - True, even when x doesn't compare equal to itself. This was a regression - from 2.6. - -- Issue #3705: Command-line arguments were not correctly decoded when the - terminal does not use UTF8. - -Library -------- - -- Issue #4363: The uuid.uuid1() and uuid.uuid4() functions now work even if - the ctypes module is not present. - -- FileIO's mode attribute now always includes ``"b"``. - -- Issue #3799: Fix dbm.dumb to accept strings as well as bytes for keys. String - keys are now written out in UTF-8. - -- Issue #4338: Fix distutils upload command. - -- Issue #4354: Fix distutils register command. - -- Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__. - -- Issue #4307: The named tuple that ``inspect.getfullargspec()`` returns now - uses ``kwonlydefaults`` instead of ``kwdefaults``. - -- Issue #4298: Fix a segfault when pickle.loads is passed a ill-formed input. - -- Issue #4283: Fix a left-over "iteritems" call in distutils. - -Build ------ - -- Issue #4389: Add icon to the uninstall entry in "add-and-remove-programs". - -- Issue #4289: Remove Cancel button from AdvancedDlg. - -- Issue #1656675: Register a drop handler for .py* files on Windows. - -Tools/Demos ------------ - -- Demos of the socketserver module now work with Python 3. - - -What's New in Python 3.0 release candidate 2 -============================================ - -*Release date: 05-Nov-2008* - -Core and Builtins ------------------ - -- Issue #4211: The __path__ attribute of frozen packages is now a list instead - of a string as required by PEP 302. - -- Issue #3727: Fixed poplib. - -- Issue #3714: Fixed nntplib by using bytes where appropriate. - -- Issue #1210: Fixed imaplib and its documentation. - -- Issue #4233: Changed semantic of ``_fileio.FileIO``'s ``close()`` - method on file objects with closefd=False. The file descriptor is still - kept open but the file object behaves like a closed file. The ``FileIO`` - object also got a new readonly attribute ``closefd``. - -- Issue #3626: On cygwin, starting python with a non-existent script name - would not display anything if the file name is only 1 character long. - -- Issue #4176: Fixed a crash when pickling an object which ``__reduce__`` - method does not return iterators for the 4th and 5th items. - -- Issue #3723: Fixed initialization of subinterpreters. - -- Issue #4213: The file system encoding is now normalized by the - codec subsystem, for example UTF-8 is turned into utf-8. - -- Issue #4200: Changed the atexit module to store its state in its - PyModuleDef atexitmodule. This fixes a bug with multiple subinterpeters. - -- Issue #4237: io.FileIO() was raising invalid warnings caused by - insufficient initialization of PyFileIOObject struct members. - -- Issue #4170: Pickling a collections.defaultdict object would crash the - interpreter. - -- Issue #4146: Compilation on OpenBSD has been restored. - -- Issue #3574: compile() incorrectly handled source code encoded as Latin-1. - -- Issues #2384 and #3975: Tracebacks were not correctly printed when the - source file contains a ``coding:`` header: the wrong line was displayed, and - the encoding was not respected. - -- Issue #3740: Null-initialize module state. - -- Issue #3946: PyObject_CheckReadBuffer crashed on a memoryview object. - -- Issue #1688: On Windows, the input() prompt was not correctly displayed if it - contains non-ascii characters. - -- Bug #3951: Py_USING_MEMORY_DEBUGGER should not be enabled by default. - -Library -------- - -- Issue #3664: The pickle module could segfault if a subclass of Pickler fails - to call the base __init__ method. - -- Issue #3725: telnetlib now works completely in bytes. - -- Issue #4072: Restore build_py_2to3. - -- Issue #4014: Don't claim that Python has an Alpha release status, in addition - to claiming it is Mature. - -- Issue #3187: Add sys.setfilesystemencoding. - -- Issue #3187: Better support for "undecodable" filenames. Code by Victor - Stinner, with small tweaks by GvR. - -- Issue #3965: Allow repeated calls to turtle.Screen, by making it a - true singleton object. - -- Issue #3911: ftplib.FTP.makeport() could give invalid port numbers. - -- Issue #3929: When the database cannot be opened, dbm.open() would incorrectly - raise a TypeError: "'tuple' object is not callable" instead of the expected - dbm.error. - -- Bug #3884: Make the turtle module toplevel again. - -- Issue #3547: Fixed ctypes structures bitfields of varying integer - sizes. - -Extension Modules ------------------ - -- Issue #3659: Subclasses of str didn't work as SQL parameters. - -Build ------ - -- Issue #4120: Exclude manifest from extension modules in VS2008. - -- Issue #4091: Install pythonxy.dll in system32 again. - -- Issue #4018: Disable "for me" installations on Vista. - -- Issue #4204: Fixed module build errors on FreeBSD 4. - -Tools/Demos ------------ - -- Issue #3717: Fix Demo/embed/demo.c. - -- Issue #4072: Add a distutils demo for build_py_2to3. - - -What's New in Python 3.0 release candidate 1 -============================================ - -*Release date: 17-Sep-2008* - -Core and Builtins ------------------ - -- Issue #3827: memoryview lost its size attribute in favor of using len(view). - -- Issue #3813: could not lanch python.exe via symbolic link on cygwin. - -- Issue #3705: fix crash when given a non-ascii value on the command line for - the "-c" and "-m" parameters. Now the behaviour is as expected under Linux, - although under Windows it fails at a later point. - -- Issue #3279: Importing site at interpreter was failing silently because the - site module uses the open builtin which was not initialized at the time. - -- Issue #3660: Corrected a reference leak in str.encode() when the encoder - does not return a bytes object. - -- Issue #3774: Added a few more checks in PyTokenizer_FindEncoding to handle - error conditions. - -- Issue #3594: Fix Parser/tokenizer.c:fp_setreadl() to open the file being - tokenized by either a file path or file pointer for the benefit of - PyTokenizer_FindEncoding(). - -- Issue #3696: Error parsing arguments on OpenBSD <= 4.4 and Cygwin. On - these systems, the mbstowcs() function is slightly buggy and must be - replaced with strlen() for the purpose of counting of number of wide - characters needed to represent the multi-byte character string. - -- Issue #3697: "Fatal Python error: Cannot recover from stack overflow" - could be easily encountered under Windows in debug mode when exercising - the recursion limit checking code, due to bogus handling of recursion - limit when USE_STACKCHEK was enabled. - -- Issue 3639: The _warnings module could segfault the interpreter when - unexpected types were passed in as arguments. - -- Issue #3712: The memoryview object had a reference leak and didn't support - cyclic garbage collection. - -- Issue #3668: Fix a memory leak with the "s*" argument parser in - PyArg_ParseTuple and friends, which occurred when the argument for "s*" - was correctly parsed but parsing of subsequent arguments failed. - -- Issue #3611: An exception __context__ could be cleared in a complex pattern - involving a __del__ method re-raising an exception. - -- Issue #2534: speed up isinstance() and issubclass() by 50-70%, so as to - match Python 2.5 speed despite the __instancecheck__ / __subclasscheck__ - mechanism. In the process, fix a bug where isinstance() and issubclass(), - when given a tuple of classes as second argument, were looking up - __instancecheck__ / __subclasscheck__ on the tuple rather than on each - type object. - -- Issue #3663: Py_None was decref'd when printing SyntaxErrors. - -- Issue #3651: Fix various memory leaks when using the buffer - interface, or when the "s#" code of PyArg_ParseTuple is given a - bytes object. - -- Issue #3657: Fix uninitialized memory read when pickling longs. - Found by valgrind. - -- Apply security patches from Apple. - -- Fix crashes on memory allocation failure found with failmalloc. - -- Fix memory leaks found with valgrind and update suppressions file. - -- Fix compiler warnings in opt mode which would lead to invalid memory reads. - -- Fix problem using wrong name in decimal module reported by pychecker. - -- Issue #3650: Fixed a reference leak in bytes.split('x'). - -- bytes(o) now tries to use o.__bytes__() before using fallbacks. - -- Issue #1204: The configure script now tests for additional libraries - that may be required when linking against readline. This fixes issues - with x86_64 builds on some platforms (a few Linux flavors and OpenBSD). - -C API ------ - -- PyObject_Bytes and PyBytes_FromObject were added. - -Library -------- - -- Issue #3756: make re.escape() handle bytes as well as str. - -- Issue #3800: fix filter() related bug in formatter.py. - -- Issue #874900: fix behaviour of threading module after a fork. - -- Issue #3535: zipfile couldn't read some zip files larger than 2GB. - -- Issue #3776: Deprecate the bsddb package for removal in 3.0. - -- Issue #3762: platform.architecture() fails if python is lanched via - its symbolic link. - -- Issue #3660: fix a memory leak in the C accelerator of the pickle module. - -- Issue #3160: the "bdist_wininst" distutils command didn't work. - -- Issue #1658: tkinter changes dict size during iteration in both - tkinter.BaseWidget and tkinter.scrolledtext.ScrolledText. - -- The bsddb module (and therefore the dbm.bsd module) has been removed. - It is now maintained outside of the standard library at - http://www.jcea.es/programacion/pybsddb.htm. - -- Issue 600362: Relocated parse_qs() and parse_qsl(), from the cgi module - to the urlparse one. Added a DeprecationWarning in the old module, it - will be deprecated in the future. - -- Issue #3719: platform.architecture() fails if there are spaces in the - path to the Python binary. - -- Issue 3602: As part of the merge of r66135, make the parameters on - warnings.catch_warnings() keyword-only. Also remove a DeprecationWarning. - -- The deprecation warnings for the camelCase threading API names were removed. - -- Issue #3110: multiprocessing fails to compiel on solaris 10 due to missing - SEM_VALUE_MAX. - -Extension Modules ------------------ - -- Issue #3782: os.write() must not accept unicode strings. - -- Issue #2975: When compiling several extension modules with Visual Studio 2008 - from the same python interpreter, some environment variables would grow - without limit. - -- Issue #3643: Added a few more checks to _testcapi to prevent segfaults by - exploitation of poor argument checking. - -- bsddb code updated to version 4.7.3pre2. This code is the same than - Python 2.6 one, since the intention is to keep an unified 2.x/3.x codebase. - The Python code is automatically translated using "2to3". Please, do not - update this code in Python 3.0 by hand. Update the 2.6 one and then - do "2to3". - -- The _bytesio and _stringio modules are now compiled into the python binary. - -- Issue #3492 and #3790: Fixed the zlib module and zipimport module uses of - mutable bytearray objects where they should have been using immutable bytes. - -- Issue #3797: Fixed the dbm, marshal, mmap, ossaudiodev, & winreg modules to - return bytes objects instead of bytearray objects. - - -Tools/Demos ------------ - -- Fix Misc/gdbinit so it works. - - -Build ------ - -- Issue #3812: Failed to build python if configure --without-threads. - -- Issue #3791: Remove the bsddb module from the Windows installer, and the - core bsddb library from the Windows build files. - - -What's new in Python 3.0b3? -=========================== - -*Release date: 20-Aug-2008* - -Core and Builtins ------------------ - -- Issue #3653: Fix a segfault when sys.excepthook was called with invalid - arguments. - -- Issue #2394: implement more of the memoryview API, with the caveat that - only one-dimensional contiguous buffers are supported and exercised right - now. Slicing, slice assignment and comparison (equality and inequality) - have been added. Also, the tolist() method has been implemented, but only - for byte buffers. Endly, the API has been updated to return bytes objects - wherever it used to return bytearrays. - -- Issue #3560: clean up the new C PyMemoryView API so that naming is - internally consistent; add macros PyMemoryView_GET_BASE() and - PyMemoryView_GET_BUFFER() to access useful properties of a memory views - without relying on a particular implementation; remove the ill-named - PyMemoryView() function (PyMemoryView_GET_BUFFER() can be used instead). - -- ctypes function pointers that are COM methods have a boolean True - value again. - -- Issue #1819: function calls with several named parameters are now on - average 35% faster (as measured by pybench). - -- The undocumented C APIs PyUnicode_AsString() and - PyUnicode_AsStringAndSize() were made private to the interpreter, in - order to be able to refine their interfaces for Python 3.1. - - If you need to access the UTF-8 representation of a Unicode object - as bytes string, please use PyUnicode_AsUTF8String() instead. - -- Issue #3460: PyUnicode_Join() implementation is 10% to 80% faster thanks - to Python 3.0's stricter semantics which allow to avoid successive - reallocations of the result string (this also affects str.join()). - - -Library -------- - -- Issue #1276: Added temporary aliases for CJK Mac encodings to resolve - a build problem on MacOS with CJK locales. It adds four temporary - mappings to existing legacy codecs that are virtually compatible - with Mac encodings. They will be replaced by codecs correctly - implemented in 3.1. - -- Issue #3614: Corrected a typo in xmlrpc.client, leading to a NameError - "global name 'header' is not defined". - -- Issue #2834: update the regular expression library to match the unicode - standards of py3k. In other words, mixing bytes and unicode strings - (be it as pattern, search string or replacement string) raises a TypeError. - Moreover, the re.UNICODE flag is enabled automatically for unicode patterns, - and can be disabled by specifying a new re.ASCII flag; as for bytes - patterns, ASCII matching is the only option and trying to specify re.UNICODE - for such patterns raises a ValueError. - -- Issue #3300: make urllib.parse.[un]quote() default to UTF-8. - Code contributed by Matt Giuca. quote() now encodes the input - before quoting, unquote() decodes after unquoting. There are - new arguments to change the encoding and errors settings. - There are also new APIs to skip the encode/decode steps. - [un]quote_plus() are also affected. - -- Issue #2235: numbers.Number now blocks inheritance of the default id() - based hash because that hash mechanism is not correct for numeric types. - All concrete numeric types that inherit from Number (rather than just - registering with it) must explicitly provide a hash implementation in - order for their instances to be hashable. - -- Issue #2676: in the email package, content-type parsing was hanging on - pathological input because of quadratic or exponential behaviour of a - regular expression. - -- Issue #3476: binary buffered reading through the new "io" library is now - thread-safe. - -- Issue #1342811: Fix leak in Tkinter.Menu.delete. Commands associated to - menu entries were not deleted. - -- Remove the TarFileCompat class from tarfile.py. - -- Issue #2491: os.fdopen is now almost an alias for the built-in open(), and - accepts the same parameters. It just checks that its first argument is an - integer. - -- Issue #3394: zipfile.writestr sets external attributes when passed a - file name rather than a ZipInfo instance, so files are extracted with - mode 0600 rather than 000 under Unix. - -- Issue #2523: Fix quadratic behaviour when read()ing a binary file without - asking for a specific length. - -Extension Modules ------------------ - -- Bug #3542: Support Unicode strings in _msi module. - -What's new in Python 3.0b2? -=========================== - -*Release date: 17-Jul-2008* - -Core and Builtins ------------------ - -- Issue #3008: the float type has a new instance method 'float.hex' - and a new class method 'float.fromhex' to convert floating-point - numbers to and from hexadecimal strings, respectively. - -- Issue #3083: Add alternate (#) formatting for bin, oct, hex output - for str.format(). This adds the prefix 0b, 0o, or 0x, respectively. - -- Issue #3280: like chr(), the "%c" format now accepts unicode code points - beyond the Basic Multilingual Plane (above 0xffff) on all configurations. On - "narrow Unicode" builds, the result is a string of 2 code units, forming a - UTF-16 surrogate pair. - -- Issue #3282: str.isprintable() should return False for undefined - Unicode characters. - -- Issue #3236: Return small longs from PyLong_FromString. - -- Exception tracebacks now support exception chaining. - -Library -------- - -- Removed the sunaudio module. Use sunau instead. - -- Issue #3554: ctypes.string_at and ctypes.wstring_at did call Python - api functions without holding the GIL, which could lead to a fatal - error when they failed. - -- Issue #799428: Fix Tkinter.Misc._nametowidget to unwrap Tcl command objects. - -- Removed "ast" function aliases from the parser module. - -- Issue #3313: Fixed a crash when a failed dlopen() call does not set - a valid dlerror() message. - -- Issue #3258: Fixed a crash when a ctypes POINTER type to an - incomplete structure was created. - -- Issue #2683: Fix inconsistency in subprocess.Popen.communicate(): the - argument now must be a bytes object in any case. - -- Issue #3145: help("modules whatever") failed when trying to load the source - code of every single module of the standard library, including invalid files - used in the test suite. - -- The gettext library now consistently uses Unicode strings for message ids - and message strings, and ``ugettext()`` and the like don't exist anymore. - -- The traceback module has been expanded to handle chained exceptions. - -C API ------ - -- Issue #3247: the function Py_FindMethod was removed. Modern types should - use the tp_methods slot instead. - -Tools/Demos ------------ - -- The Mac/Demos directory has been removed. - -- All of the Mac scripts have been removed (including BuildApplet.py). - - -What's new in Python 3.0b1? -=========================== - -*Release date: 18-Jun-2008* - -Core and Builtins ------------------ - -- Issue #3211: warnings.warn_explicit() did not guard against its 'registry' - argument being anything other than a dict or None. Also fixed a bug in error - handling when 'message' and 'category' were both set to None, triggering a - bus error. - -- Issue #3100: Corrected a crash on deallocation of a subclassed weakref which - holds the last (strong) reference to its referent. - -- Issue #2630: implement PEP 3138. repr() now returns printable - Unicode characters unescaped, to get an ASCII-only representation - of an object use ascii(). - -- Issue #1342: On windows, Python could not start when installed in a - directory with non-ascii characters. - -- Implement PEP 3121: new module initialization and finalization API. - -- Removed the already-defunct ``-t`` option. - -- Issue #2957: Corrected a ValueError "recursion limit exceeded", when - unmarshalling many code objects, which happens when importing a - large .pyc file (~1000 functions). - -- Issue #2963: fix merging oversight that disabled method cache for - all types. - -- Issue #2964: fix a missing INCREF in instancemethod_descr_get. - -- Issue #2895: Don't crash when given bytes objects as keyword names. - -- Issue #2798: When parsing arguments with PyArg_ParseTuple, the "s" - code now allows any unicode string and returns a utf-8 encoded - buffer, just like the "s#" code already does. The "z" code was - corrected as well. - -- Issue #2863: generators now have a ``gen.__name__`` attribute that - equals ``gen.gi_code.co_name``, like ``func.__name___`` that equals - ``func.func_code.co_name``. The repr() of a generator now also - contains this name. - -- Issue #2831: enumerate() now has a ``start`` argument. - -- Issue #2801: fix bug in the float.is_integer method where a - ValueError was sometimes incorrectly raised. - -- The ``--with-toolbox-glue`` option (and the associated - pymactoolbox.h) have been removed. - -- Issue #2196: hasattr() now lets exceptions which do not inherit - Exception (KeyboardInterrupt, and SystemExit) propagate instead of - ignoring them. - -- #3021 Exception reraising sematics have been significantly improved. However, - f_exc_type, f_exc_value, and f_exc_traceback cannot be accessed from Python - code anymore. - -- Three of PyNumberMethods' members, nb_coerce, nb_hex, and nb_oct, have been - removed. - -Extension Modules ------------------ - -- Renamed ``_winreg`` module to ``winreg``. - -- Support os.O_ASYNC and fcntl.FASYNC if the constants exist on the - platform. - -- Support for Windows 9x has been removed from the winsound module. - -- Issue #2870: cmathmodule.c compile error. - -Library -------- - -- The methods ``is_in_tuple()``, ``is_vararg()``, and ``is_keywordarg()`` of - symtable.Symbol have been removed. - -- Patch #3133: http.server.CGIHTTPRequestHandler did not work on windows. - -- a new ``urllib`` package was created. It consists of code from - ``urllib``, ``urllib2``, ``urlparse``, and ``robotparser``. The old - modules have all been removed. The new package has five submodules: - ``urllib.parse``, ``urllib.request``, ``urllib.response``, - ``urllib.error``, and ``urllib.robotparser``. The - ``urllib.request.urlopen()`` function uses the url opener from - ``urllib2``. (Note that the unittests have not been renamed for the - beta, but they will be renamed in the future.) - -- rfc822 has been removed in favor of the email package. - -- mimetools has been removed in favor of the email package. - -- Patch #2849: Remove use of rfc822 module from standard library. - -- Added C optimized implementation of io.StringIO. - -- The ``pickle`` module is now automatically use an optimized C - implementation of Pickler and Unpickler when available. The - ``cPickle`` module is no longer needed. - -- Removed the ``htmllib`` and ``sgmllib`` modules. - -- The deprecated ``SmartCookie`` and ``SimpleCookie`` classes have - been removed from ``http.cookies``. - -- The ``commands`` module has been removed. Its getoutput() and - getstatusoutput() functions have been moved to the ``subprocess`` module. - -- The ``http`` package was created; it contains the old ``httplib`` - as ``http.client``, ``Cookie`` as ``http.cookies``, ``cookielib`` - as ``http.cookiejar``, and the content of the three ``HTTPServer`` - modules as ``http.server``. - -- The ``xmlrpc`` package was created; it contains the old - ``xmlrpclib`` module as ``xmlrpc.client`` and the content of - the old ``SimpleXMLRPCServer`` and ``DocXMLRPCServer`` modules - as ``xmlrpc.server``. - -- The ``dbm`` package was created, containing the old modules - ``anydbm`` and ``whichdb`` in its ``__init__.py``, and having - ``dbm.gnu`` (was ``gdbm``), ``dbm.bsd`` (was ``dbhash``), - ``dbm.ndbm`` (was ``dbm``) and ``dbm.dumb`` (was ``dumbdbm``) - as submodules. - -- The ``repr`` module has been renamed to ``reprlib``. - -- The ``statvfs`` module has been removed. - -- Issue #1713041: fix pprint's handling of maximum depth. - -- Issue #2250: Exceptions raised during evaluation of names in - rlcompleter's ``Completer.complete()`` method are now caught and - ignored. - -- Patch #2659: Added ``break_on_hyphens`` option to textwrap's - ``TextWrapper`` class. - -- Issue #2487: change the semantics of math.ldexp(x, n) when n is too - large to fit in a C long. ldexp(x, n) now returns a zero (with - suitable sign) if n is large and negative; previously, it raised - OverflowError. - -- The ``ConfigParser`` module has been renamed to ``configparser``. - -- Issue #2865: webbrowser.open() works again in a KDE environment. - -- The ``multifile`` module has been removed. - -- The ``SocketServer`` module has been renamed to ``socketserver``. - -- Fixed the ``__all__`` setting on ``collections`` to include - ``UserList`` and ``UserString``. - -- The sre module has been removed. - -- The Queue module has been renamed to queue. - -- The copy_reg module has been renamed to copyreg. - -- The mhlib module has been removed. - -- The ihooks module has been removed. - -- The fpformat module has been removed. - -- The dircache module has been removed. - -- The Canvas module has been removed. - -- The Decimal module gained the magic methods __round__, __ceil__, - __floor__ and __trunc__, to give support for round, math.ceil, - math.floor and math.trunc. - -- The user module has been removed. - -- The mutex module has been removed. - -- The imputil module has been removed. - -- os.path.walk has been removed in favor of os.walk. - -- pdb gained the "until" command. - -- The test.test_support module has been renamed to test.support. - -- The threading module API was renamed to be PEP 8 compliant. The - old names are still present, but will be removed in the near future. - -Tools/Demos ------------ - -- The bgen tool has been removed. - -Build ------ - - -What's New in Python 3.0a5? -=========================== - -*Release date: 08-May-2008* - -Core and Builtins ------------------ - -- Fixed misbehaviour of PyLong_FromSsize_t on systems where - sizeof(size_t) > sizeof(long). - -- Issue #2221: Corrected a SystemError "error return without exception - set", when the code executed by exec() raises an exception, and - sys.stdout.flush() also raises an error. - -- Bug #2565: The repr() of type objects now calls them 'class', not - 'type' - whether they are builtin types or not. - -- The command line processing was converted to pass Unicode strings - through as unmodified as possible; as a consequence, the C API - related to command line arguments was changed to use wchar_t. - -- All backslashes in raw strings are interpreted literally. This - means that '\u' and '\U' escapes are not treated specially. - -Extension Modules ------------------ - -Library -------- - -- ctypes objects now support the PEP3118 buffer interface. - -- Issue #2682: ctypes callback functions now longer contain a cyclic - reference to themselves. - -- Issue #2058: Remove the buf attribute and add __slots__ to the - TarInfo class in order to reduce tarfile's memory usage. - -- Bug #2606: Avoid calling .sort() on a dict_keys object. - -- The bundled libffi copy is now in sync with the recently released - libffi3.0.5 version, apart from some small changes to - Modules/_ctypes/libffi/configure.ac. - -Build ------ - -- Issue #1496032: On alpha, use -mieee when gcc is the compiler. - -- "make install" is now an alias for "make altinstall", to prevent - accidentally overwriting a Python 2.x installation. Use "make - fullinstall" to force Python 3.0 to be installed as "python". - -- Issue #2544: On HP-UX systems, use 'gcc -shared' for linking when - gcc is used as compiler. - - -What's New in Python 3.0a4? -=========================== - -*Release date: 02-Apr-2008* - -Core and Builtins ------------------ - -- Bug #2301: Don't try decoding the source code into the original - encoding for syntax errors. - -Extension Modules ------------------ - -- The dl module was removed, use the ctypes module instead. - -- Use wchar_t functions in _locale module. - -Library -------- - -- The class distutils.commands.build_py.build_py_2to3 can be used as a - build_py replacement to automatically run 2to3 on modules that are - going to be installed. - -- A new pickle protocol (protocol 3) is added with explicit support - for bytes. This is the default protocol. It intentionally cannot - be unpickled by Python 2.x. - -- When a pickle written by Python 2.x contains an (8-bit) str - instance, this is now decoded to a (Unicode) str instance. The - encoding used to do this defaults to ASCII, but can be overridden - via two new keyword arguments to the Unpickler class. Previously - this would create bytes instances, which is usually wrong: str - instances are often used to pickle attribute names etc., and text is - more common than binary data anyway. - -- Default to ASCII as the locale.getpreferredencoding, if the POSIX - system doesn't support CODESET and LANG isn't set or doesn't allow - deduction of an encoding. - -- Issue #1202: zlib.crc32 and zlib.adler32 now return an unsigned - value. - -- Issue #719888: Updated tokenize to use a bytes API. generate_tokens - has been renamed tokenize and now works with bytes rather than - strings. A new detect_encoding function has been added for - determining source file encoding according to PEP-0263. Token - sequences returned by tokenize always start with an ENCODING token - which specifies the encoding used to decode the file. This token is - used to encode the output of untokenize back to bytes. - - -What's New in Python 3.0a3? -=========================== - -*Release date: 29-Feb-2008* - -Core and Builtins ------------------ - -- Issue #2282: io.TextIOWrapper was not overriding seekable() from - io.IOBase. - -- Issue #2115: Important speedup in setting __slot__ attributes. Also - prevent a possible crash: an Abstract Base Class would try to access - a slot on a registered virtual subclass. - -- Fixed repr() and str() of complex numbers with infinity or nan as - real or imaginary part. - -- Clear all free list during a gc.collect() of the highest generation - in order to allow pymalloc to free more arenas. Python may give back - memory to the OS earlier. - -- Issue #2045: Fix an infinite recursion triggered when printing a - subclass of collections.defaultdict, if its default_factory is set - to a bound method. - -- Fixed a minor memory leak in dictobject.c. The content of the free - list was not freed on interpreter shutdown. - -- Limit free list of method and builtin function objects to 256 - entries each. - -- Patch #1953: Added ``sys._compact_freelists()`` and the C API - functions ``PyInt_CompactFreeList`` and ``PyFloat_CompactFreeList`` - to compact the internal free lists of pre-allocted ints and floats. - -- Bug #1983: Fixed return type of fork(), fork1() and forkpty() calls. - Python expected the return type int but the fork familie returns - pi_t. - -- Issue #1678380: Fix a bug that identifies 0j and -0j when they - appear in the same code unit. - -- Issue #2025: Added tuple.count() and tuple.index() methods to comply - with the collections.Sequence API. - -- Fixed multiple reinitialization of the Python interpreter. The small - int list in longobject.c has caused a seg fault during the third - finalization. - -- Issue #1973: bytes.fromhex('') raised SystemError. - -- Issue #1771: remove cmp parameter from sorted() and list.sort(). - -- Issue #1969: split and rsplit in bytearray are inconsistent. - -- map() no longer accepts None for the first argument. Use zip() - instead. - -- Issue #1769: Now int("- 1") is not allowed any more. - -- Object/longobject.c: long(float('nan')) raises an OverflowError - instead of returning 0. - -- Issue #1762972: __file__ points to the source file instead of the - pyc/pyo file if the py file exists. - -- Issue #1393: object_richcompare() returns NotImplemented instead of - False if the objects aren't equal, to give the other side a chance. - -- Issue #1692: Interpreter was not displaying location of SyntaxError. - -- Improve some exception messages when Windows fails to load an - extension module. Now we get for example '%1 is not a valid Win32 - application' instead of 'error code 193'. Also use Unicode strings - to deal with non-English locales. - -- Issue #1587: Added instancemethod wrapper for PyCFunctions. The - Python C API has gained a new type *PyInstanceMethod_Type* and the - functions *PyInstanceMethod_Check(o)*, *PyInstanceMethod_New(func)* - and *PyInstanceMethod_Function(im)*. - -- Constants gc.DEBUG_OBJECT and gc.DEBUG_INSTANCE have been removed - from the gc module; gc.DEBUG_COLLECTABLE or gc.DEBUG_UNCOLLECTABLE - are now enough to print the corresponding list of objects considered - by the garbage collector. - -- Issue #1573: Improper use of the keyword-only syntax makes the - parser crash. - -- Issue #1564: The set implementation should special-case PyUnicode - instead of PyString. - -- Patch #1031213: Decode source line in SyntaxErrors back to its - original source encoding. - -- inspect.getsource() includes the decorators again. - -- Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a - mountpoint. - -- Fix utf-8-sig incremental decoder, which didn't recognise a BOM when - the first chunk fed to the decoder started with a BOM, but was - longer than 3 bytes. - -Extension Modules ------------------ - -- Code for itertools ifilter(), imap(), and izip() moved to bultins - and renamed to filter(), map(), and zip(). Also, renamed - izip_longest() to zip_longest() and ifilterfalse() to filterfalse(). - -- Issue #1762972: Readded the reload() function as imp.reload(). - -- Bug #2111: mmap segfaults when trying to write a block opened with - PROT_READ. - -- Issue #2063: correct order of utime and stime in os.times() result - on Windows. - -Library -------- - -- Weakref dictionaries now inherit from MutableMapping. - -- Created new UserDict class in collections module. This one inherits - from and complies with the MutableMapping ABC. Also, moved - UserString and UserList to the collections module. The - MutableUserString class was removed. - -- Removed UserDict.DictMixin. Replaced all its uses with - collections.MutableMapping. - -- Issue #1703: getpass() should flush after writing prompt. - -- Issue #1585: IDLE uses non-existent xrange() function. - -- Issue #1578: Problems in win_getpass. - -Build ------ - -- Renamed --enable-unicode configure flag to --with-wide-unicode, - since Unicode strings can't be disabled anymore. - -C API ------ - -- Issue #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, - Py_TYPE and Py_REFCNT. - -- New API PyImport_ImportModuleNoBlock(), works like - PyImport_ImportModule() but won't block on the import lock - (returning an error instead). - - -What's New in Python 3.0a2? -=========================== - -*Release date: 07-Dec-2007* - -(Note: this list is incomplete.) - -Core and Builtins ------------------ - -- str8 now has the same construction signature as bytes. - -- Comparisons between str and str8 now return False/True for ==/!=. - sqlite3 returns str8 when recreating on object from it's __conform__ - value. The struct module returns str8 for all string-related - formats. This was true before this change, but becomes more - apparent thanks to string comparisons always being False. - -- Replaced `PyFile_FromFile()` with `PyFile_FromFd(fd, name. mode, - buffer, encoding, newline)`. - -- Fixed `imp.find_module()` to obey the -*- coding: -*- header. - -- Changed `__file__` and `co_filename` to unicode. The path names are decoded - with `Py_FileSystemDefaultEncoding` and a new API method - `PyUnicode_DecodeFSDefault(char*)` was added. - -- io.open() and _fileio.FileIO have grown a new argument closefd. A - false value disables the closing of the file descriptor. - -- Added a new option -b to issues warnings (-bb for errors) about - certain operations between bytes/buffer and str like str(b'') and - comparison. - -- The standards streams sys.stdin, stdout and stderr may be None when - the when the C runtime library returns an invalid file descriptor - for the streams (fileno(stdin) < 0). For now this happens only for - Windows GUI apps and scripts started with `pythonw.exe`. - -- Added PCbuild9 directory for VS 2008. - -- Renamed structmember.h WRITE_RESTRICTED to PY_WRITE_RESTRICTED to - work around a name clash with VS 2008 on Windows. - -- Unbound methods are gone for good. ClassObject.method returns an - ordinary function object, instance.method still returns a bound - method object. The API of bound methods is cleaned up, too. The - im_class attribute is removed and im_func + im_self are renamed to - __func__ and __self__. The factory PyMethod_New takes only func and - instance as argument. - -- intobject.h is no longer included by Python.h. The remains were - moved to longobject.h. It still exists to define several aliases - from PyInt to PyLong functions. - -- Removed sys.maxint, use sys.maxsize instead. - -Extension Modules ------------------ - -- The `hotshot` profiler has been removed; use `cProfile` instead. - -Library -------- - -- When loading an external file using testfile(), the passed-in - encoding argument was being ignored if __loader__ is defined and - forcing the source to be UTF-8. - -- The methods `os.tmpnam()`, `os.tempnam()` and `os.tmpfile()` have - been removed in favor of the tempfile module. - -- Removed the 'new' module. - -- Removed all types from the 'types' module that are easily accessable - through builtins. - - -What's New in Python 3.0a1? -=========================== - -*Release date: 31-Aug-2007* - -Core and Builtins ------------------ - -- PEP 3131: Support non-ASCII identifiers. - -- PEP 3120: Change default encoding to UTF-8. - -- PEP 3123: Use proper C inheritance for PyObject. - -- Removed the __oct__ and __hex__ special methods and added a bin() - builtin function. - -- PEP 3127: octal literals now start with "0o". Old-style octal - literals are invalid. There are binary literals with a prefix of - "0b". This also affects int(x, 0). - -- None, True, False are now keywords. - -- PEP 3119: isinstance() and issubclass() can be overridden. - -- Remove BaseException.message. - -- Remove tuple parameter unpacking (PEP 3113). - -- Remove the f_restricted attribute from frames. This naturally leads - to the removal of PyEval_GetRestricted() and PyFrame_IsRestricted(). - -- PEP 3132 was accepted. That means that you can do ``a, *b = - range(5)`` to assign 0 to a and [1, 2, 3, 4] to b. - -- range() now returns an iterator rather than a list. Floats are not - allowed. xrange() is no longer defined. - -- Patch #1660500: hide iteration variable in list comps, add set comps - and use common code to handle compilation of iterative expressions. - -- By default, != returns the opposite of ==, unless the latter returns - NotImplemented. - -- Patch #1680961: sys.exitfunc has been removed and replaced with a - private C-level API. - -- PEP 3115: new metaclasses: the metaclass is now specified as a - keyword arg in the class statement, which can now use the full - syntax of a parameter list. Also, the metaclass can implement a - __prepare__ function which will be called to create the dictionary - for the new class namespace. - -- The long-deprecated argument "pend" of PyFloat_FromString() has been - removed. - -- The dir() function has been extended to call the __dir__() method on - its argument, if it exists. If not, it will work like before. This - allows customizing the output of dir() in the presence of a - __getattr__(). - -- Removed support for __members__ and __methods__. - -- Removed indexing/slicing on BaseException. - -- input() became raw_input(): the name input() now implements the - functionality formerly known as raw_input(); the name raw_input() is - no longer defined. - -- Classes listed in an 'except' clause must inherit from - BaseException. - -- PEP 3106: dict.iterkeys(), .iteritems(), .itervalues() are now gone; - and .keys(), .items(), .values() return dict views, which behave - like sets. - -- PEP 3105: print is now a function. Also (not in the PEP) the - 'softspace' attribute of files is now gone (since print() doesn't - use it). A side effect of this change is that you can get - incomplete output lines in interactive sessions: - - >>> print(42, end="") - 42>>> - - We may be able to fix this after the I/O library rewrite. - -- PEP 3102: keyword-only arguments. - -- Int/Long unification is complete. The 'long' built-in type and - literals with trailing 'L' or 'l' have been removed. Performance - may be sub-optimal (haven't really benchmarked). - -- 'except E, V' must now be spelled as 'except E as V' and deletes V - at the end of the except clause; V must be a simple name. - -- Added function annotations per PEP 3107. - -- Added nonlocal declaration from PEP 3104: - - >>> def f(x): - ... def inc(): - ... nonlocal x - ... x += 1 - ... return x - ... return inc - ... - >>> inc = f(0) - >>> inc() - 1 - >>> inc() - 2 - -- Moved intern() to sys.intern(). - -- exec is now a function. - -- Renamed nb_nonzero to nb_bool and __nonzero__ to __bool__. - -- Classic classes are a thing of the past. All classes are new style. - -- Exceptions *must* derive from BaseException. - -- Integer division always returns a float. The -Q option is no more. - All the following are gone: - - * PyNumber_Divide and PyNumber_InPlaceDivide - * __div__, __rdiv__, and __idiv__ - * nb_divide, nb_inplace_divide - * operator.div, operator.idiv, operator.__div__, operator.__idiv__ - (Only __truediv__ and __floordiv__ remain, not sure how to handle - them if we want to re-use __div__ and friends. If we do, it will - make it harder to write code for both 2.x and 3.x.) - -- 'as' and 'with' are keywords. - -- Absolute import is the default behavior for 'import foo' etc. - -- Removed support for syntax: backticks (ie, `x`), <>. - -- Removed these Python builtins: apply(), callable(), coerce(), - execfile(), file(), reduce(), reload(). - -- Removed these Python methods: {}.has_key. - -- Removed these opcodes: BINARY_DIVIDE, INPLACE_DIVIDE, UNARY_CONVERT. - -- Remove C API support for restricted execution. - -- zip(), map() and filter() now return iterators, behaving like their - itertools counterparts. This also affect map()'s behavior on - sequences of unequal length -- it now stops after the shortest one - is exhausted. - -- Additions: set literals, set comprehensions, ellipsis literal. - -- Added class decorators per PEP 3129. - - -Extension Modules ------------------ - -- Removed the imageop module. Obsolete long with its unit tests - becoming useless from the removal of rgbimg and imgfile. - -- Removed these attributes from the operator module: div, idiv, - __div__, __idiv__, isCallable, sequenceIncludes. - -- Removed these attributes from the sys module: exc_clear(), exc_type, - exc_value, exc_traceback. - - -Library -------- - -- Removed the compiler package. Use of the _ast module and (an - eventual) AST -> bytecode mechanism. - -- Removed these modules: audiodev, Bastion, bsddb185, exceptions, - linuxaudiodev, md5, MimeWriter, mimify, popen2, rexec, sets, sha, - stringold, strop, sunaudiodev, timing, xmllib. - -- Moved the toaiff module to Tools/Demos. - -- Removed obsolete IRIX modules: al/AL, cd/CD, cddb, cdplayer, cl/CL, - DEVICE, ERRNO, FILE, fl/FL, flp, fm, GET, gl/GL, GLWS, IN, imgfile, - IOCTL, jpeg, panel, panelparser, readcd, sgi, sv/SV, torgb, WAIT. - -- Removed obsolete functions: commands.getstatus(), os.popen*(). - -- Removed functions in the string module that are also string methods; - Remove string.{letters, lowercase, uppercase}. - -- Removed support for long obsolete platforms: plat-aix3, plat-irix5. - -- Removed xmlrpclib.SlowParser. It was based on xmllib. - -- Patch #1680961: atexit has been reimplemented in C. - -- Add new codecs for UTF-32, UTF-32-LE and UTF-32-BE. - -Build ------ - -C API ------ - -- Removed these Python slots: __coerce__, __div__, __idiv__, __rdiv__. - -- Removed these C APIs: PyNumber_Coerce(), PyNumber_CoerceEx(), - PyMember_Get, PyMember_Set. - -- Removed these C slots/fields: nb_divide, nb_inplace_divide. - -- Removed these macros: staticforward, statichere, PyArg_GetInt, - PyArg_NoArgs, _PyObject_Del. - -- Removed these typedefs: intargfunc, intintargfunc, intobjargproc, - intintobjargproc, getreadbufferproc, getwritebufferproc, - getsegcountproc, getcharbufferproc, memberlist. - -Tests ------ - -- Removed test.testall as test.regrtest replaces it. - -Documentation -------------- - -Mac ---- - -- The cfmfile module was removed. - -Platforms ---------- - -- Support for BeOS and AtheOS was removed (according to PEP 11). - -- Support for RiscOS, Irix, Tru64 was removed (alledgedly). - -Tools/Demos ------------ - **(For information about older versions, consult the HISTORY file.)** Modified: python/branches/py3k/README ============================================================================== --- python/branches/py3k/README (original) +++ python/branches/py3k/README Wed Dec 3 17:46:14 2008 @@ -1,17 +1,16 @@ -This is Python version 3.0 release candidate 3 -============================================== +This is Python version 3.1 alpha 0 +================================== For notes specific to this release, see RELNOTES in this directory. Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Python Software Foundation. All rights reserved. -Python 3000 (a.k.a. "Py3k", and released as Python 3.0) is a new -version of the language, which is incompatible with the 2.x line of -releases. The language is mostly the same, but many details, -especially how built-in objects like dictionaries and strings work, -have changed considerably, and a lot of deprecated features have -finally been removed. +Python 3.x is a new version of the language, which is incompatible with the +2.x line of releases. The language is mostly the same, but many details, +especially how built-in objects like dictionaries and strings work, have +changed considerably, and a lot of deprecated features have finally been +removed. This is an ongoing project; the cleanup isn't expected to be complete until some time in 2008. In particular there are plans to reorganize @@ -21,22 +20,15 @@ Release Schedule ---------------- -The release plan is to have a series of alpha releases in 2007 and 2008, -beta releases in 2008, and a final release in October 2008. The alpha -releases are primarily aimed at developers who want a sneak peek at the -new langauge, especially those folks who plan to port their code to -Python 3000. The hope is that by the time of the final release, many -3rd party packages will already be available in a 3.0-compatible form. - -See PEP 361 for release details: http://www.python.org/dev/peps/pep-0361/ +See PEP XXX for release details: http://www.python.org/dev/peps/pep-XXX/ Documentation ------------- -Documentation for Python 3000 is online, updated twice a day: +Documentation for Python 3.1 is online, updated twice a day: - http://docs.python.org/dev/3.0/ + http://docs.python.org/dev/3.1/ All documentation is also available online at the Python web site (http://docs.python.org/, see below). It is available online for @@ -48,9 +40,9 @@ This is a work in progress; please help improve it! -The design documents for Python 3000 are also online. While the -reference documentation is being updated, the PEPs are often the best -source of information about new features. Start by reading PEP 3000: +The design documents for Python 3 are also online. While the reference +documentation is being updated, the PEPs are often the best source of +information about new features. Start by reading PEP 3000: http://python.org/dev/peps/pep-3000/ @@ -58,15 +50,15 @@ What's New ---------- -For an overview of what's new in Python 3000, see Guido van Rossum's -blog at artima.com: +For an overview of what's new in Python 3, see Guido van Rossum's blog at +artima.com: http://www.artima.com/weblogs/index.jsp?blogger=guido We try to eventually have a comprehensive overview of the changes in -the "What's New in Python 3.0" document, found at +the "What's New in Python 3.1" document, found at - http://docs.python.org/dev/3.0/whatsnew/3.0 + http://docs.python.org/dev/3.1/whatsnew/3.1 Please help write it! @@ -88,13 +80,12 @@ http://www.python.org/dev/peps/. -Converting From Python 2.x to 3.0 +Converting From Python 2.x to 3.x --------------------------------- -Python 2.6 (to be released concurrent with Python 3.0) will contain features -to help locating code that needs to be changed, such as optional warnings when -deprecated features are used, and backported versions of certain key Python -3000 features. +Python starting with 2.6 will contain features to help locating code that +needs to be changed, such as optional warnings when deprecated features are +used, and backported versions of certain key Python 3.x features. Installing multiple versions Modified: python/branches/py3k/RELNOTES ============================================================================== --- python/branches/py3k/RELNOTES (original) +++ python/branches/py3k/RELNOTES Wed Dec 3 17:46:14 2008 @@ -1,29 +1,29 @@ -Python 3.0 Release Notes -======================== +Python 3 Release Notes +====================== -These release notes describe unfinished work, or important notes that Python -3.0 adopters need to be aware of. This is not a complete list of changes for -Python 3.0 -- for that, see Misc/NEWS. +These release notes describe unfinished work, or important notes that Python 3 +adopters need to be aware of. This is not a complete list of changes for +Python 3 -- for that, see Misc/NEWS. Please report bugs to http://bugs.python.org/ -The list of all known open issues for Python 3.0 can be found here: +The list of all known open issues for Python 3 can be found here: http://bugs.python.org/issue?%40search_text=&title=&%40columns=title&id=&%40columns=id&creation=&creator=&activity=&%40columns=activity&%40sort=activity&actor=&nosy=&type=&components=&versions=12&dependencies=&assignee=&keywords=&priority=&%40group=priority&status=1&%40columns=status&resolution=&%40pagesize=50&%40startwith=0&%40queryname=&%40old-queryname=&%40action=search -Additional notes for Python 3.0 final -------------------------------------- +Additional notes for Python 3 +----------------------------- * The bsddb3 package has been removed from the standard library. It is available as a separate distutils based package from the Python Cheeseshop. - If you need bsddb3 support in Python 3.0, you can find it here: + If you need bsddb3 support in Python 3, you can find it here: http://pypi.python.org/pypi/bsddb3 * The email package needs quite a bit of work to make it consistent with respect to bytes and strings. There have been discussions on - email-sig at python.org about where to go with the email package for 3.0, but - this was not resolved in time for 3.0 final. With enough care though, the - email package in Python 3.0 should be about as usable as it is with Python + email-sig at python.org about where to go with the email package for Python 3, + but this was not resolved in time for 3.0 final. With enough care though, + the email package in Python 3 should be about as usable as it is with Python 2. From python-3000-checkins at python.org Wed Dec 3 19:18:24 2008 From: python-3000-checkins at python.org (christian.heimes) Date: Wed, 3 Dec 2008 19:18:24 +0100 (CET) Subject: [Python-3000-checkins] r67507 - in python/branches/py3k: configure configure.in Message-ID: <20081203181824.3F4FD1E4002@bag.python.org> Author: christian.heimes Date: Wed Dec 3 19:18:23 2008 New Revision: 67507 Log: Bumped up version numbers of configure/autoconf scripts Modified: python/branches/py3k/configure python/branches/py3k/configure.in Modified: python/branches/py3k/configure ============================================================================== --- python/branches/py3k/configure (original) +++ python/branches/py3k/configure Wed Dec 3 19:18:23 2008 @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in Revision: 67100 . +# From configure.in Revision: 67461 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for python 3.0. +# Generated by GNU Autoconf 2.61 for python 3.1. # # Report bugs to . # @@ -575,8 +575,8 @@ # Identity of this package. PACKAGE_NAME='python' PACKAGE_TARNAME='python' -PACKAGE_VERSION='3.0' -PACKAGE_STRING='python 3.0' +PACKAGE_VERSION='3.1' +PACKAGE_STRING='python 3.1' PACKAGE_BUGREPORT='http://www.python.org/python-bugs' ac_unique_file="Include/object.h" @@ -1244,7 +1244,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures python 3.0 to adapt to many kinds of systems. +\`configure' configures python 3.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1305,7 +1305,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of python 3.0:";; + short | recursive ) echo "Configuration of python 3.1:";; esac cat <<\_ACEOF @@ -1428,7 +1428,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -python configure 3.0 +python configure 3.1 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1442,7 +1442,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by python $as_me 3.0, which was +It was created by python $as_me 3.1, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1811,7 +1811,7 @@ mv confdefs.h.new confdefs.h -VERSION=3.0 +VERSION=3.1 SOVERSION=1.0 @@ -24735,7 +24735,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by python $as_me 3.0, which was +This file was extended by python $as_me 3.1, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -24784,7 +24784,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -python config.status 3.0 +python config.status 3.1 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Modified: python/branches/py3k/configure.in ============================================================================== --- python/branches/py3k/configure.in (original) +++ python/branches/py3k/configure.in Wed Dec 3 19:18:23 2008 @@ -4,7 +4,7 @@ dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.61). # Set VERSION so we only need to edit in one place (i.e., here) -m4_define(PYTHON_VERSION, 3.0) +m4_define(PYTHON_VERSION, 3.1) AC_REVISION($Revision$) AC_PREREQ(2.61) From python-3000-checkins at python.org Wed Dec 3 19:35:13 2008 From: python-3000-checkins at python.org (christian.heimes) Date: Wed, 3 Dec 2008 19:35:13 +0100 (CET) Subject: [Python-3000-checkins] r67508 - in python/branches/py3k: PC/VC6/pythoncore.dsp PC/VC6/readme.txt PC/VS7.1/pythoncore.vcproj PC/VS8.0/pyproject.vsprops PCbuild/kill_python.c PCbuild/pyproject.vsprops PCbuild/readme.txt Message-ID: <20081203183513.B8A131E404D@bag.python.org> Author: christian.heimes Date: Wed Dec 3 19:35:13 2008 New Revision: 67508 Log: More 3.0 -> 3.1 transistions Modified: python/branches/py3k/PC/VC6/pythoncore.dsp python/branches/py3k/PC/VC6/readme.txt python/branches/py3k/PC/VS7.1/pythoncore.vcproj python/branches/py3k/PC/VS8.0/pyproject.vsprops python/branches/py3k/PCbuild/kill_python.c python/branches/py3k/PCbuild/pyproject.vsprops python/branches/py3k/PCbuild/readme.txt Modified: python/branches/py3k/PC/VC6/pythoncore.dsp ============================================================================== --- python/branches/py3k/PC/VC6/pythoncore.dsp (original) +++ python/branches/py3k/PC/VC6/pythoncore.dsp Wed Dec 3 19:35:13 2008 @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python30.dll" +# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python31.dll" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" @@ -82,7 +82,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python30_d.dll" /pdbtype:sept +# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python31_d.dll" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF Modified: python/branches/py3k/PC/VC6/readme.txt ============================================================================== --- python/branches/py3k/PC/VC6/readme.txt (original) +++ python/branches/py3k/PC/VC6/readme.txt Wed Dec 3 19:35:13 2008 @@ -13,7 +13,7 @@ The proper order to build subprojects: 1) pythoncore (this builds the main Python DLL and library files, - python30.{dll, lib} in Release mode) + python31.{dll, lib} in Release mode) 2) python (this builds the main Python executable, python.exe in Release mode) @@ -24,7 +24,7 @@ to the subsystems they implement; see SUBPROJECTS below) When using the Debug setting, the output files have a _d added to -their name: python30_d.dll, python_d.exe, pyexpat_d.pyd, and so on. +their name: python31_d.dll, python_d.exe, pyexpat_d.pyd, and so on. SUBPROJECTS ----------- Modified: python/branches/py3k/PC/VS7.1/pythoncore.vcproj ============================================================================== --- python/branches/py3k/PC/VS7.1/pythoncore.vcproj (original) +++ python/branches/py3k/PC/VS7.1/pythoncore.vcproj Wed Dec 3 19:35:13 2008 @@ -39,15 +39,15 @@ @@ -99,15 +99,15 @@ @@ -166,15 +166,15 @@ Name="VCLinkerTool" AdditionalOptions=" /MACHINE:IA64 /USELINK:MS_SDK" AdditionalDependencies="getbuildinfo.o" - OutputFile="./python30.dll" + OutputFile="./python31.dll" LinkIncremental="1" SuppressStartupBanner="FALSE" IgnoreDefaultLibraryNames="libc" GenerateDebugInformation="TRUE" - ProgramDatabaseFile=".\./python30.pdb" + ProgramDatabaseFile=".\./python31.pdb" SubSystem="2" BaseAddress="0x1e000000" - ImportLibrary=".\./python30.lib" + ImportLibrary=".\./python31.lib" TargetMachine="0"/> @@ -233,15 +233,15 @@ Name="VCLinkerTool" AdditionalOptions=" /MACHINE:AMD64 /USELINK:MS_SDK" AdditionalDependencies="getbuildinfo.o" - OutputFile="./python30.dll" + OutputFile="./python31.dll" LinkIncremental="1" SuppressStartupBanner="TRUE" IgnoreDefaultLibraryNames="libc" GenerateDebugInformation="TRUE" - ProgramDatabaseFile=".\./python30.pdb" + ProgramDatabaseFile=".\./python31.pdb" SubSystem="2" BaseAddress="0x1e000000" - ImportLibrary=".\./python30.lib" + ImportLibrary=".\./python31.lib" TargetMachine="0"/> Modified: python/branches/py3k/PC/VS8.0/pyproject.vsprops ============================================================================== --- python/branches/py3k/PC/VS8.0/pyproject.vsprops (original) +++ python/branches/py3k/PC/VS8.0/pyproject.vsprops Wed Dec 3 19:35:13 2008 @@ -38,7 +38,7 @@ /> References: <20081202223415.E1C981E4002@bag.python.org> Message-ID: <4936F395.1030904@gmail.com> guido.van.rossum wrote: > Author: guido.van.rossum > Date: Tue Dec 2 23:34:15 2008 > New Revision: 67479 > > Log: > Another checkpoint. More XXXes added... > > Also add some labels to 2.6.rst and howto/unicode.rst so I can refer > to them. (Somehow a label named 'module-contextlib' couldn't be > referenced -- why???) I think that label already points to the contextlib module itself. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- From martin at v.loewis.de Thu Dec 4 08:36:11 2008 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Thu, 04 Dec 2008 08:36:11 +0100 Subject: [Python-3000-checkins] Merging mailing lists Message-ID: <4937886B.4000002@v.loewis.de> I would like to merge mailing lists, now that the design and first implementation of Python 3000 is complete. In particular, I would like to merge the python-3000 mailing list back into python-dev, and the python-3000-checkins mailing list back into python-checkins. The rationale is to simplify usage of the lists, and to avoid cross-postings. To implement this, all subscribers of the 3000 mailing lists would be added to the trunk mailing lists (avoiding duplicates, of course), and all automated messages going to python-3000-checkins would then be directed to the trunk lists. The 3000 mailing lists would change into read-only mode (i.e. primarily leaving the archives behind). Any objections? Regards, Martin From fdrake at gmail.com Thu Dec 4 09:04:27 2008 From: fdrake at gmail.com (Fred Drake) Date: Thu, 4 Dec 2008 03:04:27 -0500 Subject: [Python-3000-checkins] [Python-checkins] Merging mailing lists In-Reply-To: <4937886B.4000002@v.loewis.de> References: <4937886B.4000002@v.loewis.de> Message-ID: <9cee7ab80812040004r54cce844lbd3728d99dc780d8@mail.gmail.com> On Thu, Dec 4, 2008 at 2:36 AM, "Martin v. L?wis" wrote: > I would like to merge mailing lists, now that the design and first > implementation of Python 3000 is complete. In particular, I would +1 -Fred -- Fred L. Drake, Jr. "Chaos is the score upon which reality is written." --Henry Miller From python-3000-checkins at python.org Thu Dec 4 09:53:27 2008 From: python-3000-checkins at python.org (hirokazu.yamamoto) Date: Thu, 4 Dec 2008 09:53:27 +0100 (CET) Subject: [Python-3000-checkins] r67517 - python/branches/py3k/PC/pyconfig.h Message-ID: <20081204085327.78B871E4002@bag.python.org> Author: hirokazu.yamamoto Date: Thu Dec 4 09:53:27 2008 New Revision: 67517 Log: Bumped up version number in PC/pyconfig.h. Modified: python/branches/py3k/PC/pyconfig.h Modified: python/branches/py3k/PC/pyconfig.h ============================================================================== --- python/branches/py3k/PC/pyconfig.h (original) +++ python/branches/py3k/PC/pyconfig.h Thu Dec 4 09:53:27 2008 @@ -319,9 +319,9 @@ their Makefile (other compilers are generally taken care of by distutils.) */ # ifdef _DEBUG -# pragma comment(lib,"python30_d.lib") +# pragma comment(lib,"python31_d.lib") # else -# pragma comment(lib,"python30.lib") +# pragma comment(lib,"python31.lib") # endif /* _DEBUG */ # endif /* _MSC_VER */ # endif /* Py_BUILD_CORE */ From jeremy at alum.mit.edu Thu Dec 4 14:24:57 2008 From: jeremy at alum.mit.edu (Jeremy Hylton) Date: Thu, 4 Dec 2008 08:24:57 -0500 Subject: [Python-3000-checkins] [Python-3000] Merging mailing lists In-Reply-To: <4937886B.4000002@v.loewis.de> References: <4937886B.4000002@v.loewis.de> Message-ID: On Thu, Dec 4, 2008 at 2:36 AM, "Martin v. L?wis" wrote: > I would like to merge mailing lists, now that the design and first > implementation of Python 3000 is complete. In particular, I would > like to merge the python-3000 mailing list back into python-dev, > and the python-3000-checkins mailing list back into python-checkins. > The rationale is to simplify usage of the lists, and to avoid > cross-postings. +1 > To implement this, all subscribers of the 3000 mailing lists would > be added to the trunk mailing lists (avoiding duplicates, of course), > and all automated messages going to python-3000-checkins would then > be directed to the trunk lists. The 3000 mailing lists would change > into read-only mode (i.e. primarily leaving the archives behind). > > Any objections? No Jeremy > Regards, > Martin > _______________________________________________ > Python-3000 mailing list > Python-3000 at python.org > http://mail.python.org/mailman/listinfo/python-3000 > Unsubscribe: http://mail.python.org/mailman/options/python-3000/jeremy%40alum.mit.edu > From python-3000-checkins at python.org Thu Dec 4 15:27:25 2008 From: python-3000-checkins at python.org (christian.heimes) Date: Thu, 4 Dec 2008 15:27:25 +0100 (CET) Subject: [Python-3000-checkins] r67519 - in python/branches/py3k: PC/VS8.0/build_ssl.bat PC/VS8.0/kill_python.c PC/os2emx/python26.def PC/os2emx/python27.def PCbuild/build_ssl.bat Message-ID: <20081204142725.E48091E4002@bag.python.org> Author: christian.heimes Date: Thu Dec 4 15:27:25 2008 New Revision: 67519 Log: More 3.0 -> 3.1 transistion in the Windows and OS/2 build files Added: python/branches/py3k/PC/os2emx/python27.def (props changed) - copied unchanged from r67518, /python/branches/py3k/PC/os2emx/python26.def Removed: python/branches/py3k/PC/os2emx/python26.def Modified: python/branches/py3k/PC/VS8.0/build_ssl.bat python/branches/py3k/PC/VS8.0/kill_python.c python/branches/py3k/PCbuild/build_ssl.bat Modified: python/branches/py3k/PC/VS8.0/build_ssl.bat ============================================================================== --- python/branches/py3k/PC/VS8.0/build_ssl.bat (original) +++ python/branches/py3k/PC/VS8.0/build_ssl.bat Thu Dec 4 15:27:25 2008 @@ -2,10 +2,10 @@ if not defined HOST_PYTHON ( if %1 EQU Debug ( set HOST_PYTHON=python_d.exe - if not exist python30_d.dll exit 1 + if not exist python31_d.dll exit 1 ) ELSE ( set HOST_PYTHON=python.exe - if not exist python30.dll exit 1 + if not exist python31.dll exit 1 ) ) %HOST_PYTHON% build_ssl.py %1 %2 %3 Modified: python/branches/py3k/PC/VS8.0/kill_python.c ============================================================================== --- python/branches/py3k/PC/VS8.0/kill_python.c (original) +++ python/branches/py3k/PC/VS8.0/kill_python.c Thu Dec 4 15:27:25 2008 @@ -106,7 +106,7 @@ /* * XXX TODO: if we really wanted to be fancy, we could check the * modules for all processes (not just the python[_d].exe ones) - * and see if any of our DLLs are loaded (i.e. python30[_d].dll), + * and see if any of our DLLs are loaded (i.e. python31[_d].dll), * as that would also inhibit our ability to rebuild the solution. * Not worth loosing sleep over though; for now, a simple check * for just the python executable should be sufficient. Deleted: python/branches/py3k/PC/os2emx/python26.def ============================================================================== --- python/branches/py3k/PC/os2emx/python26.def Thu Dec 4 15:27:25 2008 +++ (empty file) @@ -1,1310 +0,0 @@ -LIBRARY python26 INITINSTANCE TERMINSTANCE -DESCRIPTION "Python 2.6 Core DLL" -PROTMODE -DATA MULTIPLE NONSHARED -EXPORTS - -; From python26_s.lib(config) - "_PyImport_Inittab" - -; From python26_s.lib(dlfcn) -; "dlopen" -; "dlsym" -; "dlclose" -; "dlerror" - -; From python26_s.lib(getpathp) - "Py_GetProgramFullPath" - "Py_GetPrefix" - "Py_GetExecPrefix" - "Py_GetPath" - -; From python26_s.lib(getbuildinfo) - "Py_GetBuildInfo" - "_Py_svnversion" - -; From python26_s.lib(main) - "Py_Main" - "Py_GetArgcArgv" - -; From python26_s.lib(acceler) - "PyGrammar_AddAccelerators" - "PyGrammar_RemoveAccelerators" - -; From python26_s.lib(grammar1) - "PyGrammar_FindDFA" - "PyGrammar_LabelRepr" - -; From python26_s.lib(listnode) - "PyNode_ListTree" - -; From python26_s.lib(node) - "PyNode_New" - "PyNode_AddChild" - "PyNode_Free" - -; From python26_s.lib(parser) - "PyParser_AddToken" - "PyParser_New" - "PyParser_Delete" - -; From python26_s.lib(parsetok) - "PyParser_ParseString" - "PyParser_ParseStringFlagsFilename" - "PyParser_ParseFile" - "PyParser_ParseFileFlags" - "PyParser_ParseStringFlags" - -; From python26_s.lib(bitset) - "_Py_newbitset" - "_Py_delbitset" - "_Py_addbit" - "_Py_samebitset" - "_Py_mergebitset" - -; From python26_s.lib(metagrammar) - "_Py_meta_grammar" - "Py_meta_grammar" - -; From python26_s.lib(tokenizer) - "PyToken_OneChar" - "PyToken_TwoChars" - "PyToken_ThreeChars" - "PyTokenizer_FromString" - "PyTokenizer_Free" - "PyTokenizer_FromFile" - "PyTokenizer_Get" - "_PyParser_TokenNames" - -; From python26_s.lib(myreadline) - "_PyOS_ReadlineTState" - "PyOS_ReadlineFunctionPointer" - "PyOS_StdioReadline" - "PyOS_Readline" - "PyOS_InputHook" - -; From python26_s.lib(abstract) - "_PyObject_LengthHint" - "PyMapping_Size" - "PyObject_CallMethod" - "PyObject_GetItem" - "PySequence_GetItem" - "PyObject_SetItem" - "PySequence_SetItem" - "PyObject_DelItem" - "PySequence_DelItem" - "PyNumber_Multiply" - "PyNumber_InPlaceAdd" - "PyNumber_InPlaceMultiply" - "PyNumber_Int" - "PyNumber_Long" - "PyNumber_Float" - "PySequence_Concat" - "PySequence_Repeat" - "PySequence_InPlaceConcat" - "PySequence_InPlaceRepeat" - "PySequence_GetSlice" - "PySequence_SetSlice" - "PySequence_Tuple" - "PyObject_GetIter" - "PyIter_Next" - "PySequence_Fast" - "_PySequence_IterSearch" - "PyObject_CallFunction" - "_PyObject_CallFunction_SizeT" - "_PyObject_CallMethod_SizeT" - "PyObject_CallMethodObjArgs" - "PyObject_CallFunctionObjArgs" - "PyObject_Cmp" - "PyObject_Call" - "PyObject_CallObject" - "PyObject_Type" - "PyObject_Size" - "PyObject_Length" - "PyObject_DelItemString" - "PyObject_AsCharBuffer" - "PyObject_CheckReadBuffer" - "PyObject_AsReadBuffer" - "PyObject_AsWriteBuffer" - "PyNumber_Check" - "PyNumber_Add" - "PyNumber_Subtract" - "PyNumber_Divide" - "PyNumber_FloorDivide" - "PyNumber_TrueDivide" - "PyNumber_Remainder" - "PyNumber_Divmod" - "PyNumber_Power" - "PyNumber_Negative" - "PyNumber_Positive" - "PyNumber_Absolute" - "PyNumber_Invert" - "PyNumber_Lshift" - "PyNumber_Rshift" - "PyNumber_And" - "PyNumber_Xor" - "PyNumber_Or" - "PyNumber_Index" - "PyNumber_InPlaceSubtract" - "PyNumber_InPlaceDivide" - "PyNumber_InPlaceFloorDivide" - "PyNumber_InPlaceTrueDivide" - "PyNumber_InPlaceRemainder" - "PyNumber_InPlacePower" - "PyNumber_InPlaceLshift" - "PyNumber_InPlaceRshift" - "PyNumber_InPlaceAnd" - "PyNumber_InPlaceXor" - "PyNumber_InPlaceOr" - "PySequence_Check" - "PySequence_Size" - "PySequence_Length" - "PySequence_DelSlice" - "PySequence_List" - "PySequence_Count" - "PySequence_Contains" - "PySequence_In" - "PySequence_Index" - "PyMapping_Check" - "PyMapping_Length" - "PyMapping_HasKeyString" - "PyMapping_HasKey" - "PyMapping_GetItemString" - "PyMapping_SetItemString" - "PyObject_IsInstance" - "PyObject_IsSubclass" - -; From python26_s.lib(boolobject) - "PyBool_FromLong" - "PyBool_Type" - "_Py_ZeroStruct" - "_Py_TrueStruct" - -; From python26_s.lib(bufferobject) - "PyBuffer_FromObject" - "PyBuffer_FromReadWriteObject" - "PyBuffer_FromMemory" - "PyBuffer_FromReadWriteMemory" - "PyBuffer_New" - "PyBuffer_Type" - -; From python26_s.lib(cellobject) - "PyCell_New" - "PyCell_Get" - "PyCell_Set" - "PyCell_Type" - -; From python26_s.lib(classobject) - "PyClass_New" - "PyClass_IsSubclass" - "PyInstance_New" - "PyInstance_NewRaw" - "PyMethod_New" - "PyMethod_Function" - "PyMethod_Self" - "PyMethod_Class" - "_PyInstance_Lookup" - "PyMethod_Fini" - "PyClass_Type" - "PyInstance_Type" - "PyMethod_Type" - -; From python26_s.lib(cobject) - "PyCObject_FromVoidPtr" - "PyCObject_FromVoidPtrAndDesc" - "PyCObject_AsVoidPtr" - "PyCObject_GetDesc" - "PyCObject_Import" - "PyCObject_SetVoidPtr" - "PyCObject_Type" - -; From python26_s.lib(codeobject) - "PyCode_New" - "PyCode_Addr2Line" - "PyCode_CheckLineNumber" - "PyCode_Type" - -; From python26_s.lib(complexobject) - "_Py_c_pow" - "_Py_c_sum" - "_Py_c_diff" - "_Py_c_neg" - "_Py_c_prod" - "_Py_c_quot" - "PyComplex_FromCComplex" - "PyComplex_FromDoubles" - "PyComplex_RealAsDouble" - "PyComplex_ImagAsDouble" - "PyComplex_AsCComplex" - "PyComplex_Type" - -; From python26_s.lib(descrobject) - "PyWrapper_New" - "PyDescr_NewMethod" - "PyDescr_NewClassMethod" - "PyDescr_NewMember" - "PyDescr_NewGetSet" - "PyDescr_NewWrapper" - "PyDictProxy_New" - "PyWrapperDescr_Type" - "PyProperty_Type" - -; From python26_s.lib(dictobject) - "PyDict_New" - "PyDict_GetItem" - "PyDict_SetItem" - "PyDict_DelItem" - "PyDict_Clear" - "PyDict_MergeFromSeq2" - "PyDict_Merge" - "PyDict_Keys" - "PyDict_Values" - "PyDict_Contains" - "PyDict_Next" - "PyDict_Items" - "PyDict_Size" - "PyDict_Copy" - "PyDict_Update" - "PyDict_GetItemString" - "PyDict_SetItemString" - "PyDict_DelItemString" - "PyDict_Type" - "PyDictIterKey_Type" - "PyDictIterValue_Type" - "PyDictIterItem_Type" - -; From python26_s.lib(enumobject) - "PyEnum_Type" - "PyReversed_Type" - -; From python26_s.lib(fileobject) - "PyFile_FromString" - "Py_UniversalNewlineFread" - "PyFile_GetLine" - "PyFile_SoftSpace" - "PyFile_WriteObject" - "PyFile_WriteString" - "PyObject_AsFileDescriptor" - "Py_UniversalNewlineFgets" - "PyFile_SetBufSize" - "PyFile_SetEncoding" - "PyFile_FromFile" - "PyFile_AsFile" - "PyFile_Name" - "PyFile_Type" - -; From python26_s.lib(floatobject) - "PyFloat_FromString" - "PyFloat_AsDouble" - "PyFloat_Fini" - "_PyFloat_Pack4" - "_PyFloat_Pack8" - "_PyFloat_Unpack4" - "_PyFloat_Unpack8" - "PyFloat_FromDouble" - "PyFloat_AsReprString" - "PyFloat_AsString" - "_PyFloat_Init" - "PyFloat_AsStringEx" - "PyFloat_Type" - -; From python26_s.lib(frameobject) - "PyFrame_New" - "PyFrame_FastToLocals" - "PyFrame_LocalsToFast" - "_PyFrame_Init" - "PyFrame_Fini" - "PyFrame_BlockSetup" - "PyFrame_BlockPop" - "PyFrame_Type" - -; From python26_s.lib(funcobject) - "PyFunction_New" - "PyFunction_GetCode" - "PyFunction_GetGlobals" - "PyFunction_GetModule" - "PyFunction_GetDefaults" - "PyFunction_SetDefaults" - "PyFunction_GetClosure" - "PyFunction_SetClosure" - "PyClassMethod_New" - "PyStaticMethod_New" - "PyFunction_Type" - "PyClassMethod_Type" - "PyStaticMethod_Type" - -; From python26_s.lib(genobject) - "PyGen_New" - "PyGen_NeedsFinalizing" - "PyGen_Type" - -; From python26_s.lib(intobject) - "PyInt_AsLong" - "PyInt_AsUnsignedLongMask" - "PyInt_AsUnsignedLongLongMask" - "PyInt_FromString" - "PyInt_AsSsize_t" - "PyInt_Fini" - "PyInt_FromUnicode" - "PyInt_FromLong" - "PyInt_FromSize_t" - "PyInt_FromSsize_t" - "PyInt_GetMax" - "_PyInt_Init" - "PyInt_Type" - -; From python26_s.lib(iterobject) - "PySeqIter_New" - "PyCallIter_New" - "PySeqIter_Type" - "PyCallIter_Type" - -; From python26_s.lib(listobject) - "PyList_New" - "PyList_Append" - "PyList_Size" - "PyList_GetItem" - "PyList_SetItem" - "PyList_Insert" - "PyList_GetSlice" - "PyList_SetSlice" - "PyList_Sort" - "PyList_Reverse" - "PyList_AsTuple" - "_PyList_Extend" - "PyList_Fini" - "PyList_Type" - "PyListIter_Type" - "PyListRevIter_Type" - -; From python26_s.lib(longobject) - "PyLong_FromDouble" - "PyLong_AsLong" - "_PyLong_AsSsize_t" - "PyLong_AsUnsignedLong" - "_PyLong_FromByteArray" - "_PyLong_AsByteArray" - "PyLong_AsDouble" - "PyLong_FromLongLong" - "PyLong_AsLongLong" - "PyLong_FromString" - "PyLong_FromLong" - "PyLong_FromUnsignedLong" - "PyLong_AsUnsignedLongMask" - "_PyLong_FromSize_t" - "_PyLong_FromSsize_t" - "_PyLong_AsScaledDouble" - "PyLong_FromVoidPtr" - "PyLong_AsVoidPtr" - "PyLong_FromUnsignedLongLong" - "PyLong_AsUnsignedLongLong" - "PyLong_AsUnsignedLongLongMask" - "PyLong_FromUnicode" - "_PyLong_Sign" - "_PyLong_NumBits" - "_PyLong_New" - "_PyLong_Copy" - "PyLong_Type" - "_PyLong_DigitValue" - -; From python26_s.lib(methodobject) - "PyCFunction_Call" - "Py_FindMethodInChain" - "PyCFunction_GetFunction" - "PyCFunction_GetSelf" - "PyCFunction_GetFlags" - "Py_FindMethod" - "PyCFunction_NewEx" - "PyCFunction_Fini" - "PyCFunction_New" - "PyCFunction_Type" - -; From python26_s.lib(moduleobject) - "PyModule_New" - "_PyModule_Clear" - "PyModule_GetDict" - "PyModule_GetName" - "PyModule_GetFilename" - "PyModule_Type" - -; From python26_s.lib(object) - "Py_DivisionWarningFlag" - "PyObject_Str" - "PyObject_Repr" - "_PyObject_Str" - "PyObject_Unicode" - "PyObject_GetAttr" - "PyObject_IsTrue" - "PyNumber_CoerceEx" - "PyObject_Compare" - "PyObject_RichCompare" - "_Py_HashDouble" - "PyObject_Hash" - "PyObject_SetAttr" - "PyObject_GenericGetAttr" - "PyObject_GenericSetAttr" - "PyCallable_Check" - "PyObject_Dir" - "PyMem_Malloc" - "PyMem_Realloc" - "PyMem_Free" - "PyObject_Print" - "_PyObject_Dump" - "PyObject_RichCompareBool" - "PyObject_GetAttrString" - "PyObject_SetAttrString" - "PyObject_HasAttrString" - "PyObject_HasAttr" - "_PyObject_GetDictPtr" - "PyObject_SelfIter" - "PyObject_Not" - "PyNumber_Coerce" - "Py_ReprEnter" - "Py_ReprLeave" - "_Py_HashPointer" - "Py_IncRef" - "Py_DecRef" - "_PyTrash_deposit_object" - "_PyTrash_destroy_chain" - "PyObject_Init" - "PyObject_InitVar" - "_PyObject_New" - "_PyObject_NewVar" - "_PyObject_Del" - "_Py_ReadyTypes" - "_Py_SwappedOp" - "_Py_NotImplementedStruct" - "_Py_NoneStruct" - "_Py_cobject_hack" - "_Py_abstract_hack" - "_PyTrash_delete_nesting" - "_PyTrash_delete_later" - -; From python26_s.lib(obmalloc) - "PyObject_Malloc" - "PyObject_Free" - "PyObject_Realloc" - -; From python26_s.lib(rangeobject) - "PyRange_Type" - -; From python26_s.lib(setobject) - "PySet_Pop" - "PySet_New" - "PyFrozenSet_New" - "PySet_Size" - "PySet_Clear" - "PySet_Contains" - "PySet_Discard" - "PySet_Add" - "_PySet_Next" - "_PySet_Update" - "PySet_Fini" - "PySet_Type" - "PyFrozenSet_Type" - -; From python26_s.lib(sliceobject) - "_PySlice_FromIndices" - "PySlice_GetIndices" - "PySlice_GetIndicesEx" - "PySlice_New" - "_Py_EllipsisObject" - "PySlice_Type" - -; From python26_s.lib(stringobject) - "PyString_FromStringAndSize" - "PyString_InternInPlace" - "PyString_FromString" - "PyString_FromFormatV" - "PyString_AsString" - "_PyString_Resize" - "PyString_FromFormat" - "PyString_AsDecodedString" - "PyString_AsEncodedString" - "PyString_DecodeEscape" - "PyString_Repr" - "PyString_AsStringAndSize" - "_PyString_FormatLong" - "PyString_Format" - "_Py_ReleaseInternedStrings" - "PyString_Size" - "PyString_Concat" - "PyString_ConcatAndDel" - "_PyString_Eq" - "PyString_InternImmortal" - "PyString_InternFromString" - "_PyString_Join" - "PyString_Decode" - "PyString_Encode" - "PyString_AsEncodedObject" - "PyString_AsDecodedObject" - "PyString_Fini" - "PyString_Type" - "PyBaseString_Type" - -; From python26_s.lib(structseq) - "PyStructSequence_InitType" - "PyStructSequence_New" - "PyStructSequence_UnnamedField" - -; From python26_s.lib(tupleobject) - "PyTuple_New" - "PyTuple_Pack" - "_PyTuple_Resize" - "PyTuple_Size" - "PyTuple_GetItem" - "PyTuple_SetItem" - "PyTuple_GetSlice" - "PyTuple_Fini" - "PyTuple_Type" - "PyTupleIter_Type" - -; From python26_s.lib(typeobject) - "PyType_IsSubtype" - "_PyType_Lookup" - "PyType_Ready" - "PyType_GenericAlloc" - "_PyObject_SlotCompare" - "PyType_GenericNew" - "PyType_Type" - "PyBaseObject_Type" - "PySuper_Type" - -; From python26_s.lib(unicodeobject) - "PyUnicodeUCS2_Resize" - "PyUnicodeUCS2_FromOrdinal" - "PyUnicodeUCS2_FromObject" - "PyUnicodeUCS2_FromEncodedObject" - "PyUnicodeUCS2_Decode" - "PyUnicodeUCS2_GetDefaultEncoding" - "PyUnicodeUCS2_DecodeUTF8" - "PyUnicodeUCS2_DecodeLatin1" - "PyUnicodeUCS2_DecodeASCII" - "PyUnicodeUCS2_AsEncodedString" - "PyUnicodeUCS2_AsUTF8String" - "PyUnicodeUCS2_AsLatin1String" - "PyUnicodeUCS2_AsASCIIString" - "PyUnicode_DecodeUTF7" - "PyUnicode_EncodeUTF7" - "PyUnicodeUCS2_DecodeUTF8Stateful" - "PyUnicodeUCS2_EncodeUTF8" - "PyUnicodeUCS2_DecodeUTF16Stateful" - "PyUnicodeUCS2_AsUTF16String" - "PyUnicodeUCS2_DecodeUnicodeEscape" - "PyUnicodeUCS2_DecodeRawUnicodeEscape" - "PyUnicodeUCS2_EncodeRawUnicodeEscape" - "_PyUnicode_DecodeUnicodeInternal" - "PyUnicodeUCS2_DecodeCharmap" - "PyUnicode_BuildEncodingMap" - "PyUnicodeUCS2_EncodeCharmap" - "PyUnicodeUCS2_TranslateCharmap" - "PyUnicodeUCS2_EncodeDecimal" - "PyUnicodeUCS2_Count" - "PyUnicodeUCS2_Find" - "PyUnicodeUCS2_Join" - "PyUnicodeUCS2_Splitlines" - "PyUnicodeUCS2_Compare" - "PyUnicodeUCS2_Contains" - "PyUnicodeUCS2_Concat" - "_PyUnicode_XStrip" - "PyUnicodeUCS2_Replace" - "PyUnicodeUCS2_Split" - "PyUnicodeUCS2_RSplit" - "PyUnicodeUCS2_Format" - "_PyUnicodeUCS2_Init" - "_PyUnicodeUCS2_Fini" - "PyUnicodeUCS2_FromUnicode" - "PyUnicodeUCS2_AsUnicode" - "PyUnicodeUCS2_GetSize" - "PyUnicodeUCS2_GetMax" - "_PyUnicodeUCS2_AsDefaultEncodedString" - "PyUnicodeUCS2_SetDefaultEncoding" - "PyUnicodeUCS2_Encode" - "PyUnicodeUCS2_AsEncodedObject" - "PyUnicodeUCS2_DecodeUTF16" - "PyUnicodeUCS2_EncodeUTF16" - "PyUnicodeUCS2_AsUnicodeEscapeString" - "PyUnicodeUCS2_EncodeUnicodeEscape" - "PyUnicodeUCS2_AsRawUnicodeEscapeString" - "PyUnicodeUCS2_EncodeLatin1" - "PyUnicodeUCS2_EncodeASCII" - "PyUnicodeUCS2_AsCharmapString" - "PyUnicodeUCS2_Partition" - "PyUnicodeUCS2_RPartition" - "PyUnicodeUCS2_Translate" - "PyUnicodeUCS2_Tailmatch" - "PyUnicode_AsDecodedObject" - "PyUnicode_Type" - -; From python26_s.lib(unicodectype) - "_PyUnicode_TypeRecords" - "_PyUnicodeUCS2_ToNumeric" - "_PyUnicodeUCS2_IsLowercase" - "_PyUnicodeUCS2_IsUppercase" - "_PyUnicodeUCS2_IsTitlecase" - "_PyUnicodeUCS2_IsWhitespace" - "_PyUnicodeUCS2_IsLinebreak" - "_PyUnicodeUCS2_ToLowercase" - "_PyUnicodeUCS2_ToUppercase" - "_PyUnicodeUCS2_ToTitlecase" - "_PyUnicodeUCS2_ToDecimalDigit" - "_PyUnicodeUCS2_ToDigit" - "_PyUnicodeUCS2_IsDecimalDigit" - "_PyUnicodeUCS2_IsDigit" - "_PyUnicodeUCS2_IsNumeric" - "_PyUnicodeUCS2_IsAlpha" - -; From python26_s.lib(weakrefobject) - "PyWeakref_NewRef" - "PyWeakref_NewProxy" - "PyObject_ClearWeakRefs" - "PyWeakref_GetObject" - "_PyWeakref_GetWeakrefCount" - "_PyWeakref_ClearRef" - "_PyWeakref_RefType" - "_PyWeakref_ProxyType" - "_PyWeakref_CallableProxyType" - -; From python26_s.lib(Python-ast) -; "init_ast" - "Module" - "Interactive" - "Expression" - "Suite" - "FunctionDef" - "ClassDef" - "Return" - "Delete" - "Assign" - "AugAssign" - "Print" - "For" - "While" - "If" - "With" - "Raise" - "TryExcept" - "TryFinally" - "Assert" - "Import" - "ImportFrom" - "Exec" - "Global" - "Expr" - "Pass" - "Break" - "Continue" - "BoolOp" - "BinOp" - "UnaryOp" - "Lambda" - "IfExp" - "Dict" - "ListComp" - "GeneratorExp" - "Yield" - "Compare" - "Call" - "Repr" - "Num" - "Str" - "Attribute" - "Subscript" - "Name" - "List" - "Tuple" - "Ellipsis" - "Slice" - "ExtSlice" - "Index" - "comprehension" - "excepthandler" - "arguments" - "keyword" - "alias" - "PyAST_mod2obj" - -; From python26_s.lib(asdl) - "asdl_seq_new" - "asdl_int_seq_new" - -; From python26_s.lib(ast) - "PyAST_FromNode" - -; From python26_s.lib(bltinmodule) - "_PyBuiltin_Init" - "Py_FileSystemDefaultEncoding" - -; From python26_s.lib(exceptions) - "PyUnicodeEncodeError_GetStart" - "PyUnicodeDecodeError_GetStart" - "PyUnicodeEncodeError_GetEnd" - "PyUnicodeDecodeError_GetEnd" - "_PyExc_Init" - "PyUnicodeDecodeError_Create" - "PyUnicodeEncodeError_Create" - "PyUnicodeTranslateError_Create" - "PyUnicodeEncodeError_GetEncoding" - "PyUnicodeDecodeError_GetEncoding" - "PyUnicodeEncodeError_GetObject" - "PyUnicodeDecodeError_GetObject" - "PyUnicodeTranslateError_GetObject" - "PyUnicodeTranslateError_GetStart" - "PyUnicodeEncodeError_SetStart" - "PyUnicodeDecodeError_SetStart" - "PyUnicodeTranslateError_SetStart" - "PyUnicodeTranslateError_GetEnd" - "PyUnicodeEncodeError_SetEnd" - "PyUnicodeDecodeError_SetEnd" - "PyUnicodeTranslateError_SetEnd" - "PyUnicodeEncodeError_GetReason" - "PyUnicodeDecodeError_GetReason" - "PyUnicodeTranslateError_GetReason" - "PyUnicodeEncodeError_SetReason" - "PyUnicodeDecodeError_SetReason" - "PyUnicodeTranslateError_SetReason" - "_PyExc_Fini" - "PyExc_BaseException" - "PyExc_Exception" - "PyExc_StandardError" - "PyExc_TypeError" - "PyExc_StopIteration" - "PyExc_GeneratorExit" - "PyExc_SystemExit" - "PyExc_KeyboardInterrupt" - "PyExc_ImportError" - "PyExc_EnvironmentError" - "PyExc_IOError" - "PyExc_OSError" - "PyExc_EOFError" - "PyExc_RuntimeError" - "PyExc_NotImplementedError" - "PyExc_NameError" - "PyExc_UnboundLocalError" - "PyExc_AttributeError" - "PyExc_IndexError" - "PyExc_SyntaxError" - "PyExc_IndentationError" - "PyExc_TabError" - "PyExc_LookupError" - "PyExc_KeyError" - "PyExc_ValueError" - "PyExc_UnicodeError" - "PyExc_UnicodeEncodeError" - "PyExc_UnicodeDecodeError" - "PyExc_UnicodeTranslateError" - "PyExc_AssertionError" - "PyExc_ArithmeticError" - "PyExc_FloatingPointError" - "PyExc_OverflowError" - "PyExc_ZeroDivisionError" - "PyExc_SystemError" - "PyExc_ReferenceError" - "PyExc_MemoryError" - "PyExc_Warning" - "PyExc_UserWarning" - "PyExc_DeprecationWarning" - "PyExc_PendingDeprecationWarning" - "PyExc_SyntaxWarning" - "PyExc_RuntimeWarning" - "PyExc_FutureWarning" - "PyExc_ImportWarning" - "PyExc_MemoryErrorInst" - -; From python26_s.lib(ceval) - "PyEval_EvalFrameEx" - "PyEval_CallObjectWithKeywords" - "PyEval_EvalCodeEx" - "PyEval_GetFrame" - "PyEval_CallObject" - "PyEval_SetProfile" - "PyEval_SetTrace" - "PyEval_GetBuiltins" - "PyEval_GetGlobals" - "PyEval_GetLocals" - "PyEval_GetRestricted" - "PyEval_MergeCompilerFlags" - "Py_FlushLine" - "Py_AddPendingCall" - "Py_MakePendingCalls" - "Py_SetRecursionLimit" - "Py_GetRecursionLimit" - "_Py_CheckRecursiveCall" - "PyEval_GetFuncName" - "PyEval_GetFuncDesc" - "PyEval_GetCallStats" - "PyEval_EvalFrame" - "PyEval_SaveThread" - "PyEval_RestoreThread" - "PyEval_ThreadsInitialized" - "PyEval_InitThreads" - "PyEval_AcquireLock" - "PyEval_ReleaseLock" - "PyEval_AcquireThread" - "PyEval_ReleaseThread" - "PyEval_ReInitThreads" - "_PyEval_SliceIndex" - "PyEval_EvalCode" - "_PyEval_CallTracing" - "_Py_CheckRecursionLimit" - "_Py_CheckInterval" - "_Py_Ticker" - -; From python26_s.lib(compile) - "_Py_Mangle" - "PyAST_Compile" - "PyNode_Compile" - "Py_OptimizeFlag" - -; From python26_s.lib(codecs) - "_PyCodec_Lookup" - "PyCodec_Encode" - "PyCodec_Decode" - "PyCodec_IgnoreErrors" - "PyCodec_ReplaceErrors" - "PyCodec_XMLCharRefReplaceErrors" - "PyCodec_BackslashReplaceErrors" - "PyCodec_Register" - "PyCodec_Encoder" - "PyCodec_Decoder" - "PyCodec_IncrementalEncoder" - "PyCodec_IncrementalDecoder" - "PyCodec_StreamReader" - "PyCodec_StreamWriter" - "PyCodec_RegisterError" - "PyCodec_LookupError" - "PyCodec_StrictErrors" - -; From python26_s.lib(errors) - "PyErr_SetNone" - "PyErr_SetString" - "PyErr_GivenExceptionMatches" - "PyErr_NormalizeException" - "PyErr_Fetch" - "PyErr_Clear" - "PyErr_NoMemory" - "PyErr_SetFromErrnoWithFilenameObject" - "PyErr_Format" - "PyErr_NewException" - "PyErr_WriteUnraisable" - "PyErr_SyntaxLocation" - "PyErr_ProgramText" - "PyErr_SetObject" - "PyErr_Occurred" - "PyErr_Restore" - "PyErr_ExceptionMatches" - "PyErr_BadArgument" - "PyErr_SetFromErrno" - "PyErr_SetFromErrnoWithFilename" - "PyErr_BadInternalCall" - "_PyErr_BadInternalCall" - "PyErr_Warn" - "PyErr_WarnExplicit" - -; From python26_s.lib(frozen) - "PyImport_FrozenModules" - -; From python26_s.lib(frozenmain) - "Py_FrozenMain" - -; From python26_s.lib(future) - "PyFuture_FromAST" - -; From python26_s.lib(getargs) - "PyArg_Parse" - "_PyArg_Parse_SizeT" - "PyArg_ParseTuple" - "_PyArg_ParseTuple_SizeT" - "PyArg_ParseTupleAndKeywords" - "_PyArg_ParseTupleAndKeywords_SizeT" - "PyArg_UnpackTuple" - "_PyArg_NoKeywords" - "PyArg_VaParse" - "PyArg_VaParseTupleAndKeywords" - "_PyArg_VaParse_SizeT" - "_PyArg_VaParseTupleAndKeywords_SizeT" - -; From python26_s.lib(getcompiler) - "Py_GetCompiler" - -; From python26_s.lib(getcopyright) - "Py_GetCopyright" - -; From python26_s.lib(getmtime) - "PyOS_GetLastModificationTime" - -; From python26_s.lib(getplatform) - "Py_GetPlatform" - -; From python26_s.lib(getversion) - "Py_GetVersion" - -; From python26_s.lib(graminit) - "_PyParser_Grammar" - -; From python26_s.lib(import) - "_PyImport_Init" - "_PyImportHooks_Init" - "PyImport_ImportModule" - "PyImport_Cleanup" - "_PyImport_FixupExtension" - "PyImport_AddModule" - "PyImport_ExecCodeModuleEx" - "PyImport_ImportFrozenModule" - "PyImport_ImportModuleEx" - "PyImport_ImportModuleLevel" - "PyImport_ReloadModule" - "PyImport_Import" -; "initimp" - "_PyImport_Fini" - "PyImport_GetMagicNumber" - "PyImport_ExecCodeModule" - "PyImport_GetModuleDict" - "_PyImport_FindModule" - "_PyImport_IsScript" - "_PyImport_ReInitLock" - "_PyImport_FindExtension" - "PyImport_AppendInittab" - "PyImport_ExtendInittab" - "PyImport_Inittab" - "_PyImport_Filetab" - -; From python26_s.lib(importdl) - "_PyImport_LoadDynamicModule" - -; From python26_s.lib(marshal) - "PyMarshal_ReadLongFromFile" - "PyMarshal_WriteObjectToString" - "PyMarshal_WriteLongToFile" - "PyMarshal_WriteObjectToFile" - "PyMarshal_ReadShortFromFile" - "PyMarshal_ReadObjectFromFile" - "PyMarshal_ReadLastObjectFromFile" - "PyMarshal_ReadObjectFromString" - "PyMarshal_Init" - -; From python26_s.lib(modsupport) - "Py_InitModule4" - "Py_BuildValue" - "_Py_BuildValue_SizeT" - "PyEval_CallFunction" - "PyEval_CallMethod" - "_Py_VaBuildValue_SizeT" - "Py_VaBuildValue" - "PyModule_AddObject" - "PyModule_AddIntConstant" - "PyModule_AddStringConstant" - "_Py_PackageContext" - -; From python26_s.lib(mysnprintf) - "PyOS_snprintf" - "PyOS_vsnprintf" - -; From python26_s.lib(mystrtoul) - "PyOS_strtoul" - "PyOS_strtol" - -; From python26_s.lib(pyarena) - "PyArena_New" - "PyArena_Free" - "PyArena_Malloc" - "PyArena_AddPyObject" - -; From python26_s.lib(pyfpe) - "PyFPE_dummy" - -; From python26_s.lib(pystate) - "PyInterpreterState_Clear" - "PyThreadState_Clear" - "_PyThread_CurrentFrames" - "PyGILState_Ensure" - "PyGILState_Release" - "PyInterpreterState_New" - "PyInterpreterState_Delete" - "PyThreadState_Delete" - "PyThreadState_New" - "PyThreadState_DeleteCurrent" - "PyThreadState_Get" - "PyThreadState_Swap" - "PyThreadState_GetDict" - "PyThreadState_SetAsyncExc" - "PyGILState_GetThisThreadState" - "PyInterpreterState_Head" - "PyInterpreterState_Next" - "PyInterpreterState_ThreadHead" - "PyThreadState_Next" - "_PyGILState_Init" - "_PyGILState_Fini" - "_PyThreadState_Current" - "_PyThreadState_GetFrame" - -; From python26_s.lib(pystrtod) - "PyOS_ascii_strtod" - "PyOS_ascii_formatd" - "PyOS_ascii_atof" - -; From python26_s.lib(pythonrun) - "Py_IgnoreEnvironmentFlag" - "Py_DebugFlag" - "Py_VerboseFlag" - "Py_NoSiteFlag" - "Py_InteractiveFlag" - "Py_FrozenFlag" - "Py_InitializeEx" - "Py_FatalError" - "Py_NewInterpreter" - "PyErr_Print" - "PyRun_InteractiveOneFlags" - "PyParser_ASTFromFile" - "PyRun_SimpleFileExFlags" - "PyRun_FileExFlags" - "Py_Exit" - "PyErr_PrintEx" - "PyErr_Display" - "Py_SetProgramName" - "Py_GetProgramName" - "Py_SetPythonHome" - "Py_GetPythonHome" - "Py_Initialize" - "Py_Finalize" - "Py_IsInitialized" - "Py_EndInterpreter" - "PyRun_AnyFileFlags" - "Py_FdIsInteractive" - "PyRun_InteractiveLoopFlags" - "PyRun_AnyFileExFlags" - "PyRun_SimpleStringFlags" - "PyRun_StringFlags" - "PyParser_ASTFromString" - "PyParser_SimpleParseStringFlags" - "PyParser_SimpleParseFileFlags" - "Py_CompileStringFlags" - "Py_SymtableString" - "Py_AtExit" - "PyOS_getsig" - "PyOS_setsig" - "PyParser_SetError" - "PyModule_GetWarningsModule" - "PyParser_SimpleParseStringFlagsFilename" - "PyParser_SimpleParseStringFilename" - "PyParser_SimpleParseFile" - "PyParser_SimpleParseString" - "PyRun_AnyFile" - "PyRun_AnyFileEx" - "PyRun_File" - "PyRun_FileEx" - "PyRun_FileFlags" - "PyRun_SimpleFile" - "PyRun_SimpleFileEx" - "PyRun_String" - "PyRun_SimpleString" - "Py_CompileString" - "PyRun_InteractiveOne" - "PyRun_InteractiveLoop" - "Py_UseClassExceptionsFlag" - "Py_UnicodeFlag" - "_Py_QnewFlag" - -; From python26_s.lib(structmember) - "PyMember_Get" - "PyMember_GetOne" - "PyMember_SetOne" - "PyMember_Set" - -; From python26_s.lib(symtable) - "PySymtable_Build" - "PySymtable_Free" - "PyST_GetScope" - "PySymtable_Lookup" - "PySTEntry_Type" - -; From python26_s.lib(sysmodule) - "_PySys_Init" - "PySys_WriteStderr" - "PySys_SetPath" - "PySys_SetArgv" - "PySys_WriteStdout" - "Py_SubversionRevision" - "Py_SubversionShortBranch" - "PySys_GetObject" - "PySys_SetObject" - "PySys_GetFile" - "PySys_ResetWarnOptions" - "PySys_AddWarnOption" - -; From python26_s.lib(traceback) - "PyTraceBack_Here" - "PyTraceBack_Print" - "PyTraceBack_Type" - -; From python26_s.lib(getopt) - "_PyOS_GetOpt" - "_PyOS_opterr" - "_PyOS_optind" - "_PyOS_optarg" - -; From python26_s.lib(dynload_shlib) - "_PyImport_DynLoadFiletab" - "_PyImport_GetDynLoadFunc" - -; From python26_s.lib(thread) - "PyThread_delete_key_value" - "PyThread_init_thread" - "PyThread_start_new_thread" - "PyThread_exit_thread" - "PyThread_get_thread_ident" - "PyThread_allocate_lock" - "PyThread_free_lock" - "PyThread_acquire_lock" - "PyThread_release_lock" - "PyThread_get_stacksize" - "PyThread_set_stacksize" - "PyThread_create_key" - "PyThread_delete_key" - "PyThread_set_key_value" - "PyThread_get_key_value" - "PyThread__exit_thread" - -; From python26_s.lib(gcmodule) -; "initgc" - "_PyObject_GC_New" - "_PyObject_GC_NewVar" - "PyGC_Collect" - "_PyObject_GC_Resize" - "_PyObject_GC_Malloc" - "PyObject_GC_Track" - "PyObject_GC_UnTrack" - "PyObject_GC_Del" - "_PyGC_Dump" - "_PyObject_GC_Track" - "_PyObject_GC_UnTrack" - "_PyObject_GC_Del" - "_PyGC_generation0" - -; From python26_s.lib(signalmodule) -; "initsignal" - "PyErr_CheckSignals" - "PyErr_SetInterrupt" - "PyOS_FiniInterrupts" - "PyOS_InterruptOccurred" - "PyOS_InitInterrupts" - "PyOS_AfterFork" - -; From python26_s.lib(posixmodule) -; "initos2" - -; From python26_s.lib(_threadmodule) -; "init_thread" - -; From python26_s.lib(arraymodule) -; "initarray" -; "array_methods" - -; From python26_s.lib(binascii) -; "initbinascii" - -; From python26_s.lib(cmathmodule) -; "initcmath" - -; From python26_s.lib(_codecsmodule) -; "init_codecs" - -; From python26_s.lib(collectionsmodule) -; "initcollections" - "dequeiter_type" - "dequereviter_type" - -; From python26_s.lib(cPickle) -; "initcPickle" -; "fast_save_leave" - -; From python26_s.lib(_csv) -; "init_csv" - -; From python26_s.lib(datetimemodule) -; "initdatetime" - -; From python26_s.lib(dlmodule) -; "initdl" - -; From python26_s.lib(errnomodule) -; "initerrno" - -; From python26_s.lib(fcntlmodule) -; "initfcntl" - -; From python26_s.lib(_functoolsmodule) -; "init_functools" - -; From python26_s.lib(_heapqmodule) -; "init_heapq" - -; From python26_s.lib(imageop) -; "initimageop" - -; From python26_s.lib(itertoolsmodule) -; "inititertools" - -; From python26_s.lib(_localemodule) -; "init_locale" - -; From python26_s.lib(mathmodule) -; "initmath" - -; From python26_s.lib(md5) - "md5_finish" - "md5_init" - "md5_append" - -; From python26_s.lib(md5module) -; "init_md5" - -; From python26_s.lib(operator) -; "initoperator" - -; From python26_s.lib(_randommodule) -; "init_random" - -; From python26_s.lib(rgbimgmodule) -; "initrgbimg" - -; From python26_s.lib(shamodule) -; "init_sha" - -; From python26_s.lib(sha256module) -; "init_sha256" - -; From python26_s.lib(sha512module) -; "init_sha512" - -; From python26_s.lib(_sre) -; "init_sre" - -; From python26_s.lib(stropmodule) -; "initstrop" - -; From python26_s.lib(_struct) -; "init_struct" - -; From python26_s.lib(symtablemodule) -; "init_symtable" - -; From python26_s.lib(termios) -; "inittermios" - -; From python26_s.lib(timemodule) -; "inittime" - "_PyTime_DoubleToTimet" -; "inittimezone" - -; From python26_s.lib(timingmodule) -; "inittiming" - -; From python26_s.lib(_weakref) -; "init_weakref" - -; From python26_s.lib(xxsubtype) -; "initxxsubtype" - -; From python26_s.lib(zipimport) -; "initzipimport" Modified: python/branches/py3k/PCbuild/build_ssl.bat ============================================================================== --- python/branches/py3k/PCbuild/build_ssl.bat (original) +++ python/branches/py3k/PCbuild/build_ssl.bat Thu Dec 4 15:27:25 2008 @@ -2,10 +2,10 @@ if not defined HOST_PYTHON ( if %1 EQU Debug ( set HOST_PYTHON=python_d.exe - if not exist python30_d.dll exit 1 + if not exist python31_d.dll exit 1 ) ELSE ( set HOST_PYTHON=python.exe - if not exist python30.dll exit 1 + if not exist python31.dll exit 1 ) ) %HOST_PYTHON% build_ssl.py %1 %2 %3 From python-3000-checkins at python.org Thu Dec 4 16:07:14 2008 From: python-3000-checkins at python.org (andrew.kuchling) Date: Thu, 4 Dec 2008 16:07:14 +0100 (CET) Subject: [Python-3000-checkins] r67522 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081204150714.A4E6A1E4002@bag.python.org> Author: andrew.kuchling Date: Thu Dec 4 16:07:14 2008 New Revision: 67522 Log: Wording change (flaunt -> disobey); markup fixes. The largest edit is to the paragraph on relative imports; please review. (Backport candidate) Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Thu Dec 4 16:07:14 2008 @@ -456,10 +456,11 @@ * The :keyword:`from` *module* :keyword:`import` ``*`` syntax is only allowed at the module level, no longer inside functions. -* The only acceptable syntax for relative imports is :keyword:`from` - ``.``[*module*] :keyword:`import` *name*; :keyword:`import` forms - not starting with ``.`` are always interpreted as absolute imports. - (:pep:`0328`) +* The only acceptable syntaxes for relative imports are :keyword:`from` + ``.`` :keyword:`import` *name* or + :keyword:`from` ``.module`` :keyword:`import` *name*. + :keyword:`import` forms not starting with ``.`` are always + interpreted as absolute imports. (:pep:`0328`) * Classic classes are gone. @@ -559,8 +560,8 @@ release schedule. However, the package is alive and well, externally maintained at http://www.jcea.es/programacion/pybsddb.htm. -* Some modules were renamed because their old name flaunted - :pep:`0008`, or for various other reasons: +* Some modules were renamed because their old name disobeyed + :pep:`0008`, or for various other reasons. Here's the list: ======================= ======================= Old Name New Name @@ -607,7 +608,7 @@ really care about :mod:`tkinter`. Also note that as of Python 2.6, the functionality of :mod:`turtle` has been greatly enhanced. - * :mod:`urllib` (:mod:`urllib`, :mod:`urllib`2, :mod:`urlparse`, + * :mod:`urllib` (:mod:`urllib`, :mod:`urllib2`, :mod:`urlparse`, :mod:`robotparse`). * :mod:`xmlrpc` (:mod:`xmlrpclib`, :mod:`DocXMLRPCServer`, @@ -649,7 +650,7 @@ * :data:`string.letters` and its friends (:data:`string.lowercase` and :data:`string.uppercase`) are gone. Use :data:`string.ascii_letters` etc. instead. (The reason for the - removal is that :data:string.letters` and friends had + removal is that :data:`string.letters` and friends had locale-specific behavior, which is a bad idea for such attractively-named global "constants".) @@ -702,8 +703,8 @@ :attr:`__traceback__` attribute (see below). * :pep:`3110`: Catching exceptions. You must now use - *:keyword:`except` SomeException* :keyword:`as` *variable* instead - *of :keyword:`except` *SomeException*, variable*. Moreover, the + :keyword:`except` *SomeException* :keyword:`as` *variable* instead + of :keyword:`except` *SomeException*, variable*. Moreover, the *variable* is explicitly deleted when the :keyword:`except` block is left. From python-3000-checkins at python.org Thu Dec 4 16:28:52 2008 From: python-3000-checkins at python.org (fred.drake) Date: Thu, 4 Dec 2008 16:28:52 +0100 (CET) Subject: [Python-3000-checkins] r67523 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081204152852.1EC551E4002@bag.python.org> Author: fred.drake Date: Thu Dec 4 16:28:51 2008 New Revision: 67523 Log: - fix markup error - remove silly emoticon Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Thu Dec 4 16:28:51 2008 @@ -704,7 +704,7 @@ * :pep:`3110`: Catching exceptions. You must now use :keyword:`except` *SomeException* :keyword:`as` *variable* instead - of :keyword:`except` *SomeException*, variable*. Moreover, the + of :keyword:`except` *SomeException*, *variable*. Moreover, the *variable* is explicitly deleted when the :keyword:`except` block is left. @@ -726,7 +726,7 @@ traceback printed when an unhandled exception occurs walks the chain of :attr:`__cause__` and :attr:`__context__` attributes and prints a separate traceback for each component of the chain, with the primary - exception at the top. (Java users may recognize this behavior. :-) + exception at the top. (Java users may recognize this behavior.) * :pep:`3134`: Exception objects now store their traceback as the :attr:`__traceback__` attribute. This means that an exception From brett at python.org Thu Dec 4 18:37:05 2008 From: brett at python.org (Brett Cannon) Date: Thu, 4 Dec 2008 09:37:05 -0800 Subject: [Python-3000-checkins] Merging mailing lists In-Reply-To: <4937886B.4000002@v.loewis.de> References: <4937886B.4000002@v.loewis.de> Message-ID: On Wed, Dec 3, 2008 at 23:36, "Martin v. L?wis" wrote: > I would like to merge mailing lists, now that the design and first > implementation of Python 3000 is complete. In particular, I would > like to merge the python-3000 mailing list back into python-dev, > and the python-3000-checkins mailing list back into python-checkins. > The rationale is to simplify usage of the lists, and to avoid > cross-postings. > > To implement this, all subscribers of the 3000 mailing lists would > be added to the trunk mailing lists (avoiding duplicates, of course), > and all automated messages going to python-3000-checkins would then > be directed to the trunk lists. The 3000 mailing lists would change > into read-only mode (i.e. primarily leaving the archives behind). > > Any objections? > Nope; +1. -Brett From python-3000-checkins at python.org Thu Dec 4 19:18:16 2008 From: python-3000-checkins at python.org (georg.brandl) Date: Thu, 4 Dec 2008 19:18:16 +0100 (CET) Subject: [Python-3000-checkins] r67525 - python/branches/py3k/Doc/library/fractions.rst Message-ID: <20081204181816.41E161E4002@bag.python.org> Author: georg.brandl Date: Thu Dec 4 19:18:16 2008 New Revision: 67525 Log: #4527: fix "unicode or string". Modified: python/branches/py3k/Doc/library/fractions.rst Modified: python/branches/py3k/Doc/library/fractions.rst ============================================================================== --- python/branches/py3k/Doc/library/fractions.rst (original) +++ python/branches/py3k/Doc/library/fractions.rst Thu Dec 4 19:18:16 2008 @@ -25,7 +25,7 @@ :exc:`ZeroDivisionError`. The second version requires that *other_fraction* is an instance of :class:`numbers.Rational` and returns an :class:`Fraction` instance with the same value. The - last version of the constructor expects a string or unicode + last version of the constructor expects a string instance in one of two possible forms. The first form is:: [sign] numerator ['/' denominator] From python-3000-checkins at python.org Thu Dec 4 19:19:42 2008 From: python-3000-checkins at python.org (georg.brandl) Date: Thu, 4 Dec 2008 19:19:42 +0100 (CET) Subject: [Python-3000-checkins] r67526 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081204181942.215FD1E4060@bag.python.org> Author: georg.brandl Date: Thu Dec 4 19:19:41 2008 New Revision: 67526 Log: #4526: fix typo. Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Thu Dec 4 19:19:41 2008 @@ -383,10 +383,11 @@ * New octal literals, e.g. ``0o720`` (already in 2.6). The old octal literals (``0720``) are gone. -* New binary literals, e.g. ``0b1010`` (already in 2.6). +* New binary literals, e.g. ``0b1010`` (already in 2.6), and + there is a new corresponding builtin function, :func:`bin`. * Bytes literals are introduced with a leading ``b`` or ``B``, and - there is a new corresponding builtin function, :func:`bin`. + there is a new corresponding builtin function, :func:`bytes`. Changed Syntax -------------- From python-3000-checkins at python.org Thu Dec 4 19:21:47 2008 From: python-3000-checkins at python.org (georg.brandl) Date: Thu, 4 Dec 2008 19:21:47 +0100 (CET) Subject: [Python-3000-checkins] r67527 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081204182147.181581E4012@bag.python.org> Author: georg.brandl Date: Thu Dec 4 19:21:46 2008 New Revision: 67527 Log: #4521: fix getcwdu() vs getcwdb(). Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Thu Dec 4 19:21:46 2008 @@ -303,7 +303,7 @@ as well as strings, and a few APIs have a way to ask for a :class:`bytes` return value. Thus, :func:`os.listdir` returns a list of :class:`bytes` instances if the argument is a :class:`bytes` - instance, and :func:`os.getcwdu` returns the current working + instance, and :func:`os.getcwdb` returns the current working directory as a :class:`bytes` instance. Note that when :func:`os.listdir` returns a list of strings, filenames that cannot be decoded properly are omitted rather than raising From python-3000-checkins at python.org Thu Dec 4 19:28:38 2008 From: python-3000-checkins at python.org (georg.brandl) Date: Thu, 4 Dec 2008 19:28:38 +0100 (CET) Subject: [Python-3000-checkins] r67529 - python/branches/py3k/Python/bltinmodule.c Message-ID: <20081204182838.9E0A41E4014@bag.python.org> Author: georg.brandl Date: Thu Dec 4 19:28:38 2008 New Revision: 67529 Log: #4513: remove traces of zip() docstring from when it was izip(). Modified: python/branches/py3k/Python/bltinmodule.c Modified: python/branches/py3k/Python/bltinmodule.c ============================================================================== --- python/branches/py3k/Python/bltinmodule.c (original) +++ python/branches/py3k/Python/bltinmodule.c Thu Dec 4 19:28:38 2008 @@ -2178,9 +2178,7 @@ Return a zip object whose .__next__() method returns a tuple where\n\ the i-th element comes from the i-th iterable argument. The .__next__()\n\ method continues until the shortest iterable in the argument sequence\n\ -is exhausted and then it raises StopIteration. Works like the zip()\n\ -function but consumes less memory by returning an iterator instead of\n\ -a list."); +is exhausted and then it raises StopIteration."); PyTypeObject PyZip_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) From python-3000-checkins at python.org Thu Dec 4 19:44:53 2008 From: python-3000-checkins at python.org (georg.brandl) Date: Thu, 4 Dec 2008 19:44:53 +0100 (CET) Subject: [Python-3000-checkins] r67530 - in python/branches/py3k/Doc/whatsnew: 3.1.rst index.rst Message-ID: <20081204184453.F07531E4002@bag.python.org> Author: georg.brandl Date: Thu Dec 4 19:44:53 2008 New Revision: 67530 Log: Add a skeleton 3.1 whatsnew document. Added: python/branches/py3k/Doc/whatsnew/3.1.rst (contents, props changed) Modified: python/branches/py3k/Doc/whatsnew/index.rst Added: python/branches/py3k/Doc/whatsnew/3.1.rst ============================================================================== --- (empty file) +++ python/branches/py3k/Doc/whatsnew/3.1.rst Thu Dec 4 19:44:53 2008 @@ -0,0 +1,69 @@ +**************************** + What's New In Python 3.1 +**************************** + +.. XXX Add trademark info for Apple, Microsoft. + +:Author: No one so far +.. :Release: |release| +.. :Date: |today| + +.. $Id$ + Rules for maintenance: + + * Anyone can add text to this document. Do not spend very much time + on the wording of your changes, because your text will probably + get rewritten to some degree. + + * The maintainer will go through Misc/NEWS periodically and add + changes; it's therefore more important to add your changes to + Misc/NEWS than to this file. (Note: I didn't get to this for 3.0. + GvR.) + + * This is not a complete list of every single change; completeness + is the purpose of Misc/NEWS. Some changes I consider too small + or esoteric to include. If such a change is added to the text, + I'll just remove it. (This is another reason you shouldn't spend + too much time on writing your addition.) + + * If you want to draw your new text to the attention of the + maintainer, add 'XXX' to the beginning of the paragraph or + section. + + * It's OK to just add a fragmentary note about a change. For + example: "XXX Describe the transmogrify() function added to the + socket module." The maintainer will research the change and + write the necessary text. + + * You can comment out your additions if you like, but it's not + necessary (especially when a final release is some months away). + + * Credit the author of a patch or bugfix. Just the name is + sufficient; the e-mail address isn't necessary. (Due to time + constraints I haven't managed to do this for 3.0. GvR.) + + * It's helpful to add the bug/patch number as a comment: + + % Patch 12345 + XXX Describe the transmogrify() function added to the socket + module. + (Contributed by P.Y. Developer.) + + This saves the maintainer the effort of going through the SVN log + when researching a change. (Again, I didn't get to this for 3.0. + GvR.) + +This article explains the new features in Python 3.1, compared to 3.0. + +.. Compare with previous release in 2 - 3 sentences here. +.. add hyperlink when the documentation becomes available online. + +.. ====================================================================== +.. Large, PEP-level features and changes should be described here. +.. Should there be a new section here for 3k migration? +.. Or perhaps a more general section describing module changes/deprecation? +.. sets module deprecated +.. ====================================================================== + + +.. ====================================================================== Modified: python/branches/py3k/Doc/whatsnew/index.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/index.rst (original) +++ python/branches/py3k/Doc/whatsnew/index.rst Thu Dec 4 19:44:53 2008 @@ -11,6 +11,7 @@ .. toctree:: :maxdepth: 2 + 3.1.rst 3.0.rst 2.7.rst 2.6.rst From python-3000-checkins at python.org Thu Dec 4 20:24:50 2008 From: python-3000-checkins at python.org (fred.drake) Date: Thu, 4 Dec 2008 20:24:50 +0100 (CET) Subject: [Python-3000-checkins] r67534 - in python/branches/py3k: Lib/cgi.py Lib/test/test_cgi.py Misc/NEWS Message-ID: <20081204192450.A20E01E4002@bag.python.org> Author: fred.drake Date: Thu Dec 4 20:24:50 2008 New Revision: 67534 Log: Merged revisions 67528 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67528 | fred.drake | 2008-12-04 13:25:17 -0500 (Thu, 04 Dec 2008) | 4 lines Issue #1055234: cgi.parse_header(): Fixed parsing of header parameters to support unusual filenames (such as those containing semi-colons) in Content-Disposition headers. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/cgi.py python/branches/py3k/Lib/test/test_cgi.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/cgi.py ============================================================================== --- python/branches/py3k/Lib/cgi.py (original) +++ python/branches/py3k/Lib/cgi.py Thu Dec 4 20:24:50 2008 @@ -272,16 +272,28 @@ return partdict +def _parseparam(s): + while s[:1] == ';': + s = s[1:] + end = s.find(';') + while end > 0 and s.count('"', 0, end) % 2: + end = s.find(';', end + 1) + if end < 0: + end = len(s) + f = s[:end] + yield f.strip() + s = s[end:] + def parse_header(line): """Parse a Content-type like header. Return the main content-type and a dictionary of options. """ - plist = [x.strip() for x in line.split(';')] - key = plist.pop(0).lower() + parts = _parseparam(';' + line) + key = parts.__next__() pdict = {} - for p in plist: + for p in parts: i = p.find('=') if i >= 0: name = p[:i].strip().lower() Modified: python/branches/py3k/Lib/test/test_cgi.py ============================================================================== --- python/branches/py3k/Lib/test/test_cgi.py (original) +++ python/branches/py3k/Lib/test/test_cgi.py Thu Dec 4 20:24:50 2008 @@ -325,6 +325,33 @@ self.assertEqual([('a', 'A1'), ('b', 'B2'), ('B', 'B3')], cgi.parse_qsl('a=A1&b=B2&B=B3')) + def test_parse_header(self): + self.assertEqual( + cgi.parse_header("text/plain"), + ("text/plain", {})) + self.assertEqual( + cgi.parse_header("text/vnd.just.made.this.up ; "), + ("text/vnd.just.made.this.up", {})) + self.assertEqual( + cgi.parse_header("text/plain;charset=us-ascii"), + ("text/plain", {"charset": "us-ascii"})) + self.assertEqual( + cgi.parse_header('text/plain ; charset="us-ascii"'), + ("text/plain", {"charset": "us-ascii"})) + self.assertEqual( + cgi.parse_header('text/plain ; charset="us-ascii"; another=opt'), + ("text/plain", {"charset": "us-ascii", "another": "opt"})) + self.assertEqual( + cgi.parse_header('attachment; filename="silly.txt"'), + ("attachment", {"filename": "silly.txt"})) + self.assertEqual( + cgi.parse_header('attachment; filename="strange;name"'), + ("attachment", {"filename": "strange;name"})) + self.assertEqual( + cgi.parse_header('attachment; filename="strange;name";size=123;'), + ("attachment", {"filename": "strange;name", "size": "123"})) + + def test_main(): run_unittest(CgiTests) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Thu Dec 4 20:24:50 2008 @@ -16,6 +16,10 @@ Library ------- +- Issue #1055234: cgi.parse_header(): Fixed parsing of header parameters to + support unusual filenames (such as those containing semi-colons) in + Content-Disposition headers. + Build ----- From p.f.moore at gmail.com Thu Dec 4 21:21:28 2008 From: p.f.moore at gmail.com (Paul Moore) Date: Thu, 4 Dec 2008 20:21:28 +0000 Subject: [Python-3000-checkins] [Python-3000] Merging mailing lists In-Reply-To: <4937886B.4000002@v.loewis.de> References: <4937886B.4000002@v.loewis.de> Message-ID: <79990c6b0812041221y6feaae02k87c7133b535e1ece@mail.gmail.com> 2008/12/4 "Martin v. L?wis" : > Any objections? The timing is right, go for it. Paul From dima at hlabs.spb.ru Thu Dec 4 21:58:40 2008 From: dima at hlabs.spb.ru (Dmitry Vasiliev) Date: Thu, 04 Dec 2008 23:58:40 +0300 Subject: [Python-3000-checkins] [Python-3000] Merging mailing lists In-Reply-To: <4937886B.4000002@v.loewis.de> References: <4937886B.4000002@v.loewis.de> Message-ID: <49384480.8090806@hlabs.spb.ru> Martin v. L?wis wrote: > I would like to merge mailing lists, now that the design and first > implementation of Python 3000 is complete. In particular, I would +1 -- Dmitry Vasiliev (dima at hlabs.spb.ru) http://hlabs.spb.ru From martin at v.loewis.de Fri Dec 5 02:00:17 2008 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Fri, 05 Dec 2008 02:00:17 +0100 Subject: [Python-3000-checkins] [Python-Dev] Merging mailing lists In-Reply-To: References: <4937886B.4000002@v.loewis.de> Message-ID: <49387D21.6080303@v.loewis.de> > I like the general sentiment, but I think it may be a bad idea to > automatically bring all the subscribers from the -3000 lists over to the > more general lists. For instance if someone has an address subscribed > specifically to archive the -3000 list suddenly it will begin archiving > the other. I would rather just see a final announcement to switch to the > other list and then close the list to further submissions. Let people > join the new appropriate list manually if needed. That sounds reasonable. So no transfer of membership will be done; people have to explicitly subscribe to python-dev and python-checkins if they want to continue to follow the discussion. Regards, Martin From python-3000-checkins at python.org Fri Dec 5 02:02:22 2008 From: python-3000-checkins at python.org (amaury.forgeotdarc) Date: Fri, 5 Dec 2008 02:02:22 +0100 (CET) Subject: [Python-3000-checkins] r67539 - in python/branches/py3k: Lib/webbrowser.py Misc/NEWS Message-ID: <20081205010222.903291E4002@bag.python.org> Author: amaury.forgeotdarc Date: Fri Dec 5 02:02:21 2008 New Revision: 67539 Log: Issue #4537: webbrowser.UnixBrowser failed because this module defines an open() function which shadows the builtin. Will backport to 3.0 Modified: python/branches/py3k/Lib/webbrowser.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/webbrowser.py ============================================================================== --- python/branches/py3k/Lib/webbrowser.py (original) +++ python/branches/py3k/Lib/webbrowser.py Fri Dec 5 02:02:21 2008 @@ -223,7 +223,7 @@ cmdline = [self.name] + raise_opt + args if remote or self.background: - inout = open(os.devnull, "r+") + inout = io.open(os.devnull, "r+") else: # for TTY browsers, we need stdin/out inout = None Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Fri Dec 5 02:02:21 2008 @@ -16,6 +16,9 @@ Library ------- +- Issue #4537: webbrowser.UnixBrowser would fail to open the browser because + it was calling the wrong open() function. + - Issue #1055234: cgi.parse_header(): Fixed parsing of header parameters to support unusual filenames (such as those containing semi-colons) in Content-Disposition headers. From python-3000-checkins at python.org Fri Dec 5 02:40:43 2008 From: python-3000-checkins at python.org (amaury.forgeotdarc) Date: Fri, 5 Dec 2008 02:40:43 +0100 (CET) Subject: [Python-3000-checkins] r67541 - in python/branches/py3k: Misc/NEWS Modules/binascii.c Message-ID: <20081205014043.91AE31E400C@bag.python.org> Author: amaury.forgeotdarc Date: Fri Dec 5 02:40:43 2008 New Revision: 67541 Log: #4542: On Windows, binascii.crc32 still accepted str as binary input. This fixes test_binascii. Will backport to 3.0 Modified: python/branches/py3k/Misc/NEWS python/branches/py3k/Modules/binascii.c Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Fri Dec 5 02:40:43 2008 @@ -16,6 +16,9 @@ Library ------- +- Issue #4542: On Windows, binascii.crc32 still accepted str as binary input; + the corresponding tests now pass. + - Issue #4537: webbrowser.UnixBrowser would fail to open the browser because it was calling the wrong open() function. Modified: python/branches/py3k/Modules/binascii.c ============================================================================== --- python/branches/py3k/Modules/binascii.c (original) +++ python/branches/py3k/Modules/binascii.c Fri Dec 5 02:40:43 2008 @@ -1019,7 +1019,7 @@ Py_ssize_t len; unsigned int result; - if ( !PyArg_ParseTuple(args, "s*|I:crc32", &pbin, &crc) ) + if ( !PyArg_ParseTuple(args, "y*|I:crc32", &pbin, &crc) ) return NULL; bin_data = pbin.buf; len = pbin.len; From python-3000-checkins at python.org Fri Dec 5 03:47:42 2008 From: python-3000-checkins at python.org (fred.drake) Date: Fri, 5 Dec 2008 03:47:42 +0100 (CET) Subject: [Python-3000-checkins] r67544 - python/branches/py3k/Lib/webbrowser.py Message-ID: <20081205024742.609C61E4002@bag.python.org> Author: fred.drake Date: Fri Dec 5 03:47:42 2008 New Revision: 67544 Log: add missing import Modified: python/branches/py3k/Lib/webbrowser.py Modified: python/branches/py3k/Lib/webbrowser.py ============================================================================== --- python/branches/py3k/Lib/webbrowser.py (original) +++ python/branches/py3k/Lib/webbrowser.py Fri Dec 5 03:47:42 2008 @@ -223,6 +223,7 @@ cmdline = [self.name] + raise_opt + args if remote or self.background: + import io inout = io.open(os.devnull, "r+") else: # for TTY browsers, we need stdin/out From python-3000-checkins at python.org Fri Dec 5 04:05:29 2008 From: python-3000-checkins at python.org (benjamin.peterson) Date: Fri, 5 Dec 2008 04:05:29 +0100 (CET) Subject: [Python-3000-checkins] r67545 - python/branches/py3k/Doc/whatsnew/3.1.rst Message-ID: <20081205030529.DCE271E4002@bag.python.org> Author: benjamin.peterson Date: Fri Dec 5 04:05:29 2008 New Revision: 67545 Log: fix Sphinx warnings Modified: python/branches/py3k/Doc/whatsnew/3.1.rst Modified: python/branches/py3k/Doc/whatsnew/3.1.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.1.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.1.rst Fri Dec 5 04:05:29 2008 @@ -5,8 +5,8 @@ .. XXX Add trademark info for Apple, Microsoft. :Author: No one so far -.. :Release: |release| -.. :Date: |today| +:Release: |release| +:Date: |today| .. $Id$ Rules for maintenance: From python-3000-checkins at python.org Fri Dec 5 06:49:13 2008 From: python-3000-checkins at python.org (guido.van.rossum) Date: Fri, 5 Dec 2008 06:49:13 +0100 (CET) Subject: [Python-3000-checkins] r67548 - python/branches/py3k/Doc/whatsnew/3.0.rst Message-ID: <20081205054913.25B381E4002@bag.python.org> Author: guido.van.rossum Date: Fri Dec 5 06:49:12 2008 New Revision: 67548 Log: Tweak verbiage and markup for relative/absolute import. Backport candidate. (I guess *all* changes to this file should be backported to the 3.0 branch.) Modified: python/branches/py3k/Doc/whatsnew/3.0.rst Modified: python/branches/py3k/Doc/whatsnew/3.0.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.0.rst Fri Dec 5 06:49:12 2008 @@ -457,10 +457,9 @@ * The :keyword:`from` *module* :keyword:`import` ``*`` syntax is only allowed at the module level, no longer inside functions. -* The only acceptable syntaxes for relative imports are :keyword:`from` - ``.`` :keyword:`import` *name* or - :keyword:`from` ``.module`` :keyword:`import` *name*. - :keyword:`import` forms not starting with ``.`` are always +* The only acceptable syntax for relative imports is :keyword:`from` + ``.`` [*module*] :keyword:`import` *name*. + All :keyword:`import` forms not starting with ``.`` are interpreted as absolute imports. (:pep:`0328`) * Classic classes are gone. From guido at python.org Fri Dec 5 06:50:06 2008 From: guido at python.org (Guido van Rossum) Date: Thu, 4 Dec 2008 21:50:06 -0800 Subject: [Python-3000-checkins] r67522 - python/branches/py3k/Doc/whatsnew/3.0.rst In-Reply-To: <20081204150714.A4E6A1E4002@bag.python.org> References: <20081204150714.A4E6A1E4002@bag.python.org> Message-ID: Reviewed. I've chosen to fix the markup problem for relative/absolute imports differently, see r67548. On Thu, Dec 4, 2008 at 7:07 AM, andrew. kuchling wrote: > Author: andrew.kuchling > Date: Thu Dec 4 16:07:14 2008 > New Revision: 67522 > > Log: > Wording change (flaunt -> disobey); markup fixes. The largest edit is to the paragraph on relative imports; please review. (Backport candidate) > > Modified: > python/branches/py3k/Doc/whatsnew/3.0.rst > > Modified: python/branches/py3k/Doc/whatsnew/3.0.rst > ============================================================================== > --- python/branches/py3k/Doc/whatsnew/3.0.rst (original) > +++ python/branches/py3k/Doc/whatsnew/3.0.rst Thu Dec 4 16:07:14 2008 > @@ -456,10 +456,11 @@ > * The :keyword:`from` *module* :keyword:`import` ``*`` syntax is only > allowed at the module level, no longer inside functions. > > -* The only acceptable syntax for relative imports is :keyword:`from` > - ``.``[*module*] :keyword:`import` *name*; :keyword:`import` forms > - not starting with ``.`` are always interpreted as absolute imports. > - (:pep:`0328`) > +* The only acceptable syntaxes for relative imports are :keyword:`from` > + ``.`` :keyword:`import` *name* or > + :keyword:`from` ``.module`` :keyword:`import` *name*. > + :keyword:`import` forms not starting with ``.`` are always > + interpreted as absolute imports. (:pep:`0328`) > > * Classic classes are gone. > > @@ -559,8 +560,8 @@ > release schedule. However, the package is alive and well, > externally maintained at http://www.jcea.es/programacion/pybsddb.htm. > > -* Some modules were renamed because their old name flaunted > - :pep:`0008`, or for various other reasons: > +* Some modules were renamed because their old name disobeyed > + :pep:`0008`, or for various other reasons. Here's the list: > > ======================= ======================= > Old Name New Name > @@ -607,7 +608,7 @@ > really care about :mod:`tkinter`. Also note that as of Python > 2.6, the functionality of :mod:`turtle` has been greatly enhanced. > > - * :mod:`urllib` (:mod:`urllib`, :mod:`urllib`2, :mod:`urlparse`, > + * :mod:`urllib` (:mod:`urllib`, :mod:`urllib2`, :mod:`urlparse`, > :mod:`robotparse`). > > * :mod:`xmlrpc` (:mod:`xmlrpclib`, :mod:`DocXMLRPCServer`, > @@ -649,7 +650,7 @@ > * :data:`string.letters` and its friends (:data:`string.lowercase` and > :data:`string.uppercase`) are gone. Use > :data:`string.ascii_letters` etc. instead. (The reason for the > - removal is that :data:string.letters` and friends had > + removal is that :data:`string.letters` and friends had > locale-specific behavior, which is a bad idea for such > attractively-named global "constants".) > > @@ -702,8 +703,8 @@ > :attr:`__traceback__` attribute (see below). > > * :pep:`3110`: Catching exceptions. You must now use > - *:keyword:`except` SomeException* :keyword:`as` *variable* instead > - *of :keyword:`except` *SomeException*, variable*. Moreover, the > + :keyword:`except` *SomeException* :keyword:`as` *variable* instead > + of :keyword:`except` *SomeException*, variable*. Moreover, the > *variable* is explicitly deleted when the :keyword:`except` block > is left. > > _______________________________________________ > Python-3000-checkins mailing list > Python-3000-checkins at python.org > http://mail.python.org/mailman/listinfo/python-3000-checkins > -- --Guido van Rossum (home page: http://www.python.org/~guido/) From guido at python.org Fri Dec 5 06:56:35 2008 From: guido at python.org (Guido van Rossum) Date: Thu, 4 Dec 2008 21:56:35 -0800 Subject: [Python-3000-checkins] r67544 - python/branches/py3k/Lib/webbrowser.py In-Reply-To: <20081205024742.609C61E4002@bag.python.org> References: <20081205024742.609C61E4002@bag.python.org> Message-ID: It's unlikely that you'll avoid importing io.py, since it's used to initialize sys.stdio. why not import it at the top of the module? Or define a global _builtin_open = open that you can use? On Thu, Dec 4, 2008 at 6:47 PM, fred. drake wrote: > Author: fred.drake > Date: Fri Dec 5 03:47:42 2008 > New Revision: 67544 > > Log: > add missing import > > > Modified: > python/branches/py3k/Lib/webbrowser.py > > Modified: python/branches/py3k/Lib/webbrowser.py > ============================================================================== > --- python/branches/py3k/Lib/webbrowser.py (original) > +++ python/branches/py3k/Lib/webbrowser.py Fri Dec 5 03:47:42 2008 > @@ -223,6 +223,7 @@ > cmdline = [self.name] + raise_opt + args > > if remote or self.background: > + import io > inout = io.open(os.devnull, "r+") > else: > # for TTY browsers, we need stdin/out > _______________________________________________ > Python-3000-checkins mailing list > Python-3000-checkins at python.org > http://mail.python.org/mailman/listinfo/python-3000-checkins > -- --Guido van Rossum (home page: http://www.python.org/~guido/) From martin at v.loewis.de Sat Dec 6 15:27:26 2008 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat, 06 Dec 2008 15:27:26 +0100 Subject: [Python-3000-checkins] List is closed now Message-ID: <493A8BCE.5080008@v.loewis.de> python-3000-checkins at python.org is closed now. All commit messages are sent to python-checkins at python.org; follow-up discussions should take place on that mailing list as well.