home *** CD-ROM | disk | FTP | other *** search
/ Freelog 33 / Freelog033.iso / Progr / Python-2.2.1.exe / NEWS < prev    next >
Encoding:
Text File  |  2002-04-09  |  133.0 KB  |  3,321 lines

  1. What's New in Python 2.2.1 final?
  2. Release date: 10-Apr-2002
  3. =================================
  4.  
  5. Core and builtins
  6.  
  7. - Added new builtin function bool() and new builtin constants True and
  8.   False to ease backporting of code developed for Python 2.3.  In 2.2,
  9.   bool() returns 1 or 0, True == 1, and False == 0.
  10.  
  11. - Fixed super() to work correctly with class methods.  [SF bug #535444]
  12.  
  13. - Fixed two bugs reported as SF #535905: under certain conditions,
  14.   deallocating a deeply nested structure could cause a segfault in the
  15.   garbage collector, due to interaction with the "trashcan" code;
  16.   access to the current frame during destruction of a local variable
  17.   could access a pointer to freed memory.
  18.  
  19. Library
  20.  
  21. - The xml.sax.expatreader.ExpatParser class will no longer create
  22.   circular references by using itself as the locator that gets passed
  23.   to the content handler implementation.  [SF bug #535474]
  24.  
  25. C API
  26.  
  27. - A type can now inherit its metatype from its base type.  Previously,
  28.   when PyType_Ready() was called, if ob_type was found to be NULL, it
  29.   was always set to &PyType_Type; now it is set to base->ob_type,
  30.   where base is tp_base, defaulting to &PyObject_Type.
  31.  
  32. - PyType_Ready() accidentally did not inherit tp_is_gc; now it does.
  33.  
  34. Windows
  35.  
  36. - Fixed a bug in urllib's proxy handling in Windows.  [SF bug #503031]
  37.  
  38. - The installer now installs Start menu shortcuts under (the local
  39.   equivalent of) "All Users" when doing an Admin install.
  40.  
  41.  
  42. What's New in Python 2.2.1c2?
  43. Release date: 26-Mar-2002
  44. =============================
  45.  
  46. There were a bunch of mostly minor fixes between 2.2.1c1 and 2.2.1c2,
  47. including:
  48.  
  49. - I remembered to run autoconf before cutting the release tarball.
  50.  
  51. Core and builtins
  52.  
  53. - The floating point behavior fix-up continued into complex_pow.
  54.  
  55. Library
  56.  
  57. - The email package bug #531966 was fixed.  This caused exceptions to
  58.   occur when flattening multipart/* messages with zero or one (scalar)
  59.   attachment.
  60.  
  61. - Support for https: urls in httplib was broken (by the sendall patch
  62.   mentioned below).
  63.  
  64. - Minor bugs in the calendar module were fixed.
  65.  
  66. - A few minor bugs in pydoc were fixed (better url recognition, proper
  67.   quoting of some elements).
  68.  
  69. - Some distutils commands didn't list all their "boolean options"
  70.   which made overriding them from .cfg files not work.
  71.  
  72.  
  73. What's New in Python 2.2.1c1?
  74. Release date: 18-Mar-2002
  75. =============================
  76.  
  77. This is primarily a bugfix release.  Many bugs have been fixed since
  78. the release of 2.2 final.  Some of the more notable are listed here.
  79.  
  80. Core and builtins
  81.  
  82. - If you try to pickle an instance of a class that has __slots__ but
  83.   doesn't define or override __getstate__, a TypeError is now raised.
  84.   This is done by adding a bozo __getstate__ to the class that always
  85.   raises TypeError.  (Before, this would appear to be pickled, but the
  86.   state of the slots would be lost.)
  87.  
  88. - (1).__nonzero__() would dump core.
  89.  
  90. - Tim has had another go at getting sensible behaviour with respect to
  91.   floating point underflow/overflow.
  92.  
  93. - Adding an instance of subclass of int to, say, a string, could
  94.   erroneously return "NotImplemented" instead of raising a TypeError.
  95.  
  96. - Subclassing longs could cause core dumps in certain circumstances.
  97.  
  98. - PyErr_Display will provide file and line information for all
  99.   exceptions that have an attribute print_file_and_line, not just
  100.   SyntaxErrors. This fixes the bug that no proper line number is given
  101.   for bad \x escapes.
  102.  
  103. - sys.setprofile() and sys.settrace() would dump core if called with
  104.   no arguments.
  105.  
  106. - An obscure & small memory overrun in wide unicode builds have been
  107.   fixed.
  108.  
  109. - __doc__ can now be of arbitrary type (in particular, it can be a
  110.   unicode string).
  111.  
  112. - complex objects are now immutable (as they should always have been).
  113.  
  114. Extension modules
  115.  
  116. - A security hole ("double free") was found in zlib-1.1.3, a popular
  117.   third party compression library used by some Python modules.  The
  118.   hole was quickly plugged in zlib-1.1.4, and the Windows build of
  119.   Python 2.2.1 now ships with zlib-1.1.4.
  120.  
  121. - new.instancemethod no longer fails for new-style classes.
  122.  
  123. - The "pseudo-sequences" returned by os.stat(), os.fstat(),
  124.   time.localtime() can now be pickled.
  125.  
  126. - Due to a cut and paste error the object exported as
  127.   posix.statvfs_result was in fact posix.stat_result.
  128.  
  129. Library
  130.  
  131. - The copy module can be used in restricted execution mode.
  132.  
  133. - A few bugs in the email package have been fixed.
  134.  
  135. - StringIO's attitude to unicode strings has been reverted to that of
  136.   the 2.1.x branch (note cStringIO still knows nothing about unicode).
  137.  
  138. - webbrowser: tightened up the command passed to os.system() so that
  139.   arbitrary shell code can't be executed because a bogus URL was
  140.   passed in.
  141.  
  142. - Recursive structures containing new-style classes can now by
  143.   deep-copied.
  144.  
  145. - ftplib defaults to passive mode (again).
  146.  
  147. Tools
  148.  
  149. - Bugs in IDLE's autoindent when using new-style division were fixed.
  150.  
  151.  
  152. What's New in Python 2.2 final?
  153. Release date: 21-Dec-2001
  154. ===============================
  155.  
  156. Type/class unification and new-style classes
  157.  
  158. - pickle.py, cPickle: allow pickling instances of new-style classes
  159.   with a custom metaclass.
  160.  
  161. Core and builtins
  162.  
  163. - weakref proxy object: when comparing, unwrap both arguments if both
  164.   are proxies.
  165.  
  166. Extension modules
  167.  
  168. - binascii.b2a_base64(): fix a potential buffer overrun when encoding
  169.   very short strings.
  170.  
  171. - cPickle: the obscure "fast" mode was suspected of causing stack
  172.   overflows on the Mac.  Hopefully fixed this by setting the recursion
  173.   limit much smaller.  If the limit is too low (it only affects
  174.   performance), you can change it by defining PY_CPICKLE_FAST_LIMIT
  175.   when compiling cPickle.c (or in pyconfig.h).
  176.  
  177. Library
  178.  
  179. - dumbdbm.py: fixed a dumb old bug (the file didn't get synched at
  180.   close or delete time).
  181.  
  182. - rfc822.py: fixed a bug where the address '<>' was converted to None
  183.   instead of an empty string (also fixes the email.Utils module).
  184.  
  185. - xmlrpclib.py: version 1.0.0; uses precision for doubles.
  186.  
  187. - test suite: the pickle and cPickle tests were not executing any code
  188.   when run from the standard regresssion test.
  189.  
  190. Tools/Demos
  191.  
  192. Build
  193.  
  194. C API
  195.  
  196. New platforms
  197.  
  198. Tests
  199.  
  200. Windows
  201.  
  202. - distutils package: fixed broken Windows installers (bdist_wininst).
  203.  
  204. - tempfile.py: prevent mysterious warnings when TemporaryFileWrapper
  205.   instances are deleted at process exit time.
  206.  
  207. - socket.py: prevent mysterious warnings when socket instances are
  208.   deleted at process exit time.
  209.  
  210. - posixmodule.c: fix a Windows crash with stat() of a filename ending
  211.   in backslash.
  212.  
  213. Mac
  214.  
  215. - The Carbon toolbox modules have been upgraded to Universal Headers
  216.   3.4, and experimental CoreGraphics and CarbonEvents modules have
  217.   been added.  All only for framework-enabled MacOSX.
  218.  
  219.  
  220. What's New in Python 2.2c1?
  221. Release date: 14-Dec-2001
  222. ===========================
  223.  
  224. Type/class unification and new-style classes
  225.  
  226. - Guido's tutorial introduction to the new type/class features has
  227.   been extensively updated.  See
  228.  
  229.       http://www.python.org/2.2/descrintro.html
  230.  
  231.   That remains the primary documentation in this area.
  232.  
  233. - Fixed a leak: instance variables declared with __slots__ were never
  234.   deleted!
  235.  
  236. - The "delete attribute" method of descriptor objects is called
  237.   __delete__, not __del__.  In previous releases, it was mistakenly
  238.   called __del__, which created an unfortunate overloading condition
  239.   with finalizers.  (The "get attribute" and "set attribute" methods
  240.   are still called __get__ and __set__, respectively.)
  241.  
  242. - Some subtle issues with the super built-in were fixed:
  243.  
  244.   (a) When super itself is subclassed, its __get__ method would still
  245.       return an instance of the base class (i.e., of super).
  246.  
  247.   (b) super(C, C()).__class__ would return C rather than super.  This
  248.       is confusing.  To fix this, I decided to change the semantics of
  249.       super so that it only applies to code attributes, not to data
  250.       attributes.  After all, overriding data attributes is not
  251.       supported anyway.
  252.  
  253.   (c) The __get__ method didn't check whether the argument was an
  254.       instance of the type used in creation of the super instance.
  255.  
  256. - Previously, hash() of an instance of a subclass of a mutable type
  257.   (list or dictionary) would return some value, rather than raising
  258.   TypeError.  This has been fixed.  Also, directly calling
  259.   dict.__hash__ and list.__hash__ now raises the same TypeError
  260.   (previously, these were the same as object.__hash__).
  261.  
  262. - New-style objects now support deleting their __dict__.  This is for
  263.   all intents and purposes equivalent to assigning a brand new empty
  264.   dictionary, but saves space if the object is not used further.
  265.  
  266. Core and builtins
  267.  
  268. - -Qnew now works as documented in PEP 238:  when -Qnew is passed on
  269.   the command line, all occurrences of "/" use true division instead
  270.   of classic division.  See the PEP for details.  Note that "all"
  271.   means all instances in library and 3rd-party modules, as well as in
  272.   your own code.  As the PEP says, -Qnew is intended for use only in
  273.   educational environments with control over the libraries in use.
  274.   Note that test_coercion.py in the standard Python test suite fails
  275.   under -Qnew; this is expected, and won't be repaired until true
  276.   division becomes the default (in the meantime, test_coercion is
  277.   testing the current rules).
  278.  
  279. - complex() now only allows the first argument to be a string
  280.   argument, and raises TypeError if either the second arg is a string
  281.   or if the second arg is specified when the first is a string.
  282.  
  283. Extension modules
  284.  
  285. - gc.get_referents was renamed to gc.get_referrers.
  286.  
  287. Library
  288.  
  289. - Functions in the os.spawn() family now release the global interpreter
  290.   lock around calling the platform spawn.  They should always have done
  291.   this, but did not before 2.2c1.  Multithreaded programs calling
  292.   an os.spawn function with P_WAIT will no longer block all Python threads
  293.   until the spawned program completes.  It's possible that some programs
  294.   relies on blocking, although more likely by accident than by design.
  295.  
  296. - webbrowser defaults to netscape.exe on OS/2 now.
  297.  
  298. - Tix.ResizeHandle exposes detach_widget, hide, and show.
  299.  
  300. - The charset alias windows_1252 has been added.
  301.  
  302. - types.StringTypes is a tuple containing the defined string types;
  303.   usually this will be (str, unicode), but if Python was compiled
  304.   without Unicode support it will be just (str,).
  305.  
  306. - The pulldom and minidom modules were synchronized to PyXML.
  307.  
  308. Tools/Demos
  309.  
  310. - A new script called Tools/scripts/google.py was added, which fires
  311.   off a search on Google.
  312.  
  313. Build
  314.  
  315. - Note that release builds of Python should arrange to define the
  316.   preprocessor symbol NDEBUG on the command line (or equivalent).
  317.   In the 2.2 pre-release series we tried to define this by magic in
  318.   Python.h instead, but it proved to cause problems for extension
  319.   authors.  The Unix, Windows and Mac builds now all define NDEBUG in
  320.   release builds via cmdline (or equivalent) instead.  Ports to
  321.   other platforms should do likewise.
  322.  
  323. - It is no longer necessary to use --with-suffix when building on a
  324.   case-insensitive file system (such as Mac OS X HFS+). In the build
  325.   directory an extension is used, but not in the installed python.
  326.  
  327. C API
  328.  
  329. - New function PyDict_MergeFromSeq2() exposes the builtin dict
  330.   constructor's logic for updating a dictionary from an iterable object
  331.   producing key-value pairs.
  332.  
  333. - PyArg_ParseTupleAndKeywords() requires that the number of entries in
  334.   the keyword list equal the number of argument specifiers.  This
  335.   wasn't checked correctly, and PyArg_ParseTupleAndKeywords could even
  336.   dump core in some bad cases.  This has been repaired.  As a result,
  337.   PyArg_ParseTupleAndKeywords may raise RuntimeError in bad cases that
  338.   previously went unchallenged.
  339.  
  340. New platforms
  341.  
  342. Tests
  343.  
  344. Windows
  345.  
  346. Mac
  347.  
  348. - In unix-Python on Mac OS X (and darwin) sys.platform is now "darwin",
  349.   without any trailing digits.
  350.  
  351. - Changed logic for finding python home in Mac OS X framework Pythons.
  352.   Now sys.executable points to the executable again, in stead of to
  353.   the shared library. The latter is used only for locating the python
  354.   home.
  355.  
  356.  
  357. What's New in Python 2.2b2?
  358. Release date: 16-Nov-2001
  359. ===========================
  360.  
  361. Type/class unification and new-style classes
  362.  
  363. - Multiple inheritance mixing new-style and classic classes in the
  364.   list of base classes is now allowed, so this works now:
  365.  
  366.       class Classic: pass
  367.       class Mixed(Classic, object): pass
  368.  
  369.   The MRO (method resolution order) for each base class is respected
  370.   according to its kind, but the MRO for the derived class is computed
  371.   using new-style MRO rules if any base clase is a new-style class.
  372.   This needs to be documented.
  373.  
  374. - The new builtin dictionary() constructor, and dictionary type, have
  375.   been renamed to dict.  This reflects a decade of common usage.
  376.  
  377. - dict() now accepts an iterable object producing 2-sequences.  For
  378.   example, dict(d.items()) == d for any dictionary d.  The argument,
  379.   and the elements of the argument, can be any iterable objects.
  380.  
  381. - New-style classes can now have a __del__ method, which is called
  382.   when the instance is deleted (just like for classic classes).
  383.  
  384. - Assignment to object.__dict__ is now possible, for objects that are
  385.   instances of new-style classes that have a __dict__ (unless the base
  386.   class forbids it).
  387.  
  388. - Methods of built-in types now properly check for keyword arguments
  389.   (formerly these were silently ignored).  The only built-in methods
  390.   that take keyword arguments are __call__, __init__ and __new__.
  391.  
  392. - The socket function has been converted to a type; see below.
  393.  
  394. Core and builtins
  395.  
  396. - Assignment to __debug__ raises SyntaxError at compile-time.  This
  397.   was promised when 2.1c1 was released as "What's New in Python 2.1c1"
  398.   (see below) says.
  399.  
  400. - Clarified the error messages for unsupported operands to an operator
  401.   (like 1 + '').
  402.  
  403. Extension modules
  404.  
  405. - mmap has a new keyword argument, "access", allowing a uniform way for
  406.   both Windows and Unix users to create read-only, write-through and
  407.   copy-on-write memory mappings.  This was previously possible only on
  408.   Unix.  A new keyword argument was required to support this in a
  409.   uniform way because the mmap() signuatures had diverged across
  410.   platforms.  Thanks to Jay T Miller for repairing this!
  411.  
  412. - By default, the gc.garbage list now contains only those instances in
  413.   unreachable cycles that have __del__ methods; in 2.1 it contained all
  414.   instances in unreachable cycles.  "Instances" here has been generalized
  415.   to include instances of both new-style and old-style classes.
  416.  
  417. - The socket module defines a new method for socket objects,
  418.   sendall().  This is like send() but may make multiple calls to
  419.   send() until all data has been sent.  Also, the socket function has
  420.   been converted to a subclassable type, like list and tuple (etc.)
  421.   before it; socket and SocketType are now the same thing.
  422.  
  423. - Various bugfixes to the curses module.  There is now a test suite
  424.   for the curses module (you have to run it manually).
  425.  
  426. - binascii.b2a_base64 no longer places an arbitrary restriction of 57
  427.   bytes on its input.
  428.  
  429. Library
  430.  
  431. - tkFileDialog exposes a Directory class and askdirectory
  432.   convenience function.
  433.  
  434. - Symbolic group names in regular expressions must be unique.  For
  435.   example, the regexp r'(?P<abc>)(?P<abc>)' is not allowed, because a
  436.   single name can't mean both "group 1" and "group 2" simultaneously.
  437.   Python 2.2 detects this error at regexp compilation time;
  438.   previously, the error went undetected, and results were
  439.   unpredictable.  Also in sre, the pattern.split(), pattern.sub(), and
  440.   pattern.subn() methods have been rewritten in C.  Also, an
  441.   experimental function/method finditer() has been added, which works
  442.   like findall() but returns an iterator.
  443.  
  444. - Tix exposes more commands through the classes DirSelectBox,
  445.   DirSelectDialog, ListNoteBook, Meter, CheckList, and the
  446.   methods tix_addbitmapdir, tix_cget, tix_configure, tix_filedialog,
  447.   tix_getbitmap, tix_getimage, tix_option_get, and tix_resetoptions.
  448.  
  449. - Traceback objects are now scanned by cyclic garbage collection, so
  450.   cycles created by casual use of sys.exc_info() no longer cause
  451.   permanent memory leaks (provided garbage collection is enabled).
  452.  
  453. - os.extsep -- a new variable needed by the RISCOS support.  It is the
  454.   separator used by extensions, and is '.' on all platforms except
  455.   RISCOS, where it is '/'.  There is no need to use this variable
  456.   unless you have a masochistic desire to port your code to RISCOS.
  457.  
  458. - mimetypes.py has optional support for non-standard, but commonly
  459.   found types.  guess_type() and guess_extension() now accept an
  460.   optional `strict' flag, defaulting to true, which controls whether
  461.   recognize non-standard types or not.  A few non-standard types we
  462.   know about have been added.  Also, when run as a script, there are
  463.   new -l and -e options.
  464.  
  465. - statcache is now deprecated.
  466.  
  467. - email.Utils.formatdate() now produces the preferred RFC 2822 style
  468.   dates with numeric timezones (it used to produce obsolete dates
  469.   hard coded to "GMT" timezone).  An optional `localtime' flag is
  470.   added to produce dates in the local timezone, with daylight savings
  471.   time properly taken into account.
  472.  
  473. - In pickle and cPickle, instead of masking errors in load() by
  474.   transforming them into SystemError, we let the original exception
  475.   propagate out.  Also, implement support for __safe_for_unpickling__
  476.   in pickle, as it already was supported in cPickle.
  477.  
  478. Tools/Demos
  479.  
  480. Build
  481.  
  482. - The dbm module is built using libdb1 if available.  The bsddb module
  483.   is built with libdb3 if available.
  484.  
  485. - Misc/Makefile.pre.in has been removed by BDFL pronouncement.
  486.  
  487. C API
  488.  
  489. - New function PySequence_Fast_GET_SIZE() returns the size of a non-
  490.   NULL result from PySequence_Fast(), more quickly than calling
  491.   PySequence_Size().
  492.  
  493. - New argument unpacking function PyArg_UnpackTuple() added.
  494.  
  495. - New functions PyObject_CallFunctionObjArgs() and
  496.   PyObject_CallMethodObjArgs() have been added to make it more
  497.   convenient and efficient to call functions and methods from C.
  498.  
  499. - PyArg_ParseTupleAndKeywords() no longer masks errors, so it's
  500.   possible that this will propagate errors it didn't before.
  501.  
  502. - New function PyObject_CheckReadBuffer(), which returns true if its
  503.   argument supports the single-segment readable buffer interface.
  504.  
  505. New platforms
  506.  
  507. - We've finally confirmed that this release builds on HP-UX 11.00,
  508.   *with* threads, and passes the test suite.
  509.  
  510. - Thanks to a series of patches from Michael Muller, Python may build
  511.   again under OS/2 Visual Age C++.
  512.  
  513. - Updated RISCOS port by Dietmar Schwertberger.
  514.  
  515. Tests
  516.  
  517. - Added a test script for the curses module.  It isn't run automatically;
  518.   regrtest.py must be run with '-u curses' to enable it.
  519.  
  520. Windows
  521.  
  522. Mac
  523.  
  524. - PythonScript has been moved to unsupported and is slated to be
  525.   removed completely in the next release.
  526.  
  527. - It should now be possible to build applets that work on both OS9 and
  528.   OSX.
  529.  
  530. - The core is now linked with CoreServices not Carbon; as a side
  531.   result, default 8bit encoding on OSX is now ASCII.
  532.  
  533. - Python should now build on OSX 10.1.1
  534.  
  535.  
  536. What's New in Python 2.2b1?
  537. Release date: 19-Oct-2001
  538. ===========================
  539.  
  540. Type/class unification and new-style classes
  541.  
  542. - New-style classes are now always dynamic (except for built-in and
  543.   extension types).  There is no longer a performance penalty, and I
  544.   no longer see another reason to keep this baggage around.  One relic
  545.   remains: the __dict__ of a new-style class is a read-only proxy; you
  546.   must set the class's attribute to modify it.  As a consequence, the
  547.   __defined__ attribute of new-style types no longer exists, for lack
  548.   of need: there is once again only one __dict__ (although in the
  549.   future a __cache__ may be resurrected with a similar function, if I
  550.   can prove that it actually speeds things up).
  551.  
  552. - C.__doc__ now works as expected for new-style classes (in 2.2a4 it
  553.   always returned None, even when there was a class docstring).
  554.  
  555. - doctest now finds and runs docstrings attached to new-style classes,
  556.   class methods, static methods, and properties.
  557.  
  558. Core and builtins
  559.  
  560. - A very subtle syntactical pitfall in list comprehensions was fixed.
  561.   For example: [a+b for a in 'abc', for b in 'def'].  The comma in
  562.   this example is a mistake.  Previously, this would silently let 'a'
  563.   iterate over the singleton tuple ('abc',), yielding ['abcd', 'abce',
  564.   'abcf'] rather than the intended ['ad', 'ae', 'af', 'bd', 'be',
  565.   'bf', 'cd', 'ce', 'cf'].  Now, this is flagged as a syntax error.
  566.   Note that [a for a in <singleton>] is a convoluted way to say
  567.   [<singleton>] anyway, so it's not like any expressiveness is lost.
  568.  
  569. - getattr(obj, name, default) now only catches AttributeError, as
  570.   documented, rather than returning the default value for all
  571.   exceptions (which could mask bugs in a __getattr__ hook, for
  572.   example).
  573.  
  574. - Weak reference objects are now part of the core and offer a C API.
  575.   A bug which could allow a core dump when binary operations involved
  576.   proxy reference has been fixed.  weakref.ReferenceError is now a
  577.   built-in exception.
  578.  
  579. - unicode(obj) now behaves more like str(obj), accepting arbitrary
  580.   objects, and calling a __unicode__ method if it exists.
  581.   unicode(obj, encoding) and unicode(obj, encoding, errors) still
  582.   require an 8-bit string or character buffer argument.
  583.  
  584. - isinstance() now allows any object as the first argument and a
  585.   class, a type or something with a __bases__ tuple attribute for the
  586.   second argument.  The second argument may also be a tuple of a
  587.   class, type, or something with __bases__, in which case isinstance()
  588.   will return true if the first argument is an instance of any of the
  589.   things contained in the second argument tuple.  E.g.
  590.  
  591.   isinstance(x, (A, B))
  592.  
  593.   returns true if x is an instance of A or B.
  594.  
  595. Extension modules
  596.  
  597. - thread.start_new_thread() now returns the thread ID (previously None).
  598.  
  599. - binascii has now two quopri support functions, a2b_qp and b2a_qp.
  600.  
  601. - readline now supports setting the startup_hook and the
  602.   pre_event_hook, and adds the add_history() function.
  603.  
  604. - os and posix supports chroot(), setgroups() and unsetenv() where
  605.   available.  The stat(), fstat(), statvfs() and fstatvfs() functions
  606.   now return "pseudo-sequences" -- the various fields can now be
  607.   accessed as attributes (e.g. os.stat("/").st_mtime) but for
  608.   backwards compatibility they also behave as a fixed-length sequence.
  609.   Some platform-specific fields (e.g. st_rdev) are only accessible as
  610.   attributes.
  611.  
  612. - time: localtime(), gmtime() and strptime() now return a
  613.   pseudo-sequence similar to the os.stat() return value, with
  614.   attributes like tm_year etc.
  615.  
  616. - Decompression objects in the zlib module now accept an optional
  617.   second parameter to decompress() that specifies the maximum amount
  618.   of memory to use for the uncompressed data.
  619.  
  620. - optional SSL support in the socket module now exports OpenSSL
  621.   functions RAND_add(), RAND_egd(), and RAND_status().  These calls
  622.   are useful on platforms like Solaris where OpenSSL does not
  623.   automatically seed its PRNG.  Also, the keyfile and certfile
  624.   arguments to socket.ssl() are now optional.
  625.  
  626. - posixmodule (and by extension, the os module on POSIX platforms) now
  627.   exports O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW.
  628.  
  629. Library
  630.  
  631. - doctest now excludes functions and classes not defined by the module
  632.   being tested, thanks to Tim Hochberg.
  633.  
  634. - HotShot, a new profiler implemented using a C-based callback, has
  635.   been added.  This substantially reduces the overhead of profiling,
  636.   but it is still quite preliminary.  Support modules and
  637.   documentation will be added in upcoming releases (before 2.2 final).
  638.  
  639. - profile now produces correct output in situations where an exception
  640.   raised in Python is cleared by C code (e.g. hasattr()).  This used
  641.   to cause wrong output, including spurious claims of recursive
  642.   functions and attribution of time spent to the wrong function.
  643.  
  644.   The code and documentation for the derived OldProfile and HotProfile
  645.   profiling classes was removed.  The code hasn't worked for years (if
  646.   you tried to use them, they raised exceptions).  OldProfile
  647.   intended to reproduce the behavior of the profiler Python used more
  648.   than 7 years ago, and isn't interesting anymore.  HotProfile intended
  649.   to provide a faster profiler (but producing less information), and
  650.   that's a worthy goal we intend to meet via a different approach (but
  651.   without losing information).
  652.  
  653. - Profile.calibrate() has a new implementation that should deliver
  654.   a much better system-specific calibration constant.  The constant can
  655.   now be specified in an instance constructor, or as a Profile class or
  656.   instance variable, instead of by editing profile.py's source code.
  657.   Calibration must still be done manually (see the docs for the profile
  658.   module).
  659.  
  660.   Note that Profile.calibrate() must be overriden by subclasses.
  661.   Improving the accuracy required exploiting detailed knowledge of
  662.   profiler internals; the earlier method abstracted away the details
  663.   and measured a simplified model instead, but consequently computed
  664.   a constant too small by a factor of 2 on some modern machines.
  665.  
  666. - quopri's encode and decode methods take an optional header parameter,
  667.   which indicates whether output is intended for the header 'Q'
  668.   encoding.
  669.  
  670. - The SocketServer.ThreadingMixIn class now closes the request after
  671.   finish_request() returns.  (Not when it errors out though.)
  672.  
  673. - The nntplib module's NNTP.body() method has grown a `file' argument
  674.   to allow saving the message body to a file.
  675.  
  676. - The email package has added a class email.Parser.HeaderParser which
  677.   only parses headers and does not recurse into the message's body.
  678.   Also, the module/class MIMEAudio has been added for representing
  679.   audio data (contributed by Anthony Baxter).
  680.  
  681. - ftplib should be able to handle files > 2GB.
  682.  
  683. - ConfigParser.getboolean() now also interprets TRUE, FALSE, YES, NO,
  684.   ON, and OFF.
  685.  
  686. - xml.dom.minidom NodeList objects now support the length attribute
  687.   and item() method as required by the DOM specifications.
  688.  
  689. Tools/Demos
  690.  
  691. - Demo/dns was removed.  It no longer serves any purpose; a package
  692.   derived from it is now maintained by Anthony Baxter, see
  693.   http://PyDNS.SourceForge.net.
  694.  
  695. - The freeze tool has been made more robust, and two new options have
  696.   been added: -X and -E.
  697.  
  698. Build
  699.  
  700. - configure will use CXX in LINKCC if CXX is used to build main() and
  701.   the system requires to link a C++ main using the C++ compiler.
  702.  
  703. C API
  704.  
  705. - The documentation for the tp_compare slot is updated to require that
  706.   the return value must be -1, 0, 1; an arbitrary number <0 or >0 is
  707.   not correct.  This is not yet enforced but will be enforced in
  708.   Python 2.3; even later, we may use -2 to indicate errors and +2 for
  709.   "NotImplemented".  Right now, -1 should be used for an error return.
  710.  
  711. - PyLong_AsLongLong() now accepts int (as well as long) arguments.
  712.   Consequently, PyArg_ParseTuple's 'L' code also accepts int (as well
  713.   as long) arguments.
  714.  
  715. - PyThread_start_new_thread() now returns a long int giving the thread
  716.   ID, if one can be calculated; it returns -1 for error, 0 if no
  717.   thread ID is calculated (this is an incompatible change, but only
  718.   the thread module used this API).  This code has only really been
  719.   tested on Linux and Windows; other platforms please beware (and
  720.   report any bugs or strange behavior).
  721.  
  722. - PyUnicode_FromEncodedObject() no longer accepts Unicode objects as
  723.   input.
  724.  
  725. New platforms
  726.  
  727. Tests
  728.  
  729. Windows
  730.  
  731. - Installer:  If you install IDLE, and don't disable file-extension
  732.   registration, a new "Edit with IDLE" context (right-click) menu entry
  733.   is created for .py and .pyw files.
  734.  
  735. - The signal module now supports SIGBREAK on Windows, thanks to Steven
  736.   Scott.  Note that SIGBREAK is unique to Windows.  The default SIGBREAK
  737.   action remains to call Win32 ExitProcess().  This can be changed via
  738.   signal.signal().  For example:
  739.  
  740.   # Make Ctrl+Break raise KeyboardInterrupt, like Python's default Ctrl+C
  741.   # (SIGINT) behavior.
  742.   import signal
  743.   signal.signal(signal.SIGBREAK,
  744.                 signal.default_int_handler)
  745.  
  746.   try:
  747.       while 1:
  748.           pass
  749.   except KeyboardInterrupt:
  750.       # We get here on Ctrl+C or Ctrl+Break now; if we had not changed
  751.       # SIGBREAK, only on Ctrl+C (and Ctrl+Break would terminate the
  752.       # program without the possibility for any Python-level cleanup).
  753.       print "Clean exit"
  754.  
  755.  
  756. What's New in Python 2.2a4?
  757. Release date: 28-Sep-2001
  758. ===========================
  759.  
  760. Type/class unification and new-style classes
  761.  
  762. - pydoc and inspect are now aware of new-style classes;
  763.   e.g. help(list) at the interactive prompt now shows proper
  764.   documentation for all operations on list objects.
  765.  
  766. - Applications using Jim Fulton's ExtensionClass module can now safely
  767.   be used with Python 2.2.  In particular, Zope 2.4.1 now works with
  768.   Python 2.2 (as well as with Python 2.1.1).  The Demo/metaclass
  769.   examples also work again.  It is hoped that Gtk and Boost also work
  770.   with 2.2a4 and beyond.  (If you can confirm this, please write
  771.   webmaster@python.org; if there are still problems, please open a bug
  772.   report on SourceForge.)
  773.  
  774. - property() now takes 4 keyword arguments:  fget, fset, fdel and doc.
  775.   These map to readonly attributes 'fget', 'fset', 'fdel', and '__doc__'
  776.   in the constructed property object.  fget, fset and fdel weren't
  777.   discoverable from Python in 2.2a3.  __doc__ is new, and allows to
  778.   associate a docstring with a property.
  779.  
  780. - Comparison overloading is now more completely implemented.  For
  781.   example, a str subclass instance can properly be compared to a str
  782.   instance, and it can properly overload comparison.  Ditto for most
  783.   other built-in object types.
  784.  
  785. - The repr() of new-style classes has changed; instead of <type
  786.   'M.Foo'> a new-style class is now rendered as <class 'M.Foo'>,
  787.   *except* for built-in types, which are still rendered as <type
  788.   'Foo'> (to avoid upsetting existing code that might parse or
  789.   otherwise rely on repr() of certain type objects).
  790.  
  791. - The repr() of new-style objects is now always <Foo object at XXX>;
  792.   previously, it was sometimes <Foo instance at XXX>.
  793.  
  794. - For new-style classes, what was previously called __getattr__ is now
  795.   called __getattribute__.  This method, if defined, is called for
  796.   *every* attribute access.  A new __getattr__ hook more similar to the
  797.   one in classic classes is defined which is called only if regular
  798.   attribute access raises AttributeError; to catch *all* attribute
  799.   access, you can use __getattribute__ (for new-style classes).  If
  800.   both are defined, __getattribute__ is called first, and if it raises
  801.   AttributeError, __getattr__ is called.
  802.  
  803. - The __class__ attribute of new-style objects can be assigned to.
  804.   The new class must have the same C-level object layout as the old
  805.   class.
  806.  
  807. - The builtin file type can be subclassed now.  In the usual pattern,
  808.   "file" is the name of the builtin type, and file() is a new builtin
  809.   constructor, with the same signature as the builtin open() function.
  810.   file() is now the preferred way to open a file.
  811.  
  812. - Previously, __new__ would only see sequential arguments passed to
  813.   the type in a constructor call; __init__ would see both sequential
  814.   and keyword arguments.  This made no sense whatsoever any more, so
  815.   now both __new__ and __init__ see all arguments.
  816.  
  817. - Previously, hash() applied to an instance of a subclass of str or
  818.   unicode always returned 0.  This has been repaired.
  819.  
  820. - Previously, an operation on an instance of a subclass of an
  821.   immutable type (int, long, float, complex, tuple, str, unicode),
  822.   where the subtype didn't override the operation (and so the
  823.   operation was handled by the builtin type), could return that
  824.   instance instead a value of the base type.  For example, if s was of
  825.   a str sublass type, s[:] returned s as-is.  Now it returns a str
  826.   with the same value as s.
  827.  
  828. - Provisional support for pickling new-style objects has been added.
  829.  
  830. Core
  831.  
  832. - file.writelines() now accepts any iterable object producing strings.
  833.  
  834. - PyUnicode_FromEncodedObject() now works very much like
  835.   PyObject_Str(obj) in that it tries to use __str__/tp_str
  836.   on the object if the object is not a string or buffer. This
  837.   makes unicode() behave like str() when applied to non-string/buffer
  838.   objects.
  839.  
  840. - PyFile_WriteObject now passes Unicode objects to the file's write
  841.   method. As a result, all file-like objects which may be the target
  842.   of a print statement must support Unicode objects, i.e. they must
  843.   at least convert them into ASCII strings.
  844.  
  845. - Thread scheduling on Solaris should be improved; it is no longer
  846.   necessary to insert a small sleep at the start of a thread in order
  847.   to let other runnable threads be scheduled.
  848.  
  849. Library
  850.  
  851. - StringIO.StringIO instances and cStringIO.StringIO instances support
  852.   read character buffer compatible objects for their .write() methods.
  853.   These objects are converted to strings and then handled as such
  854.   by the instances.
  855.  
  856. - The "email" package has been added.  This is basically a port of the
  857.   mimelib package <http://sf.net/projects/mimelib> with API changes
  858.   and some implementations updated to use iterators and generators.
  859.  
  860. - difflib.ndiff() and difflib.Differ.compare() are generators now.  This
  861.   restores the ability of Tools/scripts/ndiff.py to start producing output
  862.   before the entire comparison is complete.
  863.  
  864. - StringIO.StringIO instances and cStringIO.StringIO instances support
  865.   iteration just like file objects (i.e. their .readline() method is
  866.   called for each iteration until it returns an empty string).
  867.  
  868. - The codecs module has grown four new helper APIs to access
  869.   builtin codecs: getencoder(), getdecoder(), getreader(),
  870.   getwriter().
  871.  
  872. - SimpleXMLRPCServer: a new module (based upon SimpleHTMLServer)
  873.   simplifies writing XML RPC servers.
  874.  
  875. - os.path.realpath(): a new function that returns the absolute pathname
  876.   after interpretation of symbolic links.  On non-Unix systems, this
  877.   is an alias for os.path.abspath().
  878.  
  879. - operator.indexOf() (PySequence_Index() in the C API) now works with any
  880.   iterable object.
  881.  
  882. - smtplib now supports various authentication and security features of
  883.   the SMTP protocol through the new login() and starttls() methods.
  884.  
  885. - hmac: a new module implementing keyed hashing for message
  886.   authentication.
  887.  
  888. - mimetypes now recognizes more extensions and file types.  At the
  889.   same time, some mappings not sanctioned by IANA were removed.
  890.  
  891. - The "compiler" package has been brought up to date to the state of
  892.   Python 2.2 bytecode generation.  It has also been promoted from a
  893.   Tool to a standard library package.  (Tools/compiler still exists as
  894.   a sample driver.)
  895.  
  896. Tools
  897.  
  898. Build
  899.  
  900. - Large file support (LFS) is now automatic when the platform supports
  901.   it; no more manual configuration tweaks are needed.  On Linux, at
  902.   least, it's possible to have a system whose C library supports large
  903.   files but whose kernel doesn't; in this case, large file support is
  904.   still enabled but doesn't do you any good unless you upgrade your
  905.   kernel or share your Python executable with another system whose
  906.   kernel has large file support.
  907.  
  908. - The configure script now supplies plausible defaults in a
  909.   cross-compilation environment.  This doesn't mean that the supplied
  910.   values are always correct, or that cross-compilation now works
  911.   flawlessly -- but it's a first step (and it shuts up most of
  912.   autoconf's warnings about AC_TRY_RUN).
  913.  
  914. - The Unix build is now a bit less chatty, courtesy of the parser
  915.   generator.  The build is completely silent (except for errors) when
  916.   using "make -s", thanks to a -q option to setup.py.
  917.  
  918. C API
  919.  
  920. - The "structmember" API now supports some new flag bits to deny read
  921.   and/or write access to attributes in restricted execution mode.
  922.  
  923. New platforms
  924.  
  925. - Compaq's iPAQ handheld, running the "familiar" Linux distribution
  926.   (http://familiar.handhelds.org).
  927.  
  928. Tests
  929.  
  930. - The "classic" standard tests, which work by comparing stdout to
  931.   an expected-output file under Lib/test/output/, no longer stop at
  932.   the first mismatch.  Instead the test is run to completion, and a
  933.   variant of ndiff-style comparison is used to report all differences.
  934.   This is much easier to understand than the previous style of reporting.
  935.  
  936. - The unittest-based standard tests now use regrtest's test_main()
  937.   convention, instead of running as a side-effect of merely being
  938.   imported.  This allows these tests to be run in more natural and
  939.   flexible ways as unittests, outside the regrtest framework.
  940.  
  941. - regrtest.py is much better integrated with unittest and doctest now,
  942.   especially in regard to reporting errors.
  943.  
  944. Windows
  945.  
  946. - Large file support now also works for files > 4GB, on filesystems
  947.   that support it (NTFS under Windows 2000).  See "What's New in
  948.   Python 2.2a3" for more detail.
  949.  
  950.  
  951. What's New in Python 2.2a3?
  952. Release Date: 07-Sep-2001
  953. ===========================
  954.  
  955. Core
  956.  
  957. - Conversion of long to float now raises OverflowError if the long is too
  958.   big to represent as a C double.
  959.  
  960. - The 3-argument builtin pow() no longer allows a third non-None argument
  961.   if either of the first two arguments is a float, or if both are of
  962.   integer types and the second argument is negative (in which latter case
  963.   the arguments are converted to float, so this is really the same
  964.   restriction).
  965.  
  966. - The builtin dir() now returns more information, and sometimes much
  967.   more, generally naming all attributes of an object, and all attributes
  968.   reachable from the object via its class, and from its class's base
  969.   classes, and so on from them too.  Example:  in 2.2a2, dir([]) returned
  970.   an empty list.  In 2.2a3,
  971.  
  972.   >>> dir([])
  973.   ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
  974.    '__eq__', '__ge__', '__getattr__', '__getitem__', '__getslice__',
  975.    '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__le__',
  976.    '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__repr__',
  977.    '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__',
  978.    'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
  979.    'reverse', 'sort']
  980.  
  981.   dir(module) continues to return only the module's attributes, though.
  982.  
  983. - Overflowing operations on plain ints now return a long int rather
  984.   than raising OverflowError.  This is a partial implementation of PEP
  985.   237.  You can use -Wdefault::OverflowWarning to enable a warning for
  986.   this situation, and -Werror::OverflowWarning to revert to the old
  987.   OverflowError exception.
  988.  
  989. - A new command line option, -Q<arg>, is added to control run-time
  990.   warnings for the use of classic division.  (See PEP 238.)  Possible
  991.   values are -Qold, -Qwarn, -Qwarnall, and -Qnew.  The default is
  992.   -Qold, meaning the / operator has its classic meaning and no
  993.   warnings are issued.  Using -Qwarn issues a run-time warning about
  994.   all uses of classic division for int and long arguments; -Qwarnall
  995.   also warns about classic division for float and complex arguments
  996.   (for use with fixdiv.py).
  997.   [Note:  the remainder of this paragraph (preserved below) became
  998.    obsolete in 2.2c1 -- -Qnew has global effect in 2.2]
  999.   <obsolete>
  1000.   Using -Qnew is questionable; it turns on new division by default, but
  1001.   only in the __main__ module.  You can usefully combine -Qwarn or
  1002.   -Qwarnall and -Qnew: this gives the __main__ module new division, and
  1003.   warns about classic division everywhere else.
  1004.   </obsolete>
  1005.  
  1006. - Many built-in types can now be subclassed.  This applies to int,
  1007.   long, float, str, unicode, and tuple.  (The types complex, list and
  1008.   dictionary can also be subclassed; this was introduced earlier.)
  1009.   Note that restrictions apply when subclassing immutable built-in
  1010.   types: you can only affect the value of the instance by overloading
  1011.   __new__.  You can add mutable attributes, and the subclass instances
  1012.   will have a __dict__ attribute, but you cannot change the "value"
  1013.   (as implemented by the base class) of an immutable subclass instance
  1014.   once it is created.
  1015.  
  1016. - The dictionary constructor now takes an optional argument, a
  1017.   mapping-like object, and initializes the dictionary from its
  1018.   (key, value) pairs.
  1019.  
  1020. - A new built-in type, super, has been added.  This facilitates making
  1021.   "cooperative super calls" in a multiple inheritance setting.  For an
  1022.   explanation, see http://www.python.org/2.2/descrintro.html#cooperation
  1023.  
  1024. - A new built-in type, property, has been added.  This enables the
  1025.   creation of "properties".  These are attributes implemented by
  1026.   getter and setter functions (or only one of these for read-only or
  1027.   write-only attributes), without the need to override __getattr__.
  1028.   See http://www.python.org/2.2/descrintro.html#property
  1029.  
  1030. - The syntax of floating-point and imaginary literals has been
  1031.   liberalized, to allow leading zeroes.  Examples of literals now
  1032.   legal that were SyntaxErrors before:
  1033.  
  1034.       00.0    0e3   0100j   07.5   00000000000000000008.
  1035.  
  1036. - An old tokenizer bug allowed floating point literals with an incomplete
  1037.   exponent, such as 1e and 3.1e-.  Such literals now raise SyntaxError.
  1038.  
  1039. Library
  1040.  
  1041. - telnetlib includes symbolic names for the options, and support for
  1042.   setting an option negotiation callback.
  1043.  
  1044. - The new C standard no longer requires that math libraries set errno to
  1045.   ERANGE on overflow.  For platform libraries that exploit this new
  1046.   freedom, Python's overflow-checking was wholly broken.  A new overflow-
  1047.   checking scheme attempts to repair that, but may not be reliable on all
  1048.   platforms (C doesn't seem to provide anything both useful and portable
  1049.   in this area anymore).
  1050.  
  1051. - Asynchronous timeout actions are available through the new class
  1052.   threading.Timer.
  1053.  
  1054. - math.log and math.log10 now return sensible results for even huge
  1055.   long arguments.  For example, math.log10(10 ** 10000) ~= 10000.0.
  1056.  
  1057. - A new function, imp.lock_held(), returns 1 when the import lock is
  1058.   currently held.  See the docs for the imp module.
  1059.  
  1060. - pickle, cPickle and marshal on 32-bit platforms can now correctly read
  1061.   dumps containing ints written on platforms where Python ints are 8 bytes.
  1062.   When read on a box where Python ints are 4 bytes, such values are
  1063.   converted to Python longs.
  1064.  
  1065. - In restricted execution mode (using the rexec module), unmarshalling
  1066.   code objects is no longer allowed.  This plugs a security hole.
  1067.  
  1068. - unittest.TestResult instances no longer store references to tracebacks
  1069.   generated by test failures. This prevents unexpected dangling references
  1070.   to objects that should be garbage collected between tests.
  1071.  
  1072. Tools
  1073.  
  1074. - Tools/scripts/fixdiv.py has been added which can be used to fix
  1075.   division operators as per PEP 238.
  1076.  
  1077. Build
  1078.  
  1079. - If you are an adventurous person using Mac OS X you may want to look at
  1080.   Mac/OSX. There is a Makefile there that will build Python as a real Mac
  1081.   application, which can be used for experimenting with Carbon or Cocoa.
  1082.   Discussion of this on pythonmac-sig, please.
  1083.  
  1084. C API
  1085.  
  1086. - New function PyObject_Dir(obj), like Python __builtin__.dir(obj).
  1087.  
  1088. - Note that PyLong_AsDouble can fail!  This has always been true, but no
  1089.   callers checked for it.  It's more likely to fail now, because overflow
  1090.   errors are properly detected now.  The proper way to check:
  1091.  
  1092.   double x = PyLong_AsDouble(some_long_object);
  1093.   if (x == -1.0 && PyErr_Occurred()) {
  1094.           /* The conversion failed. */
  1095.   }
  1096.  
  1097. - The GC API has been changed.  Extensions that use the old API will still
  1098.   compile but will not participate in GC.  To upgrade an extension
  1099.   module:
  1100.  
  1101.     - rename Py_TPFLAGS_GC to PyTPFLAGS_HAVE_GC
  1102.  
  1103.     - use PyObject_GC_New or PyObject_GC_NewVar to allocate objects and
  1104.       PyObject_GC_Del to deallocate them
  1105.  
  1106.     - rename PyObject_GC_Init to PyObject_GC_Track and PyObject_GC_Fini
  1107.       to PyObject_GC_UnTrack
  1108.  
  1109.     - remove PyGC_HEAD_SIZE from object size calculations
  1110.  
  1111.     - remove calls to PyObject_AS_GC and PyObject_FROM_GC
  1112.  
  1113. - Two new functions: PyString_FromFormat() and PyString_FromFormatV().
  1114.   These can be used safely to construct string objects from a
  1115.   sprintf-style format string (similar to the format string supported
  1116.   by PyErr_Format()).
  1117.  
  1118. New platforms
  1119.  
  1120. - Stephen Hansen contributed patches sufficient to get a clean compile
  1121.   under Borland C (Windows), but he reports problems running it and ran
  1122.   out of time to complete the port.  Volunteers?  Expect a MemoryError
  1123.   when importing the types module; this is probably shallow, and
  1124.   causing later failures too.
  1125.  
  1126. Tests
  1127.  
  1128. Windows
  1129.  
  1130. - Large file support is now enabled on Win32 platforms as well as on
  1131.   Win64.  This means that, for example, you can use f.tell() and f.seek()
  1132.   to manipulate files larger than 2 gigabytes (provided you have enough
  1133.   disk space, and are using a Windows filesystem that supports large
  1134.   partitions).  Windows filesystem limits:  FAT has a 2GB (gigabyte)
  1135.   filesize limit, and large file support makes no difference there.
  1136.   FAT32's limit is 4GB, and files >= 2GB are easier to use from Python now.
  1137.   NTFS has no practical limit on file size, and files of any size can be
  1138.   used from Python now.
  1139.  
  1140. - The w9xpopen hack is now used on Windows NT and 2000 too when COMPSPEC
  1141.   points to command.com (patch from Brian Quinlan).
  1142.  
  1143.  
  1144. What's New in Python 2.2a2?
  1145. Release Date: 22-Aug-2001
  1146. ===========================
  1147.  
  1148. Build
  1149.  
  1150. - Tim Peters developed a brand new Windows installer using Wise 8.1,
  1151.   generously donated to us by Wise Solutions.
  1152.  
  1153. - configure supports a new option --enable-unicode, with the values
  1154.   ucs2 and ucs4 (new in 2.2a1). With --disable-unicode, the Unicode
  1155.   type and supporting code is completely removed from the interpreter.
  1156.  
  1157. - A new configure option --enable-framework builds a Mac OS X framework,
  1158.   which "make frameworkinstall" will install. This provides a starting
  1159.   point for more mac-like functionality, join pythonmac-sig@python.org
  1160.   if you are interested in helping.
  1161.  
  1162. - The NeXT platform is no longer supported.
  1163.  
  1164. - The `new' module is now statically linked.
  1165.  
  1166. Tools
  1167.  
  1168. - The new Tools/scripts/cleanfuture.py can be used to automatically
  1169.   edit out obsolete future statements from Python source code.  See
  1170.   the module docstring for details.
  1171.  
  1172. Tests
  1173.  
  1174. - regrtest.py now knows which tests are expected to be skipped on some
  1175.   platforms, allowing to give clearer test result output.  regrtest
  1176.   also has optional --use/-u switch to run normally disabled tests
  1177.   which require network access or consume significant disk resources.
  1178.  
  1179. - Several new tests in the standard test suite, with special thanks to
  1180.   Nick Mathewson.
  1181.  
  1182. Core
  1183.  
  1184. - The floor division operator // has been added as outlined in PEP
  1185.   238.  The / operator still provides classic division (and will until
  1186.   Python 3.0) unless "from __future__ import division" is included, in
  1187.   which case the / operator will provide true division.  The operator
  1188.   module provides truediv() and floordiv() functions.  Augmented
  1189.   assignment variants are included, as are the equivalent overloadable
  1190.   methods and C API methods.  See the PEP for a full discussion:
  1191.   <http://python.sf.net/peps/pep-0238.html>
  1192.  
  1193. - Future statements are now effective in simulated interactive shells
  1194.   (like IDLE).  This should "just work" by magic, but read Michael
  1195.   Hudson's "Future statements in simulated shells" PEP 264 for full
  1196.   details:  <http://python.sf.net/peps/pep-0264.html>.
  1197.  
  1198. - The type/class unification (PEP 252-253) was integrated into the
  1199.   trunk and is not so tentative any more (the exact specification of
  1200.   some features is still tentative).  A lot of work has done on fixing
  1201.   bugs and adding robustness and features (performance still has to
  1202.   come a long way).
  1203.  
  1204. - Warnings about a mismatch in the Python API during extension import
  1205.   now use the Python warning framework (which makes it possible to
  1206.   write filters for these warnings).
  1207.  
  1208. - A function's __dict__ (aka func_dict) will now always be a
  1209.   dictionary.  It used to be possible to delete it or set it to None,
  1210.   but now both actions raise TypeErrors.  It is still legal to set it
  1211.   to a dictionary object.  Getting func.__dict__ before any attributes
  1212.   have been assigned now returns an empty dictionary instead of None.
  1213.  
  1214. - A new command line option, -E, was added which disables the use of
  1215.   all environment variables, or at least those that are specifically
  1216.   significant to Python.  Usually those have a name starting with
  1217.   "PYTHON".  This was used to fix a problem where the tests fail if
  1218.   the user happens to have PYTHONHOME or PYTHONPATH pointing to an
  1219.   older distribution.
  1220.  
  1221. Library
  1222.  
  1223. - New class Differ and new functions ndiff() and restore() in difflib.py.
  1224.   These package the algorithms used by the popular Tools/scripts/ndiff.py,
  1225.   for programmatic reuse.
  1226.  
  1227. - New function xml.sax.saxutils.quoteattr():  Quote an XML attribute
  1228.   value using the minimal quoting required for the value; more
  1229.   reliable than using xml.sax.saxutils.escape() for attribute values.
  1230.  
  1231. - Readline completion support for cmd.Cmd was added.
  1232.  
  1233. - Calling os.tempnam() or os.tmpnam() generate RuntimeWarnings.
  1234.  
  1235. - Added function threading.BoundedSemaphore()
  1236.  
  1237. - Added Ka-Ping Yee's cgitb.py module.
  1238.  
  1239. - The `new' module now exposes the CO_xxx flags.
  1240.  
  1241. - The gc module offers the get_referents function.
  1242.  
  1243. New platforms
  1244.  
  1245. C API
  1246.  
  1247. - Two new APIs PyOS_snprintf() and PyOS_vsnprintf() were added
  1248.   which provide a cross-platform implementations for the
  1249.   relatively new snprintf()/vsnprintf() C lib APIs. In contrast to
  1250.   the standard sprintf() and vsprintf() C lib APIs, these versions
  1251.   apply bounds checking on the used buffer which enhances protection
  1252.   against buffer overruns.
  1253.  
  1254. - Unicode APIs now use name mangling to assure that mixing interpreters
  1255.   and extensions using different Unicode widths is rendered next to
  1256.   impossible. Trying to import an incompatible Unicode-aware extension
  1257.   will result in an ImportError.  Unicode extensions writers must make
  1258.   sure to check the Unicode width compatibility in their extensions by
  1259.   using at least one of the mangled Unicode APIs in the extension.
  1260.  
  1261. - Two new flags METH_NOARGS and METH_O are available in method definition
  1262.   tables to simplify implementation of methods with no arguments and a
  1263.   single untyped argument. Calling such methods is more efficient than
  1264.   calling corresponding METH_VARARGS methods. METH_OLDARGS is now
  1265.   deprecated.
  1266.  
  1267. Windows
  1268.  
  1269. - "import module" now compiles module.pyw if it exists and nothing else
  1270.   relevant is found.
  1271.  
  1272.  
  1273. What's New in Python 2.2a1?
  1274. Release date: 18-Jul-2001
  1275. ===========================
  1276.  
  1277. Core
  1278.  
  1279. - TENTATIVELY, a large amount of code implementing much of what's
  1280.   described in PEP 252 (Making Types Look More Like Classes) and PEP
  1281.   253 (Subtyping Built-in Types) was added.  This will be released
  1282.   with Python 2.2a1.  Documentation will be provided separately
  1283.   through http://www.python.org/2.2/.  The purpose of releasing this
  1284.   with Python 2.2a1 is to test backwards compatibility.  It is
  1285.   possible, though not likely, that a decision is made not to release
  1286.   this code as part of 2.2 final, if any serious backwards
  1287.   incompapatibilities are found during alpha testing that cannot be
  1288.   repaired.
  1289.  
  1290. - Generators were added; this is a new way to create an iterator (see
  1291.   below) using what looks like a simple function containing one or
  1292.   more 'yield' statements.  See PEP 255.  Since this adds a new
  1293.   keyword to the language, this feature must be enabled by including a
  1294.   future statement: "from __future__ import generators" (see PEP 236).
  1295.   Generators will become a standard feature in a future release
  1296.   (probably 2.3).  Without this future statement, 'yield' remains an
  1297.   ordinary identifier, but a warning is issued each time it is used.
  1298.   (These warnings currently don't conform to the warnings framework of
  1299.   PEP 230; we intend to fix this in 2.2a2.)
  1300.  
  1301. - The UTF-16 codec was modified to be more RFC compliant. It will now
  1302.   only remove BOM characters at the start of the string and then
  1303.   only if running in native mode (UTF-16-LE and -BE won't remove a
  1304.   leading BMO character).
  1305.  
  1306. - Strings now have a new method .decode() to complement the already
  1307.   existing .encode() method. These two methods provide direct access
  1308.   to the corresponding decoders and encoders of the registered codecs.
  1309.  
  1310.   To enhance the usability of the .encode() method, the special
  1311.   casing of Unicode object return values was dropped (Unicode objects
  1312.   were auto-magically converted to string using the default encoding).
  1313.  
  1314.   Both methods will now return whatever the codec in charge of the
  1315.   requested encoding returns as object, e.g. Unicode codecs will
  1316.   return Unicode objects when decoding is requested ("Σ÷ⁿ".decode("latin-1")
  1317.   will return u"Σ÷ⁿ"). This enables codec writer to create codecs
  1318.   for various simple to use conversions.
  1319.  
  1320.   New codecs were added to demonstrate these new features (the .encode()
  1321.   and .decode() columns indicate the type of the returned objects):
  1322.  
  1323.   Name     | .encode() | .decode() | Description
  1324.   ----------------------------------------------------------------------
  1325.   uu       | string    | string    | UU codec (e.g. for email)
  1326.   base64   | string    | string    | base64 codec
  1327.   quopri   | string    | string    | quoted-printable codec
  1328.   zlib     | string    | string    | zlib compression
  1329.   hex      | string    | string    | 2-byte hex codec
  1330.   rot-13   | string    | Unicode   | ROT-13 Unicode charmap codec
  1331.  
  1332. - Some operating systems now support the concept of a default Unicode
  1333.   encoding for file system operations.  Notably, Windows supports 'mbcs'
  1334.   as the default.  The Macintosh will also adopt this concept in the medium
  1335.   term, although the default encoding for that platform will be other than
  1336.   'mbcs'.
  1337.  
  1338.   On operating system that support non-ASCII filenames, it is common for
  1339.   functions that return filenames (such as os.listdir()) to return Python
  1340.   string objects pre-encoded using the default file system encoding for
  1341.   the platform.  As this encoding is likely to be different from Python's
  1342.   default encoding, converting this name to a Unicode object before passing
  1343.   it back to the Operating System would result in a Unicode error, as Python
  1344.   would attempt to use its default encoding (generally ASCII) rather than
  1345.   the default encoding for the file system.
  1346.  
  1347.   In general, this change simply removes surprises when working with
  1348.   Unicode and the file system, making these operations work as you expect,
  1349.   increasing the transparency of Unicode objects in this context.
  1350.   See [????] for more details, including examples.
  1351.  
  1352. - Float (and complex) literals in source code were evaluated to full
  1353.   precision only when running from a .py file; the same code loaded from a
  1354.   .pyc (or .pyo) file could suffer numeric differences starting at about the
  1355.   12th significant decimal digit.  For example, on a machine with IEEE-754
  1356.   floating arithmetic,
  1357.  
  1358.       x = 9007199254740992.0
  1359.       print long(x)
  1360.  
  1361.   printed 9007199254740992 if run directly from .py, but 9007199254740000
  1362.   if from a compiled (.pyc or .pyo) file.  This was due to marshal using
  1363.   str(float) instead of repr(float) when building code objects.  marshal
  1364.   now uses repr(float) instead, which should reproduce floats to full
  1365.   machine precision (assuming the platform C float<->string I/O conversion
  1366.   functions are of good quality).
  1367.  
  1368.   This may cause floating-point results to change in some cases, and
  1369.   usually for the better, but may also cause numerically unstable
  1370.   algorithms to break.
  1371.  
  1372. - The implementation of dicts suffers fewer collisions, which has speed
  1373.   benefits.  However, the order in which dict entries appear in dict.keys(),
  1374.   dict.values() and dict.items() may differ from previous releases for a
  1375.   given dict.  Nothing is defined about this order, so no program should
  1376.   rely on it.  Nevertheless, it's easy to write test cases that rely on the
  1377.   order by accident, typically because of printing the str() or repr() of a
  1378.   dict to an "expected results" file.  See Lib/test/test_support.py's new
  1379.   sortdict(dict) function for a simple way to display a dict in sorted
  1380.   order.
  1381.  
  1382. - Many other small changes to dicts were made, resulting in faster
  1383.   operation along the most common code paths.
  1384.  
  1385. - Dictionary objects now support the "in" operator: "x in dict" means
  1386.   the same as dict.has_key(x).
  1387.  
  1388. - The update() method of dictionaries now accepts generic mapping
  1389.   objects.  Specifically the argument object must support the .keys()
  1390.   and __getitem__() methods.  This allows you to say, for example,
  1391.   {}.update(UserDict())
  1392.  
  1393. - Iterators were added; this is a generalized way of providing values
  1394.   to a for loop.  See PEP 234.  There's a new built-in function iter()
  1395.   to return an iterator.  There's a new protocol to get the next value
  1396.   from an iterator using the next() method (in Python) or the
  1397.   tp_iternext slot (in C).  There's a new protocol to get iterators
  1398.   using the __iter__() method (in Python) or the tp_iter slot (in C).
  1399.   Iterating (i.e. a for loop) over a dictionary generates its keys.
  1400.   Iterating over a file generates its lines.
  1401.  
  1402. - The following functions were generalized to work nicely with iterator
  1403.   arguments:
  1404.     map(), filter(), reduce(), zip()
  1405.     list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API)
  1406.     max(), min()
  1407.     join() method of strings
  1408.     extend() method of lists
  1409.     'x in y' and 'x not in y' (PySequence_Contains() in C API)
  1410.     operator.countOf() (PySequence_Count() in C API)
  1411.     right-hand side of assignment statements with multiple targets, such as
  1412.         x, y, z = some_iterable_object_returning_exactly_3_values
  1413.  
  1414. - Accessing module attributes is significantly faster (for example,
  1415.   random.random or os.path or yourPythonModule.yourAttribute).
  1416.  
  1417. - Comparing dictionary objects via == and != is faster, and now works even
  1418.   if the keys and values don't support comparisons other than ==.
  1419.  
  1420. - Comparing dictionaries in ways other than == and != is slower:  there were
  1421.   insecurities in the dict comparison implementation that could cause Python
  1422.   to crash if the element comparison routines for the dict keys and/or
  1423.   values mutated the dicts.  Making the code bulletproof slowed it down.
  1424.  
  1425. - Collisions in dicts are resolved via a new approach, which can help
  1426.   dramatically in bad cases.  For example, looking up every key in a dict
  1427.   d with d.keys() == [i << 16 for i in range(20000)] is approximately 500x
  1428.   faster now.  Thanks to Christian Tismer for pointing out the cause and
  1429.   the nature of an effective cure (last December! better late than never).
  1430.  
  1431. - repr() is much faster for large containers (dict, list, tuple).
  1432.  
  1433.  
  1434. Library
  1435.  
  1436. - The constants ascii_letters, ascii_lowercase. and ascii_uppercase
  1437.   were added to the string module.  These a locale-indenpendent
  1438.   constants, unlike letters, lowercase, and uppercase.  These are now
  1439.   use in appropriate locations in the standard library.
  1440.  
  1441. - The flags used in dlopen calls can now be configured using
  1442.   sys.setdlopenflags and queried using sys.getdlopenflags.
  1443.  
  1444. - Fredrik Lundh's xmlrpclib is now a standard library module.  This
  1445.   provides full client-side XML-RPC support.  In addition,
  1446.   Demo/xmlrpc/ contains two server frameworks (one SocketServer-based,
  1447.   one asyncore-based).  Thanks to Eric Raymond for the documentation.
  1448.  
  1449. - The xrange() object is simplified: it no longer supports slicing,
  1450.   repetition, comparisons, efficient 'in' checking, the tolist()
  1451.   method, or the start, stop and step attributes.  See PEP 260.
  1452.  
  1453. - A new function fnmatch.filter to filter lists of file names was added.
  1454.  
  1455. - calendar.py uses month and day names based on the current locale.
  1456.  
  1457. - strop is now *really* obsolete (this was announced before with 1.6),
  1458.   and issues DeprecationWarning when used (except for the four items
  1459.   that are still imported into string.py).
  1460.  
  1461. - Cookie.py now sorts key+value pairs by key in output strings.
  1462.  
  1463. - pprint.isrecursive(object) didn't correctly identify recursive objects.
  1464.   Now it does.
  1465.  
  1466. - pprint functions now much faster for large containers (tuple, list, dict).
  1467.  
  1468. - New 'q' and 'Q' format codes in the struct module, corresponding to C
  1469.   types "long long" and "unsigned long long" (on Windows, __int64).  In
  1470.   native mode, these can be used only when the platform C compiler supports
  1471.   these types (when HAVE_LONG_LONG is #define'd by the Python config
  1472.   process), and then they inherit the sizes and alignments of the C types.
  1473.   In standard mode, 'q' and 'Q' are supported on all platforms, and are
  1474.   8-byte integral types.
  1475.  
  1476. - The site module installs a new built-in function 'help' that invokes
  1477.   pydoc.help.  It must be invoked as 'help()'; when invoked as 'help',
  1478.   it displays a message reminding the user to use 'help()' or
  1479.   'help(object)'.
  1480.  
  1481. Tests
  1482.  
  1483. - New test_mutants.py runs dict comparisons where the key and value
  1484.   comparison operators mutute the dicts randomly during comparison.  This
  1485.   rapidly causes Python to crash under earlier releases (not for the faint
  1486.   of heart:  it can also cause Win9x to freeze or reboot!).
  1487.  
  1488. - New test_pprint.py verfies that pprint.isrecursive() and
  1489.   pprint.isreadable() return sensible results.  Also verifies that simple
  1490.   cases produce correct output.
  1491.  
  1492. C API
  1493.  
  1494. - Removed the unused last_is_sticky argument from the internal
  1495.   _PyTuple_Resize().  If this affects you, you were cheating.
  1496.  
  1497.  
  1498. ======================================================================
  1499.  
  1500.  
  1501. What's New in Python 2.1 (final)?
  1502. =================================
  1503.  
  1504. We only changed a few things since the last release candidate, all in
  1505. Python library code:
  1506.  
  1507. - A bug in the locale module was fixed that affected locales which
  1508.   define no grouping for numeric formatting.
  1509.  
  1510. - A few bugs in the weakref module's implementations of weak
  1511.   dictionaries (WeakValueDictionary and WeakKeyDictionary) were fixed,
  1512.   and the test suite was updated to check for these bugs.
  1513.  
  1514. - An old bug in the os.path.walk() function (introduced in Python
  1515.   2.0!) was fixed: a non-existent file would cause an exception
  1516.   instead of being ignored.
  1517.  
  1518. - Fixed a few bugs in the new symtable module found by Neil Norwitz's
  1519.   PyChecker.
  1520.  
  1521.  
  1522. What's New in Python 2.1c2?
  1523. ===========================
  1524.  
  1525. A flurry of small changes, and one showstopper fixed in the nick of
  1526. time made it necessary to release another release candidate.  The list
  1527. here is the *complete* list of patches (except version updates):
  1528.  
  1529. Core
  1530.  
  1531. - Tim discovered a nasty bug in the dictionary code, caused by
  1532.   PyDict_Next() calling dict_resize(), and the GC code's use of
  1533.   PyDict_Next() violating an assumption in dict_items().  This was
  1534.   fixed with considerable amounts of band-aid, but the net effect is a
  1535.   saner and more robust implementation.
  1536.  
  1537. - Made a bunch of symbols static that were accidentally global.
  1538.  
  1539. Build and Ports
  1540.  
  1541. - The setup.py script didn't check for a new enough version of zlib
  1542.   (1.1.3 is needed).  Now it does.
  1543.  
  1544. - Changed "make clean" target to also remove shared libraries.
  1545.  
  1546. - Added a more general warning about the SGI Irix optimizer to README.
  1547.  
  1548. Library
  1549.  
  1550. - Fix a bug in urllib.basejoin("http://host", "../file.html") which
  1551.   omitted the slash between host and file.html.
  1552.  
  1553. - The mailbox module's _Mailbox class contained a completely broken
  1554.   and undocumented seek() method.  Ripped it out.
  1555.  
  1556. - Fixed a bunch of typos in various library modules (urllib2, smtpd,
  1557.   sgmllib, netrc, chunk) found by Neil Norwitz's PyChecker.
  1558.  
  1559. - Fixed a few last-minute bugs in unittest.
  1560.  
  1561. Extensions
  1562.  
  1563. - Reverted the patch to the OpenSSL code in socketmodule.c to support
  1564.   RAND_status() and the EGD, and the subsequent patch that tried to
  1565.   fix it for pre-0.9.5 versions; the problem with the patch is that on
  1566.   some systems it issues a warning whenever socket is imported, and
  1567.   that's unacceptable.
  1568.  
  1569. Tests
  1570.  
  1571. - Fixed the pickle tests to work with "import test.test_pickle".
  1572.  
  1573. - Tweaked test_locale.py to actually run the test Windows.
  1574.  
  1575. - In distutils/archive_util.py, call zipfile.ZipFile() with mode "w",
  1576.   not "wb" (which is not a valid mode at all).
  1577.  
  1578. - Fix pstats browser crashes.  Import readline if it exists to make
  1579.   the user interface nicer.
  1580.  
  1581. - Add "import thread" to the top of test modules that import the
  1582.   threading module (test_asynchat and test_threadedtempfile).  This
  1583.   prevents test failures caused by a broken threading module resulting
  1584.   from a previously caught failed import.
  1585.  
  1586. - Changed test_asynchat.py to set the SO_REUSEADDR option; this was
  1587.   needed on some platforms (e.g. Solaris 8) when the tests are run
  1588.   twice in succession.
  1589.  
  1590. - Skip rather than fail test_sunaudiodev if no audio device is found.
  1591.  
  1592.  
  1593. What's New in Python 2.1c1?
  1594. ===========================
  1595.  
  1596. This list was significantly updated when 2.1c2 was released; the 2.1c1
  1597. release didn't mention most changes that were actually part of 2.1c1:
  1598.  
  1599. Legal
  1600.  
  1601. - Copyright was assigned to the Python Software Foundation (PSF) and a
  1602.   PSF license (very similar to the CNRI license) was added.
  1603.  
  1604. - The CNRI copyright notice was updated to include 2001.
  1605.  
  1606. Core
  1607.  
  1608. - After a public outcry, assignment to __debug__ is no longer illegal;
  1609.   instead, a warning is issued.  It will become illegal in 2.2.
  1610.  
  1611. - Fixed a core dump with "%#x" % 0, and changed the semantics so that
  1612.   "%#x" now always prepends "0x", even if the value is zero.
  1613.  
  1614. - Fixed some nits in the bytecode compiler.
  1615.  
  1616. - Fixed core dumps when calling certain kinds of non-functions.
  1617.  
  1618. - Fixed various core dumps caused by reference count bugs.
  1619.  
  1620. Build and Ports
  1621.  
  1622. - Use INSTALL_SCRIPT to install script files.
  1623.  
  1624. - New port: SCO Unixware 7, by Billy G. Allie.
  1625.  
  1626. - Updated RISCOS port.
  1627.  
  1628. - Updated BeOS port and notes.
  1629.  
  1630. - Various other porting problems resolved.
  1631.  
  1632. Library
  1633.  
  1634. - The TERMIOS and SOCKET modules are now truly obsolete and
  1635.   unnecessary.  Their symbols are incorporated in the termios and
  1636.   socket modules.
  1637.  
  1638. - Fixed some 64-bit bugs in pickle, cPickle, and struct, and added
  1639.   better tests for pickling.
  1640.  
  1641. - threading: make Condition.wait() robust against KeyboardInterrupt.
  1642.  
  1643. - zipfile: add support to zipfile to support opening an archive
  1644.   represented by an open file rather than a file name.  Fix bug where
  1645.   the archive was not properly closed.  Fixed a bug in this bugfix
  1646.   where flush() was called for a read-only file.
  1647.  
  1648. - imputil: added an uninstall() method to the ImportManager.
  1649.  
  1650. - Canvas: fixed bugs in lower() and tkraise() methods.
  1651.  
  1652. - SocketServer: API change (added overridable close_request() method)
  1653.   so that the TCP server can explicitly close the request.
  1654.  
  1655. - pstats: Eric Raymond added a simple interactive statistics browser,
  1656.   invoked when the module is run as a script.
  1657.  
  1658. - locale: fixed a problem in format().
  1659.  
  1660. - webbrowser: made it work when the BROWSER environment variable has a
  1661.   value like "/usr/bin/netscape".  Made it auto-detect Konqueror for
  1662.   KDE 2.  Fixed some other nits.
  1663.  
  1664. - unittest: changes to allow using a different exception than
  1665.   AssertionError, and added a few more function aliases.  Some other
  1666.   small changes.
  1667.  
  1668. - urllib, urllib2: fixed redirect problems and a coupleof other nits.
  1669.  
  1670. - asynchat: fixed a critical bug in asynchat that slipped through the
  1671.   2.1b2 release.  Fixed another rare bug.
  1672.  
  1673. - Fix some unqualified except: clauses (always a bad code example).
  1674.  
  1675. XML
  1676.  
  1677. - pyexpat: new API get_version_string().
  1678.  
  1679. - Fixed some minidom bugs.
  1680.  
  1681. Extensions
  1682.  
  1683. - Fixed a core dump in _weakref.  Removed the weakref.mapping()
  1684.   function (it adds nothing to the API).
  1685.  
  1686. - Rationalized the use of header files in the readline module, to make
  1687.   it compile (albeit with some warnings) with the very recent readline
  1688.   4.2, without breaking for earlier versions.
  1689.  
  1690. - Hopefully fixed a buffering problem in linuxaudiodev.
  1691.  
  1692. - Attempted a fix to make the OpenSSL support in the socket module
  1693.   work again with pre-0.9.5 versions of OpenSSL.
  1694.  
  1695. Tests
  1696.  
  1697. - Added a test case for asynchat and asyncore.
  1698.  
  1699. - Removed coupling between tests where one test failing could break
  1700.   another.
  1701.  
  1702. Tools
  1703.  
  1704. - Ping added an interactive help browser to pydoc, fixed some nits
  1705.   in the rest of the pydoc code, and added some features to his
  1706.   inspect module.
  1707.  
  1708. - An updated python-mode.el version 4.1 which integrates Ken
  1709.   Manheimer's pdbtrack.el.  This makes debugging Python code via pdb
  1710.   much nicer in XEmacs and Emacs.  When stepping through your program
  1711.   with pdb, in either the shell window or the *Python* window, the
  1712.   source file and line will be tracked by an arrow.  Very cool!
  1713.  
  1714. - IDLE: syntax warnings in interactive mode are changed into errors.
  1715.  
  1716. - Some improvements to Tools/webchecker (ignore some more URL types,
  1717.   follow some more links).
  1718.  
  1719. - Brought the Tools/compiler package up to date.
  1720.  
  1721.  
  1722. What's New in Python 2.1 beta 2?
  1723. ================================
  1724.  
  1725. (Unlisted are many fixed bugs, more documentation, etc.)
  1726.  
  1727. Core language, builtins, and interpreter
  1728.  
  1729. - The nested scopes work (enabled by "from __future__ import
  1730.   nested_scopes") is completed; in particular, the future now extends
  1731.   into code executed through exec, eval() and execfile(), and into the
  1732.   interactive interpreter.
  1733.  
  1734. - When calling a base class method (e.g. BaseClass.__init__(self)),
  1735.   this is now allowed even if self is not strictly spoken a class
  1736.   instance (e.g. when using metaclasses or the Don Beaudry hook).
  1737.  
  1738. - Slice objects are now comparable but not hashable; this prevents
  1739.   dict[:] from being accepted but meaningless.
  1740.  
  1741. - Complex division is now calculated using less braindead algorithms.
  1742.   This doesn't change semantics except it's more likely to give useful
  1743.   results in extreme cases.  Complex repr() now uses full precision
  1744.   like float repr().
  1745.  
  1746. - sgmllib.py now calls handle_decl() for simple <!...> declarations.
  1747.  
  1748. - It is illegal to assign to the name __debug__, which is set when the
  1749.   interpreter starts.  It is effectively a compile-time constant.
  1750.  
  1751. - A warning will be issued if a global statement for a variable
  1752.   follows a use or assignment of that variable.
  1753.  
  1754. Standard library
  1755.  
  1756. - unittest.py, a unit testing framework by Steve Purcell (PyUNIT,
  1757.   inspired by JUnit), is now part of the standard library.  You now
  1758.   have a choice of two testing frameworks: unittest requires you to
  1759.   write testcases as separate code, doctest gathers them from
  1760.   docstrings.  Both approaches have their advantages and
  1761.   disadvantages.
  1762.  
  1763. - A new module Tix was added, which wraps the Tix extension library
  1764.   for Tk.  With that module, it is not necessary to statically link
  1765.   Tix with _tkinter, since Tix will be loaded with Tcl's "package
  1766.   require" command.  See Demo/tix/.
  1767.  
  1768. - tzparse.py is now obsolete.
  1769.  
  1770. - In gzip.py, the seek() and tell() methods are removed -- they were
  1771.   non-functional anyway, and it's better if callers can test for their
  1772.   existence with hasattr().
  1773.  
  1774. Python/C API
  1775.  
  1776. - PyDict_Next(): it is now safe to call PyDict_SetItem() with a key
  1777.   that's already in the dictionary during a PyDict_Next() iteration.
  1778.   This used to fail occasionally when a dictionary resize operation
  1779.   could be triggered that would rehash all the keys.  All other
  1780.   modifications to the dictionary are still off-limits during a
  1781.   PyDict_Next() iteration!
  1782.  
  1783. - New extended APIs related to passing compiler variables around.
  1784.  
  1785. - New abstract APIs PyObject_IsInstance(), PyObject_IsSubclass()
  1786.   implement isinstance() and issubclass().
  1787.  
  1788. - Py_BuildValue() now has a "D" conversion to create a Python complex
  1789.   number from a Py_complex C value.
  1790.  
  1791. - Extensions types which support weak references must now set the
  1792.   field allocated for the weak reference machinery to NULL themselves;
  1793.   this is done to avoid the cost of checking each object for having a
  1794.   weakly referencable type in PyObject_INIT(), since most types are
  1795.   not weakly referencable.
  1796.  
  1797. - PyFrame_FastToLocals() and PyFrame_LocalsToFast() copy bindings for
  1798.   free variables and cell variables to and from the frame's f_locals.
  1799.  
  1800. - Variants of several functions defined in pythonrun.h have been added
  1801.   to support the nested_scopes future statement.  The variants all end
  1802.   in Flags and take an extra argument, a PyCompilerFlags *; examples:
  1803.   PyRun_AnyFileExFlags(), PyRun_InteractiveLoopFlags().  These
  1804.   variants may be removed in Python 2.2, when nested scopes are
  1805.   mandatory.
  1806.  
  1807. Distutils
  1808.  
  1809. - the sdist command now writes a PKG-INFO file, as described in PEP 241,
  1810.   into the release tree.
  1811.  
  1812. - several enhancements to the bdist_wininst command from Thomas Heller
  1813.   (an uninstaller, more customization of the installer's display)
  1814.  
  1815. - from Jack Jansen: added Mac-specific code to generate a dialog for
  1816.   users to specify the command-line (because providing a command-line with
  1817.   MacPython is awkward).  Jack also made various fixes for the Mac
  1818.   and the Metrowerks compiler.
  1819.  
  1820. - added 'platforms' and 'keywords' to the set of metadata that can be
  1821.   specified for a distribution.
  1822.  
  1823. - applied patches from Jason Tishler to make the compiler class work with
  1824.   Cygwin.
  1825.  
  1826.  
  1827. What's New in Python 2.1 beta 1?
  1828. ================================
  1829.  
  1830. Core language, builtins, and interpreter
  1831.  
  1832. - Following an outcry from the community about the amount of code
  1833.   broken by the nested scopes feature introduced in 2.1a2, we decided
  1834.   to make this feature optional, and to wait until Python 2.2 (or at
  1835.   least 6 months) to make it standard.  The option can be enabled on a
  1836.   per-module basis by adding "from __future__ import nested_scopes" at
  1837.   the beginning of a module (before any other statements, but after
  1838.   comments and an optional docstring).  See PEP 236 (Back to the
  1839.   __future__) for a description of the __future__ statement.  PEP 227
  1840.   (Statically Nested Scopes) has been updated to reflect this change,
  1841.   and to clarify the semantics in a number of endcases.
  1842.  
  1843. - The nested scopes code, when enabled, has been hardened, and most
  1844.   bugs and memory leaks in it have been fixed.
  1845.  
  1846. - Compile-time warnings are now generated for a number of conditions
  1847.   that will break or change in meaning when nested scopes are enabled:
  1848.  
  1849.   - Using "from...import *" or "exec" without in-clause in a function
  1850.     scope that also defines a lambda or nested function with one or
  1851.     more free (non-local) variables.  The presence of the import* or
  1852.     bare exec makes it impossible for the compiler to determine the
  1853.     exact set of local variables in the outer scope, which makes it
  1854.     impossible to determine the bindings for free variables in the
  1855.     inner scope.  To avoid the warning about import *, change it into
  1856.     an import of explicitly name object, or move the import* statement
  1857.     to the global scope; to avoid the warning about bare exec, use
  1858.     exec...in... (a good idea anyway -- there's a possibility that
  1859.     bare exec will be deprecated in the future).
  1860.  
  1861.   - Use of a global variable in a nested scope with the same name as a
  1862.     local variable in a surrounding scope.  This will change in
  1863.     meaning with nested scopes: the name in the inner scope will
  1864.     reference the variable in the outer scope rather than the global
  1865.     of the same name.  To avoid the warning, either rename the outer
  1866.     variable, or use a global statement in the inner function.
  1867.  
  1868. - An optional object allocator has been included.  This allocator is
  1869.   optimized for Python objects and should be faster and use less memory
  1870.   than the standard system allocator.  It is not enabled by default
  1871.   because of possible thread safety problems.  The allocator is only
  1872.   protected by the Python interpreter lock and it is possible that some
  1873.   extension modules require a thread safe allocator.  The object
  1874.   allocator can be enabled by providing the "--with-pymalloc" option to
  1875.   configure.
  1876.  
  1877. Standard library
  1878.  
  1879. - pyexpat now detects the expat version if expat.h defines it. A
  1880.   number of additional handlers are provided, which are only available
  1881.   since expat 1.95. In addition, the methods SetParamEntityParsing and
  1882.   GetInputContext of Parser objects are available with 1.95.x
  1883.   only. Parser objects now provide the ordered_attributes and
  1884.   specified_attributes attributes. A new module expat.model was added,
  1885.   which offers a number of additional constants if 1.95.x is used.
  1886.  
  1887. - xml.dom offers the new functions registerDOMImplementation and
  1888.   getDOMImplementation.
  1889.  
  1890. - xml.dom.minidom offers a toprettyxml method. A number of DOM
  1891.   conformance issues have been resolved. In particular, Element now
  1892.   has an hasAttributes method, and the handling of namespaces was
  1893.   improved.
  1894.  
  1895. - Ka-Ping Yee contributed two new modules: inspect.py, a module for
  1896.   getting information about live Python code, and pydoc.py, a module
  1897.   for interactively converting docstrings to HTML or text.
  1898.   Tools/scripts/pydoc, which is now automatically installed into
  1899.   <prefix>/bin, uses pydoc.py to display documentation; try running
  1900.   "pydoc -h" for instructions.  "pydoc -g" pops up a small GUI that
  1901.   lets you browse the module docstrings using a web browser.
  1902.  
  1903. - New library module difflib.py, primarily packaging the SequenceMatcher
  1904.   class at the heart of the popular ndiff.py file-comparison tool.
  1905.  
  1906. - doctest.py (a framework for verifying Python code examples in docstrings)
  1907.   is now part of the std library.
  1908.  
  1909. Windows changes
  1910.  
  1911. - A new entry in the Start menu, "Module Docs", runs "pydoc -g" -- a
  1912.   small GUI that lets you browse the module docstrings using your
  1913.   default web browser.
  1914.  
  1915. - Import is now case-sensitive.  PEP 235 (Import on Case-Insensitive
  1916.   Platforms) is implemented.  See
  1917.  
  1918.       http://python.sourceforge.net/peps/pep-0235.html
  1919.  
  1920.   for full details, especially the "Current Lower-Left Semantics" section.
  1921.   The new Windows import rules are simpler than before:
  1922.  
  1923.   A. If the PYTHONCASEOK environment variable exists, same as
  1924.      before:  silently accept the first case-insensitive match of any
  1925.      kind; raise ImportError if none found.
  1926.  
  1927.   B. Else search sys.path for the first case-sensitive match; raise
  1928.      ImportError if none found.
  1929.  
  1930.   The same rules have been implented on other platforms with case-
  1931.   insensitive but case-preserving filesystems too (including Cygwin, and
  1932.   several flavors of Macintosh operating systems).
  1933.  
  1934. - winsound module:  Under Win9x, winsound.Beep() now attempts to simulate
  1935.   what it's supposed to do (and does do under NT and 2000) via direct
  1936.   port manipulation.  It's unknown whether this will work on all systems,
  1937.   but it does work on my Win98SE systems now and was known to be useless on
  1938.   all Win9x systems before.
  1939.  
  1940. - Build:  Subproject _test (effectively) renamed to _testcapi.
  1941.  
  1942. New platforms
  1943.  
  1944. - 2.1 should compile and run out of the box under MacOS X, even using HFS+.
  1945.   Thanks to Steven Majewski!
  1946.  
  1947. - 2.1 should compile and run out of the box on Cygwin.  Thanks to Jason
  1948.   Tishler!
  1949.  
  1950. - 2.1 contains new files and patches for RISCOS, thanks to Dietmar
  1951.   Schwertberger!  See RISCOS/README for more information -- it seems
  1952.   that because of the bizarre filename conventions on RISCOS, no port
  1953.   to that platform is easy.
  1954.  
  1955.  
  1956. What's New in Python 2.1 alpha 2?
  1957. =================================
  1958.  
  1959. Core language, builtins, and interpreter
  1960.  
  1961. - Scopes nest.  If a name is used in a function or class, but is not
  1962.   local, the definition in the nearest enclosing function scope will
  1963.   be used.  One consequence of this change is that lambda statements
  1964.   could reference variables in the namespaces where the lambda is
  1965.   defined.  In some unusual cases, this change will break code.
  1966.  
  1967.   In all previous version of Python, names were resolved in exactly
  1968.   three namespaces -- the local namespace, the global namespace, and
  1969.   the builtin namespace.  According to this old definition, if a
  1970.   function A is defined within a function B, the names bound in B are
  1971.   not visible in A.  The new rules make names bound in B visible in A,
  1972.   unless A contains a name binding that hides the binding in B.
  1973.  
  1974.   Section 4.1 of the reference manual describes the new scoping rules
  1975.   in detail.  The test script in Lib/test/test_scope.py demonstrates
  1976.   some of the effects of the change.
  1977.  
  1978.   The new rules will cause existing code to break if it defines nested
  1979.   functions where an outer function has local variables with the same
  1980.   name as globals or builtins used by the inner function.  Example:
  1981.  
  1982.     def munge(str):
  1983.         def helper(x):
  1984.             return str(x)
  1985.         if type(str) != type(''):
  1986.             str = helper(str)
  1987.         return str.strip()
  1988.  
  1989.   Under the old rules, the name str in helper() is bound to the
  1990.   builtin function str().  Under the new rules, it will be bound to
  1991.   the argument named str and an error will occur when helper() is
  1992.   called.
  1993.  
  1994. - The compiler will report a SyntaxError if "from ... import *" occurs
  1995.   in a function or class scope.  The language reference has documented
  1996.   that this case is illegal, but the compiler never checked for it.
  1997.   The recent introduction of nested scope makes the meaning of this
  1998.   form of name binding ambiguous.  In a future release, the compiler
  1999.   may allow this form when there is no possibility of ambiguity.
  2000.  
  2001. - repr(string) is easier to read, now using hex escapes instead of octal,
  2002.   and using \t, \n and \r instead of \011, \012 and \015 (respectively):
  2003.  
  2004.   >>> "\texample \r\n" + chr(0) + chr(255)
  2005.   '\texample \r\n\x00\xff'         # in 2.1
  2006.   '\011example \015\012\000\377'   # in 2.0
  2007.  
  2008. - Functions are now compared and hashed by identity, not by value, since
  2009.   the func_code attribute is writable.
  2010.  
  2011. - Weak references (PEP 205) have been added.  This involves a few
  2012.   changes in the core, an extension module (_weakref), and a Python
  2013.   module (weakref).  The weakref module is the public interface.  It
  2014.   includes support for "explicit" weak references, proxy objects, and
  2015.   mappings with weakly held values.
  2016.  
  2017. - A 'continue' statement can now appear in a try block within the body
  2018.   of a loop.  It is still not possible to use continue in a finally
  2019.   clause.
  2020.  
  2021. Standard library
  2022.  
  2023. - mailbox.py now has a new class, PortableUnixMailbox which is
  2024.   identical to UnixMailbox but uses a more portable scheme for
  2025.   determining From_ separators.  Also, the constructors for all the
  2026.   classes in this module have a new optional `factory' argument, which
  2027.   is a callable used when new message classes must be instantiated by
  2028.   the next() method.
  2029.  
  2030. - random.py is now self-contained, and offers all the functionality of
  2031.   the now-deprecated whrandom.py.  See the docs for details.  random.py
  2032.   also supports new functions getstate() and setstate(), for saving
  2033.   and restoring the internal state of the generator; and jumpahead(n),
  2034.   for quickly forcing the internal state to be the same as if n calls to
  2035.   random() had been made.  The latter is particularly useful for multi-
  2036.   threaded programs, creating one instance of the random.Random() class for
  2037.   each thread, then using .jumpahead() to force each instance to use a
  2038.   non-overlapping segment of the full period.
  2039.  
  2040. - random.py's seed() function is new.  For bit-for-bit compatibility with
  2041.   prior releases, use the whseed function instead.  The new seed function
  2042.   addresses two problems:  (1) The old function couldn't produce more than
  2043.   about 2**24 distinct internal states; the new one about 2**45 (the best
  2044.   that can be done in the Wichmann-Hill generator).  (2) The old function
  2045.   sometimes produced identical internal states when passed distinct
  2046.   integers, and there was no simple way to predict when that would happen;
  2047.   the new one guarantees to produce distinct internal states for all
  2048.   arguments in [0, 27814431486576L).
  2049.  
  2050. - The socket module now supports raw packets on Linux.  The socket
  2051.   family is AF_PACKET.
  2052.  
  2053. - test_capi.py is a start at running tests of the Python C API.  The tests
  2054.   are implemented by the new Modules/_testmodule.c.
  2055.  
  2056. - A new extension module, _symtable, provides provisional access to the
  2057.   internal symbol table used by the Python compiler.  A higher-level
  2058.   interface will be added on top of _symtable in a future release.
  2059.  
  2060. - Removed the obsolete soundex module.
  2061.  
  2062. - xml.dom.minidom now uses the standard DOM exceptions. Node supports
  2063.   the isSameNode method; NamedNodeMap the get method.
  2064.  
  2065. - xml.sax.expatreader supports the lexical handler property; it
  2066.   generates comment, startCDATA, and endCDATA events.
  2067.  
  2068. Windows changes
  2069.  
  2070. - Build procedure:  the zlib project is built in a different way that
  2071.   ensures the zlib header files used can no longer get out of synch with
  2072.   the zlib binary used.  See PCbuild\readme.txt for details.  Your old
  2073.   zlib-related directories can be deleted; you'll need to download fresh
  2074.   source for zlib and unpack it into a new directory.
  2075.  
  2076. - Build:  New subproject _test for the benefit of test_capi.py (see above).
  2077.  
  2078. - Build:  New subproject _symtable, for new DLL _symtable.pyd (a nascent
  2079.   interface to some Python compiler internals).
  2080.  
  2081. - Build:  Subproject ucnhash is gone, since the code was folded into the
  2082.   unicodedata subproject.
  2083.  
  2084. What's New in Python 2.1 alpha 1?
  2085. =================================
  2086.  
  2087. Core language, builtins, and interpreter
  2088.  
  2089. - There is a new Unicode companion to the PyObject_Str() API
  2090.   called PyObject_Unicode(). It behaves in the same way as the
  2091.   former, but assures that the returned value is an Unicode object
  2092.   (applying the usual coercion if necessary).
  2093.  
  2094. - The comparison operators support "rich comparison overloading" (PEP
  2095.   207).  C extension types can provide a rich comparison function in
  2096.   the new tp_richcompare slot in the type object.  The cmp() function
  2097.   and the C function PyObject_Compare() first try the new rich
  2098.   comparison operators before trying the old 3-way comparison.  There
  2099.   is also a new C API PyObject_RichCompare() (which also falls back on
  2100.   the old 3-way comparison, but does not constrain the outcome of the
  2101.   rich comparison to a Boolean result).
  2102.  
  2103.   The rich comparison function takes two objects (at least one of
  2104.   which is guaranteed to have the type that provided the function) and
  2105.   an integer indicating the opcode, which can be Py_LT, Py_LE, Py_EQ,
  2106.   Py_NE, Py_GT, Py_GE (for <, <=, ==, !=, >, >=), and returns a Python
  2107.   object, which may be NotImplemented (in which case the tp_compare
  2108.   slot function is used as a fallback, if defined).
  2109.  
  2110.   Classes can overload individual comparison operators by defining one
  2111.   or more of the methods__lt__, __le__, __eq__, __ne__, __gt__,
  2112.   __ge__.  There are no explicit "reflected argument" versions of
  2113.   these; instead, __lt__ and __gt__ are each other's reflection,
  2114.   likewise for__le__ and __ge__; __eq__ and __ne__ are their own
  2115.   reflection (similar at the C level).  No other implications are
  2116.   made; in particular, Python does not assume that == is the Boolean
  2117.   inverse of !=, or that < is the Boolean inverse of >=.  This makes
  2118.   it possible to define types with partial orderings.
  2119.  
  2120.   Classes or types that want to implement (in)equality tests but not
  2121.   the ordering operators (i.e. unordered types) should implement ==
  2122.   and !=, and raise an error for the ordering operators.
  2123.  
  2124.   It is possible to define types whose rich comparison results are not
  2125.   Boolean; e.g. a matrix type might want to return a matrix of bits
  2126.   for A < B, giving elementwise comparisons.  Such types should ensure
  2127.   that any interpretation of their value in a Boolean context raises
  2128.   an exception, e.g. by defining __nonzero__ (or the tp_nonzero slot
  2129.   at the C level) to always raise an exception.
  2130.  
  2131. - Complex numbers use rich comparisons to define == and != but raise
  2132.   an exception for <, <=, > and >=.  Unfortunately, this also means
  2133.   that cmp() of two complex numbers raises an exception when the two
  2134.   numbers differ.  Since it is not mathematically meaningful to compare
  2135.   complex numbers except for equality, I hope that this doesn't break
  2136.   too much code.
  2137.  
  2138. - The outcome of comparing non-numeric objects of different types is
  2139.   not defined by the language, other than that it's arbitrary but
  2140.   consistent (see the Reference Manual).  An implementation detail changed
  2141.   in 2.1a1 such that None now compares less than any other object.  Code
  2142.   relying on this new behavior (like code that relied on the previous
  2143.   behavior) does so at its own risk.
  2144.  
  2145. - Functions and methods now support getting and setting arbitrarily
  2146.   named attributes (PEP 232).  Functions have a new __dict__
  2147.   (a.k.a. func_dict) which hold the function attributes.  Methods get
  2148.   and set attributes on their underlying im_func.  It is a TypeError
  2149.   to set an attribute on a bound method.
  2150.  
  2151. - The xrange() object implementation has been improved so that
  2152.   xrange(sys.maxint) can be used on 64-bit platforms.  There's still a
  2153.   limitation that in this case len(xrange(sys.maxint)) can't be
  2154.   calculated, but the common idiom "for i in xrange(sys.maxint)" will
  2155.   work fine as long as the index i doesn't actually reach 2**31.
  2156.   (Python uses regular ints for sequence and string indices; fixing
  2157.   that is much more work.)
  2158.  
  2159. - Two changes to from...import:
  2160.  
  2161.   1) "from M import X" now works even if (after loading module M)
  2162.      sys.modules['M'] is not a real module; it's basically a getattr()
  2163.      operation with AttributeError exceptions changed into ImportError.
  2164.  
  2165.   2) "from M import *" now looks for M.__all__ to decide which names to
  2166.      import; if M.__all__ doesn't exist, it uses M.__dict__.keys() but
  2167.      filters out names starting with '_' as before.  Whether or not
  2168.      __all__ exists, there's no restriction on the type of M.
  2169.  
  2170. - File objects have a new method, xreadlines().  This is the fastest
  2171.   way to iterate over all lines in a file:
  2172.  
  2173.   for line in file.xreadlines():
  2174.       ...do something to line...
  2175.  
  2176.   See the xreadlines module (mentioned below) for how to do this for
  2177.   other file-like objects.
  2178.  
  2179. - Even if you don't use file.xreadlines(), you may expect a speedup on
  2180.   line-by-line input.  The file.readline() method has been optimized
  2181.   quite a bit in platform-specific ways:  on systems (like Linux) that
  2182.   support flockfile(), getc_unlocked(), and funlockfile(), those are
  2183.   used by default.  On systems (like Windows) without getc_unlocked(),
  2184.   a complicated (but still thread-safe) method using fgets() is used by
  2185.   default.
  2186.  
  2187.   You can force use of the fgets() method by #define'ing
  2188.   USE_FGETS_IN_GETLINE at build time (it may be faster than
  2189.   getc_unlocked()).
  2190.  
  2191.   You can force fgets() not to be used by #define'ing
  2192.   DONT_USE_FGETS_IN_GETLINE (this is the first thing to try if std test
  2193.   test_bufio.py fails -- and let us know if it does!).
  2194.  
  2195. - In addition, the fileinput module, while still slower than the other
  2196.   methods on most platforms, has been sped up too, by using
  2197.   file.readlines(sizehint).
  2198.  
  2199. - Support for run-time warnings has been added, including a new
  2200.   command line option (-W) to specify the disposition of warnings.
  2201.   See the description of the warnings module below.
  2202.  
  2203. - Extensive changes have been made to the coercion code.  This mostly
  2204.   affects extension modules (which can now implement mixed-type
  2205.   numerical operators without having to use coercion), but
  2206.   occasionally, in boundary cases the coercion semantics have changed
  2207.   subtly.  Since this was a terrible gray area of the language, this
  2208.   is considered an improvement.  Also note that __rcmp__ is no longer
  2209.   supported -- instead of calling __rcmp__, __cmp__ is called with
  2210.   reflected arguments.
  2211.  
  2212. - In connection with the coercion changes, a new built-in singleton
  2213.   object, NotImplemented is defined.  This can be returned for
  2214.   operations that wish to indicate they are not implemented for a
  2215.   particular combination of arguments.  From C, this is
  2216.   Py_NotImplemented.
  2217.  
  2218. - The interpreter accepts now bytecode files on the command line even
  2219.   if they do not have a .pyc or .pyo extension. On Linux, after executing
  2220.  
  2221. import imp,sys,string
  2222. magic = string.join(["\\x%.2x" % ord(c) for c in imp.get_magic()],"")
  2223. reg = ':pyc:M::%s::%s:' % (magic, sys.executable)
  2224. open("/proc/sys/fs/binfmt_misc/register","wb").write(reg)
  2225.  
  2226.   any byte code file can be used as an executable (i.e. as an argument
  2227.   to execve(2)).
  2228.  
  2229. - %[xXo] formats of negative Python longs now produce a sign
  2230.   character.  In 1.6 and earlier, they never produced a sign,
  2231.   and raised an error if the value of the long was too large
  2232.   to fit in a Python int.  In 2.0, they produced a sign if and
  2233.   only if too large to fit in an int.  This was inconsistent
  2234.   across platforms (because the size of an int varies across
  2235.   platforms), and inconsistent with hex() and oct().  Example:
  2236.  
  2237.   >>> "%x" % -0x42L
  2238.   '-42'      # in 2.1
  2239.   'ffffffbe' # in 2.0 and before, on 32-bit machines
  2240.   >>> hex(-0x42L)
  2241.   '-0x42L'   # in all versions of Python
  2242.  
  2243.   The behavior of %d formats for negative Python longs remains
  2244.   the same as in 2.0 (although in 1.6 and before, they raised
  2245.   an error if the long didn't fit in a Python int).
  2246.  
  2247.   %u formats don't make sense for Python longs, but are allowed
  2248.   and treated the same as %d in 2.1.  In 2.0, a negative long
  2249.   formatted via %u produced a sign if and only if too large to
  2250.   fit in an int.  In 1.6 and earlier, a negative long formatted
  2251.   via %u raised an error if it was too big to fit in an int.
  2252.  
  2253. - Dictionary objects have an odd new method, popitem().  This removes
  2254.   an arbitrary item from the dictionary and returns it (in the form of
  2255.   a (key, value) pair).  This can be useful for algorithms that use a
  2256.   dictionary as a bag of "to do" items and repeatedly need to pick one
  2257.   item.  Such algorithms normally end up running in quadratic time;
  2258.   using popitem() they can usually be made to run in linear time.
  2259.  
  2260. Standard library
  2261.  
  2262. - In the time module, the time argument to the functions strftime,
  2263.   localtime, gmtime, asctime and ctime is now optional, defaulting to
  2264.   the current time (in the local timezone).
  2265.  
  2266. - The ftplib module now defaults to passive mode, which is deemed a
  2267.   more useful default given that clients are often inside firewalls
  2268.   these days.  Note that this could break if ftplib is used to connect
  2269.   to a *server* that is inside a firewall, from outside; this is
  2270.   expected to be a very rare situation.  To fix that, you can call
  2271.   ftp.set_pasv(0).
  2272.  
  2273. - The module site now treats .pth files not only for path configuration,
  2274.   but also supports extensions to the initialization code: Lines starting
  2275.   with import are executed.
  2276.  
  2277. - There's a new module, warnings, which implements a mechanism for
  2278.   issuing and filtering warnings.  There are some new built-in
  2279.   exceptions that serve as warning categories, and a new command line
  2280.   option, -W, to control warnings (e.g. -Wi ignores all warnings, -We
  2281.   turns warnings into errors).  warnings.warn(message[, category])
  2282.   issues a warning message; this can also be called from C as
  2283.   PyErr_Warn(category, message).
  2284.  
  2285. - A new module xreadlines was added.  This exports a single factory
  2286.   function, xreadlines().  The intention is that this code is the
  2287.   absolutely fastest way to iterate over all lines in an open
  2288.   file(-like) object:
  2289.  
  2290.   import xreadlines
  2291.   for line in xreadlines.xreadlines(file):
  2292.       ...do something to line...
  2293.  
  2294.   This is equivalent to the previous the speed record holder using
  2295.   file.readlines(sizehint).  Note that if file is a real file object
  2296.   (as opposed to a file-like object), this is equivalent:
  2297.  
  2298.   for line in file.xreadlines():
  2299.       ...do something to line...
  2300.  
  2301. - The bisect module has new functions bisect_left, insort_left,
  2302.   bisect_right and insort_right.  The old names bisect and insort
  2303.   are now aliases for bisect_right and insort_right.  XXX_right
  2304.   and XXX_left methods differ in what happens when the new element
  2305.   compares equal to one or more elements already in the list:  the
  2306.   XXX_left methods insert to the left, the XXX_right methods to the
  2307.   right.  Code that doesn't care where equal elements end up should
  2308.   continue to use the old, short names ("bisect" and "insort").
  2309.  
  2310. - The new curses.panel module wraps the panel library that forms part
  2311.   of SYSV curses and ncurses.  Contributed by Thomas Gellekum.
  2312.  
  2313. - The SocketServer module now sets the allow_reuse_address flag by
  2314.   default in the TCPServer class.
  2315.  
  2316. - A new function, sys._getframe(), returns the stack frame pointer of
  2317.   the caller.  This is intended only as a building block for
  2318.   higher-level mechanisms such as string interpolation.
  2319.  
  2320. - The pyexpat module supports a number of new handlers, which are
  2321.   available only in expat 1.2. If invocation of a callback fails, it
  2322.   will report an additional frame in the traceback. Parser objects
  2323.   participate now in garbage collection. If expat reports an unknown
  2324.   encoding, pyexpat will try to use a Python codec; that works only
  2325.   for single-byte charsets. The parser type objects is exposed as
  2326.   XMLParserObject.
  2327.  
  2328. - xml.dom now offers standard definitions for symbolic node type and
  2329.   exception code constants, and a hierarchy of DOM exceptions. minidom
  2330.   was adjusted to use them.
  2331.  
  2332. - The conformance of xml.dom.minidom to the DOM specification was
  2333.   improved. It detects a number of additional error cases; the
  2334.   previous/next relationship works even when the tree is modified;
  2335.   Node supports the normalize() method; NamedNodeMap, DocumentType and
  2336.   DOMImplementation classes were added; Element supports the
  2337.   hasAttribute and hasAttributeNS methods; and Text supports the splitText
  2338.   method.
  2339.  
  2340. Build issues
  2341.  
  2342. - For Unix (and Unix-compatible) builds, configuration and building of
  2343.   extension modules is now greatly automated.  Rather than having to
  2344.   edit the Modules/Setup file to indicate which modules should be
  2345.   built and where their include files and libraries are, a
  2346.   distutils-based setup.py script now takes care of building most
  2347.   extension modules.  All extension modules built this way are built
  2348.   as shared libraries.  Only a few modules that must be linked
  2349.   statically are still listed in the Setup file; you won't need to
  2350.   edit their configuration.
  2351.  
  2352. - Python should now build out of the box on Cygwin.  If it doesn't,
  2353.   mail to Jason Tishler (jlt63 at users.sourceforge.net).
  2354.  
  2355. - Python now always uses its own (renamed) implementation of getopt()
  2356.   -- there's too much variation among C library getopt()
  2357.   implementations.
  2358.  
  2359. - C++ compilers are better supported; the CXX macro is always set to a
  2360.   C++ compiler if one is found.
  2361.  
  2362. Windows changes
  2363.  
  2364. - select module:  By default under Windows, a select() call
  2365.   can specify no more than 64 sockets.  Python now boosts
  2366.   this Microsoft default to 512.  If you need even more than
  2367.   that, see the MS docs (you'll need to #define FD_SETSIZE
  2368.   and recompile Python from source).
  2369.  
  2370. - Support for Windows 3.1, DOS and OS/2 is gone.  The Lib/dos-8x3
  2371.   subdirectory is no more!
  2372.  
  2373.  
  2374. What's New in Python 2.0?
  2375. =========================
  2376.  
  2377. Below is a list of all relevant changes since release 1.6.  Older
  2378. changes are in the file HISTORY.  If you are making the jump directly
  2379. from Python 1.5.2 to 2.0, make sure to read the section for 1.6 in the
  2380. HISTORY file!  Many important changes listed there.
  2381.  
  2382. Alternatively, a good overview of the changes between 1.5.2 and 2.0 is
  2383. the document "What's New in Python 2.0" by Kuchling and Moshe Zadka:
  2384. http://starship.python.net/crew/amk/python/writing/new-python/.
  2385.  
  2386. --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)
  2387.  
  2388. ======================================================================
  2389.  
  2390. What's new in 2.0 (since release candidate 1)?
  2391. ==============================================
  2392.  
  2393. Standard library
  2394.  
  2395. - The copy_reg module was modified to clarify its intended use: to
  2396.   register pickle support for extension types, not for classes.
  2397.   pickle() will raise a TypeError if it is passed a class.
  2398.  
  2399. - Fixed a bug in gettext's "normalize and expand" code that prevented
  2400.   it from finding an existing .mo file.
  2401.  
  2402. - Restored support for HTTP/0.9 servers in httplib.
  2403.  
  2404. - The math module was changed to stop raising OverflowError in case of
  2405.   underflow, and return 0 instead in underflow cases.  Whether Python
  2406.   used to raise OverflowError in case of underflow was platform-
  2407.   dependent (it did when the platform math library set errno to ERANGE
  2408.   on underflow).
  2409.  
  2410. - Fixed a bug in StringIO that occurred when the file position was not
  2411.   at the end of the file and write() was called with enough data to
  2412.   extend past the end of the file.
  2413.  
  2414. - Fixed a bug that caused Tkinter error messages to get lost on
  2415.   Windows.  The bug was fixed by replacing direct use of
  2416.   interp->result with Tcl_GetStringResult(interp).
  2417.  
  2418. - Fixed bug in urllib2 that caused it to fail when it received an HTTP
  2419.   redirect response.
  2420.  
  2421. - Several changes were made to distutils: Some debugging code was
  2422.   removed from util.  Fixed the installer used when an external zip
  2423.   program (like WinZip) is not found; the source code for this
  2424.   installer is in Misc/distutils.  check_lib() was modified to behave
  2425.   more like AC_CHECK_LIB by add other_libraries() as a parameter.  The
  2426.   test for whether installed modules are on sys.path was changed to
  2427.   use both normcase() and normpath().
  2428.  
  2429. - Several minor bugs were fixed in the xml package (the minidom,
  2430.   pulldom, expatreader, and saxutils modules).
  2431.  
  2432. - The regression test driver (regrtest.py) behavior when invoked with
  2433.   -l changed: It now reports a count of objects that are recognized as
  2434.   garbage but not freed by the garbage collector.
  2435.  
  2436. - The regression test for the math module was changed to test
  2437.   exceptional behavior when the test is run in verbose mode.  Python
  2438.   cannot yet guarantee consistent exception behavior across platforms,
  2439.   so the exception part of test_math is run only in verbose mode, and
  2440.   may fail on your platform.
  2441.  
  2442. Internals
  2443.  
  2444. - PyOS_CheckStack() has been disabled on Win64, where it caused
  2445.   test_sre to fail.
  2446.  
  2447. Build issues
  2448.  
  2449. - Changed compiler flags, so that gcc is always invoked with -Wall and
  2450.   -Wstrict-prototypes.  Users compiling Python with GCC should see
  2451.   exactly one warning, except if they have passed configure the
  2452.   --with-pydebug flag.  The expected warning is for getopt() in
  2453.   Modules/main.c.  This warning will be fixed for Python 2.1.
  2454.  
  2455. - Fixed configure to add -threads argument during linking on OSF1.
  2456.  
  2457. Tools and other miscellany
  2458.  
  2459. - The compiler in Tools/compiler was updated to support the new
  2460.   language features introduced in 2.0: extended print statement, list
  2461.   comprehensions, and augmented assignments.  The new compiler should
  2462.   also be backwards compatible with Python 1.5.2; the compiler will
  2463.   always generate code for the version of the interpreter it runs
  2464.   under.
  2465.  
  2466. What's new in 2.0 release candidate 1 (since beta 2)?
  2467. =====================================================
  2468.  
  2469. What is release candidate 1?
  2470.  
  2471. We believe that release candidate 1 will fix all known bugs that we
  2472. intend to fix for the 2.0 final release.  This release should be a bit
  2473. more stable than the previous betas.  We would like to see even more
  2474. widespread testing before the final release, so we are producing this
  2475. release candidate.  The final release will be exactly the same unless
  2476. any show-stopping (or brown bag) bugs are found by testers of the
  2477. release candidate.
  2478.  
  2479. All the changes since the last beta release are bug fixes or changes
  2480. to support building Python for specific platforms.
  2481.  
  2482. Core language, builtins, and interpreter
  2483.  
  2484. - A bug that caused crashes when __coerce__ was used with augmented
  2485.   assignment, e.g. +=, was fixed.
  2486.  
  2487. - Raise ZeroDivisionError when raising zero to a negative number,
  2488.   e.g. 0.0 ** -2.0.  Note that math.pow is unrelated to the builtin
  2489.   power operator and the result of math.pow(0.0, -2.0) will vary by
  2490.   platform.  On Linux, it raises a ValueError.
  2491.  
  2492. - A bug in Unicode string interpolation was fixed that occasionally
  2493.   caused errors with formats including "%%".  For example, the
  2494.   following expression "%% %s" % u"abc" no longer raises a TypeError.
  2495.  
  2496. - Compilation of deeply nested expressions raises MemoryError instead
  2497.   of SyntaxError, e.g. eval("[" * 50 + "]" * 50).
  2498.  
  2499. - In 2.0b2 on Windows, the interpreter wrote .pyc files in text mode,
  2500.   rendering them useless.  They are now written in binary mode again.
  2501.  
  2502. Standard library
  2503.  
  2504. - Keyword arguments are now accepted for most pattern and match object
  2505.   methods in SRE, the standard regular expression engine.
  2506.  
  2507. - In SRE, fixed error with negative lookahead and lookbehind that
  2508.   manifested itself as a runtime error in patterns like "(?<!abc)(def)".
  2509.  
  2510. - Several bugs in the Unicode handling and error handling in _tkinter
  2511.   were fixed.
  2512.  
  2513. - Fix memory management errors in Merge() and Tkapp_Call() routines.
  2514.  
  2515. - Several changes were made to cStringIO to make it compatible with
  2516.   the file-like object interface and with StringIO.  If operations are
  2517.   performed on a closed object, an exception is raised.  The truncate
  2518.   method now accepts a position argument and readline accepts a size
  2519.   argument.
  2520.  
  2521. - There were many changes made to the linuxaudiodev module and its
  2522.   test suite; as a result, a short, unexpected audio sample should now
  2523.   play when the regression test is run.
  2524.  
  2525.   Note that this module is named poorly, because it should work
  2526.   correctly on any platform that supports the Open Sound System
  2527.   (OSS).
  2528.  
  2529.   The module now raises exceptions when errors occur instead of
  2530.   crashing.  It also defines the AFMT_A_LAW format (logarithmic A-law
  2531.   audio) and defines a getptr() method that calls the
  2532.   SNDCTL_DSP_GETxPTR ioctl defined in the OSS Programmer's Guide.
  2533.  
  2534. - The library_version attribute, introduced in an earlier beta, was
  2535.   removed because it can not be supported with early versions of the C
  2536.   readline library, which provides no way to determine the version at
  2537.   compile-time.
  2538.  
  2539. - The binascii module is now enabled on Win64.
  2540.  
  2541. - tokenize.py no longer suffers "recursion depth" errors when parsing
  2542.   programs with very long string literals.
  2543.  
  2544. Internals
  2545.  
  2546. - Fixed several buffer overflow vulnerabilities in calculate_path(),
  2547.   which is called when the interpreter starts up to determine where
  2548.   the standard library is installed.  These vulnerabilities affect all
  2549.   previous versions of Python and can be exploited by setting very
  2550.   long values for PYTHONHOME or argv[0].  The risk is greatest for a
  2551.   setuid Python script, although use of the wrapper in
  2552.   Misc/setuid-prog.c will eliminate the vulnerability.
  2553.  
  2554. - Fixed garbage collection bugs in instance creation that were
  2555.   triggered when errors occurred during initialization.  The solution,
  2556.   applied in cPickle and in PyInstance_New(), is to call
  2557.   PyObject_GC_Init() after the initialization of the object's
  2558.   container attributes is complete.
  2559.  
  2560. - pyexpat adds definitions of PyModule_AddStringConstant and
  2561.   PyModule_AddObject if the Python version is less than 2.0, which
  2562.   provides compatibility with PyXML on Python 1.5.2.
  2563.  
  2564. - If the platform has a bogus definition for LONG_BIT (the number of
  2565.   bits in a long), an error will be reported at compile time.
  2566.  
  2567. - Fix bugs in _PyTuple_Resize() which caused hard-to-interpret garbage
  2568.   collection crashes and possibly other, unreported crashes.
  2569.  
  2570. - Fixed a memory leak in _PyUnicode_Fini().
  2571.  
  2572. Build issues
  2573.  
  2574. - configure now accepts a --with-suffix option that specifies the
  2575.   executable suffix.  This is useful for builds on Cygwin and Mac OS
  2576.   X, for example.
  2577.  
  2578. - The mmap.PAGESIZE constant is now initialized using sysconf when
  2579.   possible, which eliminates a dependency on -lucb for Reliant UNIX.
  2580.  
  2581. - The md5 file should now compile on all platforms.
  2582.  
  2583. - The select module now compiles on platforms that do not define
  2584.   POLLRDNORM and related constants.
  2585.  
  2586. - Darwin (Mac OS X):  Initial support for static builds on this
  2587.   platform.
  2588.  
  2589. - BeOS: A number of changes were made to the build and installation
  2590.   process.  ar-fake now operates on a directory of object files.
  2591.   dl_export.h is gone, and its macros now appear on the mwcc command
  2592.   line during build on PPC BeOS.
  2593.  
  2594. - Platform directory in lib/python2.0 is "plat-beos5" (or
  2595.   "plat-beos4", if building on BeOS 4.5), rather than "plat-beos".
  2596.  
  2597. - Cygwin: Support for shared libraries, Tkinter, and sockets.
  2598.  
  2599. - SunOS 4.1.4_JL: Fix test for directory existence in configure.
  2600.  
  2601. Tools and other miscellany
  2602.  
  2603. - Removed debugging prints from main used with freeze.
  2604.  
  2605. - IDLE auto-indent no longer crashes when it encounters Unicode
  2606.   characters.
  2607.  
  2608. What's new in 2.0 beta 2 (since beta 1)?
  2609. ========================================
  2610.  
  2611. Core language, builtins, and interpreter
  2612.  
  2613. - Add support for unbounded ints in %d,i,u,x,X,o formats; for example
  2614.   "%d" % 2L**64 == "18446744073709551616".
  2615.  
  2616. - Add -h and -V command line options to print the usage message and
  2617.   Python version number and exit immediately.
  2618.  
  2619. - eval() and exec accept Unicode objects as code parameters.
  2620.  
  2621. - getattr() and setattr() now also accept Unicode objects for the
  2622.   attribute name, which are converted to strings using the default
  2623.   encoding before lookup.
  2624.  
  2625. - Multiplication on string and Unicode now does proper bounds
  2626.   checking; e.g. 'a' * 65536 * 65536 will raise ValueError, "repeated
  2627.   string is too long."
  2628.  
  2629. - Better error message when continue is found in try statement in a
  2630.   loop.
  2631.  
  2632.  
  2633. Standard library and extensions
  2634.  
  2635. - socket module: the OpenSSL code now adds support for RAND_status()
  2636.   and EGD (Entropy Gathering Device).
  2637.  
  2638. - array: reverse() method of array now works.  buffer_info() now does
  2639.   argument checking; it still takes no arguments.
  2640.  
  2641. - asyncore/asynchat: Included most recent version from Sam Rushing.
  2642.  
  2643. - cgi: Accept '&' or ';' as separator characters when parsing form data.
  2644.  
  2645. - CGIHTTPServer: Now works on Windows (and perhaps even Mac).
  2646.  
  2647. - ConfigParser: When reading the file, options spelled in upper case
  2648.   letters are now correctly converted to lowercase.
  2649.  
  2650. - copy: Copy Unicode objects atomically.
  2651.  
  2652. - cPickle: Fail gracefully when copy_reg can't be imported.
  2653.  
  2654. - cStringIO: Implemented readlines() method.
  2655.  
  2656. - dbm: Add get() and setdefault() methods to dbm object.  Add constant
  2657.   `library' to module that names the library used.  Added doc strings
  2658.   and method names to error messages.  Uses configure to determine
  2659.   which ndbm.h file to include; Berkeley DB's nbdm and GDBM's ndbm is
  2660.   now available options.
  2661.  
  2662. - distutils: Update to version 0.9.3.
  2663.  
  2664. - dl: Add several dl.RTLD_ constants.
  2665.  
  2666. - fpectl: Now supported on FreeBSD.
  2667.  
  2668. - gc: Add DEBUG_SAVEALL option.  When enabled all garbage objects
  2669.   found by the collector will be saved in gc.garbage.  This is useful
  2670.   for debugging a program that creates reference cycles.
  2671.  
  2672. - httplib: Three changes: Restore support for set_debuglevel feature
  2673.   of HTTP class.  Do not close socket on zero-length response.  Do not
  2674.   crash when server sends invalid content-length header.
  2675.  
  2676. - mailbox: Mailbox class conforms better to qmail specifications.
  2677.  
  2678. - marshal: When reading a short, sign-extend on platforms where shorts
  2679.   are bigger than 16 bits.  When reading a long, repair the unportable
  2680.   sign extension that was being done for 64-bit machines.  (It assumed
  2681.   that signed right shift sign-extends.)
  2682.  
  2683. - operator: Add contains(), invert(), __invert__() as aliases for
  2684.   __contains__(), inv(), and __inv__() respectively.
  2685.  
  2686. - os: Add support for popen2() and popen3() on all platforms where
  2687.   fork() exists.  (popen4() is still in the works.)
  2688.  
  2689. - os: (Windows only:) Add startfile() function that acts like double-
  2690.   clicking on a file in Explorer (or passing the file name to the
  2691.   DOS "start" command).
  2692.  
  2693. - os.path: (Windows, DOS:) Treat trailing colon correctly in
  2694.   os.path.join.  os.path.join("a:", "b") yields "a:b".
  2695.  
  2696. - pickle: Now raises ValueError when an invalid pickle that contains
  2697.   a non-string repr where a string repr was expected.  This behavior
  2698.   matches cPickle.
  2699.  
  2700. - posixfile: Remove broken __del__() method.
  2701.  
  2702. - py_compile: support CR+LF line terminators in source file.
  2703.  
  2704. - readline: Does not immediately exit when ^C is hit when readline and
  2705.   threads are configured.  Adds definition of rl_library_version.  (The
  2706.   latter addition requires GNU readline 2.2 or later.)
  2707.  
  2708. - rfc822: Domain literals returned by AddrlistClass method
  2709.   getdomainliteral() are now properly wrapped in brackets.
  2710.  
  2711. - site: sys.setdefaultencoding() should only be called in case the
  2712.   standard default encoding ("ascii") is changed. This saves quite a
  2713.   few cycles during startup since the first call to
  2714.   setdefaultencoding() will initialize the codec registry and the
  2715.   encodings package.
  2716.  
  2717. - socket: Support for size hint in readlines() method of object returned
  2718.   by makefile().
  2719.  
  2720. - sre: Added experimental expand() method to match objects.  Does not
  2721.   use buffer interface on Unicode strings.  Does not hang if group id
  2722.   is followed by whitespace.
  2723.  
  2724. - StringIO: Size hint in readlines() is now supported as documented.
  2725.  
  2726. - struct: Check ranges for bytes and shorts.
  2727.  
  2728. - urllib: Improved handling of win32 proxy settings. Fixed quote and
  2729.   quote_plus functions so that the always encode a comma.
  2730.  
  2731. - Tkinter: Image objects are now guaranteed to have unique ids.  Set
  2732.   event.delta to zero if Tk version doesn't support mousewheel.
  2733.   Removed some debugging prints.
  2734.  
  2735. - UserList: now implements __contains__().
  2736.  
  2737. - webbrowser: On Windows, use os.startfile() instead of os.popen(),
  2738.   which works around a bug in Norton AntiVirus 2000 that leads directly
  2739.   to a Blue Screen freeze.
  2740.  
  2741. - xml: New version detection code allows PyXML to override standard
  2742.   XML package if PyXML version is greater than 0.6.1.
  2743.  
  2744. - xml.dom: DOM level 1 support for basic XML.  Includes xml.dom.minidom
  2745.   (conventional DOM), and xml.dom.pulldom, which allows building the DOM
  2746.   tree only for nodes which are sufficiently interesting to a specific
  2747.   application.  Does not provide the HTML-specific extensions.  Still
  2748.   undocumented.
  2749.  
  2750. - xml.sax: SAX 2 support for Python, including all the handler
  2751.   interfaces needed to process XML 1.0 compliant XML.  Some
  2752.   documentation is already available.
  2753.  
  2754. - pyexpat: Renamed to xml.parsers.expat since this is part of the new,
  2755.   packagized XML support.
  2756.  
  2757.  
  2758. C API
  2759.  
  2760. - Add three new convenience functions for module initialization --
  2761.   PyModule_AddObject(), PyModule_AddIntConstant(), and
  2762.   PyModule_AddStringConstant().
  2763.  
  2764. - Cleaned up definition of NULL in C source code; all definitions were
  2765.   removed and add #error to Python.h if NULL isn't defined after
  2766.   #include of stdio.h.
  2767.  
  2768. - Py_PROTO() macros that were removed in 2.0b1 have been restored for
  2769.   backwards compatibility (at the source level) with old extensions.
  2770.  
  2771. - A wrapper API was added for signal() and sigaction().  Instead of
  2772.   either function, always use PyOS_getsig() to get a signal handler
  2773.   and PyOS_setsig() to set one.  A new convenience typedef
  2774.   PyOS_sighandler_t is defined for the type of signal handlers.
  2775.  
  2776. - Add PyString_AsStringAndSize() function that provides access to the
  2777.   internal data buffer and size of a string object -- or the default
  2778.   encoded version of a Unicode object.
  2779.  
  2780. - PyString_Size() and PyString_AsString() accept Unicode objects.
  2781.  
  2782. - The standard header <limits.h> is now included by Python.h (if it
  2783.   exists).  INT_MAX and LONG_MAX will always be defined, even if
  2784.   <limits.h> is not available.
  2785.  
  2786. - PyFloat_FromString takes a second argument, pend, that was
  2787.   effectively useless.  It is now officially useless but preserved for
  2788.   backwards compatibility.  If the pend argument is not NULL, *pend is
  2789.   set to NULL.
  2790.  
  2791. - PyObject_GetAttr() and PyObject_SetAttr() now accept Unicode objects
  2792.   for the attribute name.  See note on getattr() above.
  2793.  
  2794. - A few bug fixes to argument processing for Unicode.
  2795.   PyArg_ParseTupleAndKeywords() now accepts "es#" and "es".
  2796.   PyArg_Parse() special cases "s#" for Unicode objects; it returns a
  2797.   pointer to the default encoded string data instead of to the raw
  2798.   UTF-16.
  2799.  
  2800. - Py_BuildValue accepts B format (for bgen-generated code).
  2801.  
  2802.  
  2803. Internals
  2804.  
  2805. - On Unix, fix code for finding Python installation directory so that
  2806.   it works when argv[0] is a relative path.
  2807.  
  2808. - Added a true unicode_internal_encode() function and fixed the
  2809.   unicode_internal_decode function() to support Unicode objects directly
  2810.   rather than by generating a copy of the object.
  2811.  
  2812. - Several of the internal Unicode tables are much smaller now, and
  2813.   the source code should be much friendlier to weaker compilers.
  2814.  
  2815. - In the garbage collector: Fixed bug in collection of tuples.  Fixed
  2816.   bug that caused some instances to be removed from the container set
  2817.   while they were still live.  Fixed parsing in gc.set_debug() for
  2818.   platforms where sizeof(long) > sizeof(int).
  2819.  
  2820. - Fixed refcount problem in instance deallocation that only occurred
  2821.   when Py_REF_DEBUG was defined and Py_TRACE_REFS was not.
  2822.  
  2823. - On Windows, getpythonregpath is now protected against null data in
  2824.   registry key.
  2825.  
  2826. - On Unix, create .pyc/.pyo files with O_EXCL flag to avoid a race
  2827.   condition.
  2828.  
  2829.  
  2830. Build and platform-specific issues
  2831.  
  2832. - Better support of GNU Pth via --with-pth configure option.
  2833.  
  2834. - Python/C API now properly exposed to dynamically-loaded extension
  2835.   modules on Reliant UNIX.
  2836.  
  2837. - Changes for the benefit of SunOS 4.1.4 (really!).  mmapmodule.c:
  2838.   Don't define MS_SYNC to be zero when it is undefined.  Added missing
  2839.   prototypes in posixmodule.c.
  2840.  
  2841. - Improved support for HP-UX build.  Threads should now be correctly
  2842.   configured (on HP-UX 10.20 and 11.00).
  2843.  
  2844. - Fix largefile support on older NetBSD systems and OpenBSD by adding
  2845.   define for TELL64.
  2846.  
  2847.  
  2848. Tools and other miscellany
  2849.  
  2850. - ftpmirror: Call to main() is wrapped in if __name__ == "__main__".
  2851.  
  2852. - freeze: The modulefinder now works with 2.0 opcodes.
  2853.  
  2854. - IDLE:
  2855.   Move hackery of sys.argv until after the Tk instance has been
  2856.   created, which allows the application-specific Tkinter
  2857.   initialization to be executed if present; also pass an explicit
  2858.   className parameter to the Tk() constructor.
  2859.  
  2860.  
  2861. What's new in 2.0 beta 1?
  2862. =========================
  2863.  
  2864. Source Incompatibilities
  2865. ------------------------
  2866.  
  2867. None.  Note that 1.6 introduced several incompatibilities with 1.5.2,
  2868. such as single-argument append(), connect() and bind(), and changes to
  2869. str(long) and repr(float).
  2870.  
  2871.  
  2872. Binary Incompatibilities
  2873. ------------------------
  2874.  
  2875. - Third party extensions built for Python 1.5.x or 1.6 cannot be used
  2876. with Python 2.0; these extensions will have to be rebuilt for Python
  2877. 2.0.
  2878.  
  2879. - On Windows, attempting to import a third party extension built for
  2880. Python 1.5.x or 1.6 results in an immediate crash; there's not much we
  2881. can do about this.  Check your PYTHONPATH environment variable!
  2882.  
  2883. - Python bytecode files (*.pyc and *.pyo) are not compatible between
  2884. releases.
  2885.  
  2886.  
  2887. Overview of Changes Since 1.6
  2888. -----------------------------
  2889.  
  2890. There are many new modules (including brand new XML support through
  2891. the xml package, and i18n support through the gettext module); a list
  2892. of all new modules is included below.  Lots of bugs have been fixed.
  2893.  
  2894. The process for making major new changes to the language has changed
  2895. since Python 1.6.  Enhancements must now be documented by a Python
  2896. Enhancement Proposal (PEP) before they can be accepted.
  2897.  
  2898. There are several important syntax enhancements, described in more
  2899. detail below:
  2900.  
  2901.   - Augmented assignment, e.g. x += 1
  2902.  
  2903.   - List comprehensions, e.g. [x**2 for x in range(10)]
  2904.  
  2905.   - Extended import statement, e.g. import Module as Name
  2906.  
  2907.   - Extended print statement, e.g. print >> file, "Hello"
  2908.  
  2909. Other important changes:
  2910.  
  2911.   - Optional collection of cyclical garbage
  2912.  
  2913. Python Enhancement Proposal (PEP)
  2914. ---------------------------------
  2915.  
  2916. PEP stands for Python Enhancement Proposal.  A PEP is a design
  2917. document providing information to the Python community, or describing
  2918. a new feature for Python.  The PEP should provide a concise technical
  2919. specification of the feature and a rationale for the feature.
  2920.  
  2921. We intend PEPs to be the primary mechanisms for proposing new
  2922. features, for collecting community input on an issue, and for
  2923. documenting the design decisions that have gone into Python.  The PEP
  2924. author is responsible for building consensus within the community and
  2925. documenting dissenting opinions.
  2926.  
  2927. The PEPs are available at http://python.sourceforge.net/peps/.
  2928.  
  2929. Augmented Assignment
  2930. --------------------
  2931.  
  2932. This must have been the most-requested feature of the past years!
  2933. Eleven new assignment operators were added:
  2934.  
  2935.     += -= *= /= %= **= <<= >>= &= ^= |=
  2936.  
  2937. For example,
  2938.  
  2939.     A += B
  2940.  
  2941. is similar to
  2942.  
  2943.     A = A + B
  2944.  
  2945. except that A is evaluated only once (relevant when A is something
  2946. like dict[index].attr).
  2947.  
  2948. However, if A is a mutable object, A may be modified in place.  Thus,
  2949. if A is a number or a string, A += B has the same effect as A = A+B
  2950. (except A is only evaluated once); but if a is a list, A += B has the
  2951. same effect as A.extend(B)!
  2952.  
  2953. Classes and built-in object types can override the new operators in
  2954. order to implement the in-place behavior; the not-in-place behavior is
  2955. used automatically as a fallback when an object doesn't implement the
  2956. in-place behavior.  For classes, the method name is derived from the
  2957. method name for the corresponding not-in-place operator by inserting
  2958. an 'i' in front of the name, e.g. __iadd__ implements in-place
  2959. __add__.
  2960.  
  2961. Augmented assignment was implemented by Thomas Wouters.
  2962.  
  2963.  
  2964. List Comprehensions
  2965. -------------------
  2966.  
  2967. This is a flexible new notation for lists whose elements are computed
  2968. from another list (or lists).  The simplest form is:
  2969.  
  2970.     [<expression> for <variable> in <sequence>]
  2971.  
  2972. For example, [i**2 for i in range(4)] yields the list [0, 1, 4, 9].
  2973. This is more efficient than a for loop with a list.append() call.
  2974.  
  2975. You can also add a condition:
  2976.  
  2977.     [<expression> for <variable> in <sequence> if <condition>]
  2978.  
  2979. For example, [w for w in words if w == w.lower()] would yield the list
  2980. of words that contain no uppercase characters.  This is more efficient
  2981. than a for loop with an if statement and a list.append() call.
  2982.  
  2983. You can also have nested for loops and more than one 'if' clause.  For
  2984. example, here's a function that flattens a sequence of sequences::
  2985.  
  2986.     def flatten(seq):
  2987.         return [x for subseq in seq for x in subseq]
  2988.  
  2989.     flatten([[0], [1,2,3], [4,5], [6,7,8,9], []])
  2990.  
  2991. This prints
  2992.  
  2993.     [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  2994.  
  2995. List comprehensions originated as a patch set from Greg Ewing; Skip
  2996. Montanaro and Thomas Wouters also contributed.  Described by PEP 202.
  2997.  
  2998.  
  2999. Extended Import Statement
  3000. -------------------------
  3001.  
  3002. Many people have asked for a way to import a module under a different
  3003. name.  This can be accomplished like this:
  3004.  
  3005.     import foo
  3006.     bar = foo
  3007.     del foo
  3008.  
  3009. but this common idiom gets old quickly.  A simple extension of the
  3010. import statement now allows this to be written as follows:
  3011.  
  3012.     import foo as bar
  3013.  
  3014. There's also a variant for 'from ... import':
  3015.  
  3016.     from foo import bar as spam
  3017.  
  3018. This also works with packages; e.g. you can write this:
  3019.  
  3020.     import test.regrtest as regrtest
  3021.  
  3022. Note that 'as' is not a new keyword -- it is recognized only in this
  3023. context (this is only possible because the syntax for the import
  3024. statement doesn't involve expressions).
  3025.  
  3026. Implemented by Thomas Wouters.  Described by PEP 221.
  3027.  
  3028.  
  3029. Extended Print Statement
  3030. ------------------------
  3031.  
  3032. Easily the most controversial new feature, this extension to the print
  3033. statement adds an option to make the output go to a different file
  3034. than the default sys.stdout.
  3035.  
  3036. For example, to write an error message to sys.stderr, you can now
  3037. write:
  3038.  
  3039.     print >> sys.stderr, "Error: bad dog!"
  3040.  
  3041. As a special feature, if the expression used to indicate the file
  3042. evaluates to None, the current value of sys.stdout is used.  Thus:
  3043.  
  3044.     print >> None, "Hello world"
  3045.  
  3046. is equivalent to
  3047.  
  3048.     print "Hello world"
  3049.  
  3050. Design and implementation by Barry Warsaw.  Described by PEP 214.
  3051.  
  3052.  
  3053. Optional Collection of Cyclical Garbage
  3054. ---------------------------------------
  3055.  
  3056. Python is now equipped with a garbage collector that can hunt down
  3057. cyclical references between Python objects.  It's no replacement for
  3058. reference counting; in fact, it depends on the reference counts being
  3059. correct, and decides that a set of objects belong to a cycle if all
  3060. their reference counts can be accounted for from their references to
  3061. each other.  This devious scheme was first proposed by Eric Tiedemann,
  3062. and brought to implementation by Neil Schemenauer.
  3063.  
  3064. There's a module "gc" that lets you control some parameters of the
  3065. garbage collection.  There's also an option to the configure script
  3066. that lets you enable or disable the garbage collection.  In 2.0b1,
  3067. it's on by default, so that we (hopefully) can collect decent user
  3068. experience with this new feature.  There are some questions about its
  3069. performance.  If it proves to be too much of a problem, we'll turn it
  3070. off by default in the final 2.0 release.
  3071.  
  3072.  
  3073. Smaller Changes
  3074. ---------------
  3075.  
  3076. A new function zip() was added.  zip(seq1, seq2, ...) is equivalent to
  3077. map(None, seq1, seq2, ...) when the sequences have the same length;
  3078. i.e. zip([1,2,3], [10,20,30]) returns [(1,10), (2,20), (3,30)].  When
  3079. the lists are not all the same length, the shortest list wins:
  3080. zip([1,2,3], [10,20]) returns [(1,10), (2,20)].  See PEP 201.
  3081.  
  3082. sys.version_info is a tuple (major, minor, micro, level, serial).
  3083.  
  3084. Dictionaries have an odd new method, setdefault(key, default).
  3085. dict.setdefault(key, default) returns dict[key] if it exists; if not,
  3086. it sets dict[key] to default and returns that value.  Thus:
  3087.  
  3088.     dict.setdefault(key, []).append(item)
  3089.  
  3090. does the same work as this common idiom:
  3091.  
  3092.     if not dict.has_key(key):
  3093.         dict[key] = []
  3094.     dict[key].append(item)
  3095.  
  3096. There are two new variants of SyntaxError that are raised for
  3097. indentation-related errors: IndentationError and TabError.
  3098.  
  3099. Changed \x to consume exactly two hex digits; see PEP 223.  Added \U
  3100. escape that consumes exactly eight hex digits.
  3101.  
  3102. The limits on the size of expressions and file in Python source code
  3103. have been raised from 2**16 to 2**32.  Previous versions of Python
  3104. were limited because the maximum argument size the Python VM accepted
  3105. was 2**16.  This limited the size of object constructor expressions,
  3106. e.g. [1,2,3] or {'a':1, 'b':2}, and the size of source files.  This
  3107. limit was raised thanks to a patch by Charles Waldman that effectively
  3108. fixes the problem.  It is now much more likely that you will be
  3109. limited by available memory than by an arbitrary limit in Python.
  3110.  
  3111. The interpreter's maximum recursion depth can be modified by Python
  3112. programs using sys.getrecursionlimit and sys.setrecursionlimit.  This
  3113. limit is the maximum number of recursive calls that can be made by
  3114. Python code.  The limit exists to prevent infinite recursion from
  3115. overflowing the C stack and causing a core dump.  The default value is
  3116. 1000.  The maximum safe value for a particular platform can be found
  3117. by running Misc/find_recursionlimit.py.
  3118.  
  3119. New Modules and Packages
  3120. ------------------------
  3121.  
  3122. atexit - for registering functions to be called when Python exits.
  3123.  
  3124. imputil - Greg Stein's alternative API for writing custom import
  3125. hooks.
  3126.  
  3127. pyexpat - an interface to the Expat XML parser, contributed by Paul
  3128. Prescod.
  3129.  
  3130. xml - a new package with XML support code organized (so far) in three
  3131. subpackages: xml.dom, xml.sax, and xml.parsers.  Describing these
  3132. would fill a volume.  There's a special feature whereby a
  3133. user-installed package named _xmlplus overrides the standard
  3134. xmlpackage; this is intended to give the XML SIG a hook to distribute
  3135. backwards-compatible updates to the standard xml package.
  3136.  
  3137. webbrowser - a platform-independent API to launch a web browser.
  3138.  
  3139.  
  3140. Changed Modules
  3141. ---------------
  3142.  
  3143. array -- new methods for array objects: count, extend, index, pop, and
  3144. remove
  3145.  
  3146. binascii -- new functions b2a_hex and a2b_hex that convert between
  3147. binary data and its hex representation
  3148.  
  3149. calendar -- Many new functions that support features including control
  3150. over which day of the week is the first day, returning strings instead
  3151. of printing them.  Also new symbolic constants for days of week,
  3152. e.g. MONDAY, ..., SUNDAY.
  3153.  
  3154. cgi -- FieldStorage objects have a getvalue method that works like a
  3155. dictionary's get method and returns the value attribute of the object.
  3156.  
  3157. ConfigParser -- The parser object has new methods has_option,
  3158. remove_section, remove_option, set, and write.  They allow the module
  3159. to be used for writing config files as well as reading them.
  3160.  
  3161. ftplib -- ntransfercmd(), transfercmd(), and retrbinary() all now
  3162. optionally support the RFC 959 REST command.
  3163.  
  3164. gzip -- readline and readlines now accept optional size arguments
  3165.  
  3166. httplib -- New interfaces and support for HTTP/1.1 by Greg Stein.  See
  3167. the module doc strings for details.
  3168.  
  3169. locale -- implement getdefaultlocale for Win32 and Macintosh
  3170.  
  3171. marshal -- no longer dumps core when marshaling deeply nested or
  3172. recursive data structures
  3173.  
  3174. os -- new functions isatty, seteuid, setegid, setreuid, setregid
  3175.  
  3176. os/popen2 -- popen2/popen3/popen4 support under Windows.  popen2/popen3
  3177. support under Unix.
  3178.  
  3179. os/pty -- support for openpty and forkpty
  3180.  
  3181. os.path -- fix semantics of os.path.commonprefix
  3182.  
  3183. smtplib -- support for sending very long messages
  3184.  
  3185. socket -- new function getfqdn()
  3186.  
  3187. readline -- new functions to read, write and truncate history files.
  3188. The readline section of the library reference manual contains an
  3189. example.
  3190.  
  3191. select -- add interface to poll system call
  3192.  
  3193. shutil -- new copyfileobj function
  3194.  
  3195. SimpleHTTPServer, CGIHTTPServer -- Fix problems with buffering in the
  3196. HTTP server.
  3197.  
  3198. Tkinter -- optimization of function flatten
  3199.  
  3200. urllib -- scans environment variables for proxy configuration,
  3201. e.g. http_proxy.
  3202.  
  3203. whichdb -- recognizes dumbdbm format
  3204.  
  3205.  
  3206. Obsolete Modules
  3207. ----------------
  3208.  
  3209. None.  However note that 1.6 made a whole slew of modules obsolete:
  3210. stdwin, soundex, cml, cmpcache, dircache, dump, find, grep, packmail,
  3211. poly, zmod, strop, util, whatsound.
  3212.  
  3213.  
  3214. Changed, New, Obsolete Tools
  3215. ----------------------------
  3216.  
  3217. None.
  3218.  
  3219.  
  3220. C-level Changes
  3221. ---------------
  3222.  
  3223. Several cleanup jobs were carried out throughout the source code.
  3224.  
  3225. All C code was converted to ANSI C; we got rid of all uses of the
  3226. Py_PROTO() macro, which makes the header files a lot more readable.
  3227.  
  3228. Most of the portability hacks were moved to a new header file,
  3229. pyport.h; several other new header files were added and some old
  3230. header files were removed, in an attempt to create a more rational set
  3231. of header files.  (Few of these ever need to be included explicitly;
  3232. they are all included by Python.h.)
  3233.  
  3234. Trent Mick ensured portability to 64-bit platforms, under both Linux
  3235. and Win64, especially for the new Intel Itanium processor.  Mick also
  3236. added large file support for Linux64 and Win64.
  3237.  
  3238. The C APIs to return an object's size have been update to consistently
  3239. use the form PyXXX_Size, e.g. PySequence_Size and PyDict_Size.  In
  3240. previous versions, the abstract interfaces used PyXXX_Length and the
  3241. concrete interfaces used PyXXX_Size.  The old names,
  3242. e.g. PyObject_Length, are still available for backwards compatibility
  3243. at the API level, but are deprecated.
  3244.  
  3245. The PyOS_CheckStack function has been implemented on Windows by
  3246. Fredrik Lundh.  It prevents Python from failing with a stack overflow
  3247. on Windows.
  3248.  
  3249. The GC changes resulted in creation of two new slots on object,
  3250. tp_traverse and tp_clear.  The augmented assignment changes result in
  3251. the creation of a new slot for each in-place operator.
  3252.  
  3253. The GC API creates new requirements for container types implemented in
  3254. C extension modules.  See Include/objimpl.h for details.
  3255.  
  3256. PyErr_Format has been updated to automatically calculate the size of
  3257. the buffer needed to hold the formatted result string.  This change
  3258. prevents crashes caused by programmer error.
  3259.  
  3260. New C API calls: PyObject_AsFileDescriptor, PyErr_WriteUnraisable.
  3261.  
  3262. PyRun_AnyFileEx, PyRun_SimpleFileEx, PyRun_FileEx -- New functions
  3263. that are the same as their non-Ex counterparts except they take an
  3264. extra flag argument that tells them to close the file when done.
  3265.  
  3266. XXX There were other API changes that should be fleshed out here.
  3267.  
  3268.  
  3269. Windows Changes
  3270. ---------------
  3271.  
  3272. New popen2/popen3/peopen4 in os module (see Changed Modules above).
  3273.  
  3274. os.popen is much more usable on Windows 95 and 98.  See Microsoft
  3275. Knowledge Base article Q150956.  The Win9x workaround described there
  3276. is implemented by the new w9xpopen.exe helper in the root of your
  3277. Python installation.  Note that Python uses this internally; it is not
  3278. a standalone program.
  3279.  
  3280. Administrator privileges are no longer required to install Python
  3281. on Windows NT or Windows 2000.  If you have administrator privileges,
  3282. Python's registry info will be written under HKEY_LOCAL_MACHINE.
  3283. Otherwise the installer backs off to writing Python's registry info
  3284. under HKEY_CURRENT_USER.  The latter is sufficient for all "normal"
  3285. uses of Python, but will prevent some advanced uses from working
  3286. (for example, running a Python script as an NT service, or possibly
  3287. from CGI).
  3288.  
  3289. [This was new in 1.6] The installer no longer runs a separate Tcl/Tk
  3290. installer; instead, it installs the needed Tcl/Tk files directly in the
  3291. Python directory.  If you already have a Tcl/Tk installation, this
  3292. wastes some disk space (about 4 Megs) but avoids problems with
  3293. conflicting Tcl/Tk installations, and makes it much easier for Python
  3294. to ensure that Tcl/Tk can find all its files.
  3295.  
  3296. [This was new in 1.6] The Windows installer now installs by default in
  3297. \Python20\ on the default volume, instead of \Program Files\Python-2.0\.
  3298.  
  3299.  
  3300. Updates to the changes between 1.5.2 and 1.6
  3301. --------------------------------------------
  3302.  
  3303. The 1.6 NEWS file can't be changed after the release is done, so here
  3304. is some late-breaking news:
  3305.  
  3306. New APIs in locale.py: normalize(), getdefaultlocale(), resetlocale(),
  3307. and changes to getlocale() and setlocale().
  3308.  
  3309. The new module is now enabled per default.
  3310.  
  3311. It is not true that the encodings codecs cannot be used for normal
  3312. strings: the string.encode() (which is also present on 8-bit strings
  3313. !) allows using them for 8-bit strings too, e.g. to convert files from
  3314. cp1252 (Windows) to latin-1 or vice-versa.
  3315.  
  3316. Japanese codecs are available from Tamito KAJIYAMA:
  3317. http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/python/
  3318.  
  3319.  
  3320. ======================================================================
  3321.