This commit was manufactured by cvs2svn to create tag 'r222'.
[python/dscho.git] / Misc / NEWS
blob1438082260281438534fb0c0341301511779234b
1 What's New in Python 2.2.2 (final) ?
2 Release date: 14-Oct-2002
3 ====================================
5 Almost everything in this release is a pure bugfix and is backported
6 from a corresponding bugfix already applied to Python 2.3.  While at
7 the time of writing, Python 2.3 is still in pre-alpha form, only
8 accessible via CVS, it receives continuous and extensive testing by
9 its developers.  The list below is not a complete list of fixed bugs;
10 it only lists fixed bugs that someone might be interested in hearing
11 about.  Documentation fixes are not listed.
13 Tip: to quickly find SourceForge bug or patch NNNNNN, use an URL of
14 the form www.python.org/sf/NNNNNN.
16 Here are all the changes since the 2.2.2b1 release last week, except
17 for documentation changes.  Below it are the (much more numerous!)
18 changes since the 2.2.1 release in April.
20 Core and builtins
22 - In listobject.c and tupleobject.c: added overflow checks for
23   list*int, list+list, and tuple+tuple.
25 - In object.c: changed misleading SystemError exceptions raised in
26   PyObject_Init() and PyObject_InitVar() to MemoryError.
28 - In stringobject.c: added an overflow check to string formatting;
29   this example could segfault: '%2147483647d' % -1.  [SF bug 618623]
31 - In typeobject.c: removed COPYSLOT(tp_dictoffset) from
32   inherit_slots().  For more info, read this python-dev thread:
33   http://mail.python.org/pipermail/python-dev/2002-October/029502.html
35 - In stringobject.c: fixed another string formatting nit: "%r" % u"..."
36   would return a Unicode string, even though repr(u"...")  returns an
37   8-bit string.  Now "%r" also returns an 8-bit string.
39 - In pystate.c: initialize the tick_counter to zero.
41 Library
43 - This release includes the email package version 2.4.3, which fixes
44   some minor bugs found in email 2.4.1 since its release.
46 - In urlparse.py: a one-character fix to urlunsplit() caused breakage
47   when parsing relative URLs, so added a fix for the fix and a test
48   for the fix.  [SF bug 620705]
50 - In re.py: the finditer() function was accidentally not defined.  [SF
51   bug 585882]
53 - In webbrowser.py: fixed Konqueror support.  [SF patch 539360]
55 - In xml/sax/expatreader.py: fixed a bug in the expat-based SAX reader
56   that allows it to work with arbitrary versions of Expat.
58 - In distutils/sysconfig.py: added a no-op version of
59   set_python_build() back, to avoid breaking code that might call
60   this.  (It remains no longer needed and hence deprecated, though.)
62 Build
64 - In configure[.in]: expand AC_CHECK_SIZEOF inline to overcome a
65   autoconf 2.13 weakness.  [SF bug 620791]
67 - In setup.py: Be more conservative about adding a -R flag for the SSL
68   code; it is needed on Solaris 8 and broke on Mac OSX 10.2.  The -R
69   flag is now only added for Solaris.
71 Tests
73 - The test list(xrange(sys.maxint / 4)) test in test_b1.py was changed
74   to use sys.maxint / 2 instead.  This means that the test will not
75   attempt to allocate any memory, but merely check that the overflow
76   detection code works correctly (as was intended).
78 - The MacOSX (both 10.1 and 10.2) tests will crash with SEGV in
79   test_re and test_sre due to the small default stack size.  If you
80   set the stack size to 2048 before doing a "make test" the failure
81   can be avoided.  If you're using the tcsh (the default on OSX), or
82   csh shells use "limit stacksize 2048" and for the bash shell, use
83   "ulimit -s 2048".
85 Windows
87 - Fixed the "File version" field in the DLL.  This has apparently been
88   broken forever.
90 Other
92 - Updated the Misc/ACKS file to acknowledge many new contributors.
95 What's New in Python 2.2.2b1?
96 Release date: 7-Oct-2002
97 =============================
99 Core and builtins
101 - Changed new-style class instantiation so that when C's __new__
102   method returns something that's not a C instance, its __init__ is
103   not called.  [SF bug #537450]  (This is arguably a semantic change,
104   but it's hard to imagine a reason for wanting to depend on the old
105   behavior.  If problems with this are reported within a week of the
106   release of 2.2.2 beta 1, we may revert this change.)
108 - Fix a core dump in type_new() when looking for the tp_init() slot.
109   This could call a garbage pointer when e.g. an ExtensionClass was
110   given.
112 - A variety of very obscure end-case bugs in new-style classes were
113   fixed, some of which could be made to trigger core dumps with absurd
114   input.
116 - u'%c' will now raise a ValueError in case the argument is an
117   integer outside the valid range of Unicode code point ordinals.
119 - Several small patches were applied that aren't bugfixes (and aren't
120   even backported from 2.3!) but make life easier for tools like Armin
121   Rigo's Psyco.  [SF patches 617309, 617311, 617312]
123 - Made conversion failure error message consistent between types.
125 - The complex() built-in now finds __complex__() in new-style
126   classes.  [SF bug 563740]
128 - Fixed a problem in the UTF-8 decoder where a Unicode literal
129   containing a "lone surrogate" would cause a .pyc file to be written
130   that could not be read.  [SF bug 610783]
132 - Fixed a problem with code objects whose stacksize is >= 2**15.
133   These cannot be marshalled correctly.  As a work-around, don't write
134   a .pyc file in this case.  [SF bug 561858]
136 - Fixed several bugs that could cause issubclass() and isinstance() to
137   leave an exception lingering behind while returning a non-error
138   value.
140 - The Unicode replace() method would do the wrong thing for a unicode
141   subclass when there were zero string replacements.  [SF bug 599128]
143 - Fixed some endcase bugs in Unicode rfind()/rindex() and endswith().
144   [SF bug 595350]
146 - When x is an object whose class implements __mul__ and __rmul__,
147   1.0*x would correctly invoke __rmul__, but 1*x would erroneously
148   invoke __mul__.  This was due to the sequence-repeat code in the int
149   type.  This has been fixed now.
151 - The __delete__ method wrapper wasn't supported.  [SF patch 588728]
153 - If a dying instance of a new-style class got resurrected by its
154   class's __del__ method, Python aborted with a fatal error.
156 - Source that creates parse nodes with an extremely large number of
157   children (e.g.,  test_longexp.py) triggers problems with the
158   platform realloc() under several platforms (e.g., MacPython, and
159   Win98).  This has been fixed via a more-aggressive overallocation
160   strategy.
162 - Fixed a bug with a continue inside a try block and a yield in the
163   finally clause.  [SF bug 567538]
165 - Cycles going through the __class__ link of a new-style instance are
166   now detected by the garbage collector.
168 - Classes using __slots__ are now properly garbage collected.
169   [SF bug 519621]
171 - Fixed an inefficiency in clearing the stack frame of new frame
172   objects.
174 - Repaired a slow memory leak possible only in programs creating a
175   great many cyclic structures involving frames [SF bug 543148].
177 - Fixed an esoteric performance glitch in GC.  [SF bug 574132]
179 - A method zfill() was added to str and unicode, that fills a numeric
180   string to the left with zeros.  For example,
181   "+123".zfill(6) -> "+00123".
183 - Complex numbers supported divmod() and the // and % operators, but
184   these make no sense.  Since this was documented, they're being
185   deprecated now.
187 - String and Unicode methods lstrip(), rstrip() and strip() now take
188   an optional argument that specifies the characters to strip.  For
189   example, "Foo!!!?!?!?".rstrip("?!") -> "Foo". In addition,
190   "200L".strip("L") will return "200". This is useful for replacing
191   code that assumed longs will always be printed with a trailing "L".
193 - A change to how new-style classes deal with __doc__: you can now
194   supply a __doc__ descriptor that returns something different for a
195   class than for instances of that class.
197 Extension modules
199 - In readline.c: change completion to avoid appending a space
200   character; this is usually more useful when editing Python code.
202 - Fixed a crash in debug builds for marshal.dumps([128] * 1000).  [SF
203   bug 588452]
205 - In cPickle.c: more robust test of whether global objects are
206   accessible.  Added recursion limit to pickling [SF bug 576084].  Try
207   the persistent id code *before* calling save_global().
209 - In mmapmodule.c: if the size passed to mmap() is larger than the
210   length of the file on non-Windows platforms, a ValueError is
211   raised. [SF bug 585792]
213 - In socketmodule.c: improve robustness of IPv6 code.
215 - In _hotshot.c: fix broken logic in the logreader object.
217 - In zlibmodule.c: fix for crash on second flush() call.  [SF bug
218   544995]
220 Library
222 - The email package from the Python 2.3 development tree has been
223   backported, including updated documentation.  This version
224   corresponds to email 2.4.1 and should be nearly completely backward
225   compatible.  However there have been lots of improvements in the
226   API, so you should read the section in the library manual about the
227   changes since email v1.
229 - In pydoc.py: Extend stripid() to handle strings ending in more than
230   one '>'; add resolve() to handle looking up objects and names (fix
231   SF bug 586931); add a nicer error message when given a filename that
232   doesn't exist.  Pretend that the docstring for non-callable objects
233   is always None; this makes for less confusing output and fixes the
234   problem reported in SF patch 550290.  Change the way 'less' is
235   invoked as a browser (on Unix) to make it more robust.
237 - In pickle.py: whichmodule() now skips dummy (None) package entries
238   in sys.modules.  Try the persistent id code *before* calling
239   save_global().
241 - A variety of fixes were applied to the compiler package.
243 - In distutils/: Fix distutils.sysconfig to understand that the
244   running Python is part of the build tree and needs to use the
245   appropriate "shape" of the tree [SF patch 547734].  Prefer rpmbuild
246   over rpm if available [SF patch 619493].   util.convert_path()
247   failed with empty pathname.  [SF bug 574235]
249 - In posixpath.py and user.py: fixed SF bug 555779, "import user
250   doesn't work with CGIs."
252 - In site.py: fixed a problem which triggered when sys.path was empty.
254 - In smtpd.py: print the refused list to the DEBUGSTREAM [SF 515021];
255   removed an embarrassing debug line from smtp_RCPT().
257 - In smtplib.py: fix multiline string in sendmail example [SF patch
258   586999]; handle empty addresses [SF bug 602029].
260 - In urllib.py: treat file://localhost/ as local too (same as file:/
261   and file:///).  [SF bug 607789]
263 - In warnings.py: ignore IOError when writing the message.
265 - In ConfigParser.py: allow internal whitespace in keys [SF bug
266   583248]; use option name transform consistently in has_option() [SF
267   bug 561822]; misc other patches.
269 - In sre_compile.py (the compile() function for the re module):
270   Disable big charsets in UCS-4 builds. [SF bug 599377]
272 - In pre.py (the deprecated, *old* implementation of the re module):
273   fix broken sub() and subn().  [SF bug 570057]
275 - In weakref.py: The WeakKeyDictionary constructor didn't work when a
276   dict arg was given.  [SF patch 564549]
278 - In xml/: various fixes tracking PyXML.
280 - In urllib2.py: fix proxy config with user+pass authentication.  [SF
281   patch 527518]
283 - In pdb.py: Increase the maxstring value of _saferepr.  Add exit as
284   an alias for quit [SF bug 543674].  Fix crash on input line
285   consisting of one or more spaces [SF bug 579701].
287 - In test/regrtest.py: added some sys.stdout.flush() calls.
289 - In random.py:
291   - Deprecate (in comment) cunifvariate().  [SF bug 506647]
293   - Loosened the acceptable 'start' and 'stop' arguments to
294     randrange() so that any Python (bounded) ints can be used.  So,
295     e.g., randrange(-sys.maxint-1, sys.maxint) no longer blows up.
296     [SF bug 594996]
298   - The gauss() method uses a piece of hidden state used by nothing
299     else, and the .seed() and .whseed() methods failed to reset it.
300     In other words, setting the seed didn't completely determine the
301     sequence of results produced by random.gauss().  It does now.
302     Programs repeatedly mixing calls to a seed method with calls to
303     gauss() may see different results now.
305   - The randint() method is rehabilitated (i.e. no longer deprecated).
306   
307 -  In copy.py: when an object is copied through its __reduce__ method,
308    there was no check for a __setstate__ method on the result [SF
309    patch 565085]; deepcopy should treat instances of custom
310    metaclasses the same way it treats instances of type 'type' [SF
311    patch 560794].
313 - In turtle.py: update canvas before computing width; draw turtle when
314   done drawing circle.  [SF bug 612595]
316 - In Tkinter.py: Canvas.select_item() now returns the selected item,
317   if any.  [SF patch 581396]
319 - In multifile.py: *backed out* the change that stripped a trailing
320   \r\n.  This caused more problems than it fixed.  [SF bug 514676]
322 - In rexec.py: fixed several security problems.  *This does not mean
323   that rexec is now considered safe!*
325 - In os.py: security fixes for _execvpe().
327 - In gzip.py: open files in binary mode.
329 - In CGIHTTPServer.py: update os.environ regardless of hos it tries to
330   handle calls (fork, popen*, etc.).  Also fixed a flush() of a
331   read-only file (can't do that on MacOS X).
333 - In urllib.py: in splituser(), allow @ in the userinfo field.  This
334   is not allowed by RFC 2396; however, other tools support unescaped
335   @'s so we should also.  [SF patch 596581, bug 581529]
337 - In base64.py: decodestring('') should return '' instead of raising
338   an exception.  [SF bug 595671]
340 - atexit.py: keep working if sys.exitfunc is already set when this is
341   first imported.
343 - In copy.py: Make sure that *any* object whose id() is used as a memo
344   key is kept alive in the memo.  [SF bug 592567]
346 - In httplib.py: fixed a variety of bugs.  The httplib.py in Python
347   2.2.2 is identical to that in the CVS head (at the time of the
348   release of 2.2.2).
350 - In rfc822.py: change the default for Message.get() back to None.
352 - In bdb.py: fix an old bug that made it impossible to continue after
353   hitting a breakpoint while in the bottom frame.
355 - In Queue.py: use try/finally to ensure that all locks are properly
356   released.  [SF bug 544473]
358 - In SocketServer.py: the correct initialization of self.wfile is
359   StringIO.StringIO(), not StringIO.StringIO(self.packet).  [SF bug
360   543318]
362 Build
364 - Various platform-specific problems were fixed, including most open
365   64-bit platform specific issues.
367 - Updated Misc/RPM for Python 2.2.2b1; added Makefile.pre.in to -devel.
369 - The fpectl module is not built by default; it's dangerous or useless
370   except in the hands of experts.  (At the same time, a fix for DEC
371   Alpha under Linux was applied.)
373 - Better check for C++ linkage.  [SF bug 559429]
375 - The errno module needs to be statically linked, since it is now
376   needed during the extension building phase.
378 - A bug was fixed that could cause COUNT_ALLOCS builds to segfault, or
379   get into infinite loops, when a new-style class got garbage-collected.
380   Unfortunately, to avoid this, the way COUNT_ALLOCS works requires
381   that new-style classes be immortal in COUNT_ALLOCS builds.  Note that
382   COUNT_ALLOCS is not enabled by default, in either release or debug
383   builds, and that new-style classes are immortal only in COUNT_ALLOCS
384   builds.  [SF bug 578752]
386 - In order to avoid problems with binutils 2.12 and later, test for
387   --export-dynamic in its help output.
389 C API
391 - New C API PyUnicode_FromOrdinal() which exposes unichr() at C
392   level.
394 Windows
396 - Improve handling of ^C on Windows.  [SF bug 439992]
398 - Provide a fallback version of ntpath.abspath() when the nt module
399   can't be imported.
401 - Fixed asyncore on Windows to avoid calling select() with three empty
402   lists.  Use time.sleep() instead, to match what happens on
403   Unix/Linux in that case.  [SF item 611464]
405 - Fixed selectmodule.c to call WSAGetLastError() to retrieve the error
406   number.
408 - Fixed the test for mmap so that it passes on Windows too.
410 - SF bug 595919:  popenN return only text mode pipes
411   popen2() and popen3() created text-mode pipes even when binary mode
412   was asked for.  This was specific to Windows.
414 - Sometimes the uninstall executable (UNWISE.EXE) vanishes.  One cause
415   of that has been fixed in the installer (disabled Wise's "delete in-
416   use files" uninstall option).
418 Other
420 - Most changes to IDLE were backported, including some featurettes.
421   Open module can now handle hierarchical names for packages (such
422   as xml.dom.minidom).  On Windows, Edit SelectAll is now called
423   with Control-A rather than Alt-A.  The Edit Menu only offers
424   module options (like import module, check module, or run script)
425   in a module window.  Those options no longer appear in the shell
426   window where they did not have meaningful application and was
427   confusing new users.
430 What's New in Python 2.2.1 final?
431 Release date: 10-Apr-2002
432 =================================
434 Core and builtins
436 - Added new builtin function bool() and new builtin constants True and
437   False to ease backporting of code developed for Python 2.3.  In 2.2,
438   bool() returns 1 or 0, True == 1, and False == 0.
440 - Fixed super() to work correctly with class methods.  [SF bug #535444]
442 - Fixed two bugs reported as SF #535905: under certain conditions,
443   deallocating a deeply nested structure could cause a segfault in the
444   garbage collector, due to interaction with the "trashcan" code;
445   access to the current frame during destruction of a local variable
446   could access a pointer to freed memory.
448 Library
450 - The xml.sax.expatreader.ExpatParser class will no longer create
451   circular references by using itself as the locator that gets passed
452   to the content handler implementation.  [SF bug #535474]
454 C API
456 - A type can now inherit its metatype from its base type.  Previously,
457   when PyType_Ready() was called, if ob_type was found to be NULL, it
458   was always set to &PyType_Type; now it is set to base->ob_type,
459   where base is tp_base, defaulting to &PyObject_Type.
461 - PyType_Ready() accidentally did not inherit tp_is_gc; now it does.
463 Windows
465 - Fixed a bug in urllib's proxy handling in Windows.  [SF bug #503031]
467 - The installer now installs Start menu shortcuts under (the local
468   equivalent of) "All Users" when doing an Admin install.
471 What's New in Python 2.2.1c2?
472 Release date: 26-Mar-2002
473 =============================
475 There were a bunch of mostly minor fixes between 2.2.1c1 and 2.2.1c2,
476 including:
478 - I remembered to run autoconf before cutting the release tarball.
480 Core and builtins
482 - The floating point behavior fix-up continued into complex_pow.
484 Library
486 - The email package bug #531966 was fixed.  This caused exceptions to
487   occur when flattening multipart/* messages with zero or one (scalar)
488   attachment.
490 - Support for https: urls in httplib was broken (by the sendall patch
491   mentioned below).
493 - Minor bugs in the calendar module were fixed.
495 - A few minor bugs in pydoc were fixed (better url recognition, proper
496   quoting of some elements).
498 - Some distutils commands didn't list all their "boolean options"
499   which made overriding them from .cfg files not work.
502 What's New in Python 2.2.1c1?
503 Release date: 18-Mar-2002
504 =============================
506 This is primarily a bugfix release.  Many bugs have been fixed since
507 the release of 2.2 final.  Some of the more notable are listed here.
509 Core and builtins
511 - If you try to pickle an instance of a class that has __slots__ but
512   doesn't define or override __getstate__, a TypeError is now raised.
513   This is done by adding a bozo __getstate__ to the class that always
514   raises TypeError.  (Before, this would appear to be pickled, but the
515   state of the slots would be lost.)
517 - (1).__nonzero__() would dump core.
519 - Tim has had another go at getting sensible behaviour with respect to
520   floating point underflow/overflow.
522 - Adding an instance of subclass of int to, say, a string, could
523   erroneously return "NotImplemented" instead of raising a TypeError.
525 - Subclassing longs could cause core dumps in certain circumstances.
527 - PyErr_Display will provide file and line information for all
528   exceptions that have an attribute print_file_and_line, not just
529   SyntaxErrors. This fixes the bug that no proper line number is given
530   for bad \x escapes.
532 - sys.setprofile() and sys.settrace() would dump core if called with
533   no arguments.
535 - An obscure & small memory overrun in wide unicode builds have been
536   fixed.
538 - __doc__ can now be of arbitrary type (in particular, it can be a
539   unicode string).
541 - complex objects are now immutable (as they should always have been).
543 Extension modules
545 - A security hole ("double free") was found in zlib-1.1.3, a popular
546   third party compression library used by some Python modules.  The
547   hole was quickly plugged in zlib-1.1.4, and the Windows build of
548   Python 2.2.1 now ships with zlib-1.1.4.
550 - new.instancemethod no longer fails for new-style classes.
552 - The "pseudo-sequences" returned by os.stat(), os.fstat(),
553   time.localtime() can now be pickled.
555 - Due to a cut and paste error the object exported as
556   posix.statvfs_result was in fact posix.stat_result.
558 Library
560 - The copy module can be used in restricted execution mode.
562 - A few bugs in the email package have been fixed.
564 - StringIO's attitude to unicode strings has been reverted to that of
565   the 2.1.x branch (note cStringIO still knows nothing about unicode).
567 - webbrowser: tightened up the command passed to os.system() so that
568   arbitrary shell code can't be executed because a bogus URL was
569   passed in.
571 - Recursive structures containing new-style classes can now by
572   deep-copied.
574 - ftplib defaults to passive mode (again).
576 Tools
578 - Bugs in IDLE's autoindent when using new-style division were fixed.
581 What's New in Python 2.2 final?
582 Release date: 21-Dec-2001
583 ===============================
585 Type/class unification and new-style classes
587 - pickle.py, cPickle: allow pickling instances of new-style classes
588   with a custom metaclass.
590 Core and builtins
592 - weakref proxy object: when comparing, unwrap both arguments if both
593   are proxies.
595 Extension modules
597 - binascii.b2a_base64(): fix a potential buffer overrun when encoding
598   very short strings.
600 - cPickle: the obscure "fast" mode was suspected of causing stack
601   overflows on the Mac.  Hopefully fixed this by setting the recursion
602   limit much smaller.  If the limit is too low (it only affects
603   performance), you can change it by defining PY_CPICKLE_FAST_LIMIT
604   when compiling cPickle.c (or in pyconfig.h).
606 Library
608 - dumbdbm.py: fixed a dumb old bug (the file didn't get synched at
609   close or delete time).
611 - rfc822.py: fixed a bug where the address '<>' was converted to None
612   instead of an empty string (also fixes the email.Utils module).
614 - xmlrpclib.py: version 1.0.0; uses precision for doubles.
616 - test suite: the pickle and cPickle tests were not executing any code
617   when run from the standard regresssion test.
619 Tools/Demos
621 Build
623 C API
625 New platforms
627 Tests
629 Windows
631 - distutils package: fixed broken Windows installers (bdist_wininst).
633 - tempfile.py: prevent mysterious warnings when TemporaryFileWrapper
634   instances are deleted at process exit time.
636 - socket.py: prevent mysterious warnings when socket instances are
637   deleted at process exit time.
639 - posixmodule.c: fix a Windows crash with stat() of a filename ending
640   in backslash.
644 - The Carbon toolbox modules have been upgraded to Universal Headers
645   3.4, and experimental CoreGraphics and CarbonEvents modules have
646   been added.  All only for framework-enabled MacOSX.
649 What's New in Python 2.2c1?
650 Release date: 14-Dec-2001
651 ===========================
653 Type/class unification and new-style classes
655 - Guido's tutorial introduction to the new type/class features has
656   been extensively updated.  See
658       http://www.python.org/2.2/descrintro.html
660   That remains the primary documentation in this area.
662 - Fixed a leak: instance variables declared with __slots__ were never
663   deleted!
665 - The "delete attribute" method of descriptor objects is called
666   __delete__, not __del__.  In previous releases, it was mistakenly
667   called __del__, which created an unfortunate overloading condition
668   with finalizers.  (The "get attribute" and "set attribute" methods
669   are still called __get__ and __set__, respectively.)
671 - Some subtle issues with the super built-in were fixed:
673   (a) When super itself is subclassed, its __get__ method would still
674       return an instance of the base class (i.e., of super).
676   (b) super(C, C()).__class__ would return C rather than super.  This
677       is confusing.  To fix this, I decided to change the semantics of
678       super so that it only applies to code attributes, not to data
679       attributes.  After all, overriding data attributes is not
680       supported anyway.
682   (c) The __get__ method didn't check whether the argument was an
683       instance of the type used in creation of the super instance.
685 - Previously, hash() of an instance of a subclass of a mutable type
686   (list or dictionary) would return some value, rather than raising
687   TypeError.  This has been fixed.  Also, directly calling
688   dict.__hash__ and list.__hash__ now raises the same TypeError
689   (previously, these were the same as object.__hash__).
691 - New-style objects now support deleting their __dict__.  This is for
692   all intents and purposes equivalent to assigning a brand new empty
693   dictionary, but saves space if the object is not used further.
695 Core and builtins
697 - -Qnew now works as documented in PEP 238:  when -Qnew is passed on
698   the command line, all occurrences of "/" use true division instead
699   of classic division.  See the PEP for details.  Note that "all"
700   means all instances in library and 3rd-party modules, as well as in
701   your own code.  As the PEP says, -Qnew is intended for use only in
702   educational environments with control over the libraries in use.
703   Note that test_coercion.py in the standard Python test suite fails
704   under -Qnew; this is expected, and won't be repaired until true
705   division becomes the default (in the meantime, test_coercion is
706   testing the current rules).
708 - complex() now only allows the first argument to be a string
709   argument, and raises TypeError if either the second arg is a string
710   or if the second arg is specified when the first is a string.
712 Extension modules
714 - gc.get_referents was renamed to gc.get_referrers.
716 Library
718 - Functions in the os.spawn() family now release the global interpreter
719   lock around calling the platform spawn.  They should always have done
720   this, but did not before 2.2c1.  Multithreaded programs calling
721   an os.spawn function with P_WAIT will no longer block all Python threads
722   until the spawned program completes.  It's possible that some programs
723   relies on blocking, although more likely by accident than by design.
725 - webbrowser defaults to netscape.exe on OS/2 now.
727 - Tix.ResizeHandle exposes detach_widget, hide, and show.
729 - The charset alias windows_1252 has been added.
731 - types.StringTypes is a tuple containing the defined string types;
732   usually this will be (str, unicode), but if Python was compiled
733   without Unicode support it will be just (str,).
735 - The pulldom and minidom modules were synchronized to PyXML.
737 Tools/Demos
739 - A new script called Tools/scripts/google.py was added, which fires
740   off a search on Google.
742 Build
744 - Note that release builds of Python should arrange to define the
745   preprocessor symbol NDEBUG on the command line (or equivalent).
746   In the 2.2 pre-release series we tried to define this by magic in
747   Python.h instead, but it proved to cause problems for extension
748   authors.  The Unix, Windows and Mac builds now all define NDEBUG in
749   release builds via cmdline (or equivalent) instead.  Ports to
750   other platforms should do likewise.
752 - It is no longer necessary to use --with-suffix when building on a
753   case-insensitive file system (such as Mac OS X HFS+). In the build
754   directory an extension is used, but not in the installed python.
756 C API
758 - New function PyDict_MergeFromSeq2() exposes the builtin dict
759   constructor's logic for updating a dictionary from an iterable object
760   producing key-value pairs.
762 - PyArg_ParseTupleAndKeywords() requires that the number of entries in
763   the keyword list equal the number of argument specifiers.  This
764   wasn't checked correctly, and PyArg_ParseTupleAndKeywords could even
765   dump core in some bad cases.  This has been repaired.  As a result,
766   PyArg_ParseTupleAndKeywords may raise RuntimeError in bad cases that
767   previously went unchallenged.
769 New platforms
771 Tests
773 Windows
777 - In unix-Python on Mac OS X (and darwin) sys.platform is now "darwin",
778   without any trailing digits.
780 - Changed logic for finding python home in Mac OS X framework Pythons.
781   Now sys.executable points to the executable again, in stead of to
782   the shared library. The latter is used only for locating the python
783   home.
786 What's New in Python 2.2b2?
787 Release date: 16-Nov-2001
788 ===========================
790 Type/class unification and new-style classes
792 - Multiple inheritance mixing new-style and classic classes in the
793   list of base classes is now allowed, so this works now:
795       class Classic: pass
796       class Mixed(Classic, object): pass
798   The MRO (method resolution order) for each base class is respected
799   according to its kind, but the MRO for the derived class is computed
800   using new-style MRO rules if any base clase is a new-style class.
801   This needs to be documented.
803 - The new builtin dictionary() constructor, and dictionary type, have
804   been renamed to dict.  This reflects a decade of common usage.
806 - dict() now accepts an iterable object producing 2-sequences.  For
807   example, dict(d.items()) == d for any dictionary d.  The argument,
808   and the elements of the argument, can be any iterable objects.
810 - New-style classes can now have a __del__ method, which is called
811   when the instance is deleted (just like for classic classes).
813 - Assignment to object.__dict__ is now possible, for objects that are
814   instances of new-style classes that have a __dict__ (unless the base
815   class forbids it).
817 - Methods of built-in types now properly check for keyword arguments
818   (formerly these were silently ignored).  The only built-in methods
819   that take keyword arguments are __call__, __init__ and __new__.
821 - The socket function has been converted to a type; see below.
823 Core and builtins
825 - Assignment to __debug__ raises SyntaxError at compile-time.  This
826   was promised when 2.1c1 was released as "What's New in Python 2.1c1"
827   (see below) says.
829 - Clarified the error messages for unsupported operands to an operator
830   (like 1 + '').
832 Extension modules
834 - mmap has a new keyword argument, "access", allowing a uniform way for
835   both Windows and Unix users to create read-only, write-through and
836   copy-on-write memory mappings.  This was previously possible only on
837   Unix.  A new keyword argument was required to support this in a
838   uniform way because the mmap() signuatures had diverged across
839   platforms.  Thanks to Jay T Miller for repairing this!
841 - By default, the gc.garbage list now contains only those instances in
842   unreachable cycles that have __del__ methods; in 2.1 it contained all
843   instances in unreachable cycles.  "Instances" here has been generalized
844   to include instances of both new-style and old-style classes.
846 - The socket module defines a new method for socket objects,
847   sendall().  This is like send() but may make multiple calls to
848   send() until all data has been sent.  Also, the socket function has
849   been converted to a subclassable type, like list and tuple (etc.)
850   before it; socket and SocketType are now the same thing.
852 - Various bugfixes to the curses module.  There is now a test suite
853   for the curses module (you have to run it manually).
855 - binascii.b2a_base64 no longer places an arbitrary restriction of 57
856   bytes on its input.
858 Library
860 - tkFileDialog exposes a Directory class and askdirectory
861   convenience function.
863 - Symbolic group names in regular expressions must be unique.  For
864   example, the regexp r'(?P<abc>)(?P<abc>)' is not allowed, because a
865   single name can't mean both "group 1" and "group 2" simultaneously.
866   Python 2.2 detects this error at regexp compilation time;
867   previously, the error went undetected, and results were
868   unpredictable.  Also in sre, the pattern.split(), pattern.sub(), and
869   pattern.subn() methods have been rewritten in C.  Also, an
870   experimental function/method finditer() has been added, which works
871   like findall() but returns an iterator.
873 - Tix exposes more commands through the classes DirSelectBox,
874   DirSelectDialog, ListNoteBook, Meter, CheckList, and the
875   methods tix_addbitmapdir, tix_cget, tix_configure, tix_filedialog,
876   tix_getbitmap, tix_getimage, tix_option_get, and tix_resetoptions.
878 - Traceback objects are now scanned by cyclic garbage collection, so
879   cycles created by casual use of sys.exc_info() no longer cause
880   permanent memory leaks (provided garbage collection is enabled).
882 - os.extsep -- a new variable needed by the RISCOS support.  It is the
883   separator used by extensions, and is '.' on all platforms except
884   RISCOS, where it is '/'.  There is no need to use this variable
885   unless you have a masochistic desire to port your code to RISCOS.
887 - mimetypes.py has optional support for non-standard, but commonly
888   found types.  guess_type() and guess_extension() now accept an
889   optional `strict' flag, defaulting to true, which controls whether
890   recognize non-standard types or not.  A few non-standard types we
891   know about have been added.  Also, when run as a script, there are
892   new -l and -e options.
894 - statcache is now deprecated.
896 - email.Utils.formatdate() now produces the preferred RFC 2822 style
897   dates with numeric timezones (it used to produce obsolete dates
898   hard coded to "GMT" timezone).  An optional `localtime' flag is
899   added to produce dates in the local timezone, with daylight savings
900   time properly taken into account.
902 - In pickle and cPickle, instead of masking errors in load() by
903   transforming them into SystemError, we let the original exception
904   propagate out.  Also, implement support for __safe_for_unpickling__
905   in pickle, as it already was supported in cPickle.
907 Tools/Demos
909 Build
911 - The dbm module is built using libdb1 if available.  The bsddb module
912   is built with libdb3 if available.
914 - Misc/Makefile.pre.in has been removed by BDFL pronouncement.
916 C API
918 - New function PySequence_Fast_GET_SIZE() returns the size of a non-
919   NULL result from PySequence_Fast(), more quickly than calling
920   PySequence_Size().
922 - New argument unpacking function PyArg_UnpackTuple() added.
924 - New functions PyObject_CallFunctionObjArgs() and
925   PyObject_CallMethodObjArgs() have been added to make it more
926   convenient and efficient to call functions and methods from C.
928 - PyArg_ParseTupleAndKeywords() no longer masks errors, so it's
929   possible that this will propagate errors it didn't before.
931 - New function PyObject_CheckReadBuffer(), which returns true if its
932   argument supports the single-segment readable buffer interface.
934 New platforms
936 - We've finally confirmed that this release builds on HP-UX 11.00,
937   *with* threads, and passes the test suite.
939 - Thanks to a series of patches from Michael Muller, Python may build
940   again under OS/2 Visual Age C++.
942 - Updated RISCOS port by Dietmar Schwertberger.
944 Tests
946 - Added a test script for the curses module.  It isn't run automatically;
947   regrtest.py must be run with '-u curses' to enable it.
949 Windows
953 - PythonScript has been moved to unsupported and is slated to be
954   removed completely in the next release.
956 - It should now be possible to build applets that work on both OS9 and
957   OSX.
959 - The core is now linked with CoreServices not Carbon; as a side
960   result, default 8bit encoding on OSX is now ASCII.
962 - Python should now build on OSX 10.1.1
965 What's New in Python 2.2b1?
966 Release date: 19-Oct-2001
967 ===========================
969 Type/class unification and new-style classes
971 - New-style classes are now always dynamic (except for built-in and
972   extension types).  There is no longer a performance penalty, and I
973   no longer see another reason to keep this baggage around.  One relic
974   remains: the __dict__ of a new-style class is a read-only proxy; you
975   must set the class's attribute to modify it.  As a consequence, the
976   __defined__ attribute of new-style types no longer exists, for lack
977   of need: there is once again only one __dict__ (although in the
978   future a __cache__ may be resurrected with a similar function, if I
979   can prove that it actually speeds things up).
981 - C.__doc__ now works as expected for new-style classes (in 2.2a4 it
982   always returned None, even when there was a class docstring).
984 - doctest now finds and runs docstrings attached to new-style classes,
985   class methods, static methods, and properties.
987 Core and builtins
989 - A very subtle syntactical pitfall in list comprehensions was fixed.
990   For example: [a+b for a in 'abc', for b in 'def'].  The comma in
991   this example is a mistake.  Previously, this would silently let 'a'
992   iterate over the singleton tuple ('abc',), yielding ['abcd', 'abce',
993   'abcf'] rather than the intended ['ad', 'ae', 'af', 'bd', 'be',
994   'bf', 'cd', 'ce', 'cf'].  Now, this is flagged as a syntax error.
995   Note that [a for a in <singleton>] is a convoluted way to say
996   [<singleton>] anyway, so it's not like any expressiveness is lost.
998 - getattr(obj, name, default) now only catches AttributeError, as
999   documented, rather than returning the default value for all
1000   exceptions (which could mask bugs in a __getattr__ hook, for
1001   example).
1003 - Weak reference objects are now part of the core and offer a C API.
1004   A bug which could allow a core dump when binary operations involved
1005   proxy reference has been fixed.  weakref.ReferenceError is now a
1006   built-in exception.
1008 - unicode(obj) now behaves more like str(obj), accepting arbitrary
1009   objects, and calling a __unicode__ method if it exists.
1010   unicode(obj, encoding) and unicode(obj, encoding, errors) still
1011   require an 8-bit string or character buffer argument.
1013 - isinstance() now allows any object as the first argument and a
1014   class, a type or something with a __bases__ tuple attribute for the
1015   second argument.  The second argument may also be a tuple of a
1016   class, type, or something with __bases__, in which case isinstance()
1017   will return true if the first argument is an instance of any of the
1018   things contained in the second argument tuple.  E.g.
1020   isinstance(x, (A, B))
1022   returns true if x is an instance of A or B.
1024 Extension modules
1026 - thread.start_new_thread() now returns the thread ID (previously None).
1028 - binascii has now two quopri support functions, a2b_qp and b2a_qp.
1030 - readline now supports setting the startup_hook and the
1031   pre_event_hook, and adds the add_history() function.
1033 - os and posix supports chroot(), setgroups() and unsetenv() where
1034   available.  The stat(), fstat(), statvfs() and fstatvfs() functions
1035   now return "pseudo-sequences" -- the various fields can now be
1036   accessed as attributes (e.g. os.stat("/").st_mtime) but for
1037   backwards compatibility they also behave as a fixed-length sequence.
1038   Some platform-specific fields (e.g. st_rdev) are only accessible as
1039   attributes.
1041 - time: localtime(), gmtime() and strptime() now return a
1042   pseudo-sequence similar to the os.stat() return value, with
1043   attributes like tm_year etc.
1045 - Decompression objects in the zlib module now accept an optional
1046   second parameter to decompress() that specifies the maximum amount
1047   of memory to use for the uncompressed data.
1049 - optional SSL support in the socket module now exports OpenSSL
1050   functions RAND_add(), RAND_egd(), and RAND_status().  These calls
1051   are useful on platforms like Solaris where OpenSSL does not
1052   automatically seed its PRNG.  Also, the keyfile and certfile
1053   arguments to socket.ssl() are now optional.
1055 - posixmodule (and by extension, the os module on POSIX platforms) now
1056   exports O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW.
1058 Library
1060 - doctest now excludes functions and classes not defined by the module
1061   being tested, thanks to Tim Hochberg.
1063 - HotShot, a new profiler implemented using a C-based callback, has
1064   been added.  This substantially reduces the overhead of profiling,
1065   but it is still quite preliminary.  Support modules and
1066   documentation will be added in upcoming releases (before 2.2 final).
1068 - profile now produces correct output in situations where an exception
1069   raised in Python is cleared by C code (e.g. hasattr()).  This used
1070   to cause wrong output, including spurious claims of recursive
1071   functions and attribution of time spent to the wrong function.
1073   The code and documentation for the derived OldProfile and HotProfile
1074   profiling classes was removed.  The code hasn't worked for years (if
1075   you tried to use them, they raised exceptions).  OldProfile
1076   intended to reproduce the behavior of the profiler Python used more
1077   than 7 years ago, and isn't interesting anymore.  HotProfile intended
1078   to provide a faster profiler (but producing less information), and
1079   that's a worthy goal we intend to meet via a different approach (but
1080   without losing information).
1082 - Profile.calibrate() has a new implementation that should deliver
1083   a much better system-specific calibration constant.  The constant can
1084   now be specified in an instance constructor, or as a Profile class or
1085   instance variable, instead of by editing profile.py's source code.
1086   Calibration must still be done manually (see the docs for the profile
1087   module).
1089   Note that Profile.calibrate() must be overriden by subclasses.
1090   Improving the accuracy required exploiting detailed knowledge of
1091   profiler internals; the earlier method abstracted away the details
1092   and measured a simplified model instead, but consequently computed
1093   a constant too small by a factor of 2 on some modern machines.
1095 - quopri's encode and decode methods take an optional header parameter,
1096   which indicates whether output is intended for the header 'Q'
1097   encoding.
1099 - The SocketServer.ThreadingMixIn class now closes the request after
1100   finish_request() returns.  (Not when it errors out though.)
1102 - The nntplib module's NNTP.body() method has grown a `file' argument
1103   to allow saving the message body to a file.
1105 - The email package has added a class email.Parser.HeaderParser which
1106   only parses headers and does not recurse into the message's body.
1107   Also, the module/class MIMEAudio has been added for representing
1108   audio data (contributed by Anthony Baxter).
1110 - ftplib should be able to handle files > 2GB.
1112 - ConfigParser.getboolean() now also interprets TRUE, FALSE, YES, NO,
1113   ON, and OFF.
1115 - xml.dom.minidom NodeList objects now support the length attribute
1116   and item() method as required by the DOM specifications.
1118 Tools/Demos
1120 - Demo/dns was removed.  It no longer serves any purpose; a package
1121   derived from it is now maintained by Anthony Baxter, see
1122   http://PyDNS.SourceForge.net.
1124 - The freeze tool has been made more robust, and two new options have
1125   been added: -X and -E.
1127 Build
1129 - configure will use CXX in LINKCC if CXX is used to build main() and
1130   the system requires to link a C++ main using the C++ compiler.
1132 C API
1134 - The documentation for the tp_compare slot is updated to require that
1135   the return value must be -1, 0, 1; an arbitrary number <0 or >0 is
1136   not correct.  This is not yet enforced but will be enforced in
1137   Python 2.3; even later, we may use -2 to indicate errors and +2 for
1138   "NotImplemented".  Right now, -1 should be used for an error return.
1140 - PyLong_AsLongLong() now accepts int (as well as long) arguments.
1141   Consequently, PyArg_ParseTuple's 'L' code also accepts int (as well
1142   as long) arguments.
1144 - PyThread_start_new_thread() now returns a long int giving the thread
1145   ID, if one can be calculated; it returns -1 for error, 0 if no
1146   thread ID is calculated (this is an incompatible change, but only
1147   the thread module used this API).  This code has only really been
1148   tested on Linux and Windows; other platforms please beware (and
1149   report any bugs or strange behavior).
1151 - PyUnicode_FromEncodedObject() no longer accepts Unicode objects as
1152   input.
1154 New platforms
1156 Tests
1158 Windows
1160 - Installer:  If you install IDLE, and don't disable file-extension
1161   registration, a new "Edit with IDLE" context (right-click) menu entry
1162   is created for .py and .pyw files.
1164 - The signal module now supports SIGBREAK on Windows, thanks to Steven
1165   Scott.  Note that SIGBREAK is unique to Windows.  The default SIGBREAK
1166   action remains to call Win32 ExitProcess().  This can be changed via
1167   signal.signal().  For example:
1169   # Make Ctrl+Break raise KeyboardInterrupt, like Python's default Ctrl+C
1170   # (SIGINT) behavior.
1171   import signal
1172   signal.signal(signal.SIGBREAK,
1173                 signal.default_int_handler)
1175   try:
1176       while 1:
1177           pass
1178   except KeyboardInterrupt:
1179       # We get here on Ctrl+C or Ctrl+Break now; if we had not changed
1180       # SIGBREAK, only on Ctrl+C (and Ctrl+Break would terminate the
1181       # program without the possibility for any Python-level cleanup).
1182       print "Clean exit"
1185 What's New in Python 2.2a4?
1186 Release date: 28-Sep-2001
1187 ===========================
1189 Type/class unification and new-style classes
1191 - pydoc and inspect are now aware of new-style classes;
1192   e.g. help(list) at the interactive prompt now shows proper
1193   documentation for all operations on list objects.
1195 - Applications using Jim Fulton's ExtensionClass module can now safely
1196   be used with Python 2.2.  In particular, Zope 2.4.1 now works with
1197   Python 2.2 (as well as with Python 2.1.1).  The Demo/metaclass
1198   examples also work again.  It is hoped that Gtk and Boost also work
1199   with 2.2a4 and beyond.  (If you can confirm this, please write
1200   webmaster@python.org; if there are still problems, please open a bug
1201   report on SourceForge.)
1203 - property() now takes 4 keyword arguments:  fget, fset, fdel and doc.
1204   These map to readonly attributes 'fget', 'fset', 'fdel', and '__doc__'
1205   in the constructed property object.  fget, fset and fdel weren't
1206   discoverable from Python in 2.2a3.  __doc__ is new, and allows to
1207   associate a docstring with a property.
1209 - Comparison overloading is now more completely implemented.  For
1210   example, a str subclass instance can properly be compared to a str
1211   instance, and it can properly overload comparison.  Ditto for most
1212   other built-in object types.
1214 - The repr() of new-style classes has changed; instead of <type
1215   'M.Foo'> a new-style class is now rendered as <class 'M.Foo'>,
1216   *except* for built-in types, which are still rendered as <type
1217   'Foo'> (to avoid upsetting existing code that might parse or
1218   otherwise rely on repr() of certain type objects).
1220 - The repr() of new-style objects is now always <Foo object at XXX>;
1221   previously, it was sometimes <Foo instance at XXX>.
1223 - For new-style classes, what was previously called __getattr__ is now
1224   called __getattribute__.  This method, if defined, is called for
1225   *every* attribute access.  A new __getattr__ hook more similar to the
1226   one in classic classes is defined which is called only if regular
1227   attribute access raises AttributeError; to catch *all* attribute
1228   access, you can use __getattribute__ (for new-style classes).  If
1229   both are defined, __getattribute__ is called first, and if it raises
1230   AttributeError, __getattr__ is called.
1232 - The __class__ attribute of new-style objects can be assigned to.
1233   The new class must have the same C-level object layout as the old
1234   class.
1236 - The builtin file type can be subclassed now.  In the usual pattern,
1237   "file" is the name of the builtin type, and file() is a new builtin
1238   constructor, with the same signature as the builtin open() function.
1239   file() is now the preferred way to open a file.
1241 - Previously, __new__ would only see sequential arguments passed to
1242   the type in a constructor call; __init__ would see both sequential
1243   and keyword arguments.  This made no sense whatsoever any more, so
1244   now both __new__ and __init__ see all arguments.
1246 - Previously, hash() applied to an instance of a subclass of str or
1247   unicode always returned 0.  This has been repaired.
1249 - Previously, an operation on an instance of a subclass of an
1250   immutable type (int, long, float, complex, tuple, str, unicode),
1251   where the subtype didn't override the operation (and so the
1252   operation was handled by the builtin type), could return that
1253   instance instead a value of the base type.  For example, if s was of
1254   a str sublass type, s[:] returned s as-is.  Now it returns a str
1255   with the same value as s.
1257 - Provisional support for pickling new-style objects has been added.
1259 Core
1261 - file.writelines() now accepts any iterable object producing strings.
1263 - PyUnicode_FromEncodedObject() now works very much like
1264   PyObject_Str(obj) in that it tries to use __str__/tp_str
1265   on the object if the object is not a string or buffer. This
1266   makes unicode() behave like str() when applied to non-string/buffer
1267   objects.
1269 - PyFile_WriteObject now passes Unicode objects to the file's write
1270   method. As a result, all file-like objects which may be the target
1271   of a print statement must support Unicode objects, i.e. they must
1272   at least convert them into ASCII strings.
1274 - Thread scheduling on Solaris should be improved; it is no longer
1275   necessary to insert a small sleep at the start of a thread in order
1276   to let other runnable threads be scheduled.
1278 Library
1280 - StringIO.StringIO instances and cStringIO.StringIO instances support
1281   read character buffer compatible objects for their .write() methods.
1282   These objects are converted to strings and then handled as such
1283   by the instances.
1285 - The "email" package has been added.  This is basically a port of the
1286   mimelib package <http://sf.net/projects/mimelib> with API changes
1287   and some implementations updated to use iterators and generators.
1289 - difflib.ndiff() and difflib.Differ.compare() are generators now.  This
1290   restores the ability of Tools/scripts/ndiff.py to start producing output
1291   before the entire comparison is complete.
1293 - StringIO.StringIO instances and cStringIO.StringIO instances support
1294   iteration just like file objects (i.e. their .readline() method is
1295   called for each iteration until it returns an empty string).
1297 - The codecs module has grown four new helper APIs to access
1298   builtin codecs: getencoder(), getdecoder(), getreader(),
1299   getwriter().
1301 - SimpleXMLRPCServer: a new module (based upon SimpleHTMLServer)
1302   simplifies writing XML RPC servers.
1304 - os.path.realpath(): a new function that returns the absolute pathname
1305   after interpretation of symbolic links.  On non-Unix systems, this
1306   is an alias for os.path.abspath().
1308 - operator.indexOf() (PySequence_Index() in the C API) now works with any
1309   iterable object.
1311 - smtplib now supports various authentication and security features of
1312   the SMTP protocol through the new login() and starttls() methods.
1314 - hmac: a new module implementing keyed hashing for message
1315   authentication.
1317 - mimetypes now recognizes more extensions and file types.  At the
1318   same time, some mappings not sanctioned by IANA were removed.
1320 - The "compiler" package has been brought up to date to the state of
1321   Python 2.2 bytecode generation.  It has also been promoted from a
1322   Tool to a standard library package.  (Tools/compiler still exists as
1323   a sample driver.)
1325 Tools
1327 Build
1329 - Large file support (LFS) is now automatic when the platform supports
1330   it; no more manual configuration tweaks are needed.  On Linux, at
1331   least, it's possible to have a system whose C library supports large
1332   files but whose kernel doesn't; in this case, large file support is
1333   still enabled but doesn't do you any good unless you upgrade your
1334   kernel or share your Python executable with another system whose
1335   kernel has large file support.
1337 - The configure script now supplies plausible defaults in a
1338   cross-compilation environment.  This doesn't mean that the supplied
1339   values are always correct, or that cross-compilation now works
1340   flawlessly -- but it's a first step (and it shuts up most of
1341   autoconf's warnings about AC_TRY_RUN).
1343 - The Unix build is now a bit less chatty, courtesy of the parser
1344   generator.  The build is completely silent (except for errors) when
1345   using "make -s", thanks to a -q option to setup.py.
1347 C API
1349 - The "structmember" API now supports some new flag bits to deny read
1350   and/or write access to attributes in restricted execution mode.
1352 New platforms
1354 - Compaq's iPAQ handheld, running the "familiar" Linux distribution
1355   (http://familiar.handhelds.org).
1357 Tests
1359 - The "classic" standard tests, which work by comparing stdout to
1360   an expected-output file under Lib/test/output/, no longer stop at
1361   the first mismatch.  Instead the test is run to completion, and a
1362   variant of ndiff-style comparison is used to report all differences.
1363   This is much easier to understand than the previous style of reporting.
1365 - The unittest-based standard tests now use regrtest's test_main()
1366   convention, instead of running as a side-effect of merely being
1367   imported.  This allows these tests to be run in more natural and
1368   flexible ways as unittests, outside the regrtest framework.
1370 - regrtest.py is much better integrated with unittest and doctest now,
1371   especially in regard to reporting errors.
1373 Windows
1375 - Large file support now also works for files > 4GB, on filesystems
1376   that support it (NTFS under Windows 2000).  See "What's New in
1377   Python 2.2a3" for more detail.
1380 What's New in Python 2.2a3?
1381 Release Date: 07-Sep-2001
1382 ===========================
1384 Core
1386 - Conversion of long to float now raises OverflowError if the long is too
1387   big to represent as a C double.
1389 - The 3-argument builtin pow() no longer allows a third non-None argument
1390   if either of the first two arguments is a float, or if both are of
1391   integer types and the second argument is negative (in which latter case
1392   the arguments are converted to float, so this is really the same
1393   restriction).
1395 - The builtin dir() now returns more information, and sometimes much
1396   more, generally naming all attributes of an object, and all attributes
1397   reachable from the object via its class, and from its class's base
1398   classes, and so on from them too.  Example:  in 2.2a2, dir([]) returned
1399   an empty list.  In 2.2a3,
1401   >>> dir([])
1402   ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
1403    '__eq__', '__ge__', '__getattr__', '__getitem__', '__getslice__',
1404    '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__le__',
1405    '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__repr__',
1406    '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__',
1407    'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
1408    'reverse', 'sort']
1410   dir(module) continues to return only the module's attributes, though.
1412 - Overflowing operations on plain ints now return a long int rather
1413   than raising OverflowError.  This is a partial implementation of PEP
1414   237.  You can use -Wdefault::OverflowWarning to enable a warning for
1415   this situation, and -Werror::OverflowWarning to revert to the old
1416   OverflowError exception.
1418 - A new command line option, -Q<arg>, is added to control run-time
1419   warnings for the use of classic division.  (See PEP 238.)  Possible
1420   values are -Qold, -Qwarn, -Qwarnall, and -Qnew.  The default is
1421   -Qold, meaning the / operator has its classic meaning and no
1422   warnings are issued.  Using -Qwarn issues a run-time warning about
1423   all uses of classic division for int and long arguments; -Qwarnall
1424   also warns about classic division for float and complex arguments
1425   (for use with fixdiv.py).
1426   [Note:  the remainder of this paragraph (preserved below) became
1427    obsolete in 2.2c1 -- -Qnew has global effect in 2.2]
1428   <obsolete>
1429   Using -Qnew is questionable; it turns on new division by default, but
1430   only in the __main__ module.  You can usefully combine -Qwarn or
1431   -Qwarnall and -Qnew: this gives the __main__ module new division, and
1432   warns about classic division everywhere else.
1433   </obsolete>
1435 - Many built-in types can now be subclassed.  This applies to int,
1436   long, float, str, unicode, and tuple.  (The types complex, list and
1437   dictionary can also be subclassed; this was introduced earlier.)
1438   Note that restrictions apply when subclassing immutable built-in
1439   types: you can only affect the value of the instance by overloading
1440   __new__.  You can add mutable attributes, and the subclass instances
1441   will have a __dict__ attribute, but you cannot change the "value"
1442   (as implemented by the base class) of an immutable subclass instance
1443   once it is created.
1445 - The dictionary constructor now takes an optional argument, a
1446   mapping-like object, and initializes the dictionary from its
1447   (key, value) pairs.
1449 - A new built-in type, super, has been added.  This facilitates making
1450   "cooperative super calls" in a multiple inheritance setting.  For an
1451   explanation, see http://www.python.org/2.2/descrintro.html#cooperation
1453 - A new built-in type, property, has been added.  This enables the
1454   creation of "properties".  These are attributes implemented by
1455   getter and setter functions (or only one of these for read-only or
1456   write-only attributes), without the need to override __getattr__.
1457   See http://www.python.org/2.2/descrintro.html#property
1459 - The syntax of floating-point and imaginary literals has been
1460   liberalized, to allow leading zeroes.  Examples of literals now
1461   legal that were SyntaxErrors before:
1463       00.0    0e3   0100j   07.5   00000000000000000008.
1465 - An old tokenizer bug allowed floating point literals with an incomplete
1466   exponent, such as 1e and 3.1e-.  Such literals now raise SyntaxError.
1468 Library
1470 - telnetlib includes symbolic names for the options, and support for
1471   setting an option negotiation callback.
1473 - The new C standard no longer requires that math libraries set errno to
1474   ERANGE on overflow.  For platform libraries that exploit this new
1475   freedom, Python's overflow-checking was wholly broken.  A new overflow-
1476   checking scheme attempts to repair that, but may not be reliable on all
1477   platforms (C doesn't seem to provide anything both useful and portable
1478   in this area anymore).
1480 - Asynchronous timeout actions are available through the new class
1481   threading.Timer.
1483 - math.log and math.log10 now return sensible results for even huge
1484   long arguments.  For example, math.log10(10 ** 10000) ~= 10000.0.
1486 - A new function, imp.lock_held(), returns 1 when the import lock is
1487   currently held.  See the docs for the imp module.
1489 - pickle, cPickle and marshal on 32-bit platforms can now correctly read
1490   dumps containing ints written on platforms where Python ints are 8 bytes.
1491   When read on a box where Python ints are 4 bytes, such values are
1492   converted to Python longs.
1494 - In restricted execution mode (using the rexec module), unmarshalling
1495   code objects is no longer allowed.  This plugs a security hole.
1497 - unittest.TestResult instances no longer store references to tracebacks
1498   generated by test failures. This prevents unexpected dangling references
1499   to objects that should be garbage collected between tests.
1501 Tools
1503 - Tools/scripts/fixdiv.py has been added which can be used to fix
1504   division operators as per PEP 238.
1506 Build
1508 - If you are an adventurous person using Mac OS X you may want to look at
1509   Mac/OSX. There is a Makefile there that will build Python as a real Mac
1510   application, which can be used for experimenting with Carbon or Cocoa.
1511   Discussion of this on pythonmac-sig, please.
1513 C API
1515 - New function PyObject_Dir(obj), like Python __builtin__.dir(obj).
1517 - Note that PyLong_AsDouble can fail!  This has always been true, but no
1518   callers checked for it.  It's more likely to fail now, because overflow
1519   errors are properly detected now.  The proper way to check:
1521   double x = PyLong_AsDouble(some_long_object);
1522   if (x == -1.0 && PyErr_Occurred()) {
1523           /* The conversion failed. */
1524   }
1526 - The GC API has been changed.  Extensions that use the old API will still
1527   compile but will not participate in GC.  To upgrade an extension
1528   module:
1530     - rename Py_TPFLAGS_GC to PyTPFLAGS_HAVE_GC
1532     - use PyObject_GC_New or PyObject_GC_NewVar to allocate objects and
1533       PyObject_GC_Del to deallocate them
1535     - rename PyObject_GC_Init to PyObject_GC_Track and PyObject_GC_Fini
1536       to PyObject_GC_UnTrack
1538     - remove PyGC_HEAD_SIZE from object size calculations
1540     - remove calls to PyObject_AS_GC and PyObject_FROM_GC
1542 - Two new functions: PyString_FromFormat() and PyString_FromFormatV().
1543   These can be used safely to construct string objects from a
1544   sprintf-style format string (similar to the format string supported
1545   by PyErr_Format()).
1547 New platforms
1549 - Stephen Hansen contributed patches sufficient to get a clean compile
1550   under Borland C (Windows), but he reports problems running it and ran
1551   out of time to complete the port.  Volunteers?  Expect a MemoryError
1552   when importing the types module; this is probably shallow, and
1553   causing later failures too.
1555 Tests
1557 Windows
1559 - Large file support is now enabled on Win32 platforms as well as on
1560   Win64.  This means that, for example, you can use f.tell() and f.seek()
1561   to manipulate files larger than 2 gigabytes (provided you have enough
1562   disk space, and are using a Windows filesystem that supports large
1563   partitions).  Windows filesystem limits:  FAT has a 2GB (gigabyte)
1564   filesize limit, and large file support makes no difference there.
1565   FAT32's limit is 4GB, and files >= 2GB are easier to use from Python now.
1566   NTFS has no practical limit on file size, and files of any size can be
1567   used from Python now.
1569 - The w9xpopen hack is now used on Windows NT and 2000 too when COMPSPEC
1570   points to command.com (patch from Brian Quinlan).
1573 What's New in Python 2.2a2?
1574 Release Date: 22-Aug-2001
1575 ===========================
1577 Build
1579 - Tim Peters developed a brand new Windows installer using Wise 8.1,
1580   generously donated to us by Wise Solutions.
1582 - configure supports a new option --enable-unicode, with the values
1583   ucs2 and ucs4 (new in 2.2a1). With --disable-unicode, the Unicode
1584   type and supporting code is completely removed from the interpreter.
1586 - A new configure option --enable-framework builds a Mac OS X framework,
1587   which "make frameworkinstall" will install. This provides a starting
1588   point for more mac-like functionality, join pythonmac-sig@python.org
1589   if you are interested in helping.
1591 - The NeXT platform is no longer supported.
1593 - The `new' module is now statically linked.
1595 Tools
1597 - The new Tools/scripts/cleanfuture.py can be used to automatically
1598   edit out obsolete future statements from Python source code.  See
1599   the module docstring for details.
1601 Tests
1603 - regrtest.py now knows which tests are expected to be skipped on some
1604   platforms, allowing to give clearer test result output.  regrtest
1605   also has optional --use/-u switch to run normally disabled tests
1606   which require network access or consume significant disk resources.
1608 - Several new tests in the standard test suite, with special thanks to
1609   Nick Mathewson.
1611 Core
1613 - The floor division operator // has been added as outlined in PEP
1614   238.  The / operator still provides classic division (and will until
1615   Python 3.0) unless "from __future__ import division" is included, in
1616   which case the / operator will provide true division.  The operator
1617   module provides truediv() and floordiv() functions.  Augmented
1618   assignment variants are included, as are the equivalent overloadable
1619   methods and C API methods.  See the PEP for a full discussion:
1620   <http://python.sf.net/peps/pep-0238.html>
1622 - Future statements are now effective in simulated interactive shells
1623   (like IDLE).  This should "just work" by magic, but read Michael
1624   Hudson's "Future statements in simulated shells" PEP 264 for full
1625   details:  <http://python.sf.net/peps/pep-0264.html>.
1627 - The type/class unification (PEP 252-253) was integrated into the
1628   trunk and is not so tentative any more (the exact specification of
1629   some features is still tentative).  A lot of work has done on fixing
1630   bugs and adding robustness and features (performance still has to
1631   come a long way).
1633 - Warnings about a mismatch in the Python API during extension import
1634   now use the Python warning framework (which makes it possible to
1635   write filters for these warnings).
1637 - A function's __dict__ (aka func_dict) will now always be a
1638   dictionary.  It used to be possible to delete it or set it to None,
1639   but now both actions raise TypeErrors.  It is still legal to set it
1640   to a dictionary object.  Getting func.__dict__ before any attributes
1641   have been assigned now returns an empty dictionary instead of None.
1643 - A new command line option, -E, was added which disables the use of
1644   all environment variables, or at least those that are specifically
1645   significant to Python.  Usually those have a name starting with
1646   "PYTHON".  This was used to fix a problem where the tests fail if
1647   the user happens to have PYTHONHOME or PYTHONPATH pointing to an
1648   older distribution.
1650 Library
1652 - New class Differ and new functions ndiff() and restore() in difflib.py.
1653   These package the algorithms used by the popular Tools/scripts/ndiff.py,
1654   for programmatic reuse.
1656 - New function xml.sax.saxutils.quoteattr():  Quote an XML attribute
1657   value using the minimal quoting required for the value; more
1658   reliable than using xml.sax.saxutils.escape() for attribute values.
1660 - Readline completion support for cmd.Cmd was added.
1662 - Calling os.tempnam() or os.tmpnam() generate RuntimeWarnings.
1664 - Added function threading.BoundedSemaphore()
1666 - Added Ka-Ping Yee's cgitb.py module.
1668 - The `new' module now exposes the CO_xxx flags.
1670 - The gc module offers the get_referents function.
1672 New platforms
1674 C API
1676 - Two new APIs PyOS_snprintf() and PyOS_vsnprintf() were added
1677   which provide a cross-platform implementations for the
1678   relatively new snprintf()/vsnprintf() C lib APIs. In contrast to
1679   the standard sprintf() and vsprintf() C lib APIs, these versions
1680   apply bounds checking on the used buffer which enhances protection
1681   against buffer overruns.
1683 - Unicode APIs now use name mangling to assure that mixing interpreters
1684   and extensions using different Unicode widths is rendered next to
1685   impossible. Trying to import an incompatible Unicode-aware extension
1686   will result in an ImportError.  Unicode extensions writers must make
1687   sure to check the Unicode width compatibility in their extensions by
1688   using at least one of the mangled Unicode APIs in the extension.
1690 - Two new flags METH_NOARGS and METH_O are available in method definition
1691   tables to simplify implementation of methods with no arguments and a
1692   single untyped argument. Calling such methods is more efficient than
1693   calling corresponding METH_VARARGS methods. METH_OLDARGS is now
1694   deprecated.
1696 Windows
1698 - "import module" now compiles module.pyw if it exists and nothing else
1699   relevant is found.
1702 What's New in Python 2.2a1?
1703 Release date: 18-Jul-2001
1704 ===========================
1706 Core
1708 - TENTATIVELY, a large amount of code implementing much of what's
1709   described in PEP 252 (Making Types Look More Like Classes) and PEP
1710   253 (Subtyping Built-in Types) was added.  This will be released
1711   with Python 2.2a1.  Documentation will be provided separately
1712   through http://www.python.org/2.2/.  The purpose of releasing this
1713   with Python 2.2a1 is to test backwards compatibility.  It is
1714   possible, though not likely, that a decision is made not to release
1715   this code as part of 2.2 final, if any serious backwards
1716   incompapatibilities are found during alpha testing that cannot be
1717   repaired.
1719 - Generators were added; this is a new way to create an iterator (see
1720   below) using what looks like a simple function containing one or
1721   more 'yield' statements.  See PEP 255.  Since this adds a new
1722   keyword to the language, this feature must be enabled by including a
1723   future statement: "from __future__ import generators" (see PEP 236).
1724   Generators will become a standard feature in a future release
1725   (probably 2.3).  Without this future statement, 'yield' remains an
1726   ordinary identifier, but a warning is issued each time it is used.
1727   (These warnings currently don't conform to the warnings framework of
1728   PEP 230; we intend to fix this in 2.2a2.)
1730 - The UTF-16 codec was modified to be more RFC compliant. It will now
1731   only remove BOM characters at the start of the string and then
1732   only if running in native mode (UTF-16-LE and -BE won't remove a
1733   leading BMO character).
1735 - Strings now have a new method .decode() to complement the already
1736   existing .encode() method. These two methods provide direct access
1737   to the corresponding decoders and encoders of the registered codecs.
1739   To enhance the usability of the .encode() method, the special
1740   casing of Unicode object return values was dropped (Unicode objects
1741   were auto-magically converted to string using the default encoding).
1743   Both methods will now return whatever the codec in charge of the
1744   requested encoding returns as object, e.g. Unicode codecs will
1745   return Unicode objects when decoding is requested ("äöü".decode("latin-1")
1746   will return u"äöü"). This enables codec writer to create codecs
1747   for various simple to use conversions.
1749   New codecs were added to demonstrate these new features (the .encode()
1750   and .decode() columns indicate the type of the returned objects):
1752   Name     | .encode() | .decode() | Description
1753   ----------------------------------------------------------------------
1754   uu       | string    | string    | UU codec (e.g. for email)
1755   base64   | string    | string    | base64 codec
1756   quopri   | string    | string    | quoted-printable codec
1757   zlib     | string    | string    | zlib compression
1758   hex      | string    | string    | 2-byte hex codec
1759   rot-13   | string    | Unicode   | ROT-13 Unicode charmap codec
1761 - Some operating systems now support the concept of a default Unicode
1762   encoding for file system operations.  Notably, Windows supports 'mbcs'
1763   as the default.  The Macintosh will also adopt this concept in the medium
1764   term, although the default encoding for that platform will be other than
1765   'mbcs'.
1767   On operating system that support non-ASCII filenames, it is common for
1768   functions that return filenames (such as os.listdir()) to return Python
1769   string objects pre-encoded using the default file system encoding for
1770   the platform.  As this encoding is likely to be different from Python's
1771   default encoding, converting this name to a Unicode object before passing
1772   it back to the Operating System would result in a Unicode error, as Python
1773   would attempt to use its default encoding (generally ASCII) rather than
1774   the default encoding for the file system.
1776   In general, this change simply removes surprises when working with
1777   Unicode and the file system, making these operations work as you expect,
1778   increasing the transparency of Unicode objects in this context.
1779   See [????] for more details, including examples.
1781 - Float (and complex) literals in source code were evaluated to full
1782   precision only when running from a .py file; the same code loaded from a
1783   .pyc (or .pyo) file could suffer numeric differences starting at about the
1784   12th significant decimal digit.  For example, on a machine with IEEE-754
1785   floating arithmetic,
1787       x = 9007199254740992.0
1788       print long(x)
1790   printed 9007199254740992 if run directly from .py, but 9007199254740000
1791   if from a compiled (.pyc or .pyo) file.  This was due to marshal using
1792   str(float) instead of repr(float) when building code objects.  marshal
1793   now uses repr(float) instead, which should reproduce floats to full
1794   machine precision (assuming the platform C float<->string I/O conversion
1795   functions are of good quality).
1797   This may cause floating-point results to change in some cases, and
1798   usually for the better, but may also cause numerically unstable
1799   algorithms to break.
1801 - The implementation of dicts suffers fewer collisions, which has speed
1802   benefits.  However, the order in which dict entries appear in dict.keys(),
1803   dict.values() and dict.items() may differ from previous releases for a
1804   given dict.  Nothing is defined about this order, so no program should
1805   rely on it.  Nevertheless, it's easy to write test cases that rely on the
1806   order by accident, typically because of printing the str() or repr() of a
1807   dict to an "expected results" file.  See Lib/test/test_support.py's new
1808   sortdict(dict) function for a simple way to display a dict in sorted
1809   order.
1811 - Many other small changes to dicts were made, resulting in faster
1812   operation along the most common code paths.
1814 - Dictionary objects now support the "in" operator: "x in dict" means
1815   the same as dict.has_key(x).
1817 - The update() method of dictionaries now accepts generic mapping
1818   objects.  Specifically the argument object must support the .keys()
1819   and __getitem__() methods.  This allows you to say, for example,
1820   {}.update(UserDict())
1822 - Iterators were added; this is a generalized way of providing values
1823   to a for loop.  See PEP 234.  There's a new built-in function iter()
1824   to return an iterator.  There's a new protocol to get the next value
1825   from an iterator using the next() method (in Python) or the
1826   tp_iternext slot (in C).  There's a new protocol to get iterators
1827   using the __iter__() method (in Python) or the tp_iter slot (in C).
1828   Iterating (i.e. a for loop) over a dictionary generates its keys.
1829   Iterating over a file generates its lines.
1831 - The following functions were generalized to work nicely with iterator
1832   arguments:
1833     map(), filter(), reduce(), zip()
1834     list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API)
1835     max(), min()
1836     join() method of strings
1837     extend() method of lists
1838     'x in y' and 'x not in y' (PySequence_Contains() in C API)
1839     operator.countOf() (PySequence_Count() in C API)
1840     right-hand side of assignment statements with multiple targets, such as
1841         x, y, z = some_iterable_object_returning_exactly_3_values
1843 - Accessing module attributes is significantly faster (for example,
1844   random.random or os.path or yourPythonModule.yourAttribute).
1846 - Comparing dictionary objects via == and != is faster, and now works even
1847   if the keys and values don't support comparisons other than ==.
1849 - Comparing dictionaries in ways other than == and != is slower:  there were
1850   insecurities in the dict comparison implementation that could cause Python
1851   to crash if the element comparison routines for the dict keys and/or
1852   values mutated the dicts.  Making the code bulletproof slowed it down.
1854 - Collisions in dicts are resolved via a new approach, which can help
1855   dramatically in bad cases.  For example, looking up every key in a dict
1856   d with d.keys() == [i << 16 for i in range(20000)] is approximately 500x
1857   faster now.  Thanks to Christian Tismer for pointing out the cause and
1858   the nature of an effective cure (last December! better late than never).
1860 - repr() is much faster for large containers (dict, list, tuple).
1863 Library
1865 - The constants ascii_letters, ascii_lowercase. and ascii_uppercase
1866   were added to the string module.  These a locale-indenpendent
1867   constants, unlike letters, lowercase, and uppercase.  These are now
1868   use in appropriate locations in the standard library.
1870 - The flags used in dlopen calls can now be configured using
1871   sys.setdlopenflags and queried using sys.getdlopenflags.
1873 - Fredrik Lundh's xmlrpclib is now a standard library module.  This
1874   provides full client-side XML-RPC support.  In addition,
1875   Demo/xmlrpc/ contains two server frameworks (one SocketServer-based,
1876   one asyncore-based).  Thanks to Eric Raymond for the documentation.
1878 - The xrange() object is simplified: it no longer supports slicing,
1879   repetition, comparisons, efficient 'in' checking, the tolist()
1880   method, or the start, stop and step attributes.  See PEP 260.
1882 - A new function fnmatch.filter to filter lists of file names was added.
1884 - calendar.py uses month and day names based on the current locale.
1886 - strop is now *really* obsolete (this was announced before with 1.6),
1887   and issues DeprecationWarning when used (except for the four items
1888   that are still imported into string.py).
1890 - Cookie.py now sorts key+value pairs by key in output strings.
1892 - pprint.isrecursive(object) didn't correctly identify recursive objects.
1893   Now it does.
1895 - pprint functions now much faster for large containers (tuple, list, dict).
1897 - New 'q' and 'Q' format codes in the struct module, corresponding to C
1898   types "long long" and "unsigned long long" (on Windows, __int64).  In
1899   native mode, these can be used only when the platform C compiler supports
1900   these types (when HAVE_LONG_LONG is #define'd by the Python config
1901   process), and then they inherit the sizes and alignments of the C types.
1902   In standard mode, 'q' and 'Q' are supported on all platforms, and are
1903   8-byte integral types.
1905 - The site module installs a new built-in function 'help' that invokes
1906   pydoc.help.  It must be invoked as 'help()'; when invoked as 'help',
1907   it displays a message reminding the user to use 'help()' or
1908   'help(object)'.
1910 Tests
1912 - New test_mutants.py runs dict comparisons where the key and value
1913   comparison operators mutute the dicts randomly during comparison.  This
1914   rapidly causes Python to crash under earlier releases (not for the faint
1915   of heart:  it can also cause Win9x to freeze or reboot!).
1917 - New test_pprint.py verfies that pprint.isrecursive() and
1918   pprint.isreadable() return sensible results.  Also verifies that simple
1919   cases produce correct output.
1921 C API
1923 - Removed the unused last_is_sticky argument from the internal
1924   _PyTuple_Resize().  If this affects you, you were cheating.
1927 ======================================================================
1930 What's New in Python 2.1 (final)?
1931 =================================
1933 We only changed a few things since the last release candidate, all in
1934 Python library code:
1936 - A bug in the locale module was fixed that affected locales which
1937   define no grouping for numeric formatting.
1939 - A few bugs in the weakref module's implementations of weak
1940   dictionaries (WeakValueDictionary and WeakKeyDictionary) were fixed,
1941   and the test suite was updated to check for these bugs.
1943 - An old bug in the os.path.walk() function (introduced in Python
1944   2.0!) was fixed: a non-existent file would cause an exception
1945   instead of being ignored.
1947 - Fixed a few bugs in the new symtable module found by Neil Norwitz's
1948   PyChecker.
1951 What's New in Python 2.1c2?
1952 ===========================
1954 A flurry of small changes, and one showstopper fixed in the nick of
1955 time made it necessary to release another release candidate.  The list
1956 here is the *complete* list of patches (except version updates):
1958 Core
1960 - Tim discovered a nasty bug in the dictionary code, caused by
1961   PyDict_Next() calling dict_resize(), and the GC code's use of
1962   PyDict_Next() violating an assumption in dict_items().  This was
1963   fixed with considerable amounts of band-aid, but the net effect is a
1964   saner and more robust implementation.
1966 - Made a bunch of symbols static that were accidentally global.
1968 Build and Ports
1970 - The setup.py script didn't check for a new enough version of zlib
1971   (1.1.3 is needed).  Now it does.
1973 - Changed "make clean" target to also remove shared libraries.
1975 - Added a more general warning about the SGI Irix optimizer to README.
1977 Library
1979 - Fix a bug in urllib.basejoin("http://host", "../file.html") which
1980   omitted the slash between host and file.html.
1982 - The mailbox module's _Mailbox class contained a completely broken
1983   and undocumented seek() method.  Ripped it out.
1985 - Fixed a bunch of typos in various library modules (urllib2, smtpd,
1986   sgmllib, netrc, chunk) found by Neil Norwitz's PyChecker.
1988 - Fixed a few last-minute bugs in unittest.
1990 Extensions
1992 - Reverted the patch to the OpenSSL code in socketmodule.c to support
1993   RAND_status() and the EGD, and the subsequent patch that tried to
1994   fix it for pre-0.9.5 versions; the problem with the patch is that on
1995   some systems it issues a warning whenever socket is imported, and
1996   that's unacceptable.
1998 Tests
2000 - Fixed the pickle tests to work with "import test.test_pickle".
2002 - Tweaked test_locale.py to actually run the test Windows.
2004 - In distutils/archive_util.py, call zipfile.ZipFile() with mode "w",
2005   not "wb" (which is not a valid mode at all).
2007 - Fix pstats browser crashes.  Import readline if it exists to make
2008   the user interface nicer.
2010 - Add "import thread" to the top of test modules that import the
2011   threading module (test_asynchat and test_threadedtempfile).  This
2012   prevents test failures caused by a broken threading module resulting
2013   from a previously caught failed import.
2015 - Changed test_asynchat.py to set the SO_REUSEADDR option; this was
2016   needed on some platforms (e.g. Solaris 8) when the tests are run
2017   twice in succession.
2019 - Skip rather than fail test_sunaudiodev if no audio device is found.
2022 What's New in Python 2.1c1?
2023 ===========================
2025 This list was significantly updated when 2.1c2 was released; the 2.1c1
2026 release didn't mention most changes that were actually part of 2.1c1:
2028 Legal
2030 - Copyright was assigned to the Python Software Foundation (PSF) and a
2031   PSF license (very similar to the CNRI license) was added.
2033 - The CNRI copyright notice was updated to include 2001.
2035 Core
2037 - After a public outcry, assignment to __debug__ is no longer illegal;
2038   instead, a warning is issued.  It will become illegal in 2.2.
2040 - Fixed a core dump with "%#x" % 0, and changed the semantics so that
2041   "%#x" now always prepends "0x", even if the value is zero.
2043 - Fixed some nits in the bytecode compiler.
2045 - Fixed core dumps when calling certain kinds of non-functions.
2047 - Fixed various core dumps caused by reference count bugs.
2049 Build and Ports
2051 - Use INSTALL_SCRIPT to install script files.
2053 - New port: SCO Unixware 7, by Billy G. Allie.
2055 - Updated RISCOS port.
2057 - Updated BeOS port and notes.
2059 - Various other porting problems resolved.
2061 Library
2063 - The TERMIOS and SOCKET modules are now truly obsolete and
2064   unnecessary.  Their symbols are incorporated in the termios and
2065   socket modules.
2067 - Fixed some 64-bit bugs in pickle, cPickle, and struct, and added
2068   better tests for pickling.
2070 - threading: make Condition.wait() robust against KeyboardInterrupt.
2072 - zipfile: add support to zipfile to support opening an archive
2073   represented by an open file rather than a file name.  Fix bug where
2074   the archive was not properly closed.  Fixed a bug in this bugfix
2075   where flush() was called for a read-only file.
2077 - imputil: added an uninstall() method to the ImportManager.
2079 - Canvas: fixed bugs in lower() and tkraise() methods.
2081 - SocketServer: API change (added overridable close_request() method)
2082   so that the TCP server can explicitly close the request.
2084 - pstats: Eric Raymond added a simple interactive statistics browser,
2085   invoked when the module is run as a script.
2087 - locale: fixed a problem in format().
2089 - webbrowser: made it work when the BROWSER environment variable has a
2090   value like "/usr/bin/netscape".  Made it auto-detect Konqueror for
2091   KDE 2.  Fixed some other nits.
2093 - unittest: changes to allow using a different exception than
2094   AssertionError, and added a few more function aliases.  Some other
2095   small changes.
2097 - urllib, urllib2: fixed redirect problems and a coupleof other nits.
2099 - asynchat: fixed a critical bug in asynchat that slipped through the
2100   2.1b2 release.  Fixed another rare bug.
2102 - Fix some unqualified except: clauses (always a bad code example).
2106 - pyexpat: new API get_version_string().
2108 - Fixed some minidom bugs.
2110 Extensions
2112 - Fixed a core dump in _weakref.  Removed the weakref.mapping()
2113   function (it adds nothing to the API).
2115 - Rationalized the use of header files in the readline module, to make
2116   it compile (albeit with some warnings) with the very recent readline
2117   4.2, without breaking for earlier versions.
2119 - Hopefully fixed a buffering problem in linuxaudiodev.
2121 - Attempted a fix to make the OpenSSL support in the socket module
2122   work again with pre-0.9.5 versions of OpenSSL.
2124 Tests
2126 - Added a test case for asynchat and asyncore.
2128 - Removed coupling between tests where one test failing could break
2129   another.
2131 Tools
2133 - Ping added an interactive help browser to pydoc, fixed some nits
2134   in the rest of the pydoc code, and added some features to his
2135   inspect module.
2137 - An updated python-mode.el version 4.1 which integrates Ken
2138   Manheimer's pdbtrack.el.  This makes debugging Python code via pdb
2139   much nicer in XEmacs and Emacs.  When stepping through your program
2140   with pdb, in either the shell window or the *Python* window, the
2141   source file and line will be tracked by an arrow.  Very cool!
2143 - IDLE: syntax warnings in interactive mode are changed into errors.
2145 - Some improvements to Tools/webchecker (ignore some more URL types,
2146   follow some more links).
2148 - Brought the Tools/compiler package up to date.
2151 What's New in Python 2.1 beta 2?
2152 ================================
2154 (Unlisted are many fixed bugs, more documentation, etc.)
2156 Core language, builtins, and interpreter
2158 - The nested scopes work (enabled by "from __future__ import
2159   nested_scopes") is completed; in particular, the future now extends
2160   into code executed through exec, eval() and execfile(), and into the
2161   interactive interpreter.
2163 - When calling a base class method (e.g. BaseClass.__init__(self)),
2164   this is now allowed even if self is not strictly spoken a class
2165   instance (e.g. when using metaclasses or the Don Beaudry hook).
2167 - Slice objects are now comparable but not hashable; this prevents
2168   dict[:] from being accepted but meaningless.
2170 - Complex division is now calculated using less braindead algorithms.
2171   This doesn't change semantics except it's more likely to give useful
2172   results in extreme cases.  Complex repr() now uses full precision
2173   like float repr().
2175 - sgmllib.py now calls handle_decl() for simple <!...> declarations.
2177 - It is illegal to assign to the name __debug__, which is set when the
2178   interpreter starts.  It is effectively a compile-time constant.
2180 - A warning will be issued if a global statement for a variable
2181   follows a use or assignment of that variable.
2183 Standard library
2185 - unittest.py, a unit testing framework by Steve Purcell (PyUNIT,
2186   inspired by JUnit), is now part of the standard library.  You now
2187   have a choice of two testing frameworks: unittest requires you to
2188   write testcases as separate code, doctest gathers them from
2189   docstrings.  Both approaches have their advantages and
2190   disadvantages.
2192 - A new module Tix was added, which wraps the Tix extension library
2193   for Tk.  With that module, it is not necessary to statically link
2194   Tix with _tkinter, since Tix will be loaded with Tcl's "package
2195   require" command.  See Demo/tix/.
2197 - tzparse.py is now obsolete.
2199 - In gzip.py, the seek() and tell() methods are removed -- they were
2200   non-functional anyway, and it's better if callers can test for their
2201   existence with hasattr().
2203 Python/C API
2205 - PyDict_Next(): it is now safe to call PyDict_SetItem() with a key
2206   that's already in the dictionary during a PyDict_Next() iteration.
2207   This used to fail occasionally when a dictionary resize operation
2208   could be triggered that would rehash all the keys.  All other
2209   modifications to the dictionary are still off-limits during a
2210   PyDict_Next() iteration!
2212 - New extended APIs related to passing compiler variables around.
2214 - New abstract APIs PyObject_IsInstance(), PyObject_IsSubclass()
2215   implement isinstance() and issubclass().
2217 - Py_BuildValue() now has a "D" conversion to create a Python complex
2218   number from a Py_complex C value.
2220 - Extensions types which support weak references must now set the
2221   field allocated for the weak reference machinery to NULL themselves;
2222   this is done to avoid the cost of checking each object for having a
2223   weakly referencable type in PyObject_INIT(), since most types are
2224   not weakly referencable.
2226 - PyFrame_FastToLocals() and PyFrame_LocalsToFast() copy bindings for
2227   free variables and cell variables to and from the frame's f_locals.
2229 - Variants of several functions defined in pythonrun.h have been added
2230   to support the nested_scopes future statement.  The variants all end
2231   in Flags and take an extra argument, a PyCompilerFlags *; examples:
2232   PyRun_AnyFileExFlags(), PyRun_InteractiveLoopFlags().  These
2233   variants may be removed in Python 2.2, when nested scopes are
2234   mandatory.
2236 Distutils
2238 - the sdist command now writes a PKG-INFO file, as described in PEP 241,
2239   into the release tree.
2241 - several enhancements to the bdist_wininst command from Thomas Heller
2242   (an uninstaller, more customization of the installer's display)
2244 - from Jack Jansen: added Mac-specific code to generate a dialog for
2245   users to specify the command-line (because providing a command-line with
2246   MacPython is awkward).  Jack also made various fixes for the Mac
2247   and the Metrowerks compiler.
2249 - added 'platforms' and 'keywords' to the set of metadata that can be
2250   specified for a distribution.
2252 - applied patches from Jason Tishler to make the compiler class work with
2253   Cygwin.
2256 What's New in Python 2.1 beta 1?
2257 ================================
2259 Core language, builtins, and interpreter
2261 - Following an outcry from the community about the amount of code
2262   broken by the nested scopes feature introduced in 2.1a2, we decided
2263   to make this feature optional, and to wait until Python 2.2 (or at
2264   least 6 months) to make it standard.  The option can be enabled on a
2265   per-module basis by adding "from __future__ import nested_scopes" at
2266   the beginning of a module (before any other statements, but after
2267   comments and an optional docstring).  See PEP 236 (Back to the
2268   __future__) for a description of the __future__ statement.  PEP 227
2269   (Statically Nested Scopes) has been updated to reflect this change,
2270   and to clarify the semantics in a number of endcases.
2272 - The nested scopes code, when enabled, has been hardened, and most
2273   bugs and memory leaks in it have been fixed.
2275 - Compile-time warnings are now generated for a number of conditions
2276   that will break or change in meaning when nested scopes are enabled:
2278   - Using "from...import *" or "exec" without in-clause in a function
2279     scope that also defines a lambda or nested function with one or
2280     more free (non-local) variables.  The presence of the import* or
2281     bare exec makes it impossible for the compiler to determine the
2282     exact set of local variables in the outer scope, which makes it
2283     impossible to determine the bindings for free variables in the
2284     inner scope.  To avoid the warning about import *, change it into
2285     an import of explicitly name object, or move the import* statement
2286     to the global scope; to avoid the warning about bare exec, use
2287     exec...in... (a good idea anyway -- there's a possibility that
2288     bare exec will be deprecated in the future).
2290   - Use of a global variable in a nested scope with the same name as a
2291     local variable in a surrounding scope.  This will change in
2292     meaning with nested scopes: the name in the inner scope will
2293     reference the variable in the outer scope rather than the global
2294     of the same name.  To avoid the warning, either rename the outer
2295     variable, or use a global statement in the inner function.
2297 - An optional object allocator has been included.  This allocator is
2298   optimized for Python objects and should be faster and use less memory
2299   than the standard system allocator.  It is not enabled by default
2300   because of possible thread safety problems.  The allocator is only
2301   protected by the Python interpreter lock and it is possible that some
2302   extension modules require a thread safe allocator.  The object
2303   allocator can be enabled by providing the "--with-pymalloc" option to
2304   configure.
2306 Standard library
2308 - pyexpat now detects the expat version if expat.h defines it. A
2309   number of additional handlers are provided, which are only available
2310   since expat 1.95. In addition, the methods SetParamEntityParsing and
2311   GetInputContext of Parser objects are available with 1.95.x
2312   only. Parser objects now provide the ordered_attributes and
2313   specified_attributes attributes. A new module expat.model was added,
2314   which offers a number of additional constants if 1.95.x is used.
2316 - xml.dom offers the new functions registerDOMImplementation and
2317   getDOMImplementation.
2319 - xml.dom.minidom offers a toprettyxml method. A number of DOM
2320   conformance issues have been resolved. In particular, Element now
2321   has an hasAttributes method, and the handling of namespaces was
2322   improved.
2324 - Ka-Ping Yee contributed two new modules: inspect.py, a module for
2325   getting information about live Python code, and pydoc.py, a module
2326   for interactively converting docstrings to HTML or text.
2327   Tools/scripts/pydoc, which is now automatically installed into
2328   <prefix>/bin, uses pydoc.py to display documentation; try running
2329   "pydoc -h" for instructions.  "pydoc -g" pops up a small GUI that
2330   lets you browse the module docstrings using a web browser.
2332 - New library module difflib.py, primarily packaging the SequenceMatcher
2333   class at the heart of the popular ndiff.py file-comparison tool.
2335 - doctest.py (a framework for verifying Python code examples in docstrings)
2336   is now part of the std library.
2338 Windows changes
2340 - A new entry in the Start menu, "Module Docs", runs "pydoc -g" -- a
2341   small GUI that lets you browse the module docstrings using your
2342   default web browser.
2344 - Import is now case-sensitive.  PEP 235 (Import on Case-Insensitive
2345   Platforms) is implemented.  See
2347       http://python.sourceforge.net/peps/pep-0235.html
2349   for full details, especially the "Current Lower-Left Semantics" section.
2350   The new Windows import rules are simpler than before:
2352   A. If the PYTHONCASEOK environment variable exists, same as
2353      before:  silently accept the first case-insensitive match of any
2354      kind; raise ImportError if none found.
2356   B. Else search sys.path for the first case-sensitive match; raise
2357      ImportError if none found.
2359   The same rules have been implented on other platforms with case-
2360   insensitive but case-preserving filesystems too (including Cygwin, and
2361   several flavors of Macintosh operating systems).
2363 - winsound module:  Under Win9x, winsound.Beep() now attempts to simulate
2364   what it's supposed to do (and does do under NT and 2000) via direct
2365   port manipulation.  It's unknown whether this will work on all systems,
2366   but it does work on my Win98SE systems now and was known to be useless on
2367   all Win9x systems before.
2369 - Build:  Subproject _test (effectively) renamed to _testcapi.
2371 New platforms
2373 - 2.1 should compile and run out of the box under MacOS X, even using HFS+.
2374   Thanks to Steven Majewski!
2376 - 2.1 should compile and run out of the box on Cygwin.  Thanks to Jason
2377   Tishler!
2379 - 2.1 contains new files and patches for RISCOS, thanks to Dietmar
2380   Schwertberger!  See RISCOS/README for more information -- it seems
2381   that because of the bizarre filename conventions on RISCOS, no port
2382   to that platform is easy.
2385 What's New in Python 2.1 alpha 2?
2386 =================================
2388 Core language, builtins, and interpreter
2390 - Scopes nest.  If a name is used in a function or class, but is not
2391   local, the definition in the nearest enclosing function scope will
2392   be used.  One consequence of this change is that lambda statements
2393   could reference variables in the namespaces where the lambda is
2394   defined.  In some unusual cases, this change will break code.
2396   In all previous version of Python, names were resolved in exactly
2397   three namespaces -- the local namespace, the global namespace, and
2398   the builtin namespace.  According to this old definition, if a
2399   function A is defined within a function B, the names bound in B are
2400   not visible in A.  The new rules make names bound in B visible in A,
2401   unless A contains a name binding that hides the binding in B.
2403   Section 4.1 of the reference manual describes the new scoping rules
2404   in detail.  The test script in Lib/test/test_scope.py demonstrates
2405   some of the effects of the change.
2407   The new rules will cause existing code to break if it defines nested
2408   functions where an outer function has local variables with the same
2409   name as globals or builtins used by the inner function.  Example:
2411     def munge(str):
2412         def helper(x):
2413             return str(x)
2414         if type(str) != type(''):
2415             str = helper(str)
2416         return str.strip()
2418   Under the old rules, the name str in helper() is bound to the
2419   builtin function str().  Under the new rules, it will be bound to
2420   the argument named str and an error will occur when helper() is
2421   called.
2423 - The compiler will report a SyntaxError if "from ... import *" occurs
2424   in a function or class scope.  The language reference has documented
2425   that this case is illegal, but the compiler never checked for it.
2426   The recent introduction of nested scope makes the meaning of this
2427   form of name binding ambiguous.  In a future release, the compiler
2428   may allow this form when there is no possibility of ambiguity.
2430 - repr(string) is easier to read, now using hex escapes instead of octal,
2431   and using \t, \n and \r instead of \011, \012 and \015 (respectively):
2433   >>> "\texample \r\n" + chr(0) + chr(255)
2434   '\texample \r\n\x00\xff'         # in 2.1
2435   '\011example \015\012\000\377'   # in 2.0
2437 - Functions are now compared and hashed by identity, not by value, since
2438   the func_code attribute is writable.
2440 - Weak references (PEP 205) have been added.  This involves a few
2441   changes in the core, an extension module (_weakref), and a Python
2442   module (weakref).  The weakref module is the public interface.  It
2443   includes support for "explicit" weak references, proxy objects, and
2444   mappings with weakly held values.
2446 - A 'continue' statement can now appear in a try block within the body
2447   of a loop.  It is still not possible to use continue in a finally
2448   clause.
2450 Standard library
2452 - mailbox.py now has a new class, PortableUnixMailbox which is
2453   identical to UnixMailbox but uses a more portable scheme for
2454   determining From_ separators.  Also, the constructors for all the
2455   classes in this module have a new optional `factory' argument, which
2456   is a callable used when new message classes must be instantiated by
2457   the next() method.
2459 - random.py is now self-contained, and offers all the functionality of
2460   the now-deprecated whrandom.py.  See the docs for details.  random.py
2461   also supports new functions getstate() and setstate(), for saving
2462   and restoring the internal state of the generator; and jumpahead(n),
2463   for quickly forcing the internal state to be the same as if n calls to
2464   random() had been made.  The latter is particularly useful for multi-
2465   threaded programs, creating one instance of the random.Random() class for
2466   each thread, then using .jumpahead() to force each instance to use a
2467   non-overlapping segment of the full period.
2469 - random.py's seed() function is new.  For bit-for-bit compatibility with
2470   prior releases, use the whseed function instead.  The new seed function
2471   addresses two problems:  (1) The old function couldn't produce more than
2472   about 2**24 distinct internal states; the new one about 2**45 (the best
2473   that can be done in the Wichmann-Hill generator).  (2) The old function
2474   sometimes produced identical internal states when passed distinct
2475   integers, and there was no simple way to predict when that would happen;
2476   the new one guarantees to produce distinct internal states for all
2477   arguments in [0, 27814431486576L).
2479 - The socket module now supports raw packets on Linux.  The socket
2480   family is AF_PACKET.
2482 - test_capi.py is a start at running tests of the Python C API.  The tests
2483   are implemented by the new Modules/_testmodule.c.
2485 - A new extension module, _symtable, provides provisional access to the
2486   internal symbol table used by the Python compiler.  A higher-level
2487   interface will be added on top of _symtable in a future release.
2489 - Removed the obsolete soundex module.
2491 - xml.dom.minidom now uses the standard DOM exceptions. Node supports
2492   the isSameNode method; NamedNodeMap the get method.
2494 - xml.sax.expatreader supports the lexical handler property; it
2495   generates comment, startCDATA, and endCDATA events.
2497 Windows changes
2499 - Build procedure:  the zlib project is built in a different way that
2500   ensures the zlib header files used can no longer get out of synch with
2501   the zlib binary used.  See PCbuild\readme.txt for details.  Your old
2502   zlib-related directories can be deleted; you'll need to download fresh
2503   source for zlib and unpack it into a new directory.
2505 - Build:  New subproject _test for the benefit of test_capi.py (see above).
2507 - Build:  New subproject _symtable, for new DLL _symtable.pyd (a nascent
2508   interface to some Python compiler internals).
2510 - Build:  Subproject ucnhash is gone, since the code was folded into the
2511   unicodedata subproject.
2513 What's New in Python 2.1 alpha 1?
2514 =================================
2516 Core language, builtins, and interpreter
2518 - There is a new Unicode companion to the PyObject_Str() API
2519   called PyObject_Unicode(). It behaves in the same way as the
2520   former, but assures that the returned value is an Unicode object
2521   (applying the usual coercion if necessary).
2523 - The comparison operators support "rich comparison overloading" (PEP
2524   207).  C extension types can provide a rich comparison function in
2525   the new tp_richcompare slot in the type object.  The cmp() function
2526   and the C function PyObject_Compare() first try the new rich
2527   comparison operators before trying the old 3-way comparison.  There
2528   is also a new C API PyObject_RichCompare() (which also falls back on
2529   the old 3-way comparison, but does not constrain the outcome of the
2530   rich comparison to a Boolean result).
2532   The rich comparison function takes two objects (at least one of
2533   which is guaranteed to have the type that provided the function) and
2534   an integer indicating the opcode, which can be Py_LT, Py_LE, Py_EQ,
2535   Py_NE, Py_GT, Py_GE (for <, <=, ==, !=, >, >=), and returns a Python
2536   object, which may be NotImplemented (in which case the tp_compare
2537   slot function is used as a fallback, if defined).
2539   Classes can overload individual comparison operators by defining one
2540   or more of the methods__lt__, __le__, __eq__, __ne__, __gt__,
2541   __ge__.  There are no explicit "reflected argument" versions of
2542   these; instead, __lt__ and __gt__ are each other's reflection,
2543   likewise for__le__ and __ge__; __eq__ and __ne__ are their own
2544   reflection (similar at the C level).  No other implications are
2545   made; in particular, Python does not assume that == is the Boolean
2546   inverse of !=, or that < is the Boolean inverse of >=.  This makes
2547   it possible to define types with partial orderings.
2549   Classes or types that want to implement (in)equality tests but not
2550   the ordering operators (i.e. unordered types) should implement ==
2551   and !=, and raise an error for the ordering operators.
2553   It is possible to define types whose rich comparison results are not
2554   Boolean; e.g. a matrix type might want to return a matrix of bits
2555   for A < B, giving elementwise comparisons.  Such types should ensure
2556   that any interpretation of their value in a Boolean context raises
2557   an exception, e.g. by defining __nonzero__ (or the tp_nonzero slot
2558   at the C level) to always raise an exception.
2560 - Complex numbers use rich comparisons to define == and != but raise
2561   an exception for <, <=, > and >=.  Unfortunately, this also means
2562   that cmp() of two complex numbers raises an exception when the two
2563   numbers differ.  Since it is not mathematically meaningful to compare
2564   complex numbers except for equality, I hope that this doesn't break
2565   too much code.
2567 - The outcome of comparing non-numeric objects of different types is
2568   not defined by the language, other than that it's arbitrary but
2569   consistent (see the Reference Manual).  An implementation detail changed
2570   in 2.1a1 such that None now compares less than any other object.  Code
2571   relying on this new behavior (like code that relied on the previous
2572   behavior) does so at its own risk.
2574 - Functions and methods now support getting and setting arbitrarily
2575   named attributes (PEP 232).  Functions have a new __dict__
2576   (a.k.a. func_dict) which hold the function attributes.  Methods get
2577   and set attributes on their underlying im_func.  It is a TypeError
2578   to set an attribute on a bound method.
2580 - The xrange() object implementation has been improved so that
2581   xrange(sys.maxint) can be used on 64-bit platforms.  There's still a
2582   limitation that in this case len(xrange(sys.maxint)) can't be
2583   calculated, but the common idiom "for i in xrange(sys.maxint)" will
2584   work fine as long as the index i doesn't actually reach 2**31.
2585   (Python uses regular ints for sequence and string indices; fixing
2586   that is much more work.)
2588 - Two changes to from...import:
2590   1) "from M import X" now works even if (after loading module M)
2591      sys.modules['M'] is not a real module; it's basically a getattr()
2592      operation with AttributeError exceptions changed into ImportError.
2594   2) "from M import *" now looks for M.__all__ to decide which names to
2595      import; if M.__all__ doesn't exist, it uses M.__dict__.keys() but
2596      filters out names starting with '_' as before.  Whether or not
2597      __all__ exists, there's no restriction on the type of M.
2599 - File objects have a new method, xreadlines().  This is the fastest
2600   way to iterate over all lines in a file:
2602   for line in file.xreadlines():
2603       ...do something to line...
2605   See the xreadlines module (mentioned below) for how to do this for
2606   other file-like objects.
2608 - Even if you don't use file.xreadlines(), you may expect a speedup on
2609   line-by-line input.  The file.readline() method has been optimized
2610   quite a bit in platform-specific ways:  on systems (like Linux) that
2611   support flockfile(), getc_unlocked(), and funlockfile(), those are
2612   used by default.  On systems (like Windows) without getc_unlocked(),
2613   a complicated (but still thread-safe) method using fgets() is used by
2614   default.
2616   You can force use of the fgets() method by #define'ing
2617   USE_FGETS_IN_GETLINE at build time (it may be faster than
2618   getc_unlocked()).
2620   You can force fgets() not to be used by #define'ing
2621   DONT_USE_FGETS_IN_GETLINE (this is the first thing to try if std test
2622   test_bufio.py fails -- and let us know if it does!).
2624 - In addition, the fileinput module, while still slower than the other
2625   methods on most platforms, has been sped up too, by using
2626   file.readlines(sizehint).
2628 - Support for run-time warnings has been added, including a new
2629   command line option (-W) to specify the disposition of warnings.
2630   See the description of the warnings module below.
2632 - Extensive changes have been made to the coercion code.  This mostly
2633   affects extension modules (which can now implement mixed-type
2634   numerical operators without having to use coercion), but
2635   occasionally, in boundary cases the coercion semantics have changed
2636   subtly.  Since this was a terrible gray area of the language, this
2637   is considered an improvement.  Also note that __rcmp__ is no longer
2638   supported -- instead of calling __rcmp__, __cmp__ is called with
2639   reflected arguments.
2641 - In connection with the coercion changes, a new built-in singleton
2642   object, NotImplemented is defined.  This can be returned for
2643   operations that wish to indicate they are not implemented for a
2644   particular combination of arguments.  From C, this is
2645   Py_NotImplemented.
2647 - The interpreter accepts now bytecode files on the command line even
2648   if they do not have a .pyc or .pyo extension. On Linux, after executing
2650 import imp,sys,string
2651 magic = string.join(["\\x%.2x" % ord(c) for c in imp.get_magic()],"")
2652 reg = ':pyc:M::%s::%s:' % (magic, sys.executable)
2653 open("/proc/sys/fs/binfmt_misc/register","wb").write(reg)
2655   any byte code file can be used as an executable (i.e. as an argument
2656   to execve(2)).
2658 - %[xXo] formats of negative Python longs now produce a sign
2659   character.  In 1.6 and earlier, they never produced a sign,
2660   and raised an error if the value of the long was too large
2661   to fit in a Python int.  In 2.0, they produced a sign if and
2662   only if too large to fit in an int.  This was inconsistent
2663   across platforms (because the size of an int varies across
2664   platforms), and inconsistent with hex() and oct().  Example:
2666   >>> "%x" % -0x42L
2667   '-42'      # in 2.1
2668   'ffffffbe' # in 2.0 and before, on 32-bit machines
2669   >>> hex(-0x42L)
2670   '-0x42L'   # in all versions of Python
2672   The behavior of %d formats for negative Python longs remains
2673   the same as in 2.0 (although in 1.6 and before, they raised
2674   an error if the long didn't fit in a Python int).
2676   %u formats don't make sense for Python longs, but are allowed
2677   and treated the same as %d in 2.1.  In 2.0, a negative long
2678   formatted via %u produced a sign if and only if too large to
2679   fit in an int.  In 1.6 and earlier, a negative long formatted
2680   via %u raised an error if it was too big to fit in an int.
2682 - Dictionary objects have an odd new method, popitem().  This removes
2683   an arbitrary item from the dictionary and returns it (in the form of
2684   a (key, value) pair).  This can be useful for algorithms that use a
2685   dictionary as a bag of "to do" items and repeatedly need to pick one
2686   item.  Such algorithms normally end up running in quadratic time;
2687   using popitem() they can usually be made to run in linear time.
2689 Standard library
2691 - In the time module, the time argument to the functions strftime,
2692   localtime, gmtime, asctime and ctime is now optional, defaulting to
2693   the current time (in the local timezone).
2695 - The ftplib module now defaults to passive mode, which is deemed a
2696   more useful default given that clients are often inside firewalls
2697   these days.  Note that this could break if ftplib is used to connect
2698   to a *server* that is inside a firewall, from outside; this is
2699   expected to be a very rare situation.  To fix that, you can call
2700   ftp.set_pasv(0).
2702 - The module site now treats .pth files not only for path configuration,
2703   but also supports extensions to the initialization code: Lines starting
2704   with import are executed.
2706 - There's a new module, warnings, which implements a mechanism for
2707   issuing and filtering warnings.  There are some new built-in
2708   exceptions that serve as warning categories, and a new command line
2709   option, -W, to control warnings (e.g. -Wi ignores all warnings, -We
2710   turns warnings into errors).  warnings.warn(message[, category])
2711   issues a warning message; this can also be called from C as
2712   PyErr_Warn(category, message).
2714 - A new module xreadlines was added.  This exports a single factory
2715   function, xreadlines().  The intention is that this code is the
2716   absolutely fastest way to iterate over all lines in an open
2717   file(-like) object:
2719   import xreadlines
2720   for line in xreadlines.xreadlines(file):
2721       ...do something to line...
2723   This is equivalent to the previous the speed record holder using
2724   file.readlines(sizehint).  Note that if file is a real file object
2725   (as opposed to a file-like object), this is equivalent:
2727   for line in file.xreadlines():
2728       ...do something to line...
2730 - The bisect module has new functions bisect_left, insort_left,
2731   bisect_right and insort_right.  The old names bisect and insort
2732   are now aliases for bisect_right and insort_right.  XXX_right
2733   and XXX_left methods differ in what happens when the new element
2734   compares equal to one or more elements already in the list:  the
2735   XXX_left methods insert to the left, the XXX_right methods to the
2736   right.  Code that doesn't care where equal elements end up should
2737   continue to use the old, short names ("bisect" and "insort").
2739 - The new curses.panel module wraps the panel library that forms part
2740   of SYSV curses and ncurses.  Contributed by Thomas Gellekum.
2742 - The SocketServer module now sets the allow_reuse_address flag by
2743   default in the TCPServer class.
2745 - A new function, sys._getframe(), returns the stack frame pointer of
2746   the caller.  This is intended only as a building block for
2747   higher-level mechanisms such as string interpolation.
2749 - The pyexpat module supports a number of new handlers, which are
2750   available only in expat 1.2. If invocation of a callback fails, it
2751   will report an additional frame in the traceback. Parser objects
2752   participate now in garbage collection. If expat reports an unknown
2753   encoding, pyexpat will try to use a Python codec; that works only
2754   for single-byte charsets. The parser type objects is exposed as
2755   XMLParserObject.
2757 - xml.dom now offers standard definitions for symbolic node type and
2758   exception code constants, and a hierarchy of DOM exceptions. minidom
2759   was adjusted to use them.
2761 - The conformance of xml.dom.minidom to the DOM specification was
2762   improved. It detects a number of additional error cases; the
2763   previous/next relationship works even when the tree is modified;
2764   Node supports the normalize() method; NamedNodeMap, DocumentType and
2765   DOMImplementation classes were added; Element supports the
2766   hasAttribute and hasAttributeNS methods; and Text supports the splitText
2767   method.
2769 Build issues
2771 - For Unix (and Unix-compatible) builds, configuration and building of
2772   extension modules is now greatly automated.  Rather than having to
2773   edit the Modules/Setup file to indicate which modules should be
2774   built and where their include files and libraries are, a
2775   distutils-based setup.py script now takes care of building most
2776   extension modules.  All extension modules built this way are built
2777   as shared libraries.  Only a few modules that must be linked
2778   statically are still listed in the Setup file; you won't need to
2779   edit their configuration.
2781 - Python should now build out of the box on Cygwin.  If it doesn't,
2782   mail to Jason Tishler (jlt63 at users.sourceforge.net).
2784 - Python now always uses its own (renamed) implementation of getopt()
2785   -- there's too much variation among C library getopt()
2786   implementations.
2788 - C++ compilers are better supported; the CXX macro is always set to a
2789   C++ compiler if one is found.
2791 Windows changes
2793 - select module:  By default under Windows, a select() call
2794   can specify no more than 64 sockets.  Python now boosts
2795   this Microsoft default to 512.  If you need even more than
2796   that, see the MS docs (you'll need to #define FD_SETSIZE
2797   and recompile Python from source).
2799 - Support for Windows 3.1, DOS and OS/2 is gone.  The Lib/dos-8x3
2800   subdirectory is no more!
2803 What's New in Python 2.0?
2804 =========================
2806 Below is a list of all relevant changes since release 1.6.  Older
2807 changes are in the file HISTORY.  If you are making the jump directly
2808 from Python 1.5.2 to 2.0, make sure to read the section for 1.6 in the
2809 HISTORY file!  Many important changes listed there.
2811 Alternatively, a good overview of the changes between 1.5.2 and 2.0 is
2812 the document "What's New in Python 2.0" by Kuchling and Moshe Zadka:
2813 http://starship.python.net/crew/amk/python/writing/new-python/.
2815 --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)
2817 ======================================================================
2819 What's new in 2.0 (since release candidate 1)?
2820 ==============================================
2822 Standard library
2824 - The copy_reg module was modified to clarify its intended use: to
2825   register pickle support for extension types, not for classes.
2826   pickle() will raise a TypeError if it is passed a class.
2828 - Fixed a bug in gettext's "normalize and expand" code that prevented
2829   it from finding an existing .mo file.
2831 - Restored support for HTTP/0.9 servers in httplib.
2833 - The math module was changed to stop raising OverflowError in case of
2834   underflow, and return 0 instead in underflow cases.  Whether Python
2835   used to raise OverflowError in case of underflow was platform-
2836   dependent (it did when the platform math library set errno to ERANGE
2837   on underflow).
2839 - Fixed a bug in StringIO that occurred when the file position was not
2840   at the end of the file and write() was called with enough data to
2841   extend past the end of the file.
2843 - Fixed a bug that caused Tkinter error messages to get lost on
2844   Windows.  The bug was fixed by replacing direct use of
2845   interp->result with Tcl_GetStringResult(interp).
2847 - Fixed bug in urllib2 that caused it to fail when it received an HTTP
2848   redirect response.
2850 - Several changes were made to distutils: Some debugging code was
2851   removed from util.  Fixed the installer used when an external zip
2852   program (like WinZip) is not found; the source code for this
2853   installer is in Misc/distutils.  check_lib() was modified to behave
2854   more like AC_CHECK_LIB by add other_libraries() as a parameter.  The
2855   test for whether installed modules are on sys.path was changed to
2856   use both normcase() and normpath().
2858 - Several minor bugs were fixed in the xml package (the minidom,
2859   pulldom, expatreader, and saxutils modules).
2861 - The regression test driver (regrtest.py) behavior when invoked with
2862   -l changed: It now reports a count of objects that are recognized as
2863   garbage but not freed by the garbage collector.
2865 - The regression test for the math module was changed to test
2866   exceptional behavior when the test is run in verbose mode.  Python
2867   cannot yet guarantee consistent exception behavior across platforms,
2868   so the exception part of test_math is run only in verbose mode, and
2869   may fail on your platform.
2871 Internals
2873 - PyOS_CheckStack() has been disabled on Win64, where it caused
2874   test_sre to fail.
2876 Build issues
2878 - Changed compiler flags, so that gcc is always invoked with -Wall and
2879   -Wstrict-prototypes.  Users compiling Python with GCC should see
2880   exactly one warning, except if they have passed configure the
2881   --with-pydebug flag.  The expected warning is for getopt() in
2882   Modules/main.c.  This warning will be fixed for Python 2.1.
2884 - Fixed configure to add -threads argument during linking on OSF1.
2886 Tools and other miscellany
2888 - The compiler in Tools/compiler was updated to support the new
2889   language features introduced in 2.0: extended print statement, list
2890   comprehensions, and augmented assignments.  The new compiler should
2891   also be backwards compatible with Python 1.5.2; the compiler will
2892   always generate code for the version of the interpreter it runs
2893   under.
2895 What's new in 2.0 release candidate 1 (since beta 2)?
2896 =====================================================
2898 What is release candidate 1?
2900 We believe that release candidate 1 will fix all known bugs that we
2901 intend to fix for the 2.0 final release.  This release should be a bit
2902 more stable than the previous betas.  We would like to see even more
2903 widespread testing before the final release, so we are producing this
2904 release candidate.  The final release will be exactly the same unless
2905 any show-stopping (or brown bag) bugs are found by testers of the
2906 release candidate.
2908 All the changes since the last beta release are bug fixes or changes
2909 to support building Python for specific platforms.
2911 Core language, builtins, and interpreter
2913 - A bug that caused crashes when __coerce__ was used with augmented
2914   assignment, e.g. +=, was fixed.
2916 - Raise ZeroDivisionError when raising zero to a negative number,
2917   e.g. 0.0 ** -2.0.  Note that math.pow is unrelated to the builtin
2918   power operator and the result of math.pow(0.0, -2.0) will vary by
2919   platform.  On Linux, it raises a ValueError.
2921 - A bug in Unicode string interpolation was fixed that occasionally
2922   caused errors with formats including "%%".  For example, the
2923   following expression "%% %s" % u"abc" no longer raises a TypeError.
2925 - Compilation of deeply nested expressions raises MemoryError instead
2926   of SyntaxError, e.g. eval("[" * 50 + "]" * 50).
2928 - In 2.0b2 on Windows, the interpreter wrote .pyc files in text mode,
2929   rendering them useless.  They are now written in binary mode again.
2931 Standard library
2933 - Keyword arguments are now accepted for most pattern and match object
2934   methods in SRE, the standard regular expression engine.
2936 - In SRE, fixed error with negative lookahead and lookbehind that
2937   manifested itself as a runtime error in patterns like "(?<!abc)(def)".
2939 - Several bugs in the Unicode handling and error handling in _tkinter
2940   were fixed.
2942 - Fix memory management errors in Merge() and Tkapp_Call() routines.
2944 - Several changes were made to cStringIO to make it compatible with
2945   the file-like object interface and with StringIO.  If operations are
2946   performed on a closed object, an exception is raised.  The truncate
2947   method now accepts a position argument and readline accepts a size
2948   argument.
2950 - There were many changes made to the linuxaudiodev module and its
2951   test suite; as a result, a short, unexpected audio sample should now
2952   play when the regression test is run.
2954   Note that this module is named poorly, because it should work
2955   correctly on any platform that supports the Open Sound System
2956   (OSS).
2958   The module now raises exceptions when errors occur instead of
2959   crashing.  It also defines the AFMT_A_LAW format (logarithmic A-law
2960   audio) and defines a getptr() method that calls the
2961   SNDCTL_DSP_GETxPTR ioctl defined in the OSS Programmer's Guide.
2963 - The library_version attribute, introduced in an earlier beta, was
2964   removed because it can not be supported with early versions of the C
2965   readline library, which provides no way to determine the version at
2966   compile-time.
2968 - The binascii module is now enabled on Win64.
2970 - tokenize.py no longer suffers "recursion depth" errors when parsing
2971   programs with very long string literals.
2973 Internals
2975 - Fixed several buffer overflow vulnerabilities in calculate_path(),
2976   which is called when the interpreter starts up to determine where
2977   the standard library is installed.  These vulnerabilities affect all
2978   previous versions of Python and can be exploited by setting very
2979   long values for PYTHONHOME or argv[0].  The risk is greatest for a
2980   setuid Python script, although use of the wrapper in
2981   Misc/setuid-prog.c will eliminate the vulnerability.
2983 - Fixed garbage collection bugs in instance creation that were
2984   triggered when errors occurred during initialization.  The solution,
2985   applied in cPickle and in PyInstance_New(), is to call
2986   PyObject_GC_Init() after the initialization of the object's
2987   container attributes is complete.
2989 - pyexpat adds definitions of PyModule_AddStringConstant and
2990   PyModule_AddObject if the Python version is less than 2.0, which
2991   provides compatibility with PyXML on Python 1.5.2.
2993 - If the platform has a bogus definition for LONG_BIT (the number of
2994   bits in a long), an error will be reported at compile time.
2996 - Fix bugs in _PyTuple_Resize() which caused hard-to-interpret garbage
2997   collection crashes and possibly other, unreported crashes.
2999 - Fixed a memory leak in _PyUnicode_Fini().
3001 Build issues
3003 - configure now accepts a --with-suffix option that specifies the
3004   executable suffix.  This is useful for builds on Cygwin and Mac OS
3005   X, for example.
3007 - The mmap.PAGESIZE constant is now initialized using sysconf when
3008   possible, which eliminates a dependency on -lucb for Reliant UNIX.
3010 - The md5 file should now compile on all platforms.
3012 - The select module now compiles on platforms that do not define
3013   POLLRDNORM and related constants.
3015 - Darwin (Mac OS X):  Initial support for static builds on this
3016   platform.
3018 - BeOS: A number of changes were made to the build and installation
3019   process.  ar-fake now operates on a directory of object files.
3020   dl_export.h is gone, and its macros now appear on the mwcc command
3021   line during build on PPC BeOS.
3023 - Platform directory in lib/python2.0 is "plat-beos5" (or
3024   "plat-beos4", if building on BeOS 4.5), rather than "plat-beos".
3026 - Cygwin: Support for shared libraries, Tkinter, and sockets.
3028 - SunOS 4.1.4_JL: Fix test for directory existence in configure.
3030 Tools and other miscellany
3032 - Removed debugging prints from main used with freeze.
3034 - IDLE auto-indent no longer crashes when it encounters Unicode
3035   characters.
3037 What's new in 2.0 beta 2 (since beta 1)?
3038 ========================================
3040 Core language, builtins, and interpreter
3042 - Add support for unbounded ints in %d,i,u,x,X,o formats; for example
3043   "%d" % 2L**64 == "18446744073709551616".
3045 - Add -h and -V command line options to print the usage message and
3046   Python version number and exit immediately.
3048 - eval() and exec accept Unicode objects as code parameters.
3050 - getattr() and setattr() now also accept Unicode objects for the
3051   attribute name, which are converted to strings using the default
3052   encoding before lookup.
3054 - Multiplication on string and Unicode now does proper bounds
3055   checking; e.g. 'a' * 65536 * 65536 will raise ValueError, "repeated
3056   string is too long."
3058 - Better error message when continue is found in try statement in a
3059   loop.
3062 Standard library and extensions
3064 - socket module: the OpenSSL code now adds support for RAND_status()
3065   and EGD (Entropy Gathering Device).
3067 - array: reverse() method of array now works.  buffer_info() now does
3068   argument checking; it still takes no arguments.
3070 - asyncore/asynchat: Included most recent version from Sam Rushing.
3072 - cgi: Accept '&' or ';' as separator characters when parsing form data.
3074 - CGIHTTPServer: Now works on Windows (and perhaps even Mac).
3076 - ConfigParser: When reading the file, options spelled in upper case
3077   letters are now correctly converted to lowercase.
3079 - copy: Copy Unicode objects atomically.
3081 - cPickle: Fail gracefully when copy_reg can't be imported.
3083 - cStringIO: Implemented readlines() method.
3085 - dbm: Add get() and setdefault() methods to dbm object.  Add constant
3086   `library' to module that names the library used.  Added doc strings
3087   and method names to error messages.  Uses configure to determine
3088   which ndbm.h file to include; Berkeley DB's nbdm and GDBM's ndbm is
3089   now available options.
3091 - distutils: Update to version 0.9.3.
3093 - dl: Add several dl.RTLD_ constants.
3095 - fpectl: Now supported on FreeBSD.
3097 - gc: Add DEBUG_SAVEALL option.  When enabled all garbage objects
3098   found by the collector will be saved in gc.garbage.  This is useful
3099   for debugging a program that creates reference cycles.
3101 - httplib: Three changes: Restore support for set_debuglevel feature
3102   of HTTP class.  Do not close socket on zero-length response.  Do not
3103   crash when server sends invalid content-length header.
3105 - mailbox: Mailbox class conforms better to qmail specifications.
3107 - marshal: When reading a short, sign-extend on platforms where shorts
3108   are bigger than 16 bits.  When reading a long, repair the unportable
3109   sign extension that was being done for 64-bit machines.  (It assumed
3110   that signed right shift sign-extends.)
3112 - operator: Add contains(), invert(), __invert__() as aliases for
3113   __contains__(), inv(), and __inv__() respectively.
3115 - os: Add support for popen2() and popen3() on all platforms where
3116   fork() exists.  (popen4() is still in the works.)
3118 - os: (Windows only:) Add startfile() function that acts like double-
3119   clicking on a file in Explorer (or passing the file name to the
3120   DOS "start" command).
3122 - os.path: (Windows, DOS:) Treat trailing colon correctly in
3123   os.path.join.  os.path.join("a:", "b") yields "a:b".
3125 - pickle: Now raises ValueError when an invalid pickle that contains
3126   a non-string repr where a string repr was expected.  This behavior
3127   matches cPickle.
3129 - posixfile: Remove broken __del__() method.
3131 - py_compile: support CR+LF line terminators in source file.
3133 - readline: Does not immediately exit when ^C is hit when readline and
3134   threads are configured.  Adds definition of rl_library_version.  (The
3135   latter addition requires GNU readline 2.2 or later.)
3137 - rfc822: Domain literals returned by AddrlistClass method
3138   getdomainliteral() are now properly wrapped in brackets.
3140 - site: sys.setdefaultencoding() should only be called in case the
3141   standard default encoding ("ascii") is changed. This saves quite a
3142   few cycles during startup since the first call to
3143   setdefaultencoding() will initialize the codec registry and the
3144   encodings package.
3146 - socket: Support for size hint in readlines() method of object returned
3147   by makefile().
3149 - sre: Added experimental expand() method to match objects.  Does not
3150   use buffer interface on Unicode strings.  Does not hang if group id
3151   is followed by whitespace.
3153 - StringIO: Size hint in readlines() is now supported as documented.
3155 - struct: Check ranges for bytes and shorts.
3157 - urllib: Improved handling of win32 proxy settings. Fixed quote and
3158   quote_plus functions so that the always encode a comma.
3160 - Tkinter: Image objects are now guaranteed to have unique ids.  Set
3161   event.delta to zero if Tk version doesn't support mousewheel.
3162   Removed some debugging prints.
3164 - UserList: now implements __contains__().
3166 - webbrowser: On Windows, use os.startfile() instead of os.popen(),
3167   which works around a bug in Norton AntiVirus 2000 that leads directly
3168   to a Blue Screen freeze.
3170 - xml: New version detection code allows PyXML to override standard
3171   XML package if PyXML version is greater than 0.6.1.
3173 - xml.dom: DOM level 1 support for basic XML.  Includes xml.dom.minidom
3174   (conventional DOM), and xml.dom.pulldom, which allows building the DOM
3175   tree only for nodes which are sufficiently interesting to a specific
3176   application.  Does not provide the HTML-specific extensions.  Still
3177   undocumented.
3179 - xml.sax: SAX 2 support for Python, including all the handler
3180   interfaces needed to process XML 1.0 compliant XML.  Some
3181   documentation is already available.
3183 - pyexpat: Renamed to xml.parsers.expat since this is part of the new,
3184   packagized XML support.
3187 C API
3189 - Add three new convenience functions for module initialization --
3190   PyModule_AddObject(), PyModule_AddIntConstant(), and
3191   PyModule_AddStringConstant().
3193 - Cleaned up definition of NULL in C source code; all definitions were
3194   removed and add #error to Python.h if NULL isn't defined after
3195   #include of stdio.h.
3197 - Py_PROTO() macros that were removed in 2.0b1 have been restored for
3198   backwards compatibility (at the source level) with old extensions.
3200 - A wrapper API was added for signal() and sigaction().  Instead of
3201   either function, always use PyOS_getsig() to get a signal handler
3202   and PyOS_setsig() to set one.  A new convenience typedef
3203   PyOS_sighandler_t is defined for the type of signal handlers.
3205 - Add PyString_AsStringAndSize() function that provides access to the
3206   internal data buffer and size of a string object -- or the default
3207   encoded version of a Unicode object.
3209 - PyString_Size() and PyString_AsString() accept Unicode objects.
3211 - The standard header <limits.h> is now included by Python.h (if it
3212   exists).  INT_MAX and LONG_MAX will always be defined, even if
3213   <limits.h> is not available.
3215 - PyFloat_FromString takes a second argument, pend, that was
3216   effectively useless.  It is now officially useless but preserved for
3217   backwards compatibility.  If the pend argument is not NULL, *pend is
3218   set to NULL.
3220 - PyObject_GetAttr() and PyObject_SetAttr() now accept Unicode objects
3221   for the attribute name.  See note on getattr() above.
3223 - A few bug fixes to argument processing for Unicode.
3224   PyArg_ParseTupleAndKeywords() now accepts "es#" and "es".
3225   PyArg_Parse() special cases "s#" for Unicode objects; it returns a
3226   pointer to the default encoded string data instead of to the raw
3227   UTF-16.
3229 - Py_BuildValue accepts B format (for bgen-generated code).
3232 Internals
3234 - On Unix, fix code for finding Python installation directory so that
3235   it works when argv[0] is a relative path.
3237 - Added a true unicode_internal_encode() function and fixed the
3238   unicode_internal_decode function() to support Unicode objects directly
3239   rather than by generating a copy of the object.
3241 - Several of the internal Unicode tables are much smaller now, and
3242   the source code should be much friendlier to weaker compilers.
3244 - In the garbage collector: Fixed bug in collection of tuples.  Fixed
3245   bug that caused some instances to be removed from the container set
3246   while they were still live.  Fixed parsing in gc.set_debug() for
3247   platforms where sizeof(long) > sizeof(int).
3249 - Fixed refcount problem in instance deallocation that only occurred
3250   when Py_REF_DEBUG was defined and Py_TRACE_REFS was not.
3252 - On Windows, getpythonregpath is now protected against null data in
3253   registry key.
3255 - On Unix, create .pyc/.pyo files with O_EXCL flag to avoid a race
3256   condition.
3259 Build and platform-specific issues
3261 - Better support of GNU Pth via --with-pth configure option.
3263 - Python/C API now properly exposed to dynamically-loaded extension
3264   modules on Reliant UNIX.
3266 - Changes for the benefit of SunOS 4.1.4 (really!).  mmapmodule.c:
3267   Don't define MS_SYNC to be zero when it is undefined.  Added missing
3268   prototypes in posixmodule.c.
3270 - Improved support for HP-UX build.  Threads should now be correctly
3271   configured (on HP-UX 10.20 and 11.00).
3273 - Fix largefile support on older NetBSD systems and OpenBSD by adding
3274   define for TELL64.
3277 Tools and other miscellany
3279 - ftpmirror: Call to main() is wrapped in if __name__ == "__main__".
3281 - freeze: The modulefinder now works with 2.0 opcodes.
3283 - IDLE:
3284   Move hackery of sys.argv until after the Tk instance has been
3285   created, which allows the application-specific Tkinter
3286   initialization to be executed if present; also pass an explicit
3287   className parameter to the Tk() constructor.
3290 What's new in 2.0 beta 1?
3291 =========================
3293 Source Incompatibilities
3294 ------------------------
3296 None.  Note that 1.6 introduced several incompatibilities with 1.5.2,
3297 such as single-argument append(), connect() and bind(), and changes to
3298 str(long) and repr(float).
3301 Binary Incompatibilities
3302 ------------------------
3304 - Third party extensions built for Python 1.5.x or 1.6 cannot be used
3305 with Python 2.0; these extensions will have to be rebuilt for Python
3306 2.0.
3308 - On Windows, attempting to import a third party extension built for
3309 Python 1.5.x or 1.6 results in an immediate crash; there's not much we
3310 can do about this.  Check your PYTHONPATH environment variable!
3312 - Python bytecode files (*.pyc and *.pyo) are not compatible between
3313 releases.
3316 Overview of Changes Since 1.6
3317 -----------------------------
3319 There are many new modules (including brand new XML support through
3320 the xml package, and i18n support through the gettext module); a list
3321 of all new modules is included below.  Lots of bugs have been fixed.
3323 The process for making major new changes to the language has changed
3324 since Python 1.6.  Enhancements must now be documented by a Python
3325 Enhancement Proposal (PEP) before they can be accepted.
3327 There are several important syntax enhancements, described in more
3328 detail below:
3330   - Augmented assignment, e.g. x += 1
3332   - List comprehensions, e.g. [x**2 for x in range(10)]
3334   - Extended import statement, e.g. import Module as Name
3336   - Extended print statement, e.g. print >> file, "Hello"
3338 Other important changes:
3340   - Optional collection of cyclical garbage
3342 Python Enhancement Proposal (PEP)
3343 ---------------------------------
3345 PEP stands for Python Enhancement Proposal.  A PEP is a design
3346 document providing information to the Python community, or describing
3347 a new feature for Python.  The PEP should provide a concise technical
3348 specification of the feature and a rationale for the feature.
3350 We intend PEPs to be the primary mechanisms for proposing new
3351 features, for collecting community input on an issue, and for
3352 documenting the design decisions that have gone into Python.  The PEP
3353 author is responsible for building consensus within the community and
3354 documenting dissenting opinions.
3356 The PEPs are available at http://python.sourceforge.net/peps/.
3358 Augmented Assignment
3359 --------------------
3361 This must have been the most-requested feature of the past years!
3362 Eleven new assignment operators were added:
3364     += -= *= /= %= **= <<= >>= &= ^= |=
3366 For example,
3368     A += B
3370 is similar to
3372     A = A + B
3374 except that A is evaluated only once (relevant when A is something
3375 like dict[index].attr).
3377 However, if A is a mutable object, A may be modified in place.  Thus,
3378 if A is a number or a string, A += B has the same effect as A = A+B
3379 (except A is only evaluated once); but if a is a list, A += B has the
3380 same effect as A.extend(B)!
3382 Classes and built-in object types can override the new operators in
3383 order to implement the in-place behavior; the not-in-place behavior is
3384 used automatically as a fallback when an object doesn't implement the
3385 in-place behavior.  For classes, the method name is derived from the
3386 method name for the corresponding not-in-place operator by inserting
3387 an 'i' in front of the name, e.g. __iadd__ implements in-place
3388 __add__.
3390 Augmented assignment was implemented by Thomas Wouters.
3393 List Comprehensions
3394 -------------------
3396 This is a flexible new notation for lists whose elements are computed
3397 from another list (or lists).  The simplest form is:
3399     [<expression> for <variable> in <sequence>]
3401 For example, [i**2 for i in range(4)] yields the list [0, 1, 4, 9].
3402 This is more efficient than a for loop with a list.append() call.
3404 You can also add a condition:
3406     [<expression> for <variable> in <sequence> if <condition>]
3408 For example, [w for w in words if w == w.lower()] would yield the list
3409 of words that contain no uppercase characters.  This is more efficient
3410 than a for loop with an if statement and a list.append() call.
3412 You can also have nested for loops and more than one 'if' clause.  For
3413 example, here's a function that flattens a sequence of sequences::
3415     def flatten(seq):
3416         return [x for subseq in seq for x in subseq]
3418     flatten([[0], [1,2,3], [4,5], [6,7,8,9], []])
3420 This prints
3422     [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
3424 List comprehensions originated as a patch set from Greg Ewing; Skip
3425 Montanaro and Thomas Wouters also contributed.  Described by PEP 202.
3428 Extended Import Statement
3429 -------------------------
3431 Many people have asked for a way to import a module under a different
3432 name.  This can be accomplished like this:
3434     import foo
3435     bar = foo
3436     del foo
3438 but this common idiom gets old quickly.  A simple extension of the
3439 import statement now allows this to be written as follows:
3441     import foo as bar
3443 There's also a variant for 'from ... import':
3445     from foo import bar as spam
3447 This also works with packages; e.g. you can write this:
3449     import test.regrtest as regrtest
3451 Note that 'as' is not a new keyword -- it is recognized only in this
3452 context (this is only possible because the syntax for the import
3453 statement doesn't involve expressions).
3455 Implemented by Thomas Wouters.  Described by PEP 221.
3458 Extended Print Statement
3459 ------------------------
3461 Easily the most controversial new feature, this extension to the print
3462 statement adds an option to make the output go to a different file
3463 than the default sys.stdout.
3465 For example, to write an error message to sys.stderr, you can now
3466 write:
3468     print >> sys.stderr, "Error: bad dog!"
3470 As a special feature, if the expression used to indicate the file
3471 evaluates to None, the current value of sys.stdout is used.  Thus:
3473     print >> None, "Hello world"
3475 is equivalent to
3477     print "Hello world"
3479 Design and implementation by Barry Warsaw.  Described by PEP 214.
3482 Optional Collection of Cyclical Garbage
3483 ---------------------------------------
3485 Python is now equipped with a garbage collector that can hunt down
3486 cyclical references between Python objects.  It's no replacement for
3487 reference counting; in fact, it depends on the reference counts being
3488 correct, and decides that a set of objects belong to a cycle if all
3489 their reference counts can be accounted for from their references to
3490 each other.  This devious scheme was first proposed by Eric Tiedemann,
3491 and brought to implementation by Neil Schemenauer.
3493 There's a module "gc" that lets you control some parameters of the
3494 garbage collection.  There's also an option to the configure script
3495 that lets you enable or disable the garbage collection.  In 2.0b1,
3496 it's on by default, so that we (hopefully) can collect decent user
3497 experience with this new feature.  There are some questions about its
3498 performance.  If it proves to be too much of a problem, we'll turn it
3499 off by default in the final 2.0 release.
3502 Smaller Changes
3503 ---------------
3505 A new function zip() was added.  zip(seq1, seq2, ...) is equivalent to
3506 map(None, seq1, seq2, ...) when the sequences have the same length;
3507 i.e. zip([1,2,3], [10,20,30]) returns [(1,10), (2,20), (3,30)].  When
3508 the lists are not all the same length, the shortest list wins:
3509 zip([1,2,3], [10,20]) returns [(1,10), (2,20)].  See PEP 201.
3511 sys.version_info is a tuple (major, minor, micro, level, serial).
3513 Dictionaries have an odd new method, setdefault(key, default).
3514 dict.setdefault(key, default) returns dict[key] if it exists; if not,
3515 it sets dict[key] to default and returns that value.  Thus:
3517     dict.setdefault(key, []).append(item)
3519 does the same work as this common idiom:
3521     if not dict.has_key(key):
3522         dict[key] = []
3523     dict[key].append(item)
3525 There are two new variants of SyntaxError that are raised for
3526 indentation-related errors: IndentationError and TabError.
3528 Changed \x to consume exactly two hex digits; see PEP 223.  Added \U
3529 escape that consumes exactly eight hex digits.
3531 The limits on the size of expressions and file in Python source code
3532 have been raised from 2**16 to 2**32.  Previous versions of Python
3533 were limited because the maximum argument size the Python VM accepted
3534 was 2**16.  This limited the size of object constructor expressions,
3535 e.g. [1,2,3] or {'a':1, 'b':2}, and the size of source files.  This
3536 limit was raised thanks to a patch by Charles Waldman that effectively
3537 fixes the problem.  It is now much more likely that you will be
3538 limited by available memory than by an arbitrary limit in Python.
3540 The interpreter's maximum recursion depth can be modified by Python
3541 programs using sys.getrecursionlimit and sys.setrecursionlimit.  This
3542 limit is the maximum number of recursive calls that can be made by
3543 Python code.  The limit exists to prevent infinite recursion from
3544 overflowing the C stack and causing a core dump.  The default value is
3545 1000.  The maximum safe value for a particular platform can be found
3546 by running Misc/find_recursionlimit.py.
3548 New Modules and Packages
3549 ------------------------
3551 atexit - for registering functions to be called when Python exits.
3553 imputil - Greg Stein's alternative API for writing custom import
3554 hooks.
3556 pyexpat - an interface to the Expat XML parser, contributed by Paul
3557 Prescod.
3559 xml - a new package with XML support code organized (so far) in three
3560 subpackages: xml.dom, xml.sax, and xml.parsers.  Describing these
3561 would fill a volume.  There's a special feature whereby a
3562 user-installed package named _xmlplus overrides the standard
3563 xmlpackage; this is intended to give the XML SIG a hook to distribute
3564 backwards-compatible updates to the standard xml package.
3566 webbrowser - a platform-independent API to launch a web browser.
3569 Changed Modules
3570 ---------------
3572 array -- new methods for array objects: count, extend, index, pop, and
3573 remove
3575 binascii -- new functions b2a_hex and a2b_hex that convert between
3576 binary data and its hex representation
3578 calendar -- Many new functions that support features including control
3579 over which day of the week is the first day, returning strings instead
3580 of printing them.  Also new symbolic constants for days of week,
3581 e.g. MONDAY, ..., SUNDAY.
3583 cgi -- FieldStorage objects have a getvalue method that works like a
3584 dictionary's get method and returns the value attribute of the object.
3586 ConfigParser -- The parser object has new methods has_option,
3587 remove_section, remove_option, set, and write.  They allow the module
3588 to be used for writing config files as well as reading them.
3590 ftplib -- ntransfercmd(), transfercmd(), and retrbinary() all now
3591 optionally support the RFC 959 REST command.
3593 gzip -- readline and readlines now accept optional size arguments
3595 httplib -- New interfaces and support for HTTP/1.1 by Greg Stein.  See
3596 the module doc strings for details.
3598 locale -- implement getdefaultlocale for Win32 and Macintosh
3600 marshal -- no longer dumps core when marshaling deeply nested or
3601 recursive data structures
3603 os -- new functions isatty, seteuid, setegid, setreuid, setregid
3605 os/popen2 -- popen2/popen3/popen4 support under Windows.  popen2/popen3
3606 support under Unix.
3608 os/pty -- support for openpty and forkpty
3610 os.path -- fix semantics of os.path.commonprefix
3612 smtplib -- support for sending very long messages
3614 socket -- new function getfqdn()
3616 readline -- new functions to read, write and truncate history files.
3617 The readline section of the library reference manual contains an
3618 example.
3620 select -- add interface to poll system call
3622 shutil -- new copyfileobj function
3624 SimpleHTTPServer, CGIHTTPServer -- Fix problems with buffering in the
3625 HTTP server.
3627 Tkinter -- optimization of function flatten
3629 urllib -- scans environment variables for proxy configuration,
3630 e.g. http_proxy.
3632 whichdb -- recognizes dumbdbm format
3635 Obsolete Modules
3636 ----------------
3638 None.  However note that 1.6 made a whole slew of modules obsolete:
3639 stdwin, soundex, cml, cmpcache, dircache, dump, find, grep, packmail,
3640 poly, zmod, strop, util, whatsound.
3643 Changed, New, Obsolete Tools
3644 ----------------------------
3646 None.
3649 C-level Changes
3650 ---------------
3652 Several cleanup jobs were carried out throughout the source code.
3654 All C code was converted to ANSI C; we got rid of all uses of the
3655 Py_PROTO() macro, which makes the header files a lot more readable.
3657 Most of the portability hacks were moved to a new header file,
3658 pyport.h; several other new header files were added and some old
3659 header files were removed, in an attempt to create a more rational set
3660 of header files.  (Few of these ever need to be included explicitly;
3661 they are all included by Python.h.)
3663 Trent Mick ensured portability to 64-bit platforms, under both Linux
3664 and Win64, especially for the new Intel Itanium processor.  Mick also
3665 added large file support for Linux64 and Win64.
3667 The C APIs to return an object's size have been update to consistently
3668 use the form PyXXX_Size, e.g. PySequence_Size and PyDict_Size.  In
3669 previous versions, the abstract interfaces used PyXXX_Length and the
3670 concrete interfaces used PyXXX_Size.  The old names,
3671 e.g. PyObject_Length, are still available for backwards compatibility
3672 at the API level, but are deprecated.
3674 The PyOS_CheckStack function has been implemented on Windows by
3675 Fredrik Lundh.  It prevents Python from failing with a stack overflow
3676 on Windows.
3678 The GC changes resulted in creation of two new slots on object,
3679 tp_traverse and tp_clear.  The augmented assignment changes result in
3680 the creation of a new slot for each in-place operator.
3682 The GC API creates new requirements for container types implemented in
3683 C extension modules.  See Include/objimpl.h for details.
3685 PyErr_Format has been updated to automatically calculate the size of
3686 the buffer needed to hold the formatted result string.  This change
3687 prevents crashes caused by programmer error.
3689 New C API calls: PyObject_AsFileDescriptor, PyErr_WriteUnraisable.
3691 PyRun_AnyFileEx, PyRun_SimpleFileEx, PyRun_FileEx -- New functions
3692 that are the same as their non-Ex counterparts except they take an
3693 extra flag argument that tells them to close the file when done.
3695 XXX There were other API changes that should be fleshed out here.
3698 Windows Changes
3699 ---------------
3701 New popen2/popen3/peopen4 in os module (see Changed Modules above).
3703 os.popen is much more usable on Windows 95 and 98.  See Microsoft
3704 Knowledge Base article Q150956.  The Win9x workaround described there
3705 is implemented by the new w9xpopen.exe helper in the root of your
3706 Python installation.  Note that Python uses this internally; it is not
3707 a standalone program.
3709 Administrator privileges are no longer required to install Python
3710 on Windows NT or Windows 2000.  If you have administrator privileges,
3711 Python's registry info will be written under HKEY_LOCAL_MACHINE.
3712 Otherwise the installer backs off to writing Python's registry info
3713 under HKEY_CURRENT_USER.  The latter is sufficient for all "normal"
3714 uses of Python, but will prevent some advanced uses from working
3715 (for example, running a Python script as an NT service, or possibly
3716 from CGI).
3718 [This was new in 1.6] The installer no longer runs a separate Tcl/Tk
3719 installer; instead, it installs the needed Tcl/Tk files directly in the
3720 Python directory.  If you already have a Tcl/Tk installation, this
3721 wastes some disk space (about 4 Megs) but avoids problems with
3722 conflicting Tcl/Tk installations, and makes it much easier for Python
3723 to ensure that Tcl/Tk can find all its files.
3725 [This was new in 1.6] The Windows installer now installs by default in
3726 \Python20\ on the default volume, instead of \Program Files\Python-2.0\.
3729 Updates to the changes between 1.5.2 and 1.6
3730 --------------------------------------------
3732 The 1.6 NEWS file can't be changed after the release is done, so here
3733 is some late-breaking news:
3735 New APIs in locale.py: normalize(), getdefaultlocale(), resetlocale(),
3736 and changes to getlocale() and setlocale().
3738 The new module is now enabled per default.
3740 It is not true that the encodings codecs cannot be used for normal
3741 strings: the string.encode() (which is also present on 8-bit strings
3742 !) allows using them for 8-bit strings too, e.g. to convert files from
3743 cp1252 (Windows) to latin-1 or vice-versa.
3745 Japanese codecs are available from Tamito KAJIYAMA:
3746 http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/python/
3749 ======================================================================