+++++++++++ Python News +++++++++++ (editors: check NEWS.help for information about editing NEWS using ReST.) What's New in Python 3.0a3? =========================== *Release date: XX-XXX-2008* Core and Builtins ----------------- - 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('') raises SystemError - Issue #1771: remove cmp parameter from sorted() and list.sort() - Issue #1969: split and rsplit in bytearray are inconsistent - map() and itertools.imap() no longer accept 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 #1580: New free format floating point representation based on "Floating-Point Printer Sample Code", by Robert G. Burger. For example repr(11./5) now returns '2.2' instead of '2.2000000000000002'. - 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. Extension Modules ----------------- - Issue #1762972: Readded the reload() function as imp.reload() Library ------- - Weakref dictionaries now inherit from MutableMapping. XXX their API still needs to be modernized (i.e. eliminate the iter methods). - Created new UserDict class in collections module. This one inherits from and complies with the MutableMapping ABC. - 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 comparsion. - 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 ----------------- - Remove the imageop module. Obsolete long with its unit tests becoming useless from the removal of rgbimg and imgfile. - Removed these attributes from Python modules: * operator module: div, idiv, __div__, __idiv__, isCallable, sequenceIncludes * sys module: exc_clear(), exc_type, exc_value, exc_traceback Library ------- - Remove 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 these modules to Tools/Demos: * toaiff - Remove 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. - Remove obsolete functions: * commands.getstatus(), os.popen*, - Remove functions in the string module that are also string methods; Remove string.{letters, lowercase, uppercase}. - Remove support for long obsolete platforms: plat-aix3, plat-irix5. - Remove 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 ----- Documentation ------------- Mac --- - The cfmfile 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.)**