blob: f2452f2b973b3d79dcf179b55c31b8aeb2094080 [file] [log] [blame]
Guido van Rossuma598c932000-09-04 16:26:03 +00001Python History
Guido van Rossuma7925f11994-01-26 10:20:16 +00002--------------
3
Guido van Rossum439d1fa1998-12-21 21:41:14 +00004This file contains the release messages for previous Python releases.
5As you read on you go back to the dark ages of Python's history.
6
7
8======================================================================
9
10
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000011What's New in Python 2.4 final?
12===============================
13
14*Release date: 30-NOV-2004*
15
16Core and builtins
17-----------------
18
19- Bug 875692: Improve signal handling, especially when using threads, by
20 forcing an early re-execution of PyEval_EvalFrame() "periodic" code when
21 things_to_do is not cleared by Py_MakePendingCalls().
22
23
24What's New in Python 2.4 (release candidate 1)
25==============================================
26
27*Release date: 18-NOV-2004*
28
29Core and builtins
30-----------------
31
32- Bug 1061968: Fixes in 2.4a3 to address thread bug 1010677 reintroduced
33 the years-old thread shutdown race bug 225673. Numeric history lesson
34 aside, all bugs in all three reports are fixed now.
35
36
37Library
38-------
39
40- Bug 1052242: If exceptions are raised by an atexit handler function an
41 attempt is made to execute the remaining handlers. The last exception
42 raised is re-raised.
43
44- ``doctest``'s new support for adding ``pdb.set_trace()`` calls to
45 doctests was broken in a dramatic but shallow way. Fixed.
46
47- Bug 1065388: ``calendar``'s ``day_name``, ``day_abbr``, ``month_name``,
48 and ``month_abbr`` attributes emulate sequences of locale-correct
49 spellings of month and day names. Because the locale can change at
50 any time, the correct spelling is recomputed whenever one of these is
51 indexed. In the worst case, the index may be a slice object, so these
52 recomputed every day or month name each time they were indexed. This is
53 much slower than necessary in the usual case, when the index is just an
54 integer. In that case, only the single spelling needed is recomputed
55 now; and, when the index is a slice object, only the spellings needed
56 by the slice are recomputed now.
57
58- Patch 1061679: Added ``__all__`` to pickletools.py.
59
60Build
61-----
62
63- Bug 1034277 / Patch 1035255: Remove compilation of core against CoreServices
64 and CoreFoundation on OS X. Involved removing PyMac_GetAppletScriptFile()
65 which has no known users. Thanks Bob Ippolito.
66
67C API
68-----
69
70- The PyRange_New() function is deprecated.
71
72
73What's New in Python 2.4 beta 2?
74================================
75
76*Release date: 03-NOV-2004*
77
78License
79-------
80
81The Python Software Foundation changed the license under which Python
82is released, to remove Python version numbers. There were no other
83changes to the license. So, for example, wherever the license for
84Python 2.3 said "Python 2.3", the new license says "Python". The
85intent is to make it possible to refer to the PSF license in a more
86durable way. For example, some people say they're confused by that
87the Open Source Initiative's entry for the Python Software Foundation
88License::
89
90 http://www.opensource.org/licenses/PythonSoftFoundation.php
91
92says "Python 2.1.1" all over it, wondering whether it applies only
93to Python 2.1.1.
94
95The official name of the new license is the Python Software Foundation
96License Version 2.
97
98Core and builtins
99-----------------
100
101- Bug #1055820 Cyclic garbage collection was not protecting against that
102 calling a live weakref to a piece of cyclic trash could resurrect an
103 insane mutation of the trash if any Python code ran during gc (via
104 running a dead object's __del__ method, running another callback on a
105 weakref to a dead object, or via any Python code run in any other thread
106 that managed to obtain the GIL while a __del__ or callback was running
107 in the thread doing gc). The most likely symptom was "impossible"
108 ``AttributeError`` exceptions, appearing seemingly at random, on weakly
109 referenced objects. The cure was to clear all weakrefs to unreachable
110 objects before allowing any callbacks to run.
111
112- Bug #1054139 _PyString_Resize() now invalidates its cached hash value.
113
114Extension Modules
115-----------------
116
117- Bug #1048870: the compiler now generates distinct code objects for
118 functions with identical bodies. This was producing confusing
119 traceback messages which pointed to the function where the code
120 object was first defined rather than the function being executed.
121
122Library
123-------
124
125- Patch #1056967 changes the semantics of Template.safe_substitute() so that
126 no ValueError is raised on an 'invalid' match group. Now the delimiter is
127 returned.
128
129- Bug #1052503 pdb.runcall() was not passing along keyword arguments.
130
131- Bug #902037: XML.sax.saxutils.prepare_input_source() now combines relative
132 paths with a base path before checking os.path.isfile().
133
134- The whichdb module can now be run from the command line.
135
136- Bug #1045381: time.strptime() can now infer the date using %U or %W (week of
137 the year) when the day of the week and year are also specified.
138
139- Bug #1048816: fix bug in Ctrl-K at start of line in curses.textpad.Textbox
140
141- Bug #1017553: fix bug in tarfile.filemode()
142
143- Patch #737473: fix bug that old source code is shown in tracebacks even if
144 the source code is updated and reloaded.
145
146Build
147-----
148
149- Patch #1044395: --enable-shared is allowed in FreeBSD also.
150
151What's New in Python 2.4 beta 1?
152================================
153
154*Release date: 15-OCT-2004*
155
156Core and builtins
157-----------------
158
159- Patch #975056: Restartable signals were not correctly disabled on
160 BSD systems. Consistently use PyOS_setsig() instead of signal().
161
162- The internal portable implementation of thread-local storage (TLS), used
163 by the ``PyGILState_Ensure()``/``PyGILState_Release()`` API, was not
164 thread-correct. This could lead to a variety of problems, up to and
165 including segfaults. See bug 1041645 for an example.
166
167- Added a command line option, -m module, which searches sys.path for the
168 module and then runs it. (Contributed by Nick Coghlan.)
169
170- The bytecode optimizer now folds tuples of constants into a single
171 constant.
172
173- SF bug #513866: Float/long comparison anomaly. Prior to 2.4b1, when
174 an integer was compared to a float, the integer was coerced to a float.
175 That could yield spurious overflow errors (if the integer was very
176 large), and to anomalies such as
177 ``long(1e200)+1 == 1e200 == long(1e200)-1``. Coercion to float is no
178 longer performed, and cases like ``long(1e200)-1 < 1e200``,
179 ``long(1e200)+1 > 1e200`` and ``(1 << 20000) > 1e200`` are computed
180 correctly now.
181
182Extension modules
183-----------------
184
185- ``collections.deque`` objects didn't play quite right with garbage
186 collection, which could lead to a segfault in a release build, or
187 an assert failure in a debug build. Also, added overflow checks,
188 better detection of mutation during iteration, and shielded deque
189 comparisons from unusual subclass overrides of the __iter__() method.
190
191Library
192-------
193
194- Patch 1046644: distutils build_ext grew two new options - --swig for
195 specifying the swig executable to use, and --swig-opts to specify
196 options to pass to swig. --swig-opts="-c++" is the new way to spell
197 --swig-cpp.
198
199- Patch 983206: distutils now obeys environment variable LDSHARED, if
200 it is set.
201
202- Added Peter Astrand's subprocess.py module. See PEP 324 for details.
203
204- time.strptime() now properly escapes timezones and all other locale-specific
205 strings for regex-specific symbols. Was breaking under Japanese Windows when
206 the timezone was specified as "Tokyo (standard time)".
207 Closes bug #1039270.
208
209- Updates for the email package:
210
211 + email.Utils.formatdate() grew a 'usegmt' argument for HTTP support.
212 + All deprecated APIs that in email 2.x issued warnings have been removed:
213 _encoder argument to the MIMEText constructor, Message.add_payload(),
214 Utils.dump_address_pair(), Utils.decode(), Utils.encode()
215 + New deprecations: Generator.__call__(), Message.get_type(),
216 Message.get_main_type(), Message.get_subtype(), the 'strict' argument to
217 the Parser constructor. These will be removed in email 3.1.
218 + Support for Python earlier than 2.3 has been removed (see PEP 291).
219 + All defect classes have been renamed to end in 'Defect'.
220 + Some FeedParser fixes; also a MultipartInvariantViolationDefect will be
221 added to messages that claim to be multipart but really aren't.
222 + Updates to documentation.
223
224- re's findall() and finditer() functions now take an optional flags argument
225 just like the compile(), search(), and match() functions. Also, documented
226 the previously existing start and stop parameters for the findall() and
227 finditer() methods of regular expression objects.
228
229- rfc822 Messages now support iterating over the headers.
230
231- The (undocumented) tarfile.Tarfile.membernames has been removed;
232 applications should use the getmember function.
233
234- httplib now offers symbolic constants for the HTTP status codes.
235
236- SF bug #1028306: Trying to compare a ``datetime.date`` to a
237 ``datetime.datetime`` mistakenly compared only the year, month and day.
238 Now it acts like a mixed-type comparison: ``False`` for ``==``,
239 ``True`` for ``!=``, and raises ``TypeError`` for other comparison
240 operators. Because datetime is a subclass of date, comparing only the
241 base class (date) members can still be done, if that's desired, by
242 forcing using of the approprate date method; e.g.,
243 ``a_date.__eq__(a_datetime)`` is true if and only if the year, month
244 and day members of ``a_date`` and ``a_datetime`` are equal.
245
246- bdist_rpm now supports command line options --force-arch,
247 {pre,post}-install, {pre,post}-uninstall, and
248 {prep,build,install,clean,verify}-script.
249
250- SF patch #998993: The UTF-8 and the UTF-16 stateful decoders now support
251 decoding incomplete input (when the input stream is temporarily exhausted).
252 ``codecs.StreamReader`` now implements buffering, which enables proper
253 readline support for the UTF-16 decoders. ``codecs.StreamReader.read()``
254 has a new argument ``chars`` which specifies the number of characters to
255 return. ``codecs.StreamReader.readline()`` and
256 ``codecs.StreamReader.readlines()`` have a new argument ``keepends``.
257 Trailing "\n"s will be stripped from the lines if ``keepends`` is false.
258
259- The documentation for doctest is greatly expanded, and now covers all
260 the new public features (of which there are many).
261
262- ``doctest.master`` was put back in, and ``doctest.testmod()`` once again
263 updates it. This isn't good, because every ``testmod()`` call
264 contributes to bloating the "hidden" state of ``doctest.master``, but
265 some old code apparently relies on it. For now, all we can do is
266 encourage people to stitch doctests together via doctest's unittest
267 integration features instead.
268
269- httplib now handles ipv6 address/port pairs.
270
271- SF bug #1017864: ConfigParser now correctly handles default keys,
272 processing them with ``ConfigParser.optionxform`` when supplied,
273 consistent with the handling of config file entries and runtime-set
274 options.
275
276- SF bug #997050: Document, test, & check for non-string values in
277 ConfigParser. Moved the new string-only restriction added in
278 rev. 1.65 to the SafeConfigParser class, leaving existing
279 ConfigParser & RawConfigParser behavior alone, and documented the
280 conditions under which non-string values work.
281
282Build
283-----
284
285- Building on darwin now includes /opt/local/include and /opt/local/lib for
286 building extension modules. This is so as to include software installed as
287 a DarwinPorts port <http://darwinports.opendarwin.org/>
288
289- pyport.h now defines a Py_IS_NAN macro. It works as-is when the
290 platform C computes true for ``x != x`` if and only if X is a NaN.
291 Other platforms can override the default definition with a platform-
292 specific spelling in that platform's pyconfig.h. You can also override
293 pyport.h's default Py_IS_INFINITY definition now.
294
295C API
296-----
297
298- SF patch 1044089: New function ``PyEval_ThreadsInitialized()`` returns
299 non-zero if PyEval_InitThreads() has been called.
300
301- The undocumented and unused extern int ``_PyThread_Started`` was removed.
302
303- The C API calls ``PyInterpreterState_New()`` and ``PyThreadState_New()``
304 are two of the very few advertised as being safe to call without holding
305 the GIL. However, this wasn't true in a debug build, as bug 1041645
306 demonstrated. In a debug build, Python redirects the ``PyMem`` family
307 of calls to Python's small-object allocator, to get the benefit of
308 its extra debugging capabilities. But Python's small-object allocator
309 isn't threadsafe, relying on the GIL to avoid the expense of doing its
310 own locking. ``PyInterpreterState_New()`` and ``PyThreadState_New()``
311 call the platform ``malloc()`` directly now, regardless of build type.
312
313- PyLong_AsUnsignedLong[Mask] now support int objects as well.
314
315- SF patch #998993: ``PyUnicode_DecodeUTF8Stateful`` and
316 ``PyUnicode_DecodeUTF16Stateful`` have been added, which implement stateful
317 decoding.
318
319Tests
320-----
321
322- test__locale ported to unittest
323
324Mac
325---
326
327- ``plistlib`` now supports non-dict root objects. There is also a new
328 interface for reading and writing plist files: ``readPlist(pathOrFile)``
329 and ``writePlist(rootObject, pathOrFile)``
330
331Tools/Demos
332-----------
333
334- The text file comparison scripts ``ndiff.py`` and ``diff.py`` now
335 read the input files in universal-newline mode. This spares them
336 from consuming a great deal of time to deduce the useless result that,
337 e.g., a file with Windows line ends and a file with Linux line ends
338 have no lines in common.
339
340
341What's New in Python 2.4 alpha 3?
342=================================
343
344*Release date: 02-SEP-2004*
345
346Core and builtins
347-----------------
348
349- SF patch #1007189: ``from ... import ...`` statements now allow the name
350 list to be surrounded by parentheses.
351
352- Some speedups for long arithmetic, thanks to Trevor Perrin. Gradeschool
353 multiplication was sped a little by optimizing the C code. Gradeschool
354 squaring was sped by about a factor of 2, by exploiting that about half
355 the digit products are duplicates in a square. Because exponentiation
356 uses squaring often, this also speeds long power. For example, the time
357 to compute 17**1000000 dropped from about 14 seconds to 9 on my box due
358 to this much. The cutoff for Karatsuba multiplication was raised,
359 since gradeschool multiplication got quicker, and the cutoff was
360 aggressively small regardless. The exponentiation algorithm was switched
361 from right-to-left to left-to-right, which is more efficient for small
362 bases. In addition, if the exponent is large, the algorithm now does
363 5 bits (instead of 1 bit) at a time. That cut the time to compute
364 17**1000000 on my box in half again, down to about 4.5 seconds.
365
366- OverflowWarning is no longer generated. PEP 237 scheduled this to
367 occur in Python 2.3, but since OverflowWarning was disabled by default,
368 nobody realized it was still being generated. On the chance that user
369 code is still using them, the Python builtin OverflowWarning, and
370 corresponding C API PyExc_OverflowWarning, will exist until Python 2.5.
371
372- Py_InitializeEx has been added.
373
374- Fix the order of application of decorators. The proper order is bottom-up;
375 the first decorator listed is the last one called.
376
377- SF patch #1005778. Fix a seg fault if the list size changed while
378 calling list.index(). This could happen if a rich comparison function
379 modified the list.
380
381- The ``func_name`` (a.k.a. ``__name__``) attribute of user-defined
382 functions is now writable.
383
384- code_new (a.k.a new.code()) now checks its arguments sufficiently
385 carefully that passing them on to PyCode_New() won't trigger calls
386 to Py_FatalError() or PyErr_BadInternalCall(). It is still the case
387 that the returned code object might be entirely insane.
388
389- Subclasses of string can no longer be interned. The semantics of
390 interning were not clear here -- a subclass could be mutable, for
391 example -- and had bugs. Explicitly interning a subclass of string
392 via intern() will raise a TypeError. Internal operations that attempt
393 to intern a string subclass will have no effect.
394
395- Bug 1003935: xrange() could report bogus OverflowErrors. Documented
396 what xrange() intends, and repaired tests accordingly.
397
398Extension modules
399-----------------
400
401- difflib now supports HTML side-by-side diff.
402
403- os.urandom has been added for systems that support sources of random
404 data.
405
406- Patch 1012740: truncate() on a writeable cStringIO now resets the
407 position to the end of the stream. This is consistent with the original
408 StringIO module and avoids inadvertently resurrecting data that was
409 supposed to have been truncated away.
410
411- Added socket.socketpair().
412
413- Added CurrentByteIndex, CurrentColumnNumber, CurrentLineNumber
414 members to xml.parsers.expat.XMLParser object.
415
416- The mpz, rotor, and xreadlines modules, all deprecated in earlier
417 versions of Python, have now been removed.
418
419Library
420-------
421
422- Patch #934356: if a module defines __all__, believe that rather than using
423 heuristics for filtering out imported names.
424
425- Patch #941486: added os.path.lexists(), which returns True for broken
426 symlinks, unlike os.path.exists().
427
428- the random module now uses os.urandom() for seeding if it is available.
429 Added a new generator based on os.urandom().
430
431- difflib and diff.py can now generate HTML.
432
433- bdist_rpm now includes version and release in the BuildRoot, and
434 replaces - by ``_`` in version and release.
435
436- distutils build/build_scripts now has an -e option to specify the
437 path to the Python interpreter for installed scripts.
438
439- PEP 292 classes Template and SafeTemplate are added to the string module.
440
441- tarfile now generates GNU tar files by default.
442
443- HTTPResponse has now a getheaders method.
444
445- Patch #1006219: let inspect.getsource handle '@' decorators. Thanks Simon
446 Percivall.
447
448- logging.handlers.SMTPHandler.date_time has been removed;
449 the class now uses email.Utils.formatdate to generate the time stamp.
450
451- A new function tkFont.nametofont was added to return an existing
452 font. The Font class constructor now has an additional exists argument
453 which, if True, requests to return/configure an existing font, rather
454 than creating a new one.
455
456- Updated the decimal package's min() and max() methods to match the
457 latest revision of the General Decimal Arithmetic Specification.
458 Quiet NaNs are ignored and equal values are sorted based on sign
459 and exponent.
460
461- The decimal package's Context.copy() method now returns deep copies.
462
463- Deprecated sys.exitfunc in favor of the atexit module. The sys.exitfunc
464 attribute will be kept around for backwards compatibility and atexit
465 will just become the one preferred way to do it.
466
467- patch #675551: Add get_history_item and replace_history_item functions
468 to the readline module.
469
470- bug #989672: pdb.doc and the help messages for the help_d and help_u methods
471 of the pdb.Pdb class gives have been corrected. d(own) goes to a newer
472 frame, u(p) to an older frame, not the other way around.
473
474- bug #990669: os.path.realpath() will resolve symlinks before normalizing the
475 path, as normalizing the path may alter the meaning of the path if it
476 contains symlinks.
477
478- bug #851123: shutil.copyfile will raise an exception when trying to copy a
479 file onto a link to itself. Thanks Gregory Ball.
480
481- bug #570300: Fix inspect to resolve file locations using os.path.realpath()
482 so as to properly list all functions in a module when the module itself is
483 reached through a symlink. Thanks Johannes Gijsbers.
484
485- doctest refactoring continued. See the docs for details. As part of
486 this effort, some old and little- (never?) used features are now
487 deprecated: the Tester class, the module is_private() function, and the
488 isprivate argument to testmod(). The Tester class supplied a feeble
489 "by hand" way to combine multiple doctests, if you knew exactly what
490 you were doing. The newer doctest features for unittest integration
491 already did a better job of that, are stronger now than ever, and the
492 new DocTestRunner class is a saner foundation if you want to do it by
493 hand. The "private name" filtering gimmick was a mistake from the
494 start, and testmod() changed long ago to ignore it by default. If
495 you want to filter out tests, the new DocTestFinder class can be used
496 to return a list of all doctests, and you can filter that list by
497 any computable criteria before passing it to a DocTestRunner instance.
498
499- Bug #891637, patch #1005466: fix inspect.getargs() crash on def foo((bar)).
500
501Tools/Demos
502-----------
503
504- IDLE's shortcut keys for windows are now case insensitive so that
505 Control-V works the same as Control-v.
506
507- pygettext.py: Generate POT-Creation-Date header in ISO format.
508
509Build
510-----
511
512- Backward incompatibility: longintrepr.h now triggers a compile-time
513 error if SHIFT (the number of bits in a Python long "digit") isn't
514 divisible by 5. This new requirement allows simple code for the new
515 5-bits-at-a-time long_pow() implementation. If necessary, the
516 restriction could be removed (by complicating long_pow(), or by
517 falling back to the 1-bit-at-a-time algorithm), but there are no
518 plans to do so.
519
520- bug #991962: When building with --disable-toolbox-glue on Darwin no
521 attempt to build Mac-specific modules occurs.
522
523- The --with-tsc flag to configure to enable VM profiling with the
524 processor's timestamp counter now works on PPC platforms.
525
526- patch #1006629: Define _XOPEN_SOURCE to 500 on Solaris 8/9 to match
527 GCC's definition and avoid redefinition warnings.
528
529- Detect pthreads support (provided by gnu pth pthread emulation) on
530 GNU/k*BSD systems.
531
532- bug #1005737, #1007249: Fixed several build problems and warnings
533 found on old/legacy C compilers of HP-UX, IRIX and Tru64.
534
535C API
536-----
537
538..
539
540Documentation
541-------------
542
543- patch #1005936, bug #1009373: fix index entries which contain
544 an underscore when viewed with Acrobat.
545
546- bug #990669: os.path.normpath may alter the meaning of a path if
547 it contains symbolic links. This has been documented in a comment
548 since 1992, but is now in the library reference as well.
549
550New platforms
551-------------
552
553- FreeBSD 6 is now supported.
554
555Tests
556-----
557
558..
559
560Windows
561-------
562
563- Boosted the stack reservation for python.exe and pythonw.exe from
564 the default 1MB to 2MB. Stack frames under VC 7.1 for 2.4 are enough
565 bigger than under VC 6.0 for 2.3.4 that deeply recursive progams
566 within the default sys.getrecursionlimit() default value of 1000 were
567 able to suffer undetected C stack overflows. The standard test program
568 test_compiler was one such program. If a Python process on Windows
569 "just vanishes" without a trace, and without an error message of any
570 kind, but with an exit code of 128, undetected stack overflow may be
571 the problem.
572
573Mac
574---
575
576..
577
578
579What's New in Python 2.4 alpha 2?
580=================================
581
582*Release date: 05-AUG-2004*
583
584Core and builtins
585-----------------
586
587- Patch #980695: Implements efficient string concatenation for statements
588 of the form s=s+t and s+=t. This will vary across implementations.
589 Accordingly, the str.join() method is strongly preferred for performance
590 sensitive code.
591
592- PEP-0318, Function Decorators have been added to the language. These are
593 implemented using the Java-style @decorator syntax, like so::
594
595 @staticmethod
596 def foo(bar):
597
598 (The PEP needs to be updated to reflect the current state)
599
600- When importing a module M raises an exception, Python no longer leaves M
601 in sys.modules. Before 2.4a2 it did, and a subsequent import of M would
602 succeed, picking up a module object from sys.modules reflecting as much
603 of the initialization of M as completed before the exception was raised.
604 Subsequent imports got no indication that M was in a partially-
605 initialized state, and the importers could get into arbitrarily bad
606 trouble as a result (the M they got was in an unintended state,
607 arbitrarily far removed from M's author's intent). Now subsequent
608 imports of M will continue raising exceptions (but if, for example, the
609 source code for M is edited between import attempts, then perhaps later
610 attempts will succeed, or raise a different exception).
611
612 This can break existing code, but in such cases the code was probably
613 working before by accident. In the Python source, the only case of
614 breakage discovered was in a test accidentally relying on a damaged
615 module remaining in sys.modules. Cases are also known where tests
616 deliberately provoking import errors remove damaged modules from
617 sys.modules themselves, and such tests will break now if they do an
618 unconditional del sys.modules[M].
619
620- u'%s' % obj will now try obj.__unicode__() first and fallback to
621 obj.__str__() if no __unicode__ method can be found.
622
623- Patch #550732: Add PyArg_VaParseTupleAndKeywords(). Analogous to
624 PyArg_VaParse(). Both are now documented. Thanks Greg Chapman.
625
626- Allow string and unicode return types from .encode()/.decode()
627 methods on string and unicode objects. Added unicode.decode()
628 which was missing for no apparent reason.
629
630- An attempt to fix the mess that is Python's behaviour with
631 signal handlers and threads, complicated by readline's behaviour.
632 It's quite possible that there are still bugs here.
633
634- Added C macros Py_CLEAR and Py_VISIT to ease the implementation of
635 types that support garbage collection.
636
637- Compiler now treats None as a constant.
638
639- The type of values returned by __int__, __float__, __long__,
640 __oct__, and __hex__ are now checked. Returning an invalid type
641 will cause a TypeError to be raised. This matches the behavior of
642 Jython.
643
644- Implemented bind_textdomain_codeset() in locale module.
645
646- Added a workaround for proper string operations in BSDs. str.split
647 and str.is* methods can now work correctly with UTF-8 locales.
648
649- Bug #989185: unicode.iswide() and unicode.width() is dropped and
650 the East Asian Width support is moved to unicodedata extension
651 module.
652
653- Patch #941229: The source code encoding in interactive mode
654 now refers sys.stdin.encoding not just ISO-8859-1 anymore. This
655 allows for non-latin-1 users to write unicode strings directly.
656
657Extension modules
658-----------------
659
660- cpickle now supports the same keyword arguments as pickle.
661
662Library
663-------
664
665- Added new codecs and aliases for ISO_8859-11, ISO_8859-16 and
666 TIS-620
667
668- Thanks to Edward Loper, doctest has been massively refactored, and
669 many new features were added. Full docs will appear later. For now
670 the doctest module comments and new test cases give good coverage.
671 The refactoring provides many hook points for customizing behavior
672 (such as how to report errors, and how to compare expected to actual
673 output). New features include a <BLANKLINE> marker for expected
674 output containing blank lines, options to produce unified or context
675 diffs when actual output doesn't match expectations, an option to
676 normalize whitespace before comparing, and an option to use an
677 ellipsis to signify "don't care" regions of output.
678
679- Tkinter now supports the wish -sync and -use options.
680
681- The following methods in time support passing of None: ctime(), gmtime(),
682 and localtime(). If None is provided, the current time is used (the
683 same as when the argument is omitted).
684 [SF bug 658254, patch 663482]
685
686- nntplib does now allow to ignore a .netrc file.
687
688- urllib2 now recognizes Basic authentication even if other authentication
689 schemes are offered.
690
691- Bug #1001053. wave.open() now accepts unicode filenames.
692
693- gzip.GzipFile has a new fileno() method, to retrieve the handle of the
694 underlying file object (provided it has a fileno() method). This is
695 needed if you want to use os.fsync() on a GzipFile.
696
697- imaplib has two new methods: deleteacl and myrights.
698
699- nntplib has two new methods: description and descriptions. They
700 use a more RFC-compliant way of getting a newsgroup description.
701
702- Bug #993394. Fix a possible red herring of KeyError in 'threading' being
703 raised during interpreter shutdown from a registered function with atexit
704 when dummy_threading is being used.
705
706- Bug #857297/Patch #916874. Fix an error when extracting a hard link
707 from a tarfile.
708
709- Patch #846659. Fix an error in tarfile.py when using
710 GNU longname/longlink creation.
711
712- The obsolete FCNTL.py has been deleted. The builtin fcntl module
713 has been available (on platforms that support fcntl) since Python
714 1.5a3, and all FCNTL.py did is export fcntl's names, after generating
715 a deprecation warning telling you to use fcntl directly.
716
717- Several new unicode codecs are added: big5hkscs, euc_jis_2004,
718 iso2022_jp_2004, shift_jis_2004.
719
720- Bug #788520. Queue.{get, get_nowait, put, put_nowait} have new
721 implementations, exploiting Conditions (which didn't exist at the time
722 Queue was introduced). A minor semantic change is that the Full and
723 Empty exceptions raised by non-blocking calls now occur only if the
724 queue truly was full or empty at the instant the queue was checked (of
725 course the Queue may no longer be full or empty by the time a calling
726 thread sees those exceptions, though). Before, the exceptions could
727 also be raised if it was "merely inconvenient" for the implementation
728 to determine the true state of the Queue (because the Queue was locked
729 by some other method in progress).
730
731- Bugs #979794 and #980117: difflib.get_grouped_opcodes() now handles the
732 case of comparing two empty lists. This affected both context_diff() and
733 unified_diff(),
734
735- Bug #980938: smtplib now prints debug output to sys.stderr.
736
737- Bug #930024: posixpath.realpath() now handles infinite loops in symlinks by
738 returning the last point in the path that was not part of any loop. Thanks
739 AM Kuchling.
740
741- Bug #980327: ntpath not handles compressing erroneous slashes between the
742 drive letter and the rest of the path. Also clearly handles UNC addresses now
743 as well. Thanks Paul Moore.
744
745- bug #679953: zipfile.py should now work for files over 2 GB. The packed data
746 for file sizes (compressed and uncompressed) was being stored as signed
747 instead of unsigned.
748
749- decimal.py now only uses signals in the IBM spec. The other conditions are
750 no longer part of the public API.
751
752- codecs module now has two new generic APIs: encode() and decode()
753 which don't restrict the return types (unlike the unicode and
754 string methods of the same name).
755
756- Non-blocking SSL sockets work again; they were broken in Python 2.3.
757 SF patch 945642.
758
759- doctest unittest integration improvements:
760
761 o Improved the unitest test output for doctest-based unit tests
762
763 o Can now pass setUp and tearDown functions when creating
764 DocTestSuites.
765
766- The threading module has a new class, local, for creating objects
767 that provide thread-local data.
768
769- Bug #990307: when keep_empty_values is True, cgi.parse_qsl()
770 no longer returns spurious empty fields.
771
772- Implemented bind_textdomain_codeset() in gettext module.
773
774- Introduced in gettext module the l*gettext() family of functions,
775 which return translation strings encoded in the preferred encoding,
776 as informed by locale module's getpreferredencoding().
777
778- optparse module (and tests) upgraded to Optik 1.5a1. Changes:
779
780 - Add expansion of default values in help text: the string
781 "%default" in an option's help string is expanded to str() of
782 that option's default value, or "none" if no default value.
783
784 - Bug #955889: option default values that happen to be strings are
785 now processed in the same way as values from the command line; this
786 allows generation of nicer help when using custom types. Can
787 be disabled with parser.set_process_default_values(False).
788
789 - Bug #960515: don't crash when generating help for callback
790 options that specify 'type', but not 'dest' or 'metavar'.
791
792 - Feature #815264: change the default help format for short options
793 that take an argument from e.g. "-oARG" to "-o ARG"; add
794 set_short_opt_delimiter() and set_long_opt_delimiter() methods to
795 HelpFormatter to allow (slight) customization of the formatting.
796
797 - Patch #736940: internationalize Optik: all built-in user-
798 targeted literal strings are passed through gettext.gettext(). (If
799 you want translations (.po files), they're not included with Python
800 -- you'll find them in the Optik source distribution from
801 http://optik.sourceforge.net/ .)
802
803 - Bug #878453: respect $COLUMNS environment variable for
804 wrapping help output.
805
806 - Feature #988122: expand "%prog" in the 'description' passed
807 to OptionParser, just like in the 'usage' and 'version' strings.
808 (This is *not* done in the 'description' passed to OptionGroup.)
809
810C API
811-----
812
813- PyImport_ExecCodeModule() and PyImport_ExecCodeModuleEx(): if an
814 error occurs while loading the module, these now delete the module's
815 entry from sys.modules. All ways of loading modules eventually call
816 one of these, so this is an error-case change in semantics for all
817 ways of loading modules. In rare cases, a module loader may wish
818 to keep a module object in sys.modules despite that the module's
819 code cannot be executed. In such cases, the module loader must
820 arrange to reinsert the name and module object in sys.modules.
821 PyImport_ReloadModule() has been changed to reinsert the original
822 module object into sys.modules if the module reload fails, so that
823 its visible semantics have not changed.
824
825- A large pile of datetime field-extraction macros is now documented,
826 thanks to Anthony Tuininga (patch #986010).
827
828Documentation
829-------------
830
831- Improved the tutorial on creating types in C.
832
833 - point out the importance of reassigning data members before
834 assigning their values
835
836 - correct my misconception about return values from visitprocs. Sigh.
837
838 - mention the labor saving Py_VISIT and Py_CLEAR macros.
839
840- Major rewrite of the math module docs, to address common confusions.
841
842Tests
843-----
844
845- The test data files for the decimal test suite are now installed on
846 platforms that use the Makefile.
847
848- SF patch 995225: The test file testtar.tar accidentally contained
849 CVS keywords (like $Id$), which could cause spurious failures in
850 test_tarfile.py depending on how the test file was checked out.
851
852
853What's New in Python 2.4 alpha 1?
854=================================
855
856*Release date: 08-JUL-2004*
857
858Core and builtins
859-----------------
860
861- weakref.ref is now the type object also known as
862 weakref.ReferenceType; it can be subclassed like any other new-style
863 class. There's less per-entry overhead in WeakValueDictionary
864 objects now (one object instead of three).
865
866- Bug #951851: Python crashed when reading import table of certain
867 Windows DLLs.
868
869- Bug #215126. The locals argument to eval(), execfile(), and exec now
870 accept any mapping type.
871
872- marshal now shares interned strings. This change introduces
873 a new .pyc magic.
874
875- Bug #966623. classes created with type() in an exec(, {}) don't
876 have a __module__, but code in typeobject assumed it would always
877 be there.
878
879- Python no longer relies on the LC_NUMERIC locale setting to be
880 the "C" locale; as a result, it no longer tries to prevent changing
881 the LC_NUMERIC category.
882
883- Bug #952807: Unpickling pickled instances of subclasses of
884 datetime.date, datetime.datetime and datetime.time could yield insane
885 objects. Thanks to Jiwon Seo for a fix.
886
887- Bug #845802: Python crashes when __init__.py is a directory.
888
889- Unicode objects received two new methods: iswide() and width().
890 These query East Asian width information, as specified in Unicode
891 TR11.
892
893- Improved the tuple hashing algorithm to give fewer collisions in
894 common cases. Fixes bug #942952.
895
896- Implemented generator expressions (PEP 289). Coded by Jiwon Seo.
897
898- Enabled the profiling of C extension functions (and builtins) - check
899 new documentation and modified profile and bdb modules for more details
900
901- Set file.name to the object passed to open (instead of a new string)
902
903- Moved tracebackobject into traceback.h and renamed to PyTracebackObject
904
905- Optimized the byte coding for multiple assignments like "a,b=b,a" and
906 "a,b,c=1,2,3". Improves their speed by 25% to 30%.
907
908- Limit the nested depth of a tuple for the second argument to isinstance()
909 and issubclass() to the recursion limit of the interpreter.
910 Fixes bug #858016 .
911
912- Optimized dict iterators, creating separate types for each
913 and having them reveal their length. Also optimized the
914 methods: keys(), values(), and items().
915
916- Implemented a newcode opcode, LIST_APPEND, that simplifies
917 the generated bytecode for list comprehensions and further
918 improves their performance (about 35%).
919
920- Implemented rich comparisons for floats, which seems to make
921 comparisons involving NaNs somewhat less surprising when the
922 underlying C compiler actually implements C99 semantics.
923
924- Optimized list.extend() to save memory and no longer create
925 intermediate sequences. Also, extend() now pre-allocates the
926 needed memory whenever the length of the iterable is known in
927 advance -- this halves the time to extend the list.
928
929- Optimized list resize operations to make fewer calls to the system
930 realloc(). Significantly speeds up list appends, list pops,
931 list comprehensions, and the list constructor (when the input iterable
932 length is not known).
933
934- Changed the internal list over-allocation scheme. For larger lists,
935 overallocation ranged between 3% and 25%. Now, it is a constant 12%.
936 For smaller lists (n<8), overallocation was upto eight elements. Now,
937 the overallocation is no more than three elements -- this improves space
938 utilization for applications that have large numbers of small lists.
939
940- Most list bodies now get re-used rather than freed. Speeds up list
941 instantiation and deletion by saving calls to malloc() and free().
942
943- The dict.update() method now accepts all the same argument forms
944 as the dict() constructor. This now includes item lists and/or
945 keyword arguments.
946
947- Support for arbitrary objects supporting the read-only buffer
948 interface as the co_code field of code objects (something that was
949 only possible to create from C code) has been removed.
950
951- Made omitted callback and None equivalent for weakref.ref() and
952 weakref.proxy(); the None case wasn't handled correctly in all
953 cases.
954
955- Fixed problem where PyWeakref_NewRef() and PyWeakref_NewProxy()
956 assumed that initial existing entries in an object's weakref list
957 would not be removed while allocating a new weakref object. Since
958 GC could be invoked at that time, however, that assumption was
959 invalid. In a truly obscure case of GC being triggered during
960 creation for a new weakref object for an referent which already
961 has a weakref without a callback which is only referenced from
962 cyclic trash, a memory error can occur. This consistently created a
963 segfault in a debug build, but provided less predictable behavior in
964 a release build.
965
966- input() builtin function now respects compiler flags such as
967 __future__ statements. SF patch 876178.
968
969- Removed PendingDeprecationWarning from apply(). apply() remains
970 deprecated, but the nuisance warning will not be issued.
971
972- At Python shutdown time (Py_Finalize()), 2.3 called cyclic garbage
973 collection twice, both before and after tearing down modules. The
974 call after tearing down modules has been disabled, because too much
975 of Python has been torn down then for __del__ methods and weakref
976 callbacks to execute sanely. The most common symptom was a sequence
977 of uninformative messages on stderr when Python shut down, produced
978 by threads trying to raise exceptions, but unable to report the nature
979 of their problems because too much of the sys module had already been
980 destroyed.
981
982- Removed FutureWarnings related to hex/oct literals and conversions
983 and left shifts. (Thanks to Kalle Svensson for SF patch 849227.)
984 This addresses most of the remaining semantic changes promised by
985 PEP 237, except for repr() of a long, which still shows the trailing
986 'L'. The PEP appears to promise warnings for operations that
987 changed semantics compared to Python 2.3, but this is not
988 implemented; we've suffered through enough warnings related to
989 hex/oct literals and I think it's best to be silent now.
990
991- For str and unicode objects, the ljust(), center(), and rjust()
992 methods now accept an optional argument specifying a fill
993 character other than a space.
994
995- When method objects have an attribute that can be satisfied either
996 by the function object or by the method object, the function
997 object's attribute usually wins. Christian Tismer pointed out that
998 that this is really a mistake, because this only happens for special
999 methods (like __reduce__) where the method object's version is
1000 really more appropriate than the function's attribute. So from now
1001 on, all method attributes will have precedence over function
1002 attributes with the same name.
1003
1004- Critical bugfix, for SF bug 839548: if a weakref with a callback,
1005 its callback, and its weakly referenced object, all became part of
1006 cyclic garbage during a single run of garbage collection, the order
1007 in which they were torn down was unpredictable. It was possible for
1008 the callback to see partially-torn-down objects, leading to immediate
1009 segfaults, or, if the callback resurrected garbage objects, to
1010 resurrect insane objects that caused segfaults (or other surprises)
1011 later. In one sense this wasn't surprising, because Python's cyclic gc
1012 had no knowledge of Python's weakref objects. It does now. When
1013 weakrefs with callbacks become part of cyclic garbage now, those
1014 weakrefs are cleared first. The callbacks don't trigger then,
1015 preventing the problems. If you need callbacks to trigger, then just
1016 as when cyclic gc is not involved, you need to write your code so
1017 that weakref objects outlive the objects they weakly reference.
1018
1019- Critical bugfix, for SF bug 840829: if cyclic garbage collection
1020 happened to occur during a weakref callback for a new-style class
1021 instance, subtle memory corruption was the result (in a release build;
1022 in a debug build, a segfault occurred reliably very soon after).
1023 This has been repaired.
1024
1025- Compiler flags set in PYTHONSTARTUP are now active in __main__.
1026
1027- Added two builtin types, set() and frozenset().
1028
1029- Added a reversed() builtin function that returns a reverse iterator
1030 over a sequence.
1031
1032- Added a sorted() builtin function that returns a new sorted list
1033 from any iterable.
1034
1035- CObjects are now mutable (on the C level) through PyCObject_SetVoidPtr.
1036
1037- list.sort() now supports three keyword arguments: cmp, key, and reverse.
1038 The key argument can be a function of one argument that extracts a
1039 comparison key from the original record: mylist.sort(key=str.lower).
1040 The reverse argument is a boolean value and if True will change the
1041 sort order as if the comparison arguments were reversed. In addition,
1042 the documentation has been amended to provide a guarantee that all sorts
1043 starting with Py2.3 are guaranteed to be stable (the relative order of
1044 records with equal keys is unchanged).
1045
1046- Added test whether wchar_t is signed or not. A signed wchar_t is not
1047 usable as internal unicode type base for Py_UNICODE since the
1048 unicode implementation assumes an unsigned type.
1049
1050- Fixed a bug in the cache of length-one Unicode strings that could
1051 lead to a seg fault. The specific problem occurred when an earlier,
1052 non-fatal error left an uninitialized Unicode object in the
1053 freelist.
1054
1055- The % formatting operator now supports '%F' which is equivalent to
1056 '%f'. This has always been documented but never implemented.
1057
1058- complex(obj) could leak a little memory if obj wasn't a string or
1059 number.
1060
1061- zip() with no arguments now returns an empty list instead of raising
1062 a TypeError exception.
1063
1064- obj.__contains__() now returns True/False instead of 1/0. SF patch
1065 820195.
1066
1067- Python no longer tries to be smart about recursive comparisons.
1068 When comparing containers with cyclic references to themselves it
1069 will now just hit the recursion limit. See SF patch 825639.
1070
1071- str and unicode builtin types now have an rsplit() method that is
1072 same as split() except that it scans the string from the end
1073 working towards the beginning. See SF feature request 801847.
1074
1075- Fixed a bug in object.__reduce_ex__ when using protocol 2. Failure
1076 to clear the error when attempts to get the __getstate__ attribute
1077 fail caused intermittent errors and odd behavior.
1078
1079- buffer objects based on other objects no longer cache a pointer to
1080 the data and the data length. Instead, the appropriate tp_as_buffer
1081 method is called as necessary.
1082
1083- fixed: if a file is opened with an explicit buffer size >= 1, repeated
1084 close() calls would attempt to free() the buffer already free()ed on
1085 the first call.
1086
1087
1088Extension modules
1089-----------------
1090
1091- Added socket.getservbyport(), and make the second argument in
1092 getservbyname() and getservbyport() optional.
1093
1094- time module code that deals with input POSIX timestamps will now raise
1095 ValueError if more than a second is lost in precision when the
1096 timestamp is cast to the platform C time_t type. There's no chance
1097 that the platform will do anything sensible with the result in such
1098 cases. This includes ctime(), localtime() and gmtime(). Assorted
1099 fromtimestamp() and utcfromtimestamp() methods in the datetime module
1100 were also protected. Closes bugs #919012 and 975996.
1101
1102- fcntl.ioctl now warns if the mutate flag is not specified.
1103
1104- nt now properly allows to refer to UNC roots, e.g. in nt.stat().
1105
1106- the weakref module now supports additional objects: array.array,
1107 sre.pattern_objects, file objects, and sockets.
1108
1109- operator.isMappingType() and operator.isSequenceType() now give
1110 fewer false positives.
1111
1112- socket.sslerror is now a subclass of socket.error . Also added
1113 socket.error to the socket module's C API.
1114
1115- Bug #920575: A problem where the _locale module segfaults on
1116 nl_langinfo(ERA) caused by GNU libc's illegal NULL return is fixed.
1117
1118- array objects now support the copy module. Also, their resizing
1119 scheme has been updated to match that used for list objects. This improves
1120 the performance (speed and memory usage) of append() operations.
1121 Also, array.array() and array.extend() now accept any iterable argument
1122 for repeated appends without needing to create another temporary array.
1123
1124- cStringIO.writelines() now accepts any iterable argument and writes
1125 the lines one at a time rather than joining them and writing once.
1126 Made a parallel change to StringIO.writelines(). Saves memory and
1127 makes suitable for use with generator expressions.
1128
1129- time.strftime() now checks that the values in its time tuple argument
1130 are within the proper boundaries to prevent possible crashes from the
1131 platform's C library implementation of strftime(). Can possibly
1132 break code that uses values outside the range that didn't cause
1133 problems previously (such as sitting day of year to 0). Fixes bug
1134 #897625.
1135
1136- The socket module now supports Bluetooth sockets, if the
1137 system has <bluetooth/bluetooth.h>
1138
1139- Added a collections module containing a new datatype, deque(),
1140 offering high-performance, thread-safe, memory friendly appends
1141 and pops on either side of the deque.
1142
1143- Several modules now take advantage of collections.deque() for
1144 improved performance: Queue, mutex, shlex, threading, and pydoc.
1145
1146- The operator module has two new functions, attrgetter() and
1147 itemgetter() which are useful for creating fast data extractor
1148 functions for map(), list.sort(), itertools.groupby(), and
1149 other functions that expect a function argument.
1150
1151- socket.SHUT_{RD,WR,RDWR} was added.
1152
1153- os.getsid was added.
1154
1155- The pwd module incorrectly advertised its struct type as
1156 struct_pwent; this has been renamed to struct_passwd. (The old name
1157 is still supported for backwards compatibility.)
1158
1159- The xml.parsers.expat module now provides Expat 1.95.7.
1160
1161- socket.IPPROTO_IPV6 was added.
1162
1163- readline.clear_history was added.
1164
1165- select.select() now accepts sequences for its first three arguments.
1166
1167- cStringIO now supports the f.closed attribute.
1168
1169- The signal module now exposes SIGRTMIN and SIGRTMAX (if available).
1170
1171- curses module now supports use_default_colors(). [patch #739124]
1172
1173- Bug #811028: ncurses.h breakage on FreeBSD/MacOS X
1174
1175- Bug #814613: INET_ADDRSTRLEN fix needed for all compilers on SGI
1176
1177- Implemented non-recursive SRE matching scheme (#757624).
1178
1179- Implemented (?(id/name)yes|no) support in SRE (#572936).
1180
1181- random.seed() with no arguments or None uses time.time() as a default
1182 seed. Modified to match Py2.2 behavior and use fractional seconds so
1183 that successive runs are more likely to produce different sequences.
1184
1185- random.Random has a new method, getrandbits(k), which returns an int
1186 with k random bits. This method is now an optional part of the API
1187 for user defined generators. Any generator that defines genrandbits()
1188 can now use randrange() for ranges with a length >= 2**53. Formerly,
1189 randrange would return only even numbers for ranges that large (see
1190 SF bug #812202). Generators that do not define genrandbits() now
1191 issue a warning when randrange() is called with a range that large.
1192
1193- itertools has a new function, groupby() for aggregating iterables
1194 into groups sharing the same key (as determined by a key function).
1195 It offers some of functionality of SQL's groupby keyword and of
1196 the Unix uniq filter.
1197
1198- itertools now has a new tee() function which produces two independent
1199 iterators from a single iterable.
1200
1201- itertools.izip() with no arguments now returns an empty iterator instead
1202 of raising a TypeError exception.
1203
1204- Fixed #853061: allow BZ2Compressor.compress() to receive an empty string
1205 as parameter.
1206
1207Library
1208-------
1209
1210- Added a new module: cProfile, a C profiler with the same interface as the
1211 profile module. cProfile avoids some of the drawbacks of the hotshot
1212 profiler and provides a bit more information than the other two profilers.
1213 Based on "lsprof" (patch #1212837).
1214
1215- Bug #1266283: The new function "lexists" is now in os.path.__all__.
1216
1217- Bug #981530: Fix UnboundLocalError in shutil.rmtree(). This affects
1218 the documented behavior: the function passed to the onerror()
1219 handler can now also be os.listdir.
1220
1221- Bug #754449: threading.Thread objects no longer mask exceptions raised during
1222 interpreter shutdown with another exception from attempting to handle the
1223 original exception.
1224
1225- Added decimal.py per PEP 327.
1226
1227- Bug #981299: rsync is now a recognized protocol in urlparse that uses a
1228 "netloc" portion of a URL.
1229
1230- Bug #919012: shutil.move() will not try to move a directory into itself.
1231 Thanks Johannes Gijsbers.
1232
1233- Bug #934282: pydoc.stripid() is now case-insensitive. Thanks Robin Becker.
1234
1235- Bug #823209: cmath.log() now takes an optional base argument so that its
1236 API matches math.log().
1237
1238- Bug #957381: distutils bdist_rpm no longer fails on recent RPM versions
1239 that generate a -debuginfo.rpm
1240
1241- os.path.devnull has been added for all supported platforms.
1242
1243- Fixed #877165: distutils now picks the right C++ compiler command
1244 on cygwin and mingw32.
1245
1246- urllib.urlopen().readline() now handles HTTP/0.9 correctly.
1247
1248- refactored site.py into functions. Also wrote regression tests for the
1249 module.
1250
1251- The distutils install command now supports the --home option and
1252 installation scheme for all platforms.
1253
1254- asyncore.loop now has a repeat count parameter that defaults to
1255 looping forever.
1256
1257- The distutils sdist command now ignores all .svn directories, in
1258 addition to CVS and RCS directories. .svn directories hold
1259 administrative files for the Subversion source control system.
1260
1261- Added a new module: cookielib. Automatic cookie handling for HTTP
1262 clients. Also, support for cookielib has been added to urllib2, so
1263 urllib2.urlopen() can transparently handle cookies.
1264
1265- stringprep.py now uses built-in set() instead of sets.Set().
1266
1267- Bug #876278: Unbounded recursion in modulefinder
1268
1269- Bug #780300: Swap public and system ID in LexicalHandler.startDTD.
1270 Applications relying on the wrong order need to be corrected.
1271
1272- Bug #926075: Fixed a bug that returns a wrong pattern object
1273 for a string or unicode object in sre.compile() when a different
1274 type pattern with the same value exists.
1275
1276- Added countcallers arg to trace.Trace class (--trackcalls command line arg
1277 when run from the command prompt).
1278
1279- Fixed a caching bug in platform.platform() where the argument of 'terse' was
1280 not taken into consideration when caching value.
1281
1282- Added two new command-line arguments for profile (output file and
1283 default sort).
1284
1285- Added global runctx function to profile module
1286
1287- Add hlist missing entryconfigure and entrycget methods.
1288
1289- The ptcp154 codec was added for Kazakh character set support.
1290
1291- Support non-anonymous ftp URLs in urllib2.
1292
1293- The encodings package will now apply codec name aliases
1294 first before starting to try the import of the codec module.
1295 This simplifies overriding built-in codecs with external
1296 packages, e.g. the included CJK codecs with the JapaneseCodecs
1297 package, by adjusting the aliases dictionary in encodings.aliases
1298 accordingly.
1299
1300- base64 now supports RFC 3548 Base16, Base32, and Base64 encoding and
1301 decoding standards.
1302
1303- urllib2 now supports processors. A processor is a handler that
1304 implements an xxx_request or xxx_response method. These methods are
1305 called for all requests.
1306
1307- distutils compilers now compile source files in the same order as
1308 they are passed to the compiler.
1309
1310- pprint.pprint() and pprint.pformat() now have additional parameters
1311 indent, width and depth.
1312
1313- Patch #750542: pprint now will pretty print subclasses of list, tuple
1314 and dict too, as long as they don't overwrite __repr__().
1315
1316- Bug #848614: distutils' msvccompiler fails to find the MSVC6
1317 compiler because of incomplete registry entries.
1318
1319- httplib.HTTP.putrequest now offers to omit the implicit Accept-Encoding.
1320
1321- Patch #841977: modulefinder didn't find extension modules in packages
1322
1323- imaplib.IMAP4.thread was added.
1324
1325- Plugged a minor hole in tempfile.mktemp() due to the use of
1326 os.path.exists(), switched to using os.lstat() directly if possible.
1327
1328- bisect.py and heapq.py now have underlying C implementations
1329 for better performance.
1330
1331- heapq.py has two new functions, nsmallest() and nlargest().
1332
1333- traceback.format_exc has been added (similar to print_exc but it returns
1334 a string).
1335
1336- xmlrpclib.MultiCall has been added.
1337
1338- poplib.POP3_SSL has been added.
1339
1340- tmpfile.mkstemp now returns an absolute path even if dir is relative.
1341
1342- urlparse is RFC 2396 compliant.
1343
1344- The fieldnames argument to the csv module's DictReader constructor is now
1345 optional. If omitted, the first row of the file will be used as the
1346 list of fieldnames.
1347
1348- encodings.bz2_codec was added for access to bz2 compression
1349 using "a long string".encode('bz2')
1350
1351- Various improvements to unittest.py, realigned with PyUnit CVS.
1352
1353- dircache now passes exceptions to the caller, instead of returning
1354 empty lists.
1355
1356- The bsddb module and dbhash module now support the iterator and
1357 mapping protocols which make them more substitutable for dictionaries
1358 and shelves.
1359
1360- The csv module's DictReader and DictWriter classes now accept keyword
1361 arguments. This was an omission in the initial implementation.
1362
1363- The email package handles some RFC 2231 parameters with missing
1364 CHARSET fields better. It also includes a patch to parameter
1365 parsing when semicolons appear inside quotes.
1366
1367- sets.py now runs under Py2.2. In addition, the argument restrictions
1368 for most set methods (but not the operators) have been relaxed to
1369 allow any iterable.
1370
1371- _strptime.py now has a behind-the-scenes caching mechanism for the most
1372 recent TimeRE instance used along with the last five unique directive
1373 patterns. The overall module was also made more thread-safe.
1374
1375- random.cunifvariate() and random.stdgamma() were deprecated in Py2.3
1376 and removed in Py2.4.
1377
1378- Bug #823328: urllib2.py's HTTP Digest Auth support works again.
1379
1380- Patch #873597: CJK codecs are imported into rank of default codecs.
1381
1382Tools/Demos
1383-----------
1384
1385- A hotshotmain script was added to the Tools/scripts directory that
1386 makes it easy to run a script under control of the hotshot profiler.
1387
1388- The db2pickle and pickle2db scripts can now dump/load gdbm files.
1389
1390- The file order on the command line of the pickle2db script was reversed.
1391 It is now [ picklefile ] dbfile. This provides better symmetry with
1392 db2pickle. The file arguments to both scripts are now source followed by
1393 destination in situations where both files are given.
1394
1395- The pydoc script will display a link to the module documentation for
1396 modules determined to be part of the core distribution. The documentation
1397 base directory defaults to http://www.python.org/doc/current/lib/ but can
1398 be changed by setting the PYTHONDOCS environment variable.
1399
1400- texcheck.py now detects double word errors.
1401
1402- md5sum.py mistakenly opened input files in text mode by default, a
1403 silent and dangerous change from previous releases. It once again
1404 opens input files in binary mode by default. The -t and -b flags
1405 remain for compatibility with the 2.3 release, but -b is the default
1406 now.
1407
1408- py-electric-colon now works when pending-delete/delete-selection mode is
1409 in effect
1410
1411- py-help-at-point is no longer bound to the F1 key - it's still bound to
1412 C-c C-h
1413
1414- Pynche was fixed to not crash when there is no ~/.pynche file and no
1415 -d option was given.
1416
1417Build
1418-----
1419
1420- Bug #978645: Modules/getpath.c now builds properly in --disable-framework
1421 build under OS X.
1422
1423- Profiling using gprof is now available if Python is configured with
1424 --enable-profiling.
1425
1426- Profiling the VM using the Pentium TSC is now possible if Python
1427 is configured --with-tsc.
1428
1429- In order to find libraries, setup.py now also looks in /lib64, for use
1430 on AMD64.
1431
1432- Bug #934635: Fixed a bug where the configure script couldn't detect
1433 getaddrinfo() properly if the KAME stack had SCTP support.
1434
1435- Support for missing ANSI C header files (limits.h, stddef.h, etc) was
1436 removed.
1437
1438- Systems requiring the D4, D6 or D7 variants of pthreads are no longer
1439 supported (see PEP 11).
1440
1441- Universal newline support can no longer be disabled (see PEP 11).
1442
1443- Support for DGUX, SunOS 4, IRIX 4 and Minix was removed (see PEP 11).
1444
1445- Support for systems requiring --with-dl-dld or --with-sgi-dl was removed
1446 (see PEP 11).
1447
1448- Tests for sizeof(char) were removed since ANSI C mandates that
1449 sizeof(char) must be 1.
1450
1451C API
1452-----
1453
1454- Thanks to Anthony Tuininga, the datetime module now supplies a C API
1455 containing type-check macros and constructors. See new docs in the
1456 Python/C API Reference Manual for details.
1457
1458- Private function _PyTime_DoubleToTimet added, to convert a Python
1459 timestamp (C double) to platform time_t with some out-of-bounds
1460 checking. Declared in new header file timefuncs.h. It would be
1461 good to expose some other internal timemodule.c functions there.
1462
1463- New public functions PyEval_EvaluateFrame and PyGen_New to expose
1464 generator objects.
1465
1466- New public functions Py_IncRef() and Py_DecRef(), exposing the
1467 functionality of the Py_XINCREF() and Py_XDECREF macros. Useful for
1468 runtime dynamic embedding of Python. See patch #938302, by Bob
1469 Ippolito.
1470
1471- Added a new macro, PySequence_Fast_ITEMS, which retrieves a fast sequence's
1472 underlying array of PyObject pointers. Useful for high speed looping.
1473
1474- Created a new method flag, METH_COEXIST, which causes a method to be loaded
1475 even if already defined by a slot wrapper. This allows a __contains__
1476 method, for example, to co-exist with a defined sq_contains slot. This
1477 is helpful because the PyCFunction can take advantage of optimized calls
1478 whenever METH_O or METH_NOARGS flags are defined.
1479
1480- Added a new function, PyDict_Contains(d, k) which is like
1481 PySequence_Contains() but is specific to dictionaries and executes
1482 about 10% faster.
1483
1484- Added three new macros: Py_RETURN_NONE, Py_RETURN_TRUE, and Py_RETURN_FALSE.
1485 Each return the singleton they mention after Py_INCREF()ing them.
1486
1487- Added a new function, PyTuple_Pack(n, ...) for constructing tuples from a
1488 variable length argument list of Python objects without having to invoke
1489 the more complex machinery of Py_BuildValue(). PyTuple_Pack(3, a, b, c)
1490 is equivalent to Py_BuildValue("(OOO)", a, b, c).
1491
1492Windows
1493-------
1494
1495- The _winreg module could segfault when reading very large registry
1496 values, due to unchecked alloca() calls (SF bug 851056). The fix is
1497 uses either PyMem_Malloc(n) or PyString_FromStringAndSize(NULL, n),
1498 as appropriate, followed by a size check.
1499
1500- file.truncate() could misbehave if the file was open for update
1501 (modes r+, rb+, w+, wb+), and the most recent file operation before
1502 the truncate() call was an input operation. SF bug 801631.
1503
1504
1505What's New in Python 2.3 final?
1506===============================
1507
1508*Release date: 29-Jul-2003*
1509
1510IDLE
1511----
1512
1513- Bug 778400: IDLE hangs when selecting "Edit with IDLE" from explorer.
1514 This was unique to Windows, and was fixed by adding an -n switch to
1515 the command the Windows installer creates to execute "Edit with IDLE"
1516 context-menu actions.
1517
1518- IDLE displays a new message upon startup: some "personal firewall"
1519 kinds of programs (for example, ZoneAlarm) open a dialog of their
1520 own when any program opens a socket. IDLE does use sockets, talking
1521 on the computer's internal loopback interface. This connection is not
1522 visible on any external interface and no data is sent to or received
1523 from the Internet. So, if you get such a dialog when opening IDLE,
1524 asking whether to let pythonw.exe talk to address 127.0.0.1, say yes,
1525 and rest assured no communication external to your machine is taking
1526 place. If you don't allow it, IDLE won't be able to start.
1527
1528
1529What's New in Python 2.3 release candidate 2?
1530=============================================
1531
1532*Release date: 24-Jul-2003*
1533
1534Core and builtins
1535-----------------
1536
1537- It is now possible to import from zipfiles containing additional
1538 data bytes before the zip compatible archive. Zipfiles containing a
1539 comment at the end are still unsupported.
1540
1541Extension modules
1542-----------------
1543
1544- A longstanding bug in the parser module's initialization could cause
1545 fatal internal refcount confusion when the module got initialized more
1546 than once. This has been fixed.
1547
1548- Fixed memory leak in pyexpat; using the parser's ParseFile() method
1549 with open files that aren't instances of the standard file type
1550 caused an instance of the bound .read() method to be leaked on every
1551 call.
1552
1553- Fixed some leaks in the locale module.
1554
1555Library
1556-------
1557
1558- Lib/encodings/rot_13.py when used as a script, now more properly
1559 uses the first Python interpreter on your path.
1560
1561- Removed caching of TimeRE (and thus LocaleTime) in _strptime.py to
1562 fix a locale related bug in the test suite. Although another patch
1563 was needed to actually fix the problem, the cache code was not
1564 restored.
1565
1566IDLE
1567----
1568
1569- Calltips patches.
1570
1571Build
1572-----
1573
1574- For MacOSX, added -mno-fused-madd to BASECFLAGS to fix test_coercion
1575 on Panther (OSX 10.3).
1576
1577C API
1578-----
1579
1580Windows
1581-------
1582
1583- The tempfile module could do insane imports on Windows if PYTHONCASEOK
1584 was set, making temp file creation impossible. Repaired.
1585
1586- Add a patch to workaround pthread_sigmask() bugs in Cygwin.
1587
1588Mac
1589---
1590
1591- Various fixes to pimp.
1592
1593- Scripts runs with pythonw no longer had full window manager access.
1594
1595- Don't force boot-disk-only install, for reasons unknown it causes
1596 more problems than it solves.
1597
1598
1599What's New in Python 2.3 release candidate 1?
1600=============================================
1601
1602*Release date: 18-Jul-2003*
1603
1604Core and builtins
1605-----------------
1606
1607- The new function sys.getcheckinterval() returns the last value set
1608 by sys.setcheckinterval().
1609
1610- Several bugs in the symbol table phase of the compiler have been
1611 fixed. Errors could be lost and compilation could fail without
1612 reporting an error. SF patch 763201.
1613
1614- The interpreter is now more robust about importing the warnings
1615 module. In an executable generated by freeze or similar programs,
1616 earlier versions of 2.3 would fail if the warnings module could
1617 not be found on the file system. Fixes SF bug 771097.
1618
1619- A warning about assignments to module attributes that shadow
1620 builtins, present in earlier releases of 2.3, has been removed.
1621
1622- It is not possible to create subclasses of builtin types like str
1623 and tuple that define an itemsize. Earlier releases of Python 2.3
1624 allowed this by mistake, leading to crashes and other problems.
1625
1626- The thread_id is now initialized to 0 in a non-thread build. SF bug
1627 770247.
1628
1629- SF bug 762891: "del p[key]" on proxy object no longer raises SystemError.
1630
1631Extension modules
1632-----------------
1633
1634- weakref.proxy() can now handle "del obj[i]" for proxy objects
1635 defining __delitem__. Formerly, it generated a SystemError.
1636
1637- SSL no longer crashes the interpreter when the remote side disconnects.
1638
1639- On Unix the mmap module can again be used to map device files.
1640
1641- time.strptime now exclusively uses the Python implementation
1642 contained within the _strptime module.
1643
1644- The print slot of weakref proxy objects was removed, because it was
1645 not consistent with the object's repr slot.
1646
1647- The mmap module only checks file size for regular files, not
1648 character or block devices. SF patch 708374.
1649
1650- The cPickle Pickler garbage collection support was fixed to traverse
1651 the find_class attribute, if present.
1652
1653- There are several fixes for the bsddb3 wrapper module.
1654
1655 bsddb3 no longer crashes if an environment is closed before a cursor
1656 (SF bug 763298).
1657
1658 The DB and DBEnv set_get_returns_none function was extended to take
1659 a level instead of a boolean flag. The new level 2 means that in
1660 addition, cursor.set()/.get() methods return None instead of raising
1661 an exception.
1662
1663 A typo was fixed in DBCursor.join_item(), preventing a crash.
1664
1665Library
1666-------
1667
1668- distutils now supports MSVC 7.1
1669
1670- doctest now examines all docstrings by default. Previously, it would
1671 skip over functions with private names (as indicated by the underscore
1672 naming convention). The old default created too much of a risk that
1673 user tests were being skipped inadvertently. Note, this change could
1674 break code in the unlikely case that someone had intentionally put
1675 failing tests in the docstrings of private functions. The breakage
1676 is easily fixable by specifying the old behavior when calling testmod()
1677 or Tester().
1678
1679- There were several fixes to the way dumbdbms are closed. It's vital
1680 that a dumbdbm database be closed properly, else the on-disk data
1681 and directory files can be left in mutually inconsistent states.
1682 dumbdbm.py's _Database.__del__() method attempted to close the
1683 database properly, but a shutdown race in _Database._commit() could
1684 prevent this from working, so that a program trusting __del__() to
1685 get the on-disk files in synch could be badly surprised. The race
1686 has been repaired. A sync() method was also added so that shelve
1687 can guarantee data is written to disk.
1688
1689 The close() method can now be called more than once without complaint.
1690
1691- The classes in threading.py are now new-style classes. That they
1692 weren't before was an oversight.
1693
1694- The urllib2 digest authentication handlers now define the correct
1695 auth_header. The earlier versions would fail at runtime.
1696
1697- SF bug 763023: fix uncaught ZeroDivisionError in difflib ratio methods
1698 when there are no lines.
1699
1700- SF bug 763637: fix exception in Tkinter with after_cancel
1701 which could occur with Tk 8.4
1702
1703- SF bug 770601: CGIHTTPServer.py now passes the entire environment
1704 to child processes.
1705
1706- SF bug 765238: add filter to fnmatch's __all__.
1707
1708- SF bug 748201: make time.strptime() error messages more helpful.
1709
1710- SF patch 764470: Do not dump the args attribute of a Fault object in
1711 xmlrpclib.
1712
1713- SF patch 549151: urllib and urllib2 now redirect POSTs on 301
1714 responses.
1715
1716- SF patch 766650: The whichdb module was fixed to recognize dbm files
1717 generated by gdbm on OS/2 EMX.
1718
1719- SF bugs 763047 and 763052: fixes bug of timezone value being left as
1720 -1 when ``time.tzname[0] == time.tzname[1] and not time.daylight``
1721 is true when it should only when time.daylight is true.
1722
1723- SF bug 764548: re now allows subclasses of str and unicode to be
1724 used as patterns.
1725
1726- SF bug 763637: In Tkinter, change after_cancel() to handle tuples
1727 of varying sizes. Tk 8.4 returns a different number of values
1728 than Tk 8.3.
1729
1730- SF bug 763023: difflib.ratio() did not catch zero division.
1731
1732- The Queue module now has an __all__ attribute.
1733
1734Tools/Demos
1735-----------
1736
1737- See Lib/idlelib/NEWS.txt for IDLE news.
1738
1739- SF bug 753592: webchecker/wsgui now handles user supplied directories.
1740
1741- The trace.py script has been removed. It is now in the standard library.
1742
1743Build
1744-----
1745
1746- Python now compiles with -fno-strict-aliasing if possible (SF bug 766696).
1747
1748- The socket module compiles on IRIX 6.5.10.
1749
1750- An irix64 system is treated the same way as an irix6 system (SF
1751 patch 764560).
1752
1753- Several definitions were missing on FreeBSD 5.x unless the
1754 __BSD_VISIBLE symbol was defined. configure now defines it as
1755 needed.
1756
1757C API
1758-----
1759
1760- Unicode objects now support mbcs as a built-in encoding, so the C
1761 API can use it without deferring to the encodings package.
1762
1763Windows
1764-------
1765
1766- The Windows implementation of PyThread_start_new_thread() never
1767 checked error returns from Windows functions correctly. As a result,
1768 it could claim to start a new thread even when the Microsoft
1769 _beginthread() function failed (due to "too many threads" -- this is
1770 on the order of thousands when it happens). In these cases, the
1771 Python exception ::
1772
1773 thread.error: can't start new thread
1774
1775 is raised now.
1776
1777- SF bug 766669: Prevent a GPF on interpreter exit when sockets are in
1778 use. The interpreter now calls WSACleanup() from Py_Finalize()
1779 instead of from DLL teardown.
1780
1781Mac
1782---
1783
1784- Bundlebuilder now inherits default values in the right way. It was
1785 previously possible for app bundles to get a type of "BNDL" instead
1786 of "APPL." Other improvements include, a --build-id option to
1787 specify the CFBundleIdentifier and using the --python option to set
1788 the executable in the bundle.
1789
1790- Fixed two bugs in MacOSX framework handling.
1791
1792- pythonw did not allow user interaction in 2.3rc1, this has been fixed.
1793
1794- Python is now compiled with -mno-fused-madd, making all tests pass
1795 on Panther.
1796
1797What's New in Python 2.3 beta 2?
1798================================
1799
1800*Release date: 29-Jun-2003*
1801
1802Core and builtins
1803-----------------
1804
1805- A program can now set the environment variable PYTHONINSPECT to some
1806 string value in Python, and cause the interpreter to enter the
1807 interactive prompt at program exit, as if Python had been invoked
1808 with the -i option.
1809
1810- list.index() now accepts optional start and stop arguments. Similar
1811 changes were made to UserList.index(). SF feature request 754014.
1812
1813- SF patch 751998 fixes an unwanted side effect of the previous fix
1814 for SF bug 742860 (the next item).
1815
1816- SF bug 742860: "WeakKeyDictionary __delitem__ uses iterkeys". This
1817 wasn't threadsafe, was very inefficient (expected time O(len(dict))
1818 instead of O(1)), and could raise a spurious RuntimeError if another
1819 thread mutated the dict during __delitem__, or if a comparison function
1820 mutated it. It also neglected to raise KeyError when the key wasn't
1821 present; didn't raise TypeError when the key wasn't of a weakly
1822 referencable type; and broke various more-or-less obscure dict
1823 invariants by using a sequence of equality comparisons over the whole
1824 set of dict keys instead of computing the key's hash code to narrow
1825 the search to those keys with the same hash code. All of these are
1826 considered to be bugs. A new implementation of __delitem__ repairs all
1827 that, but note that fixing these bugs may change visible behavior in
1828 code relying (whether intentionally or accidentally) on old behavior.
1829
1830- SF bug 734869: Fixed a compiler bug that caused a fatal error when
1831 compiling a list comprehension that contained another list comprehension
1832 embedded in a lambda expression.
1833
1834- SF bug 705231: builtin pow() no longer lets the platform C pow()
1835 raise -1.0 to integer powers, because (at least) glibc gets it wrong
1836 in some cases. The result should be -1.0 if the power is odd and 1.0
1837 if the power is even, and any float with a sufficiently large exponent
1838 is (mathematically) an exact even integer.
1839
1840- SF bug 759227: A new-style class that implements __nonzero__() must
1841 return a bool or int (but not an int subclass) from that method. This
1842 matches the restriction on classic classes.
1843
1844- The encoding attribute has been added for file objects, and set to
1845 the terminal encoding on Unix and Windows.
1846
1847- The softspace attribute of file objects became read-only by oversight.
1848 It's writable again.
1849
1850- Reverted a 2.3 beta 1 change to iterators for subclasses of list and
1851 tuple. By default, the iterators now access data elements directly
1852 instead of going through __getitem__. If __getitem__ access is
1853 preferred, then __iter__ can be overridden.
1854
1855- SF bug 735247: The staticmethod and super types participate in
1856 garbage collection. Before this change, it was possible for leaks to
1857 occur in functions with non-global free variables that used these types.
1858
1859Extension modules
1860-----------------
1861
1862- the socket module has a new exception, socket.timeout, to allow
1863 timeouts to be handled separately from other socket errors.
1864
1865- SF bug 751276: cPickle has fixed to propagate exceptions raised in
1866 user code. In earlier versions, cPickle caught and ignored any
1867 exception when it performed operations that it expected to raise
1868 specific exceptions like AttributeError.
1869
1870- cPickle Pickler and Unpickler objects now participate in garbage
1871 collection.
1872
1873- mimetools.choose_boundary() could return duplicate strings at times,
1874 especially likely on Windows. The strings returned are now guaranteed
1875 unique within a single program run.
1876
1877- thread.interrupt_main() raises KeyboardInterrupt in the main thread.
1878 dummy_thread has also been modified to try to simulate the behavior.
1879
1880- array.array.insert() now treats negative indices as being relative
1881 to the end of the array, just like list.insert() does. (SF bug #739313)
1882
1883- The datetime module classes datetime, time, and timedelta are now
1884 properly subclassable.
1885
1886- _tkinter.{get|set}busywaitinterval was added.
1887
1888- itertools.islice() now accepts stop=None as documented.
1889 Fixes SF bug #730685.
1890
1891- the bsddb185 module is built in one restricted instance -
1892 /usr/include/db.h exists and defines HASHVERSION to be 2. This is true
1893 for many BSD-derived systems.
1894
1895
1896Library
1897-------
1898
1899- Some happy doctest extensions from Jim Fulton have been added to
1900 doctest.py. These are already being used in Zope3. The two
1901 primary ones:
1902
1903 doctest.debug(module, name) extracts the doctests from the named object
1904 in the given module, puts them in a temp file, and starts pdb running
1905 on that file. This is great when a doctest fails.
1906
1907 doctest.DocTestSuite(module=None) returns a synthesized unittest
1908 TestSuite instance, to be run by the unittest framework, which
1909 runs all the doctests in the module. This allows writing tests in
1910 doctest style (which can be clearer and shorter than writing tests
1911 in unittest style), without losing unittest's powerful testing
1912 framework features (which doctest lacks).
1913
1914- For compatibility with doctests created before 2.3, if an expected
1915 output block consists solely of "1" and the actual output block
1916 consists solely of "True", it's accepted as a match; similarly
1917 for "0" and "False". This is quite un-doctest-like, but is practical.
1918 The behavior can be disabled by passing the new doctest module
1919 constant DONT_ACCEPT_TRUE_FOR_1 to the new optionflags optional
1920 argument.
1921
1922- ZipFile.testzip() now only traps BadZipfile exceptions. Previously,
1923 a bare except caught to much and reported all errors as a problem
1924 in the archive.
1925
1926- The logging module now has a new function, makeLogRecord() making
1927 LogHandler easier to interact with DatagramHandler and SocketHandler.
1928
1929- The cgitb module has been extended to support plain text display (SF patch
1930 569574).
1931
1932- A brand new version of IDLE (from the IDLEfork project at
1933 SourceForge) is now included as Lib/idlelib. The old Tools/idle is
1934 no more.
1935
1936- Added a new module: trace (documentation missing). This module used
1937 to be distributed in Tools/scripts. It uses sys.settrace() to trace
1938 code execution -- either function calls or individual lines. It can
1939 generate tracing output during execution or a post-mortem report of
1940 code coverage.
1941
1942- The threading module has new functions settrace() and setprofile()
1943 that cooperate with the functions of the same name in the sys
1944 module. A function registered with the threading module will
1945 be used for all threads it creates. The new trace module uses this
1946 to provide tracing for code running in threads.
1947
1948- copy.py: applied SF patch 707900, fixing bug 702858, by Steven
1949 Taschuk. Copying a new-style class that had a reference to itself
1950 didn't work. (The same thing worked fine for old-style classes.)
1951 Builtin functions are now treated as atomic, fixing bug #746304.
1952
1953- difflib.py has two new functions: context_diff() and unified_diff().
1954
1955- More fixes to urllib (SF 549151): (a) When redirecting, always use
1956 GET. This is common practice and more-or-less sanctioned by the
1957 HTTP standard. (b) Add a handler for 307 redirection, which becomes
1958 an error for POST, but a regular redirect for GET and HEAD
1959
1960- Added optional 'onerror' argument to os.walk(), to control error
1961 handling.
1962
1963- inspect.is{method|data}descriptor was added, to allow pydoc display
1964 __doc__ of data descriptors.
1965
1966- Fixed socket speed loss caused by use of the _socketobject wrapper class
1967 in socket.py.
1968
1969- timeit.py now checks the current directory for imports.
1970
1971- urllib2.py now knows how to order proxy classes, so the user doesn't
1972 have to insert it in front of other classes, nor do dirty tricks like
1973 inserting a "dummy" HTTPHandler after a ProxyHandler when building an
1974 opener with proxy support.
1975
1976- Iterators have been added for dbm keys.
1977
1978- random.Random objects can now be pickled.
1979
1980Tools/Demos
1981-----------
1982
1983- pydoc now offers help on keywords and topics.
1984
1985- Tools/idle is gone; long live Lib/idlelib.
1986
1987- diff.py prints file diffs in context, unified, or ndiff formats,
1988 providing a command line interface to difflib.py.
1989
1990- texcheck.py is a new script for making a rough validation of Python LaTeX
1991 files.
1992
1993Build
1994-----
1995
1996- Setting DESTDIR during 'make install' now allows specifying a
1997 different root directory.
1998
1999C API
2000-----
2001
2002- PyType_Ready(): If a type declares that it participates in gc
2003 (Py_TPFLAGS_HAVE_GC), and its base class does not, and its base class's
2004 tp_free slot is the default _PyObject_Del, and type does not define
2005 a tp_free slot itself, _PyObject_GC_Del is assigned to type->tp_free.
2006 Previously _PyObject_Del was inherited, which could at best lead to a
2007 segfault. In addition, if even after this magic the type's tp_free
2008 slot is _PyObject_Del or NULL, and the type is a base type
2009 (Py_TPFLAGS_BASETYPE), TypeError is raised: since the type is a base
2010 type, its dealloc function must call type->tp_free, and since the type
2011 is gc'able, tp_free must not be NULL or _PyObject_Del.
2012
2013- PyThreadState_SetAsyncExc(): A new API (deliberately accessible only
2014 from C) to interrupt a thread by sending it an exception. It is
2015 intentional that you have to write your own C extension to call it
2016 from Python.
2017
2018
2019New platforms
2020-------------
2021
2022None this time.
2023
2024Tests
2025-----
2026
2027- test_imp rewritten so that it doesn't raise RuntimeError if run as a
2028 side effect of being imported ("import test.autotest").
2029
2030Windows
2031-------
2032
2033- The Windows installer ships with Tcl/Tk 8.4.3 (upgraded from 8.4.1).
2034
2035- The installer always suggested that Python be installed on the C:
2036 drive, due to a hardcoded "C:" generated by the Wise installation
2037 wizard. People with machines where C: is not the system drive
2038 usually want Python installed on whichever drive is their system drive
2039 instead. We removed the hardcoded "C:", and two testers on machines
2040 where C: is not the system drive report that the installer now
2041 suggests their system drive. Note that you can always select the
2042 directory you want in the "Select Destination Directory" dialog --
2043 that's what it's for.
2044
2045Mac
2046---
2047
2048- There's a new module called "autoGIL", which offers a mechanism to
2049 automatically release the Global Interpreter Lock when an event loop
2050 goes to sleep, allowing other threads to run. It's currently only
2051 supported on OSX, in the Mach-O version.
2052- The OSA modules now allow direct access to properties of the
2053 toplevel application class (in AppleScript terminology).
2054- The Package Manager can now update itself.
2055
2056SourceForge Bugs and Patches Applied
2057------------------------------------
2058
2059430160, 471893, 501716, 542562, 549151, 569574, 595837, 596434,
2060598163, 604210, 604716, 610332, 612627, 614770, 620190, 621891,
2061622042, 639139, 640236, 644345, 649742, 649742, 658233, 660022,
2062661318, 661676, 662807, 662923, 666219, 672855, 678325, 682347,
2063683486, 684981, 685773, 686254, 692776, 692959, 693094, 696777,
2064697989, 700827, 703666, 708495, 708604, 708901, 710733, 711902,
2065713722, 715782, 718286, 719359, 719367, 723136, 723831, 723962,
2066724588, 724767, 724767, 725942, 726150, 726446, 726869, 727051,
2067727719, 727719, 727805, 728277, 728563, 728656, 729096, 729103,
2068729293, 729297, 729300, 729317, 729395, 729622, 729817, 730170,
2069730296, 730594, 730685, 730826, 730963, 731209, 731403, 731504,
2070731514, 731626, 731635, 731643, 731644, 731644, 731689, 732124,
2071732143, 732234, 732284, 732284, 732479, 732761, 732783, 732951,
2072733667, 733781, 734118, 734231, 734869, 735051, 735293, 735527,
2073735613, 735694, 736962, 736962, 737970, 738066, 739313, 740055,
2074740234, 740301, 741806, 742126, 742741, 742860, 742860, 742911,
2075744041, 744104, 744238, 744687, 744877, 745055, 745478, 745525,
2076745620, 746012, 746304, 746366, 746801, 746953, 747348, 747667,
2077747954, 748846, 748849, 748973, 748975, 749191, 749210, 749759,
2078749831, 749911, 750008, 750092, 750542, 750595, 751038, 751107,
2079751276, 751451, 751916, 751941, 751956, 751998, 752671, 753451,
2080753602, 753617, 753845, 753925, 754014, 754340, 754447, 755031,
2081755087, 755147, 755245, 755683, 755987, 756032, 756996, 757058,
2082757229, 757818, 757821, 757822, 758112, 758910, 759227, 759889,
2083760257, 760703, 760792, 761104, 761337, 761519, 761830, 762455
2084
2085
2086What's New in Python 2.3 beta 1?
2087================================
2088
2089*Release date: 25-Apr-2003*
2090
2091Core and builtins
2092-----------------
2093
2094- New format codes B, H, I, k and K have been implemented for
2095 PyArg_ParseTuple and PyBuild_Value.
2096
2097- New builtin function sum(seq, start=0) returns the sum of all the
2098 items in iterable object seq, plus start (items are normally numbers,
2099 and cannot be strings).
2100
2101- bool() called without arguments now returns False rather than
2102 raising an exception. This is consistent with calling the
2103 constructors for the other builtin types -- called without argument
2104 they all return the false value of that type. (SF patch #724135)
2105
2106- In support of PEP 269 (making the pgen parser generator accessible
2107 from Python), some changes to the pgen code structure were made; a
2108 few files that used to be linked only with pgen are now linked with
2109 Python itself.
2110
2111- The repr() of a weakref object now shows the __name__ attribute of
2112 the referenced object, if it has one.
2113
2114- super() no longer ignores data descriptors, except __class__. See
2115 the thread started at
2116 http://mail.python.org/pipermail/python-dev/2003-April/034338.html
2117
2118- list.insert(i, x) now interprets negative i as it would be
2119 interpreted by slicing, so negative values count from the end of the
2120 list. This was the only place where such an interpretation was not
2121 placed on a list index.
2122
2123- range() now works even if the arguments are longs with magnitude
2124 larger than sys.maxint, as long as the total length of the sequence
2125 fits. E.g., range(2**100, 2**101, 2**100) is the following list:
2126 [1267650600228229401496703205376L]. (SF patch #707427.)
2127
2128- Some horridly obscure problems were fixed involving interaction
2129 between garbage collection and old-style classes with "ambitious"
2130 getattr hooks. If an old-style instance didn't have a __del__ method,
2131 but did have a __getattr__ hook, and the instance became reachable
2132 only from an unreachable cycle, and the hook resurrected or deleted
2133 unreachable objects when asked to resolve "__del__", anything up to
2134 a segfault could happen. That's been repaired.
2135
2136- dict.pop now takes an optional argument specifying a default
2137 value to return if the key is not in the dict. If a default is not
2138 given and the key is not found, a KeyError will still be raised.
2139 Parallel changes were made to UserDict.UserDict and UserDict.DictMixin.
2140 [SF patch #693753] (contributed by Michael Stone.)
2141
2142- sys.getfilesystemencoding() was added to expose
2143 Py_FileSystemDefaultEncoding.
2144
2145- New function sys.exc_clear() clears the current exception. This is
2146 rarely needed, but can sometimes be useful to release objects
2147 referenced by the traceback held in sys.exc_info()[2]. (SF patch
2148 #693195.)
2149
2150- On 64-bit systems, a dictionary could contain duplicate long/int keys
2151 if the key value was larger than 2**32. See SF bug #689659.
2152
2153- Fixed SF bug #663074. The codec system was using global static
2154 variables to store internal data. As a result, any attempts to use the
2155 unicode system with multiple active interpreters, or successive
2156 interpreter executions, would fail.
2157
2158- "%c" % u"a" now returns a unicode string instead of raising a
2159 TypeError. u"%c" % 0xffffffff now raises a OverflowError instead
2160 of a ValueError to be consistent with "%c" % 256. See SF patch #710127.
2161
2162Extension modules
2163-----------------
2164
2165- The socket module now provides the functions inet_pton and inet_ntop
2166 for converting between string and packed representation of IP
2167 addresses. There is also a new module variable, has_ipv6, which is
2168 True iff the current Python has IPv6 support. See SF patch #658327.
2169
2170- Tkinter wrappers around Tcl variables now pass objects directly
2171 to Tcl, instead of first converting them to strings.
2172
2173- The .*? pattern in the re module is now special-cased to avoid the
2174 recursion limit. (SF patch #720991 -- many thanks to Gary Herron
2175 and Greg Chapman.)
2176
2177- New function sys.call_tracing() allows pdb to debug code
2178 recursively.
2179
2180- New function gc.get_referents(obj) returns a list of objects
2181 directly referenced by obj. In effect, it exposes what the object's
2182 tp_traverse slot does, and can be helpful when debugging memory
2183 leaks.
2184
2185- The iconv module has been removed from this release.
2186
2187- The platform-independent routines for packing floats in IEEE formats
2188 (struct.pack's <f, >f, <d, and >d codes; pickle and cPickle's protocol 1
2189 pickling of floats) ignored that rounding can cause a carry to
2190 propagate. The worst consequence was that, in rare cases, <f and >f
2191 could produce strings that, when unpacked again, were a factor of 2
2192 away from the original float. This has been fixed. See SF bug
2193 #705836.
2194
2195- New function time.tzset() provides access to the C library tzset()
2196 function, if supported. (SF patch #675422.)
2197
2198- Using createfilehandler, deletefilehandler, createtimerhandler functions
2199 on Tkinter.tkinter (_tkinter module) no longer crashes the interpreter.
2200 See SF bug #692416.
2201
2202- Modified the fcntl.ioctl() function to allow modification of a passed
2203 mutable buffer (for details see the reference documentation).
2204
2205- Made user requested changes to the itertools module.
2206 Subsumed the times() function into repeat().
2207 Added chain() and cycle().
2208
2209- The rotor module is now deprecated; the encryption algorithm it uses
2210 is not believed to be secure, and including crypto code with Python
2211 has implications for exporting and importing it in various countries.
2212
2213- The socket module now always uses the _socketobject wrapper class, even on
2214 platforms which have dup(2). The makefile() method is built directly
2215 on top of the socket without duplicating the file descriptor, allowing
2216 timeouts to work properly.
2217
2218Library
2219-------
2220
2221- New generator function os.walk() is an easy-to-use alternative to
2222 os.path.walk(). See os module docs for details. os.path.walk()
2223 isn't deprecated at this time, but may become deprecated in a
2224 future release.
2225
2226- Added new module "platform" which provides a wide range of tools
2227 for querying platform dependent features.
2228
2229- netrc now allows ASCII punctuation characters in passwords.
2230
2231- shelve now supports the optional writeback argument, and exposes
2232 pickle protocol versions.
2233
2234- Several methods of nntplib.NNTP have grown an optional file argument
2235 which specifies a file where to divert the command's output
2236 (already supported by the body() method). (SF patch #720468)
2237
2238- The self-documenting XML server library DocXMLRPCServer was added.
2239
2240- Support for internationalized domain names has been added through
2241 the 'idna' and 'punycode' encodings, the 'stringprep' module, the
2242 'mkstringprep' tool, and enhancements to the socket and httplib
2243 modules.
2244
2245- htmlentitydefs has two new dictionaries: name2codepoint maps
2246 HTML entity names to Unicode codepoints (as integers).
2247 codepoint2name is the reverse mapping. See SF patch #722017.
2248
2249- pdb has a new command, "debug", which lets you step through
2250 arbitrary code from the debugger's (pdb) prompt.
2251
2252- unittest.failUnlessEqual and its equivalent unittest.assertEqual now
2253 return 'not a == b' rather than 'a != b'. This gives the desired
2254 result for classes that define __eq__ without defining __ne__.
2255
2256- sgmllib now supports SGML marked sections, in particular the
2257 MS Office extensions.
2258
2259- The urllib module now offers support for the iterator protocol.
2260 SF patch 698520 contributed by Brett Cannon.
2261
2262- New module timeit provides a simple framework for timing the
2263 execution speed of expressions and statements.
2264
2265- sets.Set objects now support mixed-type __eq__ and __ne__, instead
2266 of raising TypeError. If x is a Set object and y is a non-Set object,
2267 x == y is False, and x != y is True. This is akin to the change made
2268 for mixed-type comparisons of datetime objects in 2.3a2; more info
2269 about the rationale is in the NEWS entry for that. See also SF bug
2270 report <http://www.python.org/sf/693121>.
2271
2272- On Unix platforms, if os.listdir() is called with a Unicode argument,
2273 it now returns Unicode strings. (This behavior was added earlier
2274 to the Windows NT/2k/XP version of os.listdir().)
2275
2276- Distutils: both 'py_modules' and 'packages' keywords can now be specified
2277 in core.setup(). Previously you could supply one or the other, but
2278 not both of them. (SF patch #695090 from Bernhard Herzog)
2279
2280- New csv package makes it easy to read/write CSV files.
2281
2282- Module shlex has been extended to allow posix-like shell parsings,
2283 including a split() function for easy spliting of quoted strings and
2284 commands. An iterator interface was also implemented.
2285
2286Tools/Demos
2287-----------
2288
2289- New script combinerefs.py helps analyze new PYTHONDUMPREFS output.
2290 See the module docstring for details.
2291
2292Build
2293-----
2294
2295- Fix problem building on OSF1 because the compiler only accepted
2296 preprocessor directives that start in column 1. (SF bug #691793.)
2297
2298C API
2299-----
2300
2301- Added PyGC_Collect(), equivalent to calling gc.collect().
2302
2303- PyThreadState_GetDict() was changed not to raise an exception or
2304 issue a fatal error when no current thread state is available. This
2305 makes it possible to print dictionaries when no thread is active.
2306
2307- LONG_LONG was renamed to PY_LONG_LONG. Extensions that use this and
2308 need compatibility with previous versions can use this:
2309
2310 #ifndef PY_LONG_LONG
2311 #define PY_LONG_LONG LONG_LONG
2312 #endif
2313
2314- Added PyObject_SelfIter() to fill the tp_iter slot for the
2315 typical case where the method returns its self argument.
2316
2317- The extended type structure used for heap types (new-style
2318 classes defined by Python code using a class statement) is now
2319 exported from object.h as PyHeapTypeObject. (SF patch #696193.)
2320
2321New platforms
2322-------------
2323
2324None this time.
2325
2326Tests
2327-----
2328
2329- test_timeout now requires -u network to be passed to regrtest to run.
2330 See SF bug #692988.
2331
2332Windows
2333-------
2334
2335- os.fsync() now exists on Windows, and calls the Microsoft _commit()
2336 function.
2337
2338- New function winsound.MessageBeep() wraps the Win32 API
2339 MessageBeep().
2340
2341Mac
2342---
2343
2344- os.listdir() now returns Unicode strings on MacOS X when called with
2345 a Unicode argument. See the general news item under "Library".
2346
2347- A new method MacOS.WMAvailable() returns true if it is safe to access
2348 the window manager, false otherwise.
2349
2350- EasyDialogs dialogs are now movable-modal, and if the application is
2351 currently in the background they will ask to be moved to the foreground
2352 before displaying.
2353
2354- OSA Scripting support has improved a lot, and gensuitemodule.py can now
2355 be used by mere mortals. The documentation is now also more or less
2356 complete.
2357
2358- The IDE (in a framework build) now includes introductory documentation
2359 in Apple Help Viewer format.
2360
2361
2362What's New in Python 2.3 alpha 2?
2363=================================
2364
2365*Release date: 19-Feb-2003*
2366
2367Core and builtins
2368-----------------
2369
2370- Negative positions returned from PEP 293 error callbacks are now
2371 treated as being relative to the end of the input string. Positions
2372 that are out of bounds raise an IndexError.
2373
2374- sys.path[0] (the directory from which the script is loaded) is now
2375 turned into an absolute pathname, unless it is the empty string.
2376 (SF patch #664376.)
2377
2378- Finally fixed the bug in compile() and exec where a string ending
2379 with an indented code block but no newline would raise SyntaxError.
2380 This would have been a four-line change in parsetok.c... Except
2381 codeop.py depends on this behavior, so a compilation flag had to be
2382 invented that causes the tokenizer to revert to the old behavior;
2383 this required extra changes to 2 .h files, 2 .c files, and 2 .py
2384 files. (Fixes SF bug #501622.)
2385
2386- If a new-style class defines neither __new__ nor __init__, its
2387 constructor would ignore all arguments. This is changed now: the
2388 constructor refuses arguments in this case. This might break code
2389 that worked under Python 2.2. The simplest fix is to add a no-op
2390 __init__: ``def __init__(self, *args, **kw): pass``.
2391
2392- Through a bytecode optimizer bug (and I bet you didn't even know
2393 Python *had* a bytecode optimizer :-), "unsigned" hex/oct constants
2394 with a leading minus sign would come out with the wrong sign.
2395 ("Unsigned" hex/oct constants are those with a face value in the
2396 range sys.maxint+1 through sys.maxint*2+1, inclusive; these have
2397 always been interpreted as negative numbers through sign folding.)
2398 E.g. 0xffffffff is -1, and -(0xffffffff) is 1, but -0xffffffff would
2399 come out as -4294967295. This was the case in Python 2.2 through
2400 2.2.2 and 2.3a1, and in Python 2.4 it will once again have that
2401 value, but according to PEP 237 it really needs to be 1 now. This
2402 will be backported to Python 2.2.3 a well. (SF #660455)
2403
2404- int(s, base) sometimes sign-folds hex and oct constants; it only
2405 does this when base is 0 and s.strip() starts with a '0'. When the
2406 sign is actually folded, as in int("0xffffffff", 0) on a 32-bit
2407 machine, which returns -1, a FutureWarning is now issued; in Python
2408 2.4, this will return 4294967295L, as do int("+0xffffffff", 0) and
2409 int("0xffffffff", 16) right now. (PEP 347)
2410
2411- super(X, x): x may now be a proxy for an X instance, i.e.
2412 issubclass(x.__class__, X) but not issubclass(type(x), X).
2413
2414- isinstance(x, X): if X is a new-style class, this is now equivalent
2415 to issubclass(type(x), X) or issubclass(x.__class__, X). Previously
2416 only type(x) was tested. (For classic classes this was already the
2417 case.)
2418
2419- compile(), eval() and the exec statement now fully support source code
2420 passed as unicode strings.
2421
2422- int subclasses can be initialized with longs if the value fits in an int.
2423 See SF bug #683467.
2424
2425- long(string, base) takes time linear in len(string) when base is a power
2426 of 2 now. It used to take time quadratic in len(string).
2427
2428- filter returns now Unicode results for Unicode arguments.
2429
2430- raw_input can now return Unicode objects.
2431
2432- List objects' sort() method now accepts None as the comparison function.
2433 Passing None is semantically identical to calling sort() with no
2434 arguments.
2435
2436- Fixed crash when printing a subclass of str and __str__ returned self.
2437 See SF bug #667147.
2438
2439- Fixed an invalid RuntimeWarning and an undetected error when trying
2440 to convert a long integer into a float which couldn't fit.
2441 See SF bug #676155.
2442
2443- Function objects now have a __module__ attribute that is bound to
2444 the name of the module in which the function was defined. This
2445 applies for C functions and methods as well as functions and methods
2446 defined in Python. This attribute is used by pickle.whichmodule(),
2447 which changes the behavior of whichmodule slightly. In Python 2.2
2448 whichmodule() returns "__main__" for functions that are not defined
2449 at the top-level of a module (examples: methods, nested functions).
2450 Now whichmodule() will return the proper module name.
2451
2452Extension modules
2453-----------------
2454
2455- operator.isNumberType() now checks that the object has a nb_int or
2456 nb_float slot, rather than simply checking whether it has a non-NULL
2457 tp_as_number pointer.
2458
2459- The imp module now has ways to acquire and release the "import
2460 lock": imp.acquire_lock() and imp.release_lock(). Note: this is a
2461 reentrant lock, so releasing the lock only truly releases it when
2462 this is the last release_lock() call. You can check with
2463 imp.lock_held(). (SF bug #580952 and patch #683257.)
2464
2465- Change to cPickle to match pickle.py (see below and PEP 307).
2466
2467- Fix some bugs in the parser module. SF bug #678518.
2468
2469- Thanks to Scott David Daniels, a subtle bug in how the zlib
2470 extension implemented flush() was fixed. Scott also rewrote the
2471 zlib test suite using the unittest module. (SF bug #640230 and
2472 patch #678531.)
2473
2474- Added an itertools module containing high speed, memory efficient
2475 looping constructs inspired by tools from Haskell and SML.
2476
2477- The SSL module now handles sockets with a timeout set correctly (SF
2478 patch #675750, fixing SF bug #675552).
2479
2480- os/posixmodule has grown the sysexits.h constants (EX_OK and friends).
2481
2482- Fixed broken threadstate swap in readline that could cause fatal
2483 errors when a readline hook was being invoked while a background
2484 thread was active. (SF bugs #660476 and #513033.)
2485
2486- fcntl now exposes the strops.h I_* constants.
2487
2488- Fix a crash on Solaris that occurred when calling close() on
2489 an mmap'ed file which was already closed. (SF patch #665913)
2490
2491- Fixed several serious bugs in the zipimport implementation.
2492
2493- datetime changes:
2494
2495 The date class is now properly subclassable. (SF bug #720908)
2496
2497 The datetime and datetimetz classes have been collapsed into a single
2498 datetime class, and likewise the time and timetz classes into a single
2499 time class. Previously, a datetimetz object with tzinfo=None acted
2500 exactly like a datetime object, and similarly for timetz. This wasn't
2501 enough of a difference to justify distinct classes, and life is simpler
2502 now.
2503
2504 today() and now() now round system timestamps to the closest
2505 microsecond <http://www.python.org/sf/661086>. This repairs an
2506 irritation most likely seen on Windows systems.
2507
2508 In dt.astimezone(tz), if tz.utcoffset(dt) returns a duration,
2509 ValueError is raised if tz.dst(dt) returns None (2.3a1 treated it
2510 as 0 instead, but a tzinfo subclass wishing to participate in
2511 time zone conversion has to take a stand on whether it supports
2512 DST; if you don't care about DST, then code dst() to return 0 minutes,
2513 meaning that DST is never in effect).
2514
2515 The tzinfo methods utcoffset() and dst() must return a timedelta object
2516 (or None) now. In 2.3a1 they could also return an int or long, but that
2517 was an unhelpfully redundant leftover from an earlier version wherein
2518 they couldn't return a timedelta. TOOWTDI.
2519
2520 The example tzinfo class for local time had a bug. It was replaced
2521 by a later example coded by Guido.
2522
2523 datetime.astimezone(tz) no longer raises an exception when the
2524 input datetime has no UTC equivalent in tz. For typical "hybrid" time
2525 zones (a single tzinfo subclass modeling both standard and daylight
2526 time), this case can arise one hour per year, at the hour daylight time
2527 ends. See new docs for details. In short, the new behavior mimics
2528 the local wall clock's behavior of repeating an hour in local time.
2529
2530 dt.astimezone() can no longer be used to convert between naive and aware
2531 datetime objects. If you merely want to attach, or remove, a tzinfo
2532 object, without any conversion of date and time members, use
2533 dt.replace(tzinfo=whatever) instead, where "whatever" is None or a
2534 tzinfo subclass instance.
2535
2536 A new method tzinfo.fromutc(dt) can be overridden in tzinfo subclasses
2537 to give complete control over how a UTC time is to be converted to
2538 a local time. The default astimezone() implementation calls fromutc()
2539 as its last step, so a tzinfo subclass can affect that too by overriding
2540 fromutc(). It's expected that the default fromutc() implementation will
2541 be suitable as-is for "almost all" time zone subclasses, but the
2542 creativity of political time zone fiddling appears unbounded -- fromutc()
2543 allows the highly motivated to emulate any scheme expressible in Python.
2544
2545 datetime.now(): The optional tzinfo argument was undocumented (that's
2546 repaired), and its name was changed to tz ("tzinfo" is overloaded enough
2547 already). With a tz argument, now(tz) used to return the local date
2548 and time, and attach tz to it, without any conversion of date and time
2549 members. This was less than useful. Now now(tz) returns the current
2550 date and time as local time in tz's time zone, akin to ::
2551
2552 tz.fromutc(datetime.utcnow().replace(tzinfo=utc))
2553
2554 where "utc" is an instance of a tzinfo subclass modeling UTC. Without
2555 a tz argument, now() continues to return the current local date and time,
2556 as a naive datetime object.
2557
2558 datetime.fromtimestamp(): Like datetime.now() above, this had less than
2559 useful behavior when the optional tinzo argument was specified. See
2560 also SF bug report <http://www.python.org/sf/660872>.
2561
2562 date and datetime comparison: In order to prevent comparison from
2563 falling back to the default compare-object-addresses strategy, these
2564 raised TypeError whenever they didn't understand the other object type.
2565 They still do, except when the other object has a "timetuple" attribute,
2566 in which case they return NotImplemented now. This gives other
2567 datetime objects (e.g., mxDateTime) a chance to intercept the
2568 comparison.
2569
2570 date, time, datetime and timedelta comparison: When the exception
2571 for mixed-type comparisons in the last paragraph doesn't apply, if
2572 the comparison is == then False is returned, and if the comparison is
2573 != then True is returned. Because dict lookup and the "in" operator
2574 only invoke __eq__, this allows, for example, ::
2575
2576 if some_datetime in some_sequence:
2577
2578 and ::
2579
2580 some_dict[some_timedelta] = whatever
2581
2582 to work as expected, without raising TypeError just because the
2583 sequence is heterogeneous, or the dict has mixed-type keys. [This
2584 seems like a good idea to implement for all mixed-type comparisons
2585 that don't want to allow falling back to address comparison.]
2586
2587 The constructors building a datetime from a timestamp could raise
2588 ValueError if the platform C localtime()/gmtime() inserted "leap
2589 seconds". Leap seconds are ignored now. On such platforms, it's
2590 possible to have timestamps that differ by a second, yet where
2591 datetimes constructed from them are equal.
2592
2593 The pickle format of date, time and datetime objects has changed
2594 completely. The undocumented pickler and unpickler functions no
2595 longer exist. The undocumented __setstate__() and __getstate__()
2596 methods no longer exist either.
2597
2598Library
2599-------
2600
2601- The logging module was updated slightly; the WARN level was renamed
2602 to WARNING, and the matching function/method warn() to warning().
2603
2604- The pickle and cPickle modules were updated with a new pickling
2605 protocol (documented by pickletools.py, see below) and several
2606 extensions to the pickle customization API (__reduce__, __setstate__
2607 etc.). The copy module now uses more of the pickle customization
2608 API to copy objects that don't implement __copy__ or __deepcopy__.
2609 See PEP 307 for details.
2610
2611- The distutils "register" command now uses http://www.python.org/pypi
2612 as the default repository. (See PEP 301.)
2613
2614- the platform dependent path related variables sep, altsep, extsep,
2615 pathsep, curdir, pardir and defpath are now defined in the platform
2616 dependent path modules (e.g. ntpath.py) rather than os.py, so these
2617 variables are now available via os.path. They continue to be
2618 available from the os module.
2619 (see <http://www.python.org/sf/680789>).
2620
2621- array.array was added to the types repr.py knows about (see
2622 <http://www.python.org/sf/680789>).
2623
2624- The new pickletools.py contains lots of documentation about pickle
2625 internals, and supplies some helpers for working with pickles, such as
2626 a symbolic pickle disassembler.
2627
2628- Xmlrpclib.py now supports the builtin boolean type.
2629
2630- py_compile has a new 'doraise' flag and a new PyCompileError
2631 exception.
2632
2633- SimpleXMLRPCServer now supports CGI through the CGIXMLRPCRequestHandler
2634 class.
2635
2636- The sets module now raises TypeError in __cmp__, to clarify that
2637 sets are not intended to be three-way-compared; the comparison
2638 operators are overloaded as subset/superset tests.
2639
2640- Bastion.py and rexec.py are disabled. These modules are not safe in
2641 Python 2.2. or 2.3.
2642
2643- realpath is now exported when doing ``from poxixpath import *``.
2644 It is also exported for ntpath, macpath, and os2emxpath.
2645 See SF bug #659228.
2646
2647- New module tarfile from Lars Gustäbel provides a comprehensive interface
2648 to tar archive files with transparent gzip and bzip2 compression.
2649 See SF patch #651082.
2650
2651- urlparse can now parse imap:// URLs. See SF feature request #618024.
2652
2653- Tkinter.Canvas.scan_dragto() provides an optional parameter to support
2654 the gain value which is passed to Tk. SF bug# 602259.
2655
2656- Fix logging.handlers.SysLogHandler protocol when using UNIX domain sockets.
2657 See SF patch #642974.
2658
2659- The dospath module was deleted. Use the ntpath module when manipulating
2660 DOS paths from other platforms.
2661
2662Tools/Demos
2663-----------
2664
2665- Two new scripts (db2pickle.py and pickle2db.py) were added to the
2666 Tools/scripts directory to facilitate conversion from the old bsddb module
2667 to the new one. While the user-visible API of the new module is
2668 compatible with the old one, it's likely that the version of the
2669 underlying database library has changed. To convert from the old library,
2670 run the db2pickle.py script using the old version of Python to convert it
2671 to a pickle file. After upgrading Python, run the pickle2db.py script
2672 using the new version of Python to reconstitute your database. For
2673 example:
2674
2675 % python2.2 db2pickle.py -h some.db > some.pickle
2676 % python2.3 pickle2db.py -h some.db.new < some.pickle
2677
2678 Run the scripts without any args to get a usage message.
2679
2680
2681Build
2682-----
2683
2684- The audio driver tests (test_ossaudiodev.py and
2685 test_linuxaudiodev.py) are no longer run by default. This is
2686 because they don't always work, depending on your hardware and
2687 software. To run these tests, you must use an invocation like ::
2688
2689 ./python Lib/test/regrtest.py -u audio test_ossaudiodev
2690
2691- On systems which build using the configure script, compiler flags which
2692 used to be lumped together using the OPT flag have been split into two
2693 groups, OPT and BASECFLAGS. OPT is meant to carry just optimization- and
2694 debug-related flags like "-g" and "-O3". BASECFLAGS is meant to carry
2695 compiler flags that are required to get a clean compile. On some
2696 platforms (many Linux flavors in particular) BASECFLAGS will be empty by
2697 default. On others, such as Mac OS X and SCO, it will contain required
2698 flags. This change allows people building Python to override OPT without
2699 fear of clobbering compiler flags which are required to get a clean build.
2700
2701- On Darwin/Mac OS X platforms, /sw/lib and /sw/include are added to the
2702 relevant search lists in setup.py. This allows users building Python to
2703 take advantage of the many packages available from the fink project
2704 <http://fink.sf.net/>.
2705
2706- A new Makefile target, scriptsinstall, installs a number of useful scripts
2707 from the Tools/scripts directory.
2708
2709C API
2710-----
2711
2712- PyEval_GetFrame() is now declared to return a ``PyFrameObject *``
2713 instead of a plain ``PyObject *``. (SF patch #686601.)
2714
2715- PyNumber_Check() now checks that the object has a nb_int or nb_float
2716 slot, rather than simply checking whether it has a non-NULL
2717 tp_as_number pointer.
2718
2719- A C type that inherits from a base type that defines tp_as_buffer
2720 will now inherit the tp_as_buffer pointer if it doesn't define one.
2721 (SF #681367)
2722
2723- The PyArg_Parse functions now issue a DeprecationWarning if a float
2724 argument is provided when an integer is specified (this affects the 'b',
2725 'B', 'h', 'H', 'i', and 'l' codes). Future versions of Python will
2726 raise a TypeError.
2727
2728Tests
2729-----
2730
2731- Several tests weren't being run from regrtest.py (test_timeout.py,
2732 test_tarfile.py, test_netrc.py, test_multifile.py,
2733 test_importhooks.py and test_imp.py). Now they are. (Note to
2734 developers: please read Lib/test/README when creating a new test, to
2735 make sure to do it right! All tests need to use either unittest or
2736 pydoc.)
2737
2738- Added test_posix.py, a test suite for the posix module.
2739
2740- Added test_hexoct.py, a test suite for hex/oct constant folding.
2741
2742Windows
2743-------
2744
2745- The timeout code for socket connect() didn't work right; this has
2746 now been fixed. test_timeout.py should pass (at least most of the
2747 time).
2748
2749- distutils' msvccompiler class now passes the preprocessor options to
2750 the resource compiler. See SF patch #669198.
2751
2752- The bsddb module now ships with Sleepycat's 4.1.25.NC, the latest
2753 release without strong cryptography.
2754
2755- sys.path[0], if it contains a directory name, is now always an
2756 absolute pathname. (SF patch #664376.)
2757
2758- The new logging package is now installed by the Windows installer. It
2759 wasn't in 2.3a1 due to oversight.
2760
2761Mac
2762---
2763
2764- There are new dialogs EasyDialogs.AskFileForOpen, AskFileForSave
2765 and AskFolder. The old macfs.StandardGetFile and friends are deprecated.
2766
2767- Most of the standard library now uses pathnames or FSRefs in preference
2768 of FSSpecs, and use the underlying Carbon.File and Carbon.Folder modules
2769 in stead of macfs. macfs will probably be deprecated in the future.
2770
2771- Type Carbon.File.FSCatalogInfo and supporting methods have been implemented.
2772 This also makes macfs.FSSpec.SetDates() work again.
2773
2774- There is a new module pimp, the package install manager for Python, and
2775 accompanying applet PackageManager. These allow you to easily download
2776 and install pretested extension packages either in source or binary
2777 form. Only in MacPython-OSX.
2778
2779- Applets are now built with bundlebuilder in MacPython-OSX, which should make
2780 them more robust and also provides a path towards BuildApplication. The
2781 downside of this change is that applets can no longer be run from the
2782 Terminal window, this will hopefully be fixed in the 2.3b1.
2783
2784
2785What's New in Python 2.3 alpha 1?
2786=================================
2787
2788*Release date: 31-Dec-2002*
2789
2790Type/class unification and new-style classes
2791--------------------------------------------
2792
2793- One can now assign to __bases__ and __name__ of new-style classes.
2794
2795- dict() now accepts keyword arguments so that dict(one=1, two=2)
2796 is the equivalent of {"one": 1, "two": 2}. Accordingly,
2797 the existing (but undocumented) 'items' keyword argument has
2798 been eliminated. This means that dict(items=someMapping) now has
2799 a different meaning than before.
2800
2801- int() now returns a long object if the argument is outside the
2802 integer range, so int("4" * 1000), int(1e200) and int(1L<<1000) will
2803 all return long objects instead of raising an OverflowError.
2804
2805- Assignment to __class__ is disallowed if either the old or the new
2806 class is a statically allocated type object (such as defined by an
2807 extension module). This prevents anomalies like 2.__class__ = bool.
2808
2809- New-style object creation and deallocation have been sped up
2810 significantly; they are now faster than classic instance creation
2811 and deallocation.
2812
2813- The __slots__ variable can now mention "private" names, and the
2814 right thing will happen (e.g. __slots__ = ["__foo"]).
2815
2816- The built-ins slice() and buffer() are now callable types. The
2817 types classobj (formerly class), code, function, instance, and
2818 instancemethod (formerly instance-method), which have no built-in
2819 names but are accessible through the types module, are now also
2820 callable. The type dict-proxy is renamed to dictproxy.
2821
2822- Cycles going through the __class__ link of a new-style instance are
2823 now detected by the garbage collector.
2824
2825- Classes using __slots__ are now properly garbage collected.
2826 [SF bug 519621]
2827
2828- Tightened the __slots__ rules: a slot name must be a valid Python
2829 identifier.
2830
2831- The constructor for the module type now requires a name argument and
2832 takes an optional docstring argument. Previously, this constructor
2833 ignored its arguments. As a consequence, deriving a class from a
2834 module (not from the module type) is now illegal; previously this
2835 created an unnamed module, just like invoking the module type did.
2836 [SF bug 563060]
2837
2838- A new type object, 'basestring', is added. This is a common base type
2839 for 'str' and 'unicode', and can be used instead of
2840 types.StringTypes, e.g. to test whether something is "a string":
2841 isinstance(x, basestring) is True for Unicode and 8-bit strings. This
2842 is an abstract base class and cannot be instantiated directly.
2843
2844- Changed new-style class instantiation so that when C's __new__
2845 method returns something that's not a C instance, its __init__ is
2846 not called. [SF bug #537450]
2847
2848- Fixed super() to work correctly with class methods. [SF bug #535444]
2849
2850- If you try to pickle an instance of a class that has __slots__ but
2851 doesn't define or override __getstate__, a TypeError is now raised.
2852 This is done by adding a bozo __getstate__ to the class that always
2853 raises TypeError. (Before, this would appear to be pickled, but the
2854 state of the slots would be lost.)
2855
2856Core and builtins
2857-----------------
2858
2859- Import from zipfiles is now supported. The name of a zipfile placed
2860 on sys.path causes the import statement to look for importable Python
2861 modules (with .py, pyc and .pyo extensions) and packages inside the
2862 zipfile. The zipfile import follows the specification (though not
2863 the sample implementation) of PEP 273. The semantics of __path__ are
2864 compatible with those that have been implemented in Jython since
2865 Jython 2.1.
2866
2867- PEP 302 has been accepted. Although it was initially developed to
2868 support zipimport, it offers a new, general import hook mechanism.
2869 Several new variables have been added to the sys module:
2870 sys.meta_path, sys.path_hooks, and sys.path_importer_cache; these
2871 make extending the import statement much more convenient than
2872 overriding the __import__ built-in function. For a description of
2873 these, see PEP 302.
2874
2875- A frame object's f_lineno attribute can now be written to from a
2876 trace function to change which line will execute next. A command to
2877 exploit this from pdb has been added. [SF patch #643835]
2878
2879- The _codecs support module for codecs.py was turned into a builtin
2880 module to assure that at least the builtin codecs are available
2881 to the Python parser for source code decoding according to PEP 263.
2882
2883- issubclass now supports a tuple as the second argument, just like
2884 isinstance does. ``issubclass(X, (A, B))`` is equivalent to
2885 ``issubclass(X, A) or issubclass(X, B)``.
2886
2887- Thanks to Armin Rigo, the last known way to provoke a system crash
2888 by cleverly arranging for a comparison function to mutate a list
2889 during a list.sort() operation has been fixed. The effect of
2890 attempting to mutate a list, or even to inspect its contents or
2891 length, while a sort is in progress, is not defined by the language.
2892 The C implementation of Python 2.3 attempts to detect mutations,
2893 and raise ValueError if one occurs, but there's no guarantee that
2894 all mutations will be caught, or that any will be caught across
2895 releases or implementations.
2896
2897- Unicode file name processing for Windows (PEP 277) is implemented.
2898 All platforms now have an os.path.supports_unicode_filenames attribute,
2899 which is set to True on Windows NT/2000/XP, and False elsewhere.
2900
2901- Codec error handling callbacks (PEP 293) are implemented.
2902 Error handling in unicode.encode or str.decode can now be customized.
2903
2904- A subtle change to the semantics of the built-in function intern():
2905 interned strings are no longer immortal. You must keep a reference
2906 to the return value intern() around to get the benefit.
2907
2908- Use of 'None' as a variable, argument or attribute name now
2909 issues a SyntaxWarning. In the future, None may become a keyword.
2910
2911- SET_LINENO is gone. co_lnotab is now consulted to determine when to
2912 call the trace function. C code that accessed f_lineno should call
2913 PyCode_Addr2Line instead (f_lineno is still there, but only kept up
2914 to date when there is a trace function set).
2915
2916- There's a new warning category, FutureWarning. This is used to warn
2917 about a number of situations where the value or sign of an integer
2918 result will change in Python 2.4 as a result of PEP 237 (integer
2919 unification). The warnings implement stage B0 mentioned in that
2920 PEP. The warnings are about the following situations:
2921
2922 - Octal and hex literals without 'L' prefix in the inclusive range
2923 [0x80000000..0xffffffff]; these are currently negative ints, but
2924 in Python 2.4 they will be positive longs with the same bit
2925 pattern.
2926
2927 - Left shifts on integer values that cause the outcome to lose
2928 bits or have a different sign than the left operand. To be
2929 precise: x<<n where this currently doesn't yield the same value
2930 as long(x)<<n; in Python 2.4, the outcome will be long(x)<<n.
2931
2932 - Conversions from ints to string that show negative values as
2933 unsigned ints in the inclusive range [0x80000000..0xffffffff];
2934 this affects the functions hex() and oct(), and the string
2935 formatting codes %u, %o, %x, and %X. In Python 2.4, these will
2936 show signed values (e.g. hex(-1) currently returns "0xffffffff";
2937 in Python 2.4 it will return "-0x1").
2938
2939- The bits manipulated under the cover by sys.setcheckinterval() have
2940 been changed. Both the check interval and the ticker used to be
2941 per-thread values. They are now just a pair of global variables.
2942 In addition, the default check interval was boosted from 10 to 100
2943 bytecode instructions. This may have some effect on systems that
2944 relied on the old default value. In particular, in multi-threaded
2945 applications which try to be highly responsive, response time will
2946 increase by some (perhaps imperceptible) amount.
2947
2948- When multiplying very large integers, a version of the so-called
2949 Karatsuba algorithm is now used. This is most effective if the
2950 inputs have roughly the same size. If they both have about N digits,
2951 Karatsuba multiplication has O(N**1.58) runtime (the exponent is
2952 log_base_2(3)) instead of the previous O(N**2). Measured results may
2953 be better or worse than that, depending on platform quirks. Besides
2954 the O() improvement in raw instruction count, the Karatsuba algorithm
2955 appears to have much better cache behavior on extremely large integers
2956 (starting in the ballpark of a million bits). Note that this is a
2957 simple implementation, and there's no intent here to compete with,
2958 e.g., GMP. It gives a very nice speedup when it applies, but a package
2959 devoted to fast large-integer arithmetic should run circles around it.
2960
2961- u'%c' will now raise a ValueError in case the argument is an
2962 integer outside the valid range of Unicode code point ordinals.
2963
2964- The tempfile module has been overhauled for enhanced security. The
2965 mktemp() function is now deprecated; new, safe replacements are
2966 mkstemp() (for files) and mkdtemp() (for directories), and the
2967 higher-level functions NamedTemporaryFile() and TemporaryFile().
2968 Use of some global variables in this module is also deprecated; the
2969 new functions have keyword arguments to provide the same
2970 functionality. All Lib, Tools and Demo modules that used the unsafe
2971 interfaces have been updated to use the safe replacements. Thanks
2972 to Zack Weinberg!
2973
2974- When x is an object whose class implements __mul__ and __rmul__,
2975 1.0*x would correctly invoke __rmul__, but 1*x would erroneously
2976 invoke __mul__. This was due to the sequence-repeat code in the int
2977 type. This has been fixed now.
2978
2979- Previously, "str1 in str2" required str1 to be a string of length 1.
2980 This restriction has been relaxed to allow str1 to be a string of
2981 any length. Thus "'el' in 'hello world'" returns True now.
2982
2983- File objects are now their own iterators. For a file f, iter(f) now
2984 returns f (unless f is closed), and f.next() is similar to
2985 f.readline() when EOF is not reached; however, f.next() uses a
2986 readahead buffer that messes up the file position, so mixing
2987 f.next() and f.readline() (or other methods) doesn't work right.
2988 Calling f.seek() drops the readahead buffer, but other operations
2989 don't. It so happens that this gives a nice additional speed boost
2990 to "for line in file:"; the xreadlines method and corresponding
2991 module are now obsolete. Thanks to Oren Tirosh!
2992
2993- Encoding declarations (PEP 263, phase 1) have been implemented. A
2994 comment of the form "# -*- coding: <encodingname> -*-" in the first
2995 or second line of a Python source file indicates the encoding.
2996
2997- list.sort() has a new implementation. While cross-platform results
2998 may vary, and in data-dependent ways, this is much faster on many
2999 kinds of partially ordered lists than the previous implementation,
3000 and reported to be just as fast on randomly ordered lists on
3001 several major platforms. This sort is also stable (if A==B and A
3002 precedes B in the list at the start, A precedes B after the sort too),
3003 although the language definition does not guarantee stability. A
3004 potential drawback is that list.sort() may require temp space of
3005 len(list)*2 bytes (``*4`` on a 64-bit machine). It's therefore possible
3006 for list.sort() to raise MemoryError now, even if a comparison function
3007 does not. See <http://www.python.org/sf/587076> for full details.
3008
3009- All standard iterators now ensure that, once StopIteration has been
3010 raised, all future calls to next() on the same iterator will also
3011 raise StopIteration. There used to be various counterexamples to
3012 this behavior, which could caused confusion or subtle program
3013 breakage, without any benefits. (Note that this is still an
3014 iterator's responsibility; the iterator framework does not enforce
3015 this.)
3016
3017- Ctrl+C handling on Windows has been made more consistent with
3018 other platforms. KeyboardInterrupt can now reliably be caught,
3019 and Ctrl+C at an interactive prompt no longer terminates the
3020 process under NT/2k/XP (it never did under Win9x). Ctrl+C will
3021 interrupt time.sleep() in the main thread, and any child processes
3022 created via the popen family (on win2k; we can't make win9x work
3023 reliably) are also interrupted (as generally happens on for Linux/Unix.)
3024 [SF bugs 231273, 439992 and 581232]
3025
3026- sys.getwindowsversion() has been added on Windows. This
3027 returns a tuple with information about the version of Windows
3028 currently running.
3029
3030- Slices and repetitions of buffer objects now consistently return
3031 a string. Formerly, strings would be returned most of the time,
3032 but a buffer object would be returned when the repetition count
3033 was one or when the slice range was all inclusive.
3034
3035- Unicode objects in sys.path are no longer ignored but treated
3036 as directory names.
3037
3038- Fixed string.startswith and string.endswith builtin methods
3039 so they accept negative indices. [SF bug 493951]
3040
3041- Fixed a bug with a continue inside a try block and a yield in the
3042 finally clause. [SF bug 567538]
3043
3044- Most builtin sequences now support "extended slices", i.e. slices
3045 with a third "stride" parameter. For example, "hello world"[::-1]
3046 gives "dlrow olleh".
3047
3048- A new warning PendingDeprecationWarning was added to provide
3049 direction on features which are in the process of being deprecated.
3050 The warning will not be printed by default. To see the pending
3051 deprecations, use -Walways::PendingDeprecationWarning::
3052 as a command line option or warnings.filterwarnings() in code.
3053
3054- Deprecated features of xrange objects have been removed as
3055 promised. The start, stop, and step attributes and the tolist()
3056 method no longer exist. xrange repetition and slicing have been
3057 removed.
3058
3059- New builtin function enumerate(x), from PEP 279. Example:
3060 enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c").
3061 The argument can be an arbitrary iterable object.
3062
3063- The assert statement no longer tests __debug__ at runtime. This means
3064 that assert statements cannot be disabled by assigning a false value
3065 to __debug__.
3066
3067- A method zfill() was added to str and unicode, that fills a numeric
3068 string to the left with zeros. For example,
3069 "+123".zfill(6) -> "+00123".
3070
3071- Complex numbers supported divmod() and the // and % operators, but
3072 these make no sense. Since this was documented, they're being
3073 deprecated now.
3074
3075- String and unicode methods lstrip(), rstrip() and strip() now take
3076 an optional argument that specifies the characters to strip. For
3077 example, "Foo!!!?!?!?".rstrip("?!") -> "Foo".
3078
3079- There's a new dictionary constructor (a class method of the dict
3080 class), dict.fromkeys(iterable, value=None). It constructs a
3081 dictionary with keys taken from the iterable and all values set to a
3082 single value. It can be used for building sets and for removing
3083 duplicates from sequences.
3084
3085- Added a new dict method pop(key). This removes and returns the
3086 value corresponding to key. [SF patch #539949]
3087
3088- A new built-in type, bool, has been added, as well as built-in
3089 names for its two values, True and False. Comparisons and sundry
3090 other operations that return a truth value have been changed to
3091 return a bool instead. Read PEP 285 for an explanation of why this
3092 is backward compatible.
3093
3094- Fixed two bugs reported as SF #535905: under certain conditions,
3095 deallocating a deeply nested structure could cause a segfault in the
3096 garbage collector, due to interaction with the "trashcan" code;
3097 access to the current frame during destruction of a local variable
3098 could access a pointer to freed memory.
3099
3100- The optional object allocator ("pymalloc") has been enabled by
3101 default. The recommended practice for memory allocation and
3102 deallocation has been streamlined. A header file is included,
3103 Misc/pymemcompat.h, which can be bundled with 3rd party extensions
3104 and lets them use the same API with Python versions from 1.5.2
3105 onwards.
3106
3107- PyErr_Display will provide file and line information for all exceptions
3108 that have an attribute print_file_and_line, not just SyntaxErrors.
3109
3110- The UTF-8 codec will now encode and decode Unicode surrogates
3111 correctly and without raising exceptions for unpaired ones.
3112
3113- Universal newlines (PEP 278) is implemented. Briefly, using 'U'
3114 instead of 'r' when opening a text file for reading changes the line
3115 ending convention so that any of '\r', '\r\n', and '\n' is
3116 recognized (even mixed in one file); all three are converted to
3117 '\n', the standard Python line end character.
3118
3119- file.xreadlines() now raises a ValueError if the file is closed:
3120 Previously, an xreadlines object was returned which would raise
3121 a ValueError when the xreadlines.next() method was called.
3122
3123- sys.exit() inadvertently allowed more than one argument.
3124 An exception will now be raised if more than one argument is used.
3125
3126- Changed evaluation order of dictionary literals to conform to the
3127 general left to right evaluation order rule. Now {f1(): f2()} will
3128 evaluate f1 first.
3129
3130- Fixed bug #521782: when a file was in non-blocking mode, file.read()
3131 could silently lose data or wrongly throw an unknown error.
3132
3133- The sq_repeat, sq_inplace_repeat, sq_concat and sq_inplace_concat
3134 slots are now always tried after trying the corresponding nb_* slots.
3135 This fixes a number of minor bugs (see bug #624807).
3136
3137- Fix problem with dynamic loading on 64-bit AIX (see bug #639945).
3138
3139Extension modules
3140-----------------
3141
3142- Added three operators to the operator module:
3143 operator.pow(a,b) which is equivalent to: a**b.
3144 operator.is_(a,b) which is equivalent to: a is b.
3145 operator.is_not(a,b) which is equivalent to: a is not b.
3146
3147- posix.openpty now works on all systems that have /dev/ptmx.
3148
3149- A module zipimport exists to support importing code from zip
3150 archives.
3151
3152- The new datetime module supplies classes for manipulating dates and
3153 times. The basic design came from the Zope "fishbowl process", and
3154 favors practical commercial applications over calendar esoterica. See
3155
3156 http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage
3157
3158- _tkinter now returns Tcl objects, instead of strings. Objects which
3159 have Python equivalents are converted to Python objects, other objects
3160 are wrapped. This can be configured through the wantobjects method,
3161 or Tkinter.wantobjects.
3162
3163- The PyBSDDB wrapper around the Sleepycat Berkeley DB library has
3164 been added as the package bsddb. The traditional bsddb module is
3165 still available in source code, but not built automatically anymore,
3166 and is now named bsddb185. This supports Berkeley DB versions from
3167 3.0 to 4.1. For help converting your databases from the old module (which
3168 probably used an obsolete version of Berkeley DB) to the new module, see
3169 the db2pickle.py and pickle2db.py scripts described in the Tools/Demos
3170 section above.
3171
3172- unicodedata was updated to Unicode 3.2. It supports normalization
3173 and names for Hangul syllables and CJK unified ideographs.
3174
3175- resource.getrlimit() now returns longs instead of ints.
3176
3177- readline now dynamically adjusts its input/output stream if
3178 sys.stdin/stdout changes.
3179
3180- The _tkinter module (and hence Tkinter) has dropped support for
3181 Tcl/Tk 8.0 and 8.1. Only Tcl/Tk versions 8.2, 8.3 and 8.4 are
3182 supported.
3183
3184- cPickle.BadPickleGet is now a class.
3185
3186- The time stamps in os.stat_result are floating point numbers
3187 after stat_float_times has been called.
3188
3189- If the size passed to mmap.mmap() is larger than the length of the
3190 file on non-Windows platforms, a ValueError is raised. [SF bug 585792]
3191
3192- The xreadlines module is slated for obsolescence.
3193
3194- The strptime function in the time module is now always available (a
3195 Python implementation is used when the C library doesn't define it).
3196
3197- The 'new' module is no longer an extension, but a Python module that
3198 only exists for backwards compatibility. Its contents are no longer
3199 functions but callable type objects.
3200
3201- The bsddb.*open functions can now take 'None' as a filename.
3202 This will create a temporary in-memory bsddb that won't be
3203 written to disk.
3204
3205- posix.getloadavg, posix.lchown, posix.killpg, posix.mknod, and
3206 posix.getpgid have been added where available.
3207
3208- The locale module now exposes the C library's gettext interface. It
3209 also has a new function getpreferredencoding.
3210
3211- A security hole ("double free") was found in zlib-1.1.3, a popular
3212 third party compression library used by some Python modules. The
3213 hole was quickly plugged in zlib-1.1.4, and the Windows build of
3214 Python now ships with zlib-1.1.4.
3215
3216- pwd, grp, and resource return enhanced tuples now, with symbolic
3217 field names.
3218
3219- array.array is now a type object. A new format character
3220 'u' indicates Py_UNICODE arrays. For those, .tounicode and
3221 .fromunicode methods are available. Arrays now support __iadd__
3222 and __imul__.
3223
3224- dl now builds on every system that has dlfcn.h. Failure in case
3225 of sizeof(int)!=sizeof(long)!=sizeof(void*) is delayed until dl.open
3226 is called.
3227
3228- The sys module acquired a new attribute, api_version, which evaluates
3229 to the value of the PYTHON_API_VERSION macro with which the
3230 interpreter was compiled.
3231
3232- Fixed bug #470582: sre module would return a tuple (None, 'a', 'ab')
3233 when applying the regular expression '^((a)c)?(ab)$' on 'ab'. It now
3234 returns (None, None, 'ab'), as expected. Also fixed handling of
3235 lastindex/lastgroup match attributes in similar cases. For example,
3236 when running the expression r'(a)(b)?b' over 'ab', lastindex must be
3237 1, not 2.
3238
3239- Fixed bug #581080: sre scanner was not checking the buffer limit
3240 before increasing the current pointer. This was creating an infinite
3241 loop in the search function, once the pointer exceeded the buffer
3242 limit.
3243
3244- The os.fdopen function now enforces a file mode starting with the
3245 letter 'r', 'w' or 'a', otherwise a ValueError is raised. This fixes
3246 bug #623464.
3247
3248- The linuxaudiodev module is now deprecated; it is being replaced by
3249 ossaudiodev. The interface has been extended to cover a lot more of
3250 OSS (see www.opensound.com), including most DSP ioctls and the
3251 OSS mixer API. Documentation forthcoming in 2.3a2.
3252
3253Library
3254-------
3255
3256- imaplib.py now supports SSL (Tino Lange and Piers Lauder).
3257
3258- Freeze's modulefinder.py has been moved to the standard library;
3259 slightly improved so it will issue less false missing submodule
3260 reports (see sf path #643711 for details). Documentation will follow
3261 with Python 2.3a2.
3262
3263- os.path exposes getctime.
3264
3265- unittest.py now has two additional methods called assertAlmostEqual()
3266 and failIfAlmostEqual(). They implement an approximate comparison
3267 by rounding the difference between the two arguments and comparing
3268 the result to zero. Approximate comparison is essential for
3269 unit tests of floating point results.
3270
3271- calendar.py now depends on the new datetime module rather than
3272 the time module. As a result, the range of allowable dates
3273 has been increased.
3274
3275- pdb has a new 'j(ump)' command to select the next line to be
3276 executed.
3277
3278- The distutils created windows installers now can run a
3279 postinstallation script.
3280
3281- doctest.testmod can now be called without argument, which means to
3282 test the current module.
3283
3284- When canceling a server that implemented threading with a keyboard
3285 interrupt, the server would shut down but not terminate (waiting on
3286 client threads). A new member variable, daemon_threads, was added to
3287 the ThreadingMixIn class in SocketServer.py to make it explicit that
3288 this behavior needs to be controlled.
3289
3290- A new module, optparse, provides a fancy alternative to getopt for
3291 command line parsing. It is a slightly modified version of Greg
3292 Ward's Optik package.
3293
3294- UserDict.py now defines a DictMixin class which defines all dictionary
3295 methods for classes that already have a minimum mapping interface.
3296 This greatly simplifies writing classes that need to be substitutable
3297 for dictionaries (such as the shelve module).
3298
3299- shelve.py now subclasses from UserDict.DictMixin. Now shelve supports
3300 all dictionary methods. This eases the transition to persistent
3301 storage for scripts originally written with dictionaries in mind.
3302
3303- shelve.open and the various classes in shelve.py now accept an optional
3304 binary flag, which defaults to False. If True, the values stored in the
3305 shelf are binary pickles.
3306
3307- A new package, logging, implements the logging API defined by PEP
3308 282. The code is written by Vinay Sajip.
3309
3310- StreamReader, StreamReaderWriter and StreamRecoder in the codecs
3311 modules are iterators now.
3312
3313- gzip.py now handles files exceeding 2GB. Files over 4GB also work
3314 now (provided the OS supports it, and Python is configured with large
3315 file support), but in that case the underlying gzip file format can
3316 record only the least-significant 32 bits of the file size, so that
3317 some tools working with gzipped files may report an incorrect file
3318 size.
3319
3320- xml.sax.saxutils.unescape has been added, to replace entity references
3321 with their entity value.
3322
3323- Queue.Queue.{put,get} now support an optional timeout argument.
3324
3325- Various features of Tk 8.4 are exposed in Tkinter.py. The multiple
3326 option of tkFileDialog is exposed as function askopenfile{,name}s.
3327
3328- Various configure methods of Tkinter have been stream-lined, so that
3329 tag_configure, image_configure, window_configure now return a
3330 dictionary when invoked with no argument.
3331
3332- Importing the readline module now no longer has the side effect of
3333 calling setlocale(LC_CTYPE, ""). The initial "C" locale, or
3334 whatever locale is explicitly set by the user, is preserved. If you
3335 want repr() of 8-bit strings in your preferred encoding to preserve
3336 all printable characters of that encoding, you have to add the
3337 following code to your $PYTHONSTARTUP file or to your application's
3338 main():
3339
3340 import locale
3341 locale.setlocale(locale.LC_CTYPE, "")
3342
3343- shutil.move was added. shutil.copytree now reports errors as an
3344 exception at the end, instead of printing error messages.
3345
3346- Encoding name normalization was generalized to not only
3347 replace hyphens with underscores, but also all other non-alphanumeric
3348 characters (with the exception of the dot which is used for Python
3349 package names during lookup). The aliases.py mapping was updated
3350 to the new standard.
3351
3352- mimetypes has two new functions: guess_all_extensions() which
3353 returns a list of all known extensions for a mime type, and
3354 add_type() which adds one mapping between a mime type and
3355 an extension to the database.
3356
3357- New module: sets, defines the class Set that implements a mutable
3358 set type using the keys of a dict to represent the set. There's
3359 also a class ImmutableSet which is useful when you need sets of sets
3360 or when you need to use sets as dict keys, and a class BaseSet which
3361 is the base class of the two.
3362
3363- Added random.sample(population,k) for random sampling without replacement.
3364 Returns a k length list of unique elements chosen from the population.
3365
3366- random.randrange(-sys.maxint-1, sys.maxint) no longer raises
3367 OverflowError. That is, it now accepts any combination of 'start'
3368 and 'stop' arguments so long as each is in the range of Python's
3369 bounded integers.
3370
3371- Thanks to Raymond Hettinger, random.random() now uses a new core
3372 generator. The Mersenne Twister algorithm is implemented in C,
3373 threadsafe, faster than the previous generator, has an astronomically
3374 large period (2**19937-1), creates random floats to full 53-bit
3375 precision, and may be the most widely tested random number generator
3376 in existence.
3377
3378 The random.jumpahead(n) method has different semantics for the new
3379 generator. Instead of jumping n steps ahead, it uses n and the
3380 existing state to create a new state. This means that jumpahead()
3381 continues to support multi-threaded code needing generators of
3382 non-overlapping sequences. However, it will break code which relies
3383 on jumpahead moving a specific number of steps forward.
3384
3385 The attributes random.whseed and random.__whseed have no meaning for
3386 the new generator. Code using these attributes should switch to a
3387 new class, random.WichmannHill which is provided for backward
3388 compatibility and to make an alternate generator available.
3389
3390- New "algorithms" module: heapq, implements a heap queue. Thanks to
3391 Kevin O'Connor for the code and François Pinard for an entertaining
3392 write-up explaining the theory and practical uses of heaps.
3393
3394- New encoding for the Palm OS character set: palmos.
3395
3396- binascii.crc32() and the zipfile module had problems on some 64-bit
3397 platforms. These have been fixed. On a platform with 8-byte C longs,
3398 crc32() now returns a signed-extended 4-byte result, so that its value
3399 as a Python int is equal to the value computed a 32-bit platform.
3400
3401- xml.dom.minidom.toxml and toprettyxml now take an optional encoding
3402 argument.
3403
3404- Some fixes in the copy module: when an object is copied through its
3405 __reduce__ method, there was no check for a __setstate__ method on
3406 the result [SF patch 565085]; deepcopy should treat instances of
3407 custom metaclasses the same way it treats instances of type 'type'
3408 [SF patch 560794].
3409
3410- Sockets now support timeout mode. After s.settimeout(T), where T is
3411 a float expressing seconds, subsequent operations raise an exception
3412 if they cannot be completed within T seconds. To disable timeout
3413 mode, use s.settimeout(None). There's also a module function,
3414 socket.setdefaulttimeout(T), which sets the default for all sockets
3415 created henceforth.
3416
3417- getopt.gnu_getopt was added. This supports GNU-style option
3418 processing, where options can be mixed with non-option arguments.
3419
3420- Stop using strings for exceptions. String objects used for
3421 exceptions are now classes deriving from Exception. The objects
3422 changed were: Tkinter.TclError, bdb.BdbQuit, macpath.norm_error,
3423 tabnanny.NannyNag, and xdrlib.Error.
3424
3425- Constants BOM_UTF8, BOM_UTF16, BOM_UTF16_LE, BOM_UTF16_BE,
3426 BOM_UTF32, BOM_UTF32_LE and BOM_UTF32_BE that represent the Byte
3427 Order Mark in UTF-8, UTF-16 and UTF-32 encodings for little and
3428 big endian systems were added to the codecs module. The old names
3429 BOM32_* and BOM64_* were off by a factor of 2.
3430
3431- Added conversion functions math.degrees() and math.radians().
3432
3433- math.log() now takes an optional argument: math.log(x[, base]).
3434
3435- ftplib.retrlines() now tests for callback is None rather than testing
3436 for False. Was causing an error when given a callback object which
3437 was callable but also returned len() as zero. The change may
3438 create new breakage if the caller relied on the undocumented behavior
3439 and called with callback set to [] or some other False value not
3440 identical to None.
3441
3442- random.gauss() uses a piece of hidden state used by nothing else,
3443 and the .seed() and .whseed() methods failed to reset it. In other
3444 words, setting the seed didn't completely determine the sequence of
3445 results produced by random.gauss(). It does now. Programs repeatedly
3446 mixing calls to a seed method with calls to gauss() may see different
3447 results now.
3448
3449- The pickle.Pickler class grew a clear_memo() method to mimic that
3450 provided by cPickle.Pickler.
3451
3452- difflib's SequenceMatcher class now does a dynamic analysis of
3453 which elements are so frequent as to constitute noise. For
3454 comparing files as sequences of lines, this generally works better
3455 than the IS_LINE_JUNK function, and function ndiff's linejunk
3456 argument defaults to None now as a result. A happy benefit is
3457 that SequenceMatcher may run much faster now when applied
3458 to large files with many duplicate lines (for example, C program
3459 text with lots of repeated "}" and "return NULL;" lines).
3460
3461- New Text.dump() method in Tkinter module.
3462
3463- New distutils commands for building packagers were added to
3464 support pkgtool on Solaris and swinstall on HP-UX.
3465
3466- distutils now has a new abstract binary packager base class
3467 command/bdist_packager, which simplifies writing packagers.
3468 This will hopefully provide the missing bits to encourage
3469 people to submit more packagers, e.g. for Debian, FreeBSD
3470 and other systems.
3471
3472- The UTF-16, -LE and -BE stream readers now raise a
3473 NotImplementedError for all calls to .readline(). Previously, they
3474 used to just produce garbage or fail with an encoding error --
3475 UTF-16 is a 2-byte encoding and the C lib's line reading APIs don't
3476 work well with these.
3477
3478- compileall now supports quiet operation.
3479
3480- The BaseHTTPServer now implements optional HTTP/1.1 persistent
3481 connections.
3482
3483- socket module: the SSL support was broken out of the main
3484 _socket module C helper and placed into a new _ssl helper
3485 which now gets imported by socket.py if available and working.
3486
3487- encodings package: added aliases for all supported IANA character
3488 sets
3489
3490- ftplib: to safeguard the user's privacy, anonymous login will use
3491 "anonymous@" as default password, rather than the real user and host
3492 name.
3493
3494- webbrowser: tightened up the command passed to os.system() so that
3495 arbitrary shell code can't be executed because a bogus URL was
3496 passed in.
3497
3498- gettext.translation has an optional fallback argument, and
3499 gettext.find an optional all argument. Translations will now fallback
3500 on a per-message basis. The module supports plural forms, by means
3501 of gettext.[d]ngettext and Translation.[u]ngettext.
3502
3503- distutils bdist commands now offer a --skip-build option.
3504
3505- warnings.warn now accepts a Warning instance as first argument.
3506
3507- The xml.sax.expatreader.ExpatParser class will no longer create
3508 circular references by using itself as the locator that gets passed
3509 to the content handler implementation. [SF bug #535474]
3510
3511- The email.Parser.Parser class now properly parses strings regardless
3512 of their line endings, which can be any of \r, \n, or \r\n (CR, LF,
3513 or CRLF). Also, the Header class's constructor default arguments
3514 has changed slightly so that an explicit maxlinelen value is always
3515 honored, and so unicode conversion error handling can be specified.
3516
3517- distutils' build_ext command now links C++ extensions with the C++
3518 compiler available in the Makefile or CXX environment variable, if
3519 running under \*nix.
3520
3521- New module bz2: provides a comprehensive interface for the bz2 compression
3522 library. It implements a complete file interface, one-shot (de)compression
3523 functions, and types for sequential (de)compression.
3524
3525- New pdb command 'pp' which is like 'p' except that it pretty-prints
3526 the value of its expression argument.
3527
3528- Now bdist_rpm distutils command understands a verify_script option in
3529 the config file, including the contents of the referred filename in
3530 the "%verifyscript" section of the rpm spec file.
3531
3532- Fixed bug #495695: webbrowser module would run graphic browsers in a
3533 unix environment even if DISPLAY was not set. Also, support for
3534 skipstone browser was included.
3535
3536- Fixed bug #636769: rexec would run unallowed code if subclasses of
3537 strings were used as parameters for certain functions.
3538
3539Tools/Demos
3540-----------
3541
3542- pygettext.py now supports globbing on Windows, and accepts module
3543 names in addition to accepting file names.
3544
3545- The SGI demos (Demo/sgi) have been removed. Nobody thought they
3546 were interesting any more. (The SGI library modules and extensions
3547 are still there; it is believed that at least some of these are
3548 still used and useful.)
3549
3550- IDLE supports the new encoding declarations (PEP 263); it can also
3551 deal with legacy 8-bit files if they use the locale's encoding. It
3552 allows non-ASCII strings in the interactive shell and executes them
3553 in the locale's encoding.
3554
3555- freeze.py now produces binaries which can import shared modules,
3556 unlike before when this failed due to missing symbol exports in
3557 the generated binary.
3558
3559Build
3560-----
3561
3562- On Unix, IDLE is now installed automatically.
3563
3564- The fpectl module is not built by default; it's dangerous or useless
3565 except in the hands of experts.
3566
3567- The public Python C API will generally be declared using PyAPI_FUNC
3568 and PyAPI_DATA macros, while Python extension module init functions
3569 will be declared with PyMODINIT_FUNC. DL_EXPORT/DL_IMPORT macros
3570 are deprecated.
3571
3572- A bug was fixed that could cause COUNT_ALLOCS builds to segfault, or
3573 get into infinite loops, when a new-style class got garbage-collected.
3574 Unfortunately, to avoid this, the way COUNT_ALLOCS works requires
3575 that new-style classes be immortal in COUNT_ALLOCS builds. Note that
3576 COUNT_ALLOCS is not enabled by default, in either release or debug
3577 builds, and that new-style classes are immortal only in COUNT_ALLOCS
3578 builds.
3579
3580- Compiling out the cyclic garbage collector is no longer an option.
3581 The old symbol WITH_CYCLE_GC is now ignored, and Python.h arranges
3582 that it's always defined (for the benefit of any extension modules
3583 that may be conditionalizing on it). A bonus is that any extension
3584 type participating in cyclic gc can choose to participate in the
3585 Py_TRASHCAN mechanism now too; in the absence of cyclic gc, this used
3586 to require editing the core to teach the trashcan mechanism about the
3587 new type.
3588
3589- According to Annex F of the current C standard,
3590
3591 The Standard C macro HUGE_VAL and its float and long double analogs,
3592 HUGE_VALF and HUGE_VALL, expand to expressions whose values are
3593 positive infinities.
3594
3595 Python only uses the double HUGE_VAL, and only to #define its own symbol
3596 Py_HUGE_VAL. Some platforms have incorrect definitions for HUGE_VAL.
3597 pyport.h used to try to worm around that, but the workarounds triggered
3598 other bugs on other platforms, so we gave up. If your platform defines
3599 HUGE_VAL incorrectly, you'll need to #define Py_HUGE_VAL to something
3600 that works on your platform. The only instance of this I'm sure about
3601 is on an unknown subset of Cray systems, described here:
3602
3603 http://www.cray.com/swpubs/manuals/SN-2194_2.0/html-SN-2194_2.0/x3138.htm
3604
3605 Presumably 2.3a1 breaks such systems. If anyone uses such a system, help!
3606
3607- The configure option --without-doc-strings can be used to remove the
3608 doc strings from the builtin functions and modules; this reduces the
3609 size of the executable.
3610
3611- The universal newlines option (PEP 278) is on by default. On Unix
3612 it can be disabled by passing --without-universal-newlines to the
3613 configure script. On other platforms, remove
3614 WITH_UNIVERSAL_NEWLINES from pyconfig.h.
3615
3616- On Unix, a shared libpython2.3.so can be created with --enable-shared.
3617
3618- All uses of the CACHE_HASH, INTERN_STRINGS, and DONT_SHARE_SHORT_STRINGS
3619 preprocessor symbols were eliminated. The internal decisions they
3620 controlled stopped being experimental long ago.
3621
3622- The tools used to build the documentation now work under Cygwin as
3623 well as Unix.
3624
3625- The bsddb and dbm module builds have been changed to try and avoid version
3626 skew problems and disable linkage with Berkeley DB 1.85 unless the
3627 installer knows what s/he's doing. See the section on building these
3628 modules in the README file for details.
3629
3630C API
3631-----
3632
3633- PyNumber_Check() now returns true for string and unicode objects.
3634 This is a result of these types having a partially defined
3635 tp_as_number slot. (This is not a feature, but an indication that
3636 PyNumber_Check() is not very useful to determine numeric behavior.
3637 It may be deprecated.)
3638
3639- The string object's layout has changed: the pointer member
3640 ob_sinterned has been replaced by an int member ob_sstate. On some
3641 platforms (e.g. most 64-bit systems) this may change the offset of
3642 the ob_sval member, so as a precaution the API_VERSION has been
3643 incremented. The apparently unused feature of "indirect interned
3644 strings", supported by the ob_sinterned member, is gone. Interned
3645 strings are now usually mortal; there is a new API,
3646 PyString_InternImmortal() that creates immortal interned strings.
3647 (The ob_sstate member can only take three values; however, while
3648 making it a char saves a few bytes per string object on average, in
3649 it also slowed things down a bit because ob_sval was no longer
3650 aligned.)
3651
3652- The Py_InitModule*() functions now accept NULL for the 'methods'
3653 argument. Modules without global functions are becoming more common
3654 now that factories can be types rather than functions.
3655
3656- New C API PyUnicode_FromOrdinal() which exposes unichr() at C
3657 level.
3658
3659- New functions PyErr_SetExcFromWindowsErr() and
3660 PyErr_SetExcFromWindowsErrWithFilename(). Similar to
3661 PyErr_SetFromWindowsErrWithFilename() and
3662 PyErr_SetFromWindowsErr(), but they allow to specify
3663 the exception type to raise. Available on Windows.
3664
3665- Py_FatalError() is now declared as taking a const char* argument. It
3666 was previously declared without const. This should not affect working
3667 code.
3668
3669- Added new macro PySequence_ITEM(o, i) that directly calls
3670 sq_item without rechecking that o is a sequence and without
3671 adjusting for negative indices.
3672
3673- PyRange_New() now raises ValueError if the fourth argument is not 1.
3674 This is part of the removal of deprecated features of the xrange
3675 object.
3676
3677- PyNumber_Coerce() and PyNumber_CoerceEx() now also invoke the type's
3678 coercion if both arguments have the same type but this type has the
3679 CHECKTYPES flag set. This is to better support proxies.
3680
3681- The type of tp_free has been changed from "``void (*)(PyObject *)``" to
3682 "``void (*)(void *)``".
3683
3684- PyObject_Del, PyObject_GC_Del are now functions instead of macros.
3685
3686- A type can now inherit its metatype from its base type. Previously,
3687 when PyType_Ready() was called, if ob_type was found to be NULL, it
3688 was always set to &PyType_Type; now it is set to base->ob_type,
3689 where base is tp_base, defaulting to &PyObject_Type.
3690
3691- PyType_Ready() accidentally did not inherit tp_is_gc; now it does.
3692
3693- The PyCore_* family of APIs have been removed.
3694
3695- The "u#" parser marker will now pass through Unicode objects as-is
3696 without going through the buffer API.
3697
3698- The enumerators of cmp_op have been renamed to use the prefix ``PyCmp_``.
3699
3700- An old #define of ANY as void has been removed from pyport.h. This
3701 hasn't been used since Python's pre-ANSI days, and the #define has
3702 been marked as obsolete since then. SF bug 495548 says it created
3703 conflicts with other packages, so keeping it around wasn't harmless.
3704
3705- Because Python's magic number scheme broke on January 1st, we decided
3706 to stop Python development. Thanks for all the fish!
3707
3708- Some of us don't like fish, so we changed Python's magic number
3709 scheme to a new one. See Python/import.c for details.
3710
3711New platforms
3712-------------
3713
3714- OpenVMS is now supported.
3715
3716- AtheOS is now supported.
3717
3718- the EMX runtime environment on OS/2 is now supported.
3719
3720- GNU/Hurd is now supported.
3721
3722Tests
3723-----
3724
3725- The regrtest.py script's -u option now provides a way to say "allow
3726 all resources except this one." For example, to allow everything
3727 except bsddb, give the option '-uall,-bsddb'.
3728
3729Windows
3730-------
3731
3732- The Windows distribution now ships with version 4.0.14 of the
3733 Sleepycat Berkeley database library. This should be a huge
3734 improvement over the previous Berkeley DB 1.85, which had many
3735 bugs.
3736 XXX What are the licensing issues here?
3737 XXX If a user has a database created with a previous version of
3738 XXX Python, what must they do to convert it?
3739 XXX I'm still not sure how to link this thing (see PCbuild/readme.txt).
3740 XXX The version # is likely to change before 2.3a1.
3741
3742- The Windows distribution now ships with a Secure Sockets Library (SLL)
3743 module (_ssl.pyd)
3744
3745- The Windows distribution now ships with Tcl/Tk version 8.4.1 (it
3746 previously shipped with Tcl/Tk 8.3.2).
3747
3748- When Python is built under a Microsoft compiler, sys.version now
3749 includes the compiler version number (_MSC_VER). For example, under
3750 MSVC 6, sys.version contains the substring "MSC v.1200 ". 1200 is
3751 the value of _MSC_VER under MSVC 6.
3752
3753- Sometimes the uninstall executable (UNWISE.EXE) vanishes. One cause
3754 of that has been fixed in the installer (disabled Wise's "delete in-
3755 use files" uninstall option).
3756
3757- Fixed a bug in urllib's proxy handling in Windows. [SF bug #503031]
3758
3759- The installer now installs Start menu shortcuts under (the local
3760 equivalent of) "All Users" when doing an Admin install.
3761
3762- file.truncate([newsize]) now works on Windows for all newsize values.
3763 It used to fail if newsize didn't fit in 32 bits, reflecting a
3764 limitation of MS _chsize (which is no longer used).
3765
3766- os.waitpid() is now implemented for Windows, and can be used to block
3767 until a specified process exits. This is similar to, but not exactly
3768 the same as, os.waitpid() on POSIX systems. If you're waiting for
3769 a specific process whose pid was obtained from one of the spawn()
3770 functions, the same Python os.waitpid() code works across platforms.
3771 See the docs for details. The docs were changed to clarify that
3772 spawn functions return, and waitpid requires, a process handle on
3773 Windows (not the same thing as a Windows process id).
3774
3775- New tempfile.TemporaryFile implementation for Windows: this doesn't
3776 need a TemporaryFileWrapper wrapper anymore, and should be immune
3777 to a nasty problem: before 2.3, if you got a temp file on Windows, it
3778 got wrapped in an object whose close() method first closed the
3779 underlying file, then deleted the file. This usually worked fine.
3780 However, the spawn family of functions on Windows create (at a low C
3781 level) the same set of open files in the spawned process Q as were
3782 open in the spawning process P. If a temp file f was among them, then
3783 doing f.close() in P first closed P's C-level file handle on f, but Q's
3784 C-level file handle on f remained open, so the attempt in P to delete f
3785 blew up with a "Permission denied" error (Windows doesn't allow
3786 deleting open files). This was surprising, subtle, and difficult to
3787 work around.
3788
3789- The os module now exports all the symbolic constants usable with the
3790 low-level os.open() on Windows: the new constants in 2.3 are
3791 O_NOINHERIT, O_SHORT_LIVED, O_TEMPORARY, O_RANDOM and O_SEQUENTIAL.
3792 The others were also available in 2.2: O_APPEND, O_BINARY, O_CREAT,
3793 O_EXCL, O_RDONLY, O_RDWR, O_TEXT, O_TRUNC and O_WRONLY. Contrary
3794 to Microsoft docs, O_SHORT_LIVED does not seem to imply O_TEMPORARY
3795 (so specify both if you want both; note that neither is useful unless
3796 specified with O_CREAT too).
3797
3798Mac
3799----
3800
3801- Mac/Relnotes is gone, the release notes are now here.
3802
3803- Python (the OSX-only, unix-based version, not the OS9-compatible CFM
3804 version) now fully supports unicode strings as arguments to various file
3805 system calls, eg. open(), file(), os.stat() and os.listdir().
3806
3807- The current naming convention for Python on the Macintosh is that MacPython
3808 refers to the unix-based OSX-only version, and MacPython-OS9 refers to the
3809 CFM-based version that runs on both OS9 and OSX.
3810
3811- All MacPython-OS9 functionality is now available in an OSX unix build,
3812 including the Carbon modules, the IDE, OSA support, etc. A lot of this
3813 will only work correctly in a framework build, though, because you cannot
3814 talk to the window manager unless your application is run from a .app
3815 bundle. There is a command line tool "pythonw" that runs your script
3816 with an interpreter living in such a .app bundle, this interpreter should
3817 be used to run any Python script using the window manager (including
3818 Tkinter or wxPython scripts).
3819
3820- Most of Mac/Lib has moved to Lib/plat-mac, which is again used both in
3821 MacPython-OSX and MacPython-OS9. The only modules remaining in Mac/Lib
3822 are specifically for MacPython-OS9 (CFM support, preference resources, etc).
3823
3824- A new utility PythonLauncher will start a Python interpreter when a .py or
3825 .pyw script is double-clicked in the Finder. By default .py scripts are
3826 run with a normal Python interpreter in a Terminal window and .pyw
3827 files are run with a window-aware pythonw interpreter without a Terminal
3828 window, but all this can be customized.
3829
3830- MacPython-OS9 is now Carbon-only, so it runs on Mac OS 9 or Mac OS X and
3831 possibly on Mac OS 8.6 with the right CarbonLib installed, but not on earlier
3832 releases.
3833
3834- Many tools such as BuildApplet.py and gensuitemodule.py now support a command
3835 line interface too.
3836
3837- All the Carbon classes are now PEP253 compliant, meaning that you can
3838 subclass them from Python. Most of the attributes have gone, you should
3839 now use the accessor function call API, which is also what Apple's
3840 documentation uses. Some attributes such as grafport.visRgn are still
3841 available for convenience.
3842
3843- New Carbon modules File (implementing the APIs in Files.h and Aliases.h)
3844 and Folder (APIs from Folders.h). The old macfs builtin module is
3845 gone, and replaced by a Python wrapper around the new modules.
3846
3847- Pathname handling should now be fully consistent: MacPython-OSX always uses
3848 unix pathnames and MacPython-OS9 always uses colon-separated Mac pathnames
3849 (also when running on Mac OS X).
3850
3851- New Carbon modules Help and AH give access to the Carbon Help Manager.
3852 There are hooks in the IDE to allow accessing the Python documentation
3853 (and Apple's Carbon and Cocoa documentation) through the Help Viewer.
3854 See Mac/OSX/README for converting the Python documentation to a
3855 Help Viewer compatible form and installing it.
3856
3857- OSA support has been redesigned and the generated Python classes now
3858 mirror the inheritance defined by the underlying OSA classes.
3859
3860- MacPython no longer maps both \r and \n to \n on input for any text file.
3861 This feature has been replaced by universal newline support (PEP278).
3862
3863- The default encoding for Python sourcefiles in MacPython-OS9 is no longer
3864 mac-roman (or whatever your local Mac encoding was) but "ascii", like on
3865 other platforms. If you really need sourcefiles with Mac characters in them
3866 you can change this in site.py.
3867
3868
3869What's New in Python 2.2 final?
3870===============================
3871
3872*Release date: 21-Dec-2001*
3873
3874Type/class unification and new-style classes
3875--------------------------------------------
3876
3877- pickle.py, cPickle: allow pickling instances of new-style classes
3878 with a custom metaclass.
3879
3880Core and builtins
3881-----------------
3882
3883- weakref proxy object: when comparing, unwrap both arguments if both
3884 are proxies.
3885
3886Extension modules
3887-----------------
3888
3889- binascii.b2a_base64(): fix a potential buffer overrun when encoding
3890 very short strings.
3891
3892- cPickle: the obscure "fast" mode was suspected of causing stack
3893 overflows on the Mac. Hopefully fixed this by setting the recursion
3894 limit much smaller. If the limit is too low (it only affects
3895 performance), you can change it by defining PY_CPICKLE_FAST_LIMIT
3896 when compiling cPickle.c (or in pyconfig.h).
3897
3898Library
3899-------
3900
3901- dumbdbm.py: fixed a dumb old bug (the file didn't get synched at
3902 close or delete time).
3903
3904- rfc822.py: fixed a bug where the address '<>' was converted to None
3905 instead of an empty string (also fixes the email.Utils module).
3906
3907- xmlrpclib.py: version 1.0.0; uses precision for doubles.
3908
3909- test suite: the pickle and cPickle tests were not executing any code
3910 when run from the standard regression test.
3911
3912Tools/Demos
3913-----------
3914
3915Build
3916-----
3917
3918C API
3919-----
3920
3921New platforms
3922-------------
3923
3924Tests
3925-----
3926
3927Windows
3928-------
3929
3930- distutils package: fixed broken Windows installers (bdist_wininst).
3931
3932- tempfile.py: prevent mysterious warnings when TemporaryFileWrapper
3933 instances are deleted at process exit time.
3934
3935- socket.py: prevent mysterious warnings when socket instances are
3936 deleted at process exit time.
3937
3938- posixmodule.c: fix a Windows crash with stat() of a filename ending
3939 in backslash.
3940
3941Mac
3942----
3943
3944- The Carbon toolbox modules have been upgraded to Universal Headers
3945 3.4, and experimental CoreGraphics and CarbonEvents modules have
3946 been added. All only for framework-enabled MacOSX.
3947
3948
3949What's New in Python 2.2c1?
3950===========================
3951
3952*Release date: 14-Dec-2001*
3953
3954Type/class unification and new-style classes
3955--------------------------------------------
3956
3957- Guido's tutorial introduction to the new type/class features has
3958 been extensively updated. See
3959
3960 http://www.python.org/2.2/descrintro.html
3961
3962 That remains the primary documentation in this area.
3963
3964- Fixed a leak: instance variables declared with __slots__ were never
3965 deleted!
3966
3967- The "delete attribute" method of descriptor objects is called
3968 __delete__, not __del__. In previous releases, it was mistakenly
3969 called __del__, which created an unfortunate overloading condition
3970 with finalizers. (The "get attribute" and "set attribute" methods
3971 are still called __get__ and __set__, respectively.)
3972
3973- Some subtle issues with the super built-in were fixed:
3974
3975 (a) When super itself is subclassed, its __get__ method would still
3976 return an instance of the base class (i.e., of super).
3977
3978 (b) super(C, C()).__class__ would return C rather than super. This
3979 is confusing. To fix this, I decided to change the semantics of
3980 super so that it only applies to code attributes, not to data
3981 attributes. After all, overriding data attributes is not
3982 supported anyway.
3983
3984 (c) The __get__ method didn't check whether the argument was an
3985 instance of the type used in creation of the super instance.
3986
3987- Previously, hash() of an instance of a subclass of a mutable type
3988 (list or dictionary) would return some value, rather than raising
3989 TypeError. This has been fixed. Also, directly calling
3990 dict.__hash__ and list.__hash__ now raises the same TypeError
3991 (previously, these were the same as object.__hash__).
3992
3993- New-style objects now support deleting their __dict__. This is for
3994 all intents and purposes equivalent to assigning a brand new empty
3995 dictionary, but saves space if the object is not used further.
3996
3997Core and builtins
3998-----------------
3999
4000- -Qnew now works as documented in PEP 238: when -Qnew is passed on
4001 the command line, all occurrences of "/" use true division instead
4002 of classic division. See the PEP for details. Note that "all"
4003 means all instances in library and 3rd-party modules, as well as in
4004 your own code. As the PEP says, -Qnew is intended for use only in
4005 educational environments with control over the libraries in use.
4006 Note that test_coercion.py in the standard Python test suite fails
4007 under -Qnew; this is expected, and won't be repaired until true
4008 division becomes the default (in the meantime, test_coercion is
4009 testing the current rules).
4010
4011- complex() now only allows the first argument to be a string
4012 argument, and raises TypeError if either the second arg is a string
4013 or if the second arg is specified when the first is a string.
4014
4015Extension modules
4016-----------------
4017
4018- gc.get_referents was renamed to gc.get_referrers.
4019
4020Library
4021-------
4022
4023- Functions in the os.spawn() family now release the global interpreter
4024 lock around calling the platform spawn. They should always have done
4025 this, but did not before 2.2c1. Multithreaded programs calling
4026 an os.spawn function with P_WAIT will no longer block all Python threads
4027 until the spawned program completes. It's possible that some programs
4028 relies on blocking, although more likely by accident than by design.
4029
4030- webbrowser defaults to netscape.exe on OS/2 now.
4031
4032- Tix.ResizeHandle exposes detach_widget, hide, and show.
4033
4034- The charset alias windows_1252 has been added.
4035
4036- types.StringTypes is a tuple containing the defined string types;
4037 usually this will be (str, unicode), but if Python was compiled
4038 without Unicode support it will be just (str,).
4039
4040- The pulldom and minidom modules were synchronized to PyXML.
4041
4042Tools/Demos
4043-----------
4044
4045- A new script called Tools/scripts/google.py was added, which fires
4046 off a search on Google.
4047
4048Build
4049-----
4050
4051- Note that release builds of Python should arrange to define the
4052 preprocessor symbol NDEBUG on the command line (or equivalent).
4053 In the 2.2 pre-release series we tried to define this by magic in
4054 Python.h instead, but it proved to cause problems for extension
4055 authors. The Unix, Windows and Mac builds now all define NDEBUG in
4056 release builds via cmdline (or equivalent) instead. Ports to
4057 other platforms should do likewise.
4058
4059- It is no longer necessary to use --with-suffix when building on a
4060 case-insensitive file system (such as Mac OS X HFS+). In the build
4061 directory an extension is used, but not in the installed python.
4062
4063C API
4064-----
4065
4066- New function PyDict_MergeFromSeq2() exposes the builtin dict
4067 constructor's logic for updating a dictionary from an iterable object
4068 producing key-value pairs.
4069
4070- PyArg_ParseTupleAndKeywords() requires that the number of entries in
4071 the keyword list equal the number of argument specifiers. This
4072 wasn't checked correctly, and PyArg_ParseTupleAndKeywords could even
4073 dump core in some bad cases. This has been repaired. As a result,
4074 PyArg_ParseTupleAndKeywords may raise RuntimeError in bad cases that
4075 previously went unchallenged.
4076
4077New platforms
4078-------------
4079
4080Tests
4081-----
4082
4083Windows
4084-------
4085
4086Mac
4087----
4088
4089- In unix-Python on Mac OS X (and darwin) sys.platform is now "darwin",
4090 without any trailing digits.
4091
4092- Changed logic for finding python home in Mac OS X framework Pythons.
4093 Now sys.executable points to the executable again, in stead of to
4094 the shared library. The latter is used only for locating the python
4095 home.
4096
4097
4098What's New in Python 2.2b2?
4099===========================
4100
4101*Release date: 16-Nov-2001*
4102
4103Type/class unification and new-style classes
4104--------------------------------------------
4105
4106- Multiple inheritance mixing new-style and classic classes in the
4107 list of base classes is now allowed, so this works now:
4108
4109 class Classic: pass
4110 class Mixed(Classic, object): pass
4111
4112 The MRO (method resolution order) for each base class is respected
4113 according to its kind, but the MRO for the derived class is computed
4114 using new-style MRO rules if any base class is a new-style class.
4115 This needs to be documented.
4116
4117- The new builtin dictionary() constructor, and dictionary type, have
4118 been renamed to dict. This reflects a decade of common usage.
4119
4120- dict() now accepts an iterable object producing 2-sequences. For
4121 example, dict(d.items()) == d for any dictionary d. The argument,
4122 and the elements of the argument, can be any iterable objects.
4123
4124- New-style classes can now have a __del__ method, which is called
4125 when the instance is deleted (just like for classic classes).
4126
4127- Assignment to object.__dict__ is now possible, for objects that are
4128 instances of new-style classes that have a __dict__ (unless the base
4129 class forbids it).
4130
4131- Methods of built-in types now properly check for keyword arguments
4132 (formerly these were silently ignored). The only built-in methods
4133 that take keyword arguments are __call__, __init__ and __new__.
4134
4135- The socket function has been converted to a type; see below.
4136
4137Core and builtins
4138-----------------
4139
4140- Assignment to __debug__ raises SyntaxError at compile-time. This
4141 was promised when 2.1c1 was released as "What's New in Python 2.1c1"
4142 (see below) says.
4143
4144- Clarified the error messages for unsupported operands to an operator
4145 (like 1 + '').
4146
4147Extension modules
4148-----------------
4149
4150- mmap has a new keyword argument, "access", allowing a uniform way for
4151 both Windows and Unix users to create read-only, write-through and
4152 copy-on-write memory mappings. This was previously possible only on
4153 Unix. A new keyword argument was required to support this in a
4154 uniform way because the mmap() signatures had diverged across
4155 platforms. Thanks to Jay T Miller for repairing this!
4156
4157- By default, the gc.garbage list now contains only those instances in
4158 unreachable cycles that have __del__ methods; in 2.1 it contained all
4159 instances in unreachable cycles. "Instances" here has been generalized
4160 to include instances of both new-style and old-style classes.
4161
4162- The socket module defines a new method for socket objects,
4163 sendall(). This is like send() but may make multiple calls to
4164 send() until all data has been sent. Also, the socket function has
4165 been converted to a subclassable type, like list and tuple (etc.)
4166 before it; socket and SocketType are now the same thing.
4167
4168- Various bugfixes to the curses module. There is now a test suite
4169 for the curses module (you have to run it manually).
4170
4171- binascii.b2a_base64 no longer places an arbitrary restriction of 57
4172 bytes on its input.
4173
4174Library
4175-------
4176
4177- tkFileDialog exposes a Directory class and askdirectory
4178 convenience function.
4179
4180- Symbolic group names in regular expressions must be unique. For
4181 example, the regexp r'(?P<abc>)(?P<abc>)' is not allowed, because a
4182 single name can't mean both "group 1" and "group 2" simultaneously.
4183 Python 2.2 detects this error at regexp compilation time;
4184 previously, the error went undetected, and results were
4185 unpredictable. Also in sre, the pattern.split(), pattern.sub(), and
4186 pattern.subn() methods have been rewritten in C. Also, an
4187 experimental function/method finditer() has been added, which works
4188 like findall() but returns an iterator.
4189
4190- Tix exposes more commands through the classes DirSelectBox,
4191 DirSelectDialog, ListNoteBook, Meter, CheckList, and the
4192 methods tix_addbitmapdir, tix_cget, tix_configure, tix_filedialog,
4193 tix_getbitmap, tix_getimage, tix_option_get, and tix_resetoptions.
4194
4195- Traceback objects are now scanned by cyclic garbage collection, so
4196 cycles created by casual use of sys.exc_info() no longer cause
4197 permanent memory leaks (provided garbage collection is enabled).
4198
4199- os.extsep -- a new variable needed by the RISCOS support. It is the
4200 separator used by extensions, and is '.' on all platforms except
4201 RISCOS, where it is '/'. There is no need to use this variable
4202 unless you have a masochistic desire to port your code to RISCOS.
4203
4204- mimetypes.py has optional support for non-standard, but commonly
4205 found types. guess_type() and guess_extension() now accept an
4206 optional 'strict' flag, defaulting to true, which controls whether
4207 recognize non-standard types or not. A few non-standard types we
4208 know about have been added. Also, when run as a script, there are
4209 new -l and -e options.
4210
4211- statcache is now deprecated.
4212
4213- email.Utils.formatdate() now produces the preferred RFC 2822 style
4214 dates with numeric timezones (it used to produce obsolete dates
4215 hard coded to "GMT" timezone). An optional 'localtime' flag is
4216 added to produce dates in the local timezone, with daylight savings
4217 time properly taken into account.
4218
4219- In pickle and cPickle, instead of masking errors in load() by
4220 transforming them into SystemError, we let the original exception
4221 propagate out. Also, implement support for __safe_for_unpickling__
4222 in pickle, as it already was supported in cPickle.
4223
4224Tools/Demos
4225-----------
4226
4227Build
4228-----
4229
4230- The dbm module is built using libdb1 if available. The bsddb module
4231 is built with libdb3 if available.
4232
4233- Misc/Makefile.pre.in has been removed by BDFL pronouncement.
4234
4235C API
4236-----
4237
4238- New function PySequence_Fast_GET_SIZE() returns the size of a non-
4239 NULL result from PySequence_Fast(), more quickly than calling
4240 PySequence_Size().
4241
4242- New argument unpacking function PyArg_UnpackTuple() added.
4243
4244- New functions PyObject_CallFunctionObjArgs() and
4245 PyObject_CallMethodObjArgs() have been added to make it more
4246 convenient and efficient to call functions and methods from C.
4247
4248- PyArg_ParseTupleAndKeywords() no longer masks errors, so it's
4249 possible that this will propagate errors it didn't before.
4250
4251- New function PyObject_CheckReadBuffer(), which returns true if its
4252 argument supports the single-segment readable buffer interface.
4253
4254New platforms
4255-------------
4256
4257- We've finally confirmed that this release builds on HP-UX 11.00,
4258 *with* threads, and passes the test suite.
4259
4260- Thanks to a series of patches from Michael Muller, Python may build
4261 again under OS/2 Visual Age C++.
4262
4263- Updated RISCOS port by Dietmar Schwertberger.
4264
4265Tests
4266-----
4267
4268- Added a test script for the curses module. It isn't run automatically;
4269 regrtest.py must be run with '-u curses' to enable it.
4270
4271Windows
4272-------
4273
4274Mac
4275----
4276
4277- PythonScript has been moved to unsupported and is slated to be
4278 removed completely in the next release.
4279
4280- It should now be possible to build applets that work on both OS9 and
4281 OSX.
4282
4283- The core is now linked with CoreServices not Carbon; as a side
4284 result, default 8bit encoding on OSX is now ASCII.
4285
4286- Python should now build on OSX 10.1.1
4287
4288
4289What's New in Python 2.2b1?
4290===========================
4291
4292*Release date: 19-Oct-2001*
4293
4294Type/class unification and new-style classes
4295--------------------------------------------
4296
4297- New-style classes are now always dynamic (except for built-in and
4298 extension types). There is no longer a performance penalty, and I
4299 no longer see another reason to keep this baggage around. One relic
4300 remains: the __dict__ of a new-style class is a read-only proxy; you
4301 must set the class's attribute to modify it. As a consequence, the
4302 __defined__ attribute of new-style types no longer exists, for lack
4303 of need: there is once again only one __dict__ (although in the
4304 future a __cache__ may be resurrected with a similar function, if I
4305 can prove that it actually speeds things up).
4306
4307- C.__doc__ now works as expected for new-style classes (in 2.2a4 it
4308 always returned None, even when there was a class docstring).
4309
4310- doctest now finds and runs docstrings attached to new-style classes,
4311 class methods, static methods, and properties.
4312
4313Core and builtins
4314-----------------
4315
4316- A very subtle syntactical pitfall in list comprehensions was fixed.
4317 For example: [a+b for a in 'abc', for b in 'def']. The comma in
4318 this example is a mistake. Previously, this would silently let 'a'
4319 iterate over the singleton tuple ('abc',), yielding ['abcd', 'abce',
4320 'abcf'] rather than the intended ['ad', 'ae', 'af', 'bd', 'be',
4321 'bf', 'cd', 'ce', 'cf']. Now, this is flagged as a syntax error.
4322 Note that [a for a in <singleton>] is a convoluted way to say
4323 [<singleton>] anyway, so it's not like any expressiveness is lost.
4324
4325- getattr(obj, name, default) now only catches AttributeError, as
4326 documented, rather than returning the default value for all
4327 exceptions (which could mask bugs in a __getattr__ hook, for
4328 example).
4329
4330- Weak reference objects are now part of the core and offer a C API.
4331 A bug which could allow a core dump when binary operations involved
4332 proxy reference has been fixed. weakref.ReferenceError is now a
4333 built-in exception.
4334
4335- unicode(obj) now behaves more like str(obj), accepting arbitrary
4336 objects, and calling a __unicode__ method if it exists.
4337 unicode(obj, encoding) and unicode(obj, encoding, errors) still
4338 require an 8-bit string or character buffer argument.
4339
4340- isinstance() now allows any object as the first argument and a
4341 class, a type or something with a __bases__ tuple attribute for the
4342 second argument. The second argument may also be a tuple of a
4343 class, type, or something with __bases__, in which case isinstance()
4344 will return true if the first argument is an instance of any of the
4345 things contained in the second argument tuple. E.g.
4346
4347 isinstance(x, (A, B))
4348
4349 returns true if x is an instance of A or B.
4350
4351Extension modules
4352-----------------
4353
4354- thread.start_new_thread() now returns the thread ID (previously None).
4355
4356- binascii has now two quopri support functions, a2b_qp and b2a_qp.
4357
4358- readline now supports setting the startup_hook and the
4359 pre_event_hook, and adds the add_history() function.
4360
4361- os and posix supports chroot(), setgroups() and unsetenv() where
4362 available. The stat(), fstat(), statvfs() and fstatvfs() functions
4363 now return "pseudo-sequences" -- the various fields can now be
4364 accessed as attributes (e.g. os.stat("/").st_mtime) but for
4365 backwards compatibility they also behave as a fixed-length sequence.
4366 Some platform-specific fields (e.g. st_rdev) are only accessible as
4367 attributes.
4368
4369- time: localtime(), gmtime() and strptime() now return a
4370 pseudo-sequence similar to the os.stat() return value, with
4371 attributes like tm_year etc.
4372
4373- Decompression objects in the zlib module now accept an optional
4374 second parameter to decompress() that specifies the maximum amount
4375 of memory to use for the uncompressed data.
4376
4377- optional SSL support in the socket module now exports OpenSSL
4378 functions RAND_add(), RAND_egd(), and RAND_status(). These calls
4379 are useful on platforms like Solaris where OpenSSL does not
4380 automatically seed its PRNG. Also, the keyfile and certfile
4381 arguments to socket.ssl() are now optional.
4382
4383- posixmodule (and by extension, the os module on POSIX platforms) now
4384 exports O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW.
4385
4386Library
4387-------
4388
4389- doctest now excludes functions and classes not defined by the module
4390 being tested, thanks to Tim Hochberg.
4391
4392- HotShot, a new profiler implemented using a C-based callback, has
4393 been added. This substantially reduces the overhead of profiling,
4394 but it is still quite preliminary. Support modules and
4395 documentation will be added in upcoming releases (before 2.2 final).
4396
4397- profile now produces correct output in situations where an exception
4398 raised in Python is cleared by C code (e.g. hasattr()). This used
4399 to cause wrong output, including spurious claims of recursive
4400 functions and attribution of time spent to the wrong function.
4401
4402 The code and documentation for the derived OldProfile and HotProfile
4403 profiling classes was removed. The code hasn't worked for years (if
4404 you tried to use them, they raised exceptions). OldProfile
4405 intended to reproduce the behavior of the profiler Python used more
4406 than 7 years ago, and isn't interesting anymore. HotProfile intended
4407 to provide a faster profiler (but producing less information), and
4408 that's a worthy goal we intend to meet via a different approach (but
4409 without losing information).
4410
4411- Profile.calibrate() has a new implementation that should deliver
4412 a much better system-specific calibration constant. The constant can
4413 now be specified in an instance constructor, or as a Profile class or
4414 instance variable, instead of by editing profile.py's source code.
4415 Calibration must still be done manually (see the docs for the profile
4416 module).
4417
4418 Note that Profile.calibrate() must be overridden by subclasses.
4419 Improving the accuracy required exploiting detailed knowledge of
4420 profiler internals; the earlier method abstracted away the details
4421 and measured a simplified model instead, but consequently computed
4422 a constant too small by a factor of 2 on some modern machines.
4423
4424- quopri's encode and decode methods take an optional header parameter,
4425 which indicates whether output is intended for the header 'Q'
4426 encoding.
4427
4428- The SocketServer.ThreadingMixIn class now closes the request after
4429 finish_request() returns. (Not when it errors out though.)
4430
4431- The nntplib module's NNTP.body() method has grown a 'file' argument
4432 to allow saving the message body to a file.
4433
4434- The email package has added a class email.Parser.HeaderParser which
4435 only parses headers and does not recurse into the message's body.
4436 Also, the module/class MIMEAudio has been added for representing
4437 audio data (contributed by Anthony Baxter).
4438
4439- ftplib should be able to handle files > 2GB.
4440
4441- ConfigParser.getboolean() now also interprets TRUE, FALSE, YES, NO,
4442 ON, and OFF.
4443
4444- xml.dom.minidom NodeList objects now support the length attribute
4445 and item() method as required by the DOM specifications.
4446
4447Tools/Demos
4448-----------
4449
4450- Demo/dns was removed. It no longer serves any purpose; a package
4451 derived from it is now maintained by Anthony Baxter, see
4452 http://PyDNS.SourceForge.net.
4453
4454- The freeze tool has been made more robust, and two new options have
4455 been added: -X and -E.
4456
4457Build
4458-----
4459
4460- configure will use CXX in LINKCC if CXX is used to build main() and
4461 the system requires to link a C++ main using the C++ compiler.
4462
4463C API
4464-----
4465
4466- The documentation for the tp_compare slot is updated to require that
4467 the return value must be -1, 0, 1; an arbitrary number <0 or >0 is
4468 not correct. This is not yet enforced but will be enforced in
4469 Python 2.3; even later, we may use -2 to indicate errors and +2 for
4470 "NotImplemented". Right now, -1 should be used for an error return.
4471
4472- PyLong_AsLongLong() now accepts int (as well as long) arguments.
4473 Consequently, PyArg_ParseTuple's 'L' code also accepts int (as well
4474 as long) arguments.
4475
4476- PyThread_start_new_thread() now returns a long int giving the thread
4477 ID, if one can be calculated; it returns -1 for error, 0 if no
4478 thread ID is calculated (this is an incompatible change, but only
4479 the thread module used this API). This code has only really been
4480 tested on Linux and Windows; other platforms please beware (and
4481 report any bugs or strange behavior).
4482
4483- PyUnicode_FromEncodedObject() no longer accepts Unicode objects as
4484 input.
4485
4486New platforms
4487-------------
4488
4489Tests
4490-----
4491
4492Windows
4493-------
4494
4495- Installer: If you install IDLE, and don't disable file-extension
4496 registration, a new "Edit with IDLE" context (right-click) menu entry
4497 is created for .py and .pyw files.
4498
4499- The signal module now supports SIGBREAK on Windows, thanks to Steven
4500 Scott. Note that SIGBREAK is unique to Windows. The default SIGBREAK
4501 action remains to call Win32 ExitProcess(). This can be changed via
4502 signal.signal(). For example::
4503
4504 # Make Ctrl+Break raise KeyboardInterrupt, like Python's default Ctrl+C
4505 # (SIGINT) behavior.
4506 import signal
4507 signal.signal(signal.SIGBREAK, signal.default_int_handler)
4508
4509 try:
4510 while 1:
4511 pass
4512 except KeyboardInterrupt:
4513 # We get here on Ctrl+C or Ctrl+Break now; if we had not changed
4514 # SIGBREAK, only on Ctrl+C (and Ctrl+Break would terminate the
4515 # program without the possibility for any Python-level cleanup).
4516 print "Clean exit"
4517
4518
4519What's New in Python 2.2a4?
4520===========================
4521
4522*Release date: 28-Sep-2001*
4523
4524Type/class unification and new-style classes
4525--------------------------------------------
4526
4527- pydoc and inspect are now aware of new-style classes;
4528 e.g. help(list) at the interactive prompt now shows proper
4529 documentation for all operations on list objects.
4530
4531- Applications using Jim Fulton's ExtensionClass module can now safely
4532 be used with Python 2.2. In particular, Zope 2.4.1 now works with
4533 Python 2.2 (as well as with Python 2.1.1). The Demo/metaclass
4534 examples also work again. It is hoped that Gtk and Boost also work
4535 with 2.2a4 and beyond. (If you can confirm this, please write
4536 webmaster@python.org; if there are still problems, please open a bug
4537 report on SourceForge.)
4538
4539- property() now takes 4 keyword arguments: fget, fset, fdel and doc.
4540 These map to read-only attributes 'fget', 'fset', 'fdel', and '__doc__'
4541 in the constructed property object. fget, fset and fdel weren't
4542 discoverable from Python in 2.2a3. __doc__ is new, and allows to
4543 associate a docstring with a property.
4544
4545- Comparison overloading is now more completely implemented. For
4546 example, a str subclass instance can properly be compared to a str
4547 instance, and it can properly overload comparison. Ditto for most
4548 other built-in object types.
4549
4550- The repr() of new-style classes has changed; instead of <type
4551 'M.Foo'> a new-style class is now rendered as <class 'M.Foo'>,
4552 *except* for built-in types, which are still rendered as <type
4553 'Foo'> (to avoid upsetting existing code that might parse or
4554 otherwise rely on repr() of certain type objects).
4555
4556- The repr() of new-style objects is now always <Foo object at XXX>;
4557 previously, it was sometimes <Foo instance at XXX>.
4558
4559- For new-style classes, what was previously called __getattr__ is now
4560 called __getattribute__. This method, if defined, is called for
4561 *every* attribute access. A new __getattr__ hook more similar to the
4562 one in classic classes is defined which is called only if regular
4563 attribute access raises AttributeError; to catch *all* attribute
4564 access, you can use __getattribute__ (for new-style classes). If
4565 both are defined, __getattribute__ is called first, and if it raises
4566 AttributeError, __getattr__ is called.
4567
4568- The __class__ attribute of new-style objects can be assigned to.
4569 The new class must have the same C-level object layout as the old
4570 class.
4571
4572- The builtin file type can be subclassed now. In the usual pattern,
4573 "file" is the name of the builtin type, and file() is a new builtin
4574 constructor, with the same signature as the builtin open() function.
4575 file() is now the preferred way to open a file.
4576
4577- Previously, __new__ would only see sequential arguments passed to
4578 the type in a constructor call; __init__ would see both sequential
4579 and keyword arguments. This made no sense whatsoever any more, so
4580 now both __new__ and __init__ see all arguments.
4581
4582- Previously, hash() applied to an instance of a subclass of str or
4583 unicode always returned 0. This has been repaired.
4584
4585- Previously, an operation on an instance of a subclass of an
4586 immutable type (int, long, float, complex, tuple, str, unicode),
4587 where the subtype didn't override the operation (and so the
4588 operation was handled by the builtin type), could return that
4589 instance instead a value of the base type. For example, if s was of
4590 a str subclass type, s[:] returned s as-is. Now it returns a str
4591 with the same value as s.
4592
4593- Provisional support for pickling new-style objects has been added.
4594
4595Core
4596----
4597
4598- file.writelines() now accepts any iterable object producing strings.
4599
4600- PyUnicode_FromEncodedObject() now works very much like
4601 PyObject_Str(obj) in that it tries to use __str__/tp_str
4602 on the object if the object is not a string or buffer. This
4603 makes unicode() behave like str() when applied to non-string/buffer
4604 objects.
4605
4606- PyFile_WriteObject now passes Unicode objects to the file's write
4607 method. As a result, all file-like objects which may be the target
4608 of a print statement must support Unicode objects, i.e. they must
4609 at least convert them into ASCII strings.
4610
4611- Thread scheduling on Solaris should be improved; it is no longer
4612 necessary to insert a small sleep at the start of a thread in order
4613 to let other runnable threads be scheduled.
4614
4615Library
4616-------
4617
4618- StringIO.StringIO instances and cStringIO.StringIO instances support
4619 read character buffer compatible objects for their .write() methods.
4620 These objects are converted to strings and then handled as such
4621 by the instances.
4622
4623- The "email" package has been added. This is basically a port of the
4624 mimelib package <http://sf.net/projects/mimelib> with API changes
4625 and some implementations updated to use iterators and generators.
4626
4627- difflib.ndiff() and difflib.Differ.compare() are generators now. This
4628 restores the ability of Tools/scripts/ndiff.py to start producing output
4629 before the entire comparison is complete.
4630
4631- StringIO.StringIO instances and cStringIO.StringIO instances support
4632 iteration just like file objects (i.e. their .readline() method is
4633 called for each iteration until it returns an empty string).
4634
4635- The codecs module has grown four new helper APIs to access
4636 builtin codecs: getencoder(), getdecoder(), getreader(),
4637 getwriter().
4638
4639- SimpleXMLRPCServer: a new module (based upon SimpleHTMLServer)
4640 simplifies writing XML RPC servers.
4641
4642- os.path.realpath(): a new function that returns the absolute pathname
4643 after interpretation of symbolic links. On non-Unix systems, this
4644 is an alias for os.path.abspath().
4645
4646- operator.indexOf() (PySequence_Index() in the C API) now works with any
4647 iterable object.
4648
4649- smtplib now supports various authentication and security features of
4650 the SMTP protocol through the new login() and starttls() methods.
4651
4652- hmac: a new module implementing keyed hashing for message
4653 authentication.
4654
4655- mimetypes now recognizes more extensions and file types. At the
4656 same time, some mappings not sanctioned by IANA were removed.
4657
4658- The "compiler" package has been brought up to date to the state of
4659 Python 2.2 bytecode generation. It has also been promoted from a
4660 Tool to a standard library package. (Tools/compiler still exists as
4661 a sample driver.)
4662
4663Build
4664-----
4665
4666- Large file support (LFS) is now automatic when the platform supports
4667 it; no more manual configuration tweaks are needed. On Linux, at
4668 least, it's possible to have a system whose C library supports large
4669 files but whose kernel doesn't; in this case, large file support is
4670 still enabled but doesn't do you any good unless you upgrade your
4671 kernel or share your Python executable with another system whose
4672 kernel has large file support.
4673
4674- The configure script now supplies plausible defaults in a
4675 cross-compilation environment. This doesn't mean that the supplied
4676 values are always correct, or that cross-compilation now works
4677 flawlessly -- but it's a first step (and it shuts up most of
4678 autoconf's warnings about AC_TRY_RUN).
4679
4680- The Unix build is now a bit less chatty, courtesy of the parser
4681 generator. The build is completely silent (except for errors) when
4682 using "make -s", thanks to a -q option to setup.py.
4683
4684C API
4685-----
4686
4687- The "structmember" API now supports some new flag bits to deny read
4688 and/or write access to attributes in restricted execution mode.
4689
4690New platforms
4691-------------
4692
4693- Compaq's iPAQ handheld, running the "familiar" Linux distribution
4694 (http://familiar.handhelds.org).
4695
4696Tests
4697-----
4698
4699- The "classic" standard tests, which work by comparing stdout to
4700 an expected-output file under Lib/test/output/, no longer stop at
4701 the first mismatch. Instead the test is run to completion, and a
4702 variant of ndiff-style comparison is used to report all differences.
4703 This is much easier to understand than the previous style of reporting.
4704
4705- The unittest-based standard tests now use regrtest's test_main()
4706 convention, instead of running as a side-effect of merely being
4707 imported. This allows these tests to be run in more natural and
4708 flexible ways as unittests, outside the regrtest framework.
4709
4710- regrtest.py is much better integrated with unittest and doctest now,
4711 especially in regard to reporting errors.
4712
4713Windows
4714-------
4715
4716- Large file support now also works for files > 4GB, on filesystems
4717 that support it (NTFS under Windows 2000). See "What's New in
4718 Python 2.2a3" for more detail.
4719
4720
4721What's New in Python 2.2a3?
4722===========================
4723
4724*Release Date: 07-Sep-2001*
4725
4726Core
4727----
4728
4729- Conversion of long to float now raises OverflowError if the long is too
4730 big to represent as a C double.
4731
4732- The 3-argument builtin pow() no longer allows a third non-None argument
4733 if either of the first two arguments is a float, or if both are of
4734 integer types and the second argument is negative (in which latter case
4735 the arguments are converted to float, so this is really the same
4736 restriction).
4737
4738- The builtin dir() now returns more information, and sometimes much
4739 more, generally naming all attributes of an object, and all attributes
4740 reachable from the object via its class, and from its class's base
4741 classes, and so on from them too. Example: in 2.2a2, dir([]) returned
4742 an empty list. In 2.2a3,
4743
4744 >>> dir([])
4745 ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
4746 '__eq__', '__ge__', '__getattr__', '__getitem__', '__getslice__',
4747 '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__le__',
4748 '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__repr__',
4749 '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__',
4750 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
4751 'reverse', 'sort']
4752
4753 dir(module) continues to return only the module's attributes, though.
4754
4755- Overflowing operations on plain ints now return a long int rather
4756 than raising OverflowError. This is a partial implementation of PEP
4757 237. You can use -Wdefault::OverflowWarning to enable a warning for
4758 this situation, and -Werror::OverflowWarning to revert to the old
4759 OverflowError exception.
4760
4761- A new command line option, -Q<arg>, is added to control run-time
4762 warnings for the use of classic division. (See PEP 238.) Possible
4763 values are -Qold, -Qwarn, -Qwarnall, and -Qnew. The default is
4764 -Qold, meaning the / operator has its classic meaning and no
4765 warnings are issued. Using -Qwarn issues a run-time warning about
4766 all uses of classic division for int and long arguments; -Qwarnall
4767 also warns about classic division for float and complex arguments
4768 (for use with fixdiv.py).
4769 [Note: the remainder of this item (preserved below) became
4770 obsolete in 2.2c1 -- -Qnew has global effect in 2.2] ::
4771
4772 Using -Qnew is questionable; it turns on new division by default, but
4773 only in the __main__ module. You can usefully combine -Qwarn or
4774 -Qwarnall and -Qnew: this gives the __main__ module new division, and
4775 warns about classic division everywhere else.
4776
4777- Many built-in types can now be subclassed. This applies to int,
4778 long, float, str, unicode, and tuple. (The types complex, list and
4779 dictionary can also be subclassed; this was introduced earlier.)
4780 Note that restrictions apply when subclassing immutable built-in
4781 types: you can only affect the value of the instance by overloading
4782 __new__. You can add mutable attributes, and the subclass instances
4783 will have a __dict__ attribute, but you cannot change the "value"
4784 (as implemented by the base class) of an immutable subclass instance
4785 once it is created.
4786
4787- The dictionary constructor now takes an optional argument, a
4788 mapping-like object, and initializes the dictionary from its
4789 (key, value) pairs.
4790
4791- A new built-in type, super, has been added. This facilitates making
4792 "cooperative super calls" in a multiple inheritance setting. For an
4793 explanation, see http://www.python.org/2.2/descrintro.html#cooperation
4794
4795- A new built-in type, property, has been added. This enables the
4796 creation of "properties". These are attributes implemented by
4797 getter and setter functions (or only one of these for read-only or
4798 write-only attributes), without the need to override __getattr__.
4799 See http://www.python.org/2.2/descrintro.html#property
4800
4801- The syntax of floating-point and imaginary literals has been
4802 liberalized, to allow leading zeroes. Examples of literals now
4803 legal that were SyntaxErrors before:
4804
4805 00.0 0e3 0100j 07.5 00000000000000000008.
4806
4807- An old tokenizer bug allowed floating point literals with an incomplete
4808 exponent, such as 1e and 3.1e-. Such literals now raise SyntaxError.
4809
4810Library
4811-------
4812
4813- telnetlib includes symbolic names for the options, and support for
4814 setting an option negotiation callback. It also supports processing
4815 of suboptions.
4816
4817- The new C standard no longer requires that math libraries set errno to
4818 ERANGE on overflow. For platform libraries that exploit this new
4819 freedom, Python's overflow-checking was wholly broken. A new overflow-
4820 checking scheme attempts to repair that, but may not be reliable on all
4821 platforms (C doesn't seem to provide anything both useful and portable
4822 in this area anymore).
4823
4824- Asynchronous timeout actions are available through the new class
4825 threading.Timer.
4826
4827- math.log and math.log10 now return sensible results for even huge
4828 long arguments. For example, math.log10(10 ** 10000) ~= 10000.0.
4829
4830- A new function, imp.lock_held(), returns 1 when the import lock is
4831 currently held. See the docs for the imp module.
4832
4833- pickle, cPickle and marshal on 32-bit platforms can now correctly read
4834 dumps containing ints written on platforms where Python ints are 8 bytes.
4835 When read on a box where Python ints are 4 bytes, such values are
4836 converted to Python longs.
4837
4838- In restricted execution mode (using the rexec module), unmarshalling
4839 code objects is no longer allowed. This plugs a security hole.
4840
4841- unittest.TestResult instances no longer store references to tracebacks
4842 generated by test failures. This prevents unexpected dangling references
4843 to objects that should be garbage collected between tests.
4844
4845Tools
4846-----
4847
4848- Tools/scripts/fixdiv.py has been added which can be used to fix
4849 division operators as per PEP 238.
4850
4851Build
4852-----
4853
4854- If you are an adventurous person using Mac OS X you may want to look at
4855 Mac/OSX. There is a Makefile there that will build Python as a real Mac
4856 application, which can be used for experimenting with Carbon or Cocoa.
4857 Discussion of this on pythonmac-sig, please.
4858
4859C API
4860-----
4861
4862- New function PyObject_Dir(obj), like Python __builtin__.dir(obj).
4863
4864- Note that PyLong_AsDouble can fail! This has always been true, but no
4865 callers checked for it. It's more likely to fail now, because overflow
4866 errors are properly detected now. The proper way to check::
4867
4868 double x = PyLong_AsDouble(some_long_object);
4869 if (x == -1.0 && PyErr_Occurred()) {
4870 /* The conversion failed. */
4871 }
4872
4873- The GC API has been changed. Extensions that use the old API will still
4874 compile but will not participate in GC. To upgrade an extension
4875 module:
4876
4877 - rename Py_TPFLAGS_GC to PyTPFLAGS_HAVE_GC
4878
4879 - use PyObject_GC_New or PyObject_GC_NewVar to allocate objects and
4880 PyObject_GC_Del to deallocate them
4881
4882 - rename PyObject_GC_Init to PyObject_GC_Track and PyObject_GC_Fini
4883 to PyObject_GC_UnTrack
4884
4885 - remove PyGC_HEAD_SIZE from object size calculations
4886
4887 - remove calls to PyObject_AS_GC and PyObject_FROM_GC
4888
4889- Two new functions: PyString_FromFormat() and PyString_FromFormatV().
4890 These can be used safely to construct string objects from a
4891 sprintf-style format string (similar to the format string supported
4892 by PyErr_Format()).
4893
4894New platforms
4895-------------
4896
4897- Stephen Hansen contributed patches sufficient to get a clean compile
4898 under Borland C (Windows), but he reports problems running it and ran
4899 out of time to complete the port. Volunteers? Expect a MemoryError
4900 when importing the types module; this is probably shallow, and
4901 causing later failures too.
4902
4903Tests
4904-----
4905
4906Windows
4907-------
4908
4909- Large file support is now enabled on Win32 platforms as well as on
4910 Win64. This means that, for example, you can use f.tell() and f.seek()
4911 to manipulate files larger than 2 gigabytes (provided you have enough
4912 disk space, and are using a Windows filesystem that supports large
4913 partitions). Windows filesystem limits: FAT has a 2GB (gigabyte)
4914 filesize limit, and large file support makes no difference there.
4915 FAT32's limit is 4GB, and files >= 2GB are easier to use from Python now.
4916 NTFS has no practical limit on file size, and files of any size can be
4917 used from Python now.
4918
4919- The w9xpopen hack is now used on Windows NT and 2000 too when COMPSPEC
4920 points to command.com (patch from Brian Quinlan).
4921
4922
4923What's New in Python 2.2a2?
4924===========================
4925
4926*Release Date: 22-Aug-2001*
4927
4928Build
4929-----
4930
4931- Tim Peters developed a brand new Windows installer using Wise 8.1,
4932 generously donated to us by Wise Solutions.
4933
4934- configure supports a new option --enable-unicode, with the values
4935 ucs2 and ucs4 (new in 2.2a1). With --disable-unicode, the Unicode
4936 type and supporting code is completely removed from the interpreter.
4937
4938- A new configure option --enable-framework builds a Mac OS X framework,
4939 which "make frameworkinstall" will install. This provides a starting
4940 point for more mac-like functionality, join pythonmac-sig@python.org
4941 if you are interested in helping.
4942
4943- The NeXT platform is no longer supported.
4944
4945- The 'new' module is now statically linked.
4946
4947Tools
4948-----
4949
4950- The new Tools/scripts/cleanfuture.py can be used to automatically
4951 edit out obsolete future statements from Python source code. See
4952 the module docstring for details.
4953
4954Tests
4955-----
4956
4957- regrtest.py now knows which tests are expected to be skipped on some
4958 platforms, allowing to give clearer test result output. regrtest
4959 also has optional --use/-u switch to run normally disabled tests
4960 which require network access or consume significant disk resources.
4961
4962- Several new tests in the standard test suite, with special thanks to
4963 Nick Mathewson.
4964
4965Core
4966----
4967
4968- The floor division operator // has been added as outlined in PEP
4969 238. The / operator still provides classic division (and will until
4970 Python 3.0) unless "from __future__ import division" is included, in
4971 which case the / operator will provide true division. The operator
4972 module provides truediv() and floordiv() functions. Augmented
4973 assignment variants are included, as are the equivalent overloadable
4974 methods and C API methods. See the PEP for a full discussion:
4975 <http://python.sf.net/peps/pep-0238.html>
4976
4977- Future statements are now effective in simulated interactive shells
4978 (like IDLE). This should "just work" by magic, but read Michael
4979 Hudson's "Future statements in simulated shells" PEP 264 for full
4980 details: <http://python.sf.net/peps/pep-0264.html>.
4981
4982- The type/class unification (PEP 252-253) was integrated into the
4983 trunk and is not so tentative any more (the exact specification of
4984 some features is still tentative). A lot of work has done on fixing
4985 bugs and adding robustness and features (performance still has to
4986 come a long way).
4987
4988- Warnings about a mismatch in the Python API during extension import
4989 now use the Python warning framework (which makes it possible to
4990 write filters for these warnings).
4991
4992- A function's __dict__ (aka func_dict) will now always be a
4993 dictionary. It used to be possible to delete it or set it to None,
4994 but now both actions raise TypeErrors. It is still legal to set it
4995 to a dictionary object. Getting func.__dict__ before any attributes
4996 have been assigned now returns an empty dictionary instead of None.
4997
4998- A new command line option, -E, was added which disables the use of
4999 all environment variables, or at least those that are specifically
5000 significant to Python. Usually those have a name starting with
5001 "PYTHON". This was used to fix a problem where the tests fail if
5002 the user happens to have PYTHONHOME or PYTHONPATH pointing to an
5003 older distribution.
5004
5005Library
5006-------
5007
5008- New class Differ and new functions ndiff() and restore() in difflib.py.
5009 These package the algorithms used by the popular Tools/scripts/ndiff.py,
5010 for programmatic reuse.
5011
5012- New function xml.sax.saxutils.quoteattr(): Quote an XML attribute
5013 value using the minimal quoting required for the value; more
5014 reliable than using xml.sax.saxutils.escape() for attribute values.
5015
5016- Readline completion support for cmd.Cmd was added.
5017
5018- Calling os.tempnam() or os.tmpnam() generate RuntimeWarnings.
5019
5020- Added function threading.BoundedSemaphore()
5021
5022- Added Ka-Ping Yee's cgitb.py module.
5023
5024- The 'new' module now exposes the CO_xxx flags.
5025
5026- The gc module offers the get_referents function.
5027
5028New platforms
5029-------------
5030
5031C API
5032-----
5033
5034- Two new APIs PyOS_snprintf() and PyOS_vsnprintf() were added
5035 which provide a cross-platform implementations for the
5036 relatively new snprintf()/vsnprintf() C lib APIs. In contrast to
5037 the standard sprintf() and vsprintf() C lib APIs, these versions
5038 apply bounds checking on the used buffer which enhances protection
5039 against buffer overruns.
5040
5041- Unicode APIs now use name mangling to assure that mixing interpreters
5042 and extensions using different Unicode widths is rendered next to
5043 impossible. Trying to import an incompatible Unicode-aware extension
5044 will result in an ImportError. Unicode extensions writers must make
5045 sure to check the Unicode width compatibility in their extensions by
5046 using at least one of the mangled Unicode APIs in the extension.
5047
5048- Two new flags METH_NOARGS and METH_O are available in method definition
5049 tables to simplify implementation of methods with no arguments and a
5050 single untyped argument. Calling such methods is more efficient than
5051 calling corresponding METH_VARARGS methods. METH_OLDARGS is now
5052 deprecated.
5053
5054Windows
5055-------
5056
5057- "import module" now compiles module.pyw if it exists and nothing else
5058 relevant is found.
5059
5060
5061What's New in Python 2.2a1?
5062===========================
5063
5064*Release date: 18-Jul-2001*
5065
5066Core
5067----
5068
5069- TENTATIVELY, a large amount of code implementing much of what's
5070 described in PEP 252 (Making Types Look More Like Classes) and PEP
5071 253 (Subtyping Built-in Types) was added. This will be released
5072 with Python 2.2a1. Documentation will be provided separately
5073 through http://www.python.org/2.2/. The purpose of releasing this
5074 with Python 2.2a1 is to test backwards compatibility. It is
5075 possible, though not likely, that a decision is made not to release
5076 this code as part of 2.2 final, if any serious backwards
5077 incompatibilities are found during alpha testing that cannot be
5078 repaired.
5079
5080- Generators were added; this is a new way to create an iterator (see
5081 below) using what looks like a simple function containing one or
5082 more 'yield' statements. See PEP 255. Since this adds a new
5083 keyword to the language, this feature must be enabled by including a
5084 future statement: "from __future__ import generators" (see PEP 236).
5085 Generators will become a standard feature in a future release
5086 (probably 2.3). Without this future statement, 'yield' remains an
5087 ordinary identifier, but a warning is issued each time it is used.
5088 (These warnings currently don't conform to the warnings framework of
5089 PEP 230; we intend to fix this in 2.2a2.)
5090
5091- The UTF-16 codec was modified to be more RFC compliant. It will now
5092 only remove BOM characters at the start of the string and then
5093 only if running in native mode (UTF-16-LE and -BE won't remove a
5094 leading BMO character).
5095
5096- Strings now have a new method .decode() to complement the already
5097 existing .encode() method. These two methods provide direct access
5098 to the corresponding decoders and encoders of the registered codecs.
5099
5100 To enhance the usability of the .encode() method, the special
5101 casing of Unicode object return values was dropped (Unicode objects
5102 were auto-magically converted to string using the default encoding).
5103
5104 Both methods will now return whatever the codec in charge of the
5105 requested encoding returns as object, e.g. Unicode codecs will
5106 return Unicode objects when decoding is requested ("äöü".decode("latin-1")
5107 will return u"äöü"). This enables codec writer to create codecs
5108 for various simple to use conversions.
5109
5110 New codecs were added to demonstrate these new features (the .encode()
5111 and .decode() columns indicate the type of the returned objects):
5112
5113 +---------+-----------+-----------+-----------------------------+
5114 |Name | .encode() | .decode() | Description |
5115 +=========+===========+===========+=============================+
5116 |uu | string | string | UU codec (e.g. for email) |
5117 +---------+-----------+-----------+-----------------------------+
5118 |base64 | string | string | base64 codec |
5119 +---------+-----------+-----------+-----------------------------+
5120 |quopri | string | string | quoted-printable codec |
5121 +---------+-----------+-----------+-----------------------------+
5122 |zlib | string | string | zlib compression |
5123 +---------+-----------+-----------+-----------------------------+
5124 |hex | string | string | 2-byte hex codec |
5125 +---------+-----------+-----------+-----------------------------+
5126 |rot-13 | string | Unicode | ROT-13 Unicode charmap codec|
5127 +---------+-----------+-----------+-----------------------------+
5128
5129- Some operating systems now support the concept of a default Unicode
5130 encoding for file system operations. Notably, Windows supports 'mbcs'
5131 as the default. The Macintosh will also adopt this concept in the medium
5132 term, although the default encoding for that platform will be other than
5133 'mbcs'.
5134
5135 On operating system that support non-ASCII filenames, it is common for
5136 functions that return filenames (such as os.listdir()) to return Python
5137 string objects pre-encoded using the default file system encoding for
5138 the platform. As this encoding is likely to be different from Python's
5139 default encoding, converting this name to a Unicode object before passing
5140 it back to the Operating System would result in a Unicode error, as Python
5141 would attempt to use its default encoding (generally ASCII) rather than
5142 the default encoding for the file system.
5143
5144 In general, this change simply removes surprises when working with
5145 Unicode and the file system, making these operations work as you expect,
5146 increasing the transparency of Unicode objects in this context.
5147 See [????] for more details, including examples.
5148
5149- Float (and complex) literals in source code were evaluated to full
5150 precision only when running from a .py file; the same code loaded from a
5151 .pyc (or .pyo) file could suffer numeric differences starting at about the
5152 12th significant decimal digit. For example, on a machine with IEEE-754
5153 floating arithmetic,
5154
5155 x = 9007199254740992.0
5156 print long(x)
5157
5158 printed 9007199254740992 if run directly from .py, but 9007199254740000
5159 if from a compiled (.pyc or .pyo) file. This was due to marshal using
5160 str(float) instead of repr(float) when building code objects. marshal
5161 now uses repr(float) instead, which should reproduce floats to full
5162 machine precision (assuming the platform C float<->string I/O conversion
5163 functions are of good quality).
5164
5165 This may cause floating-point results to change in some cases, and
5166 usually for the better, but may also cause numerically unstable
5167 algorithms to break.
5168
5169- The implementation of dicts suffers fewer collisions, which has speed
5170 benefits. However, the order in which dict entries appear in dict.keys(),
5171 dict.values() and dict.items() may differ from previous releases for a
5172 given dict. Nothing is defined about this order, so no program should
5173 rely on it. Nevertheless, it's easy to write test cases that rely on the
5174 order by accident, typically because of printing the str() or repr() of a
5175 dict to an "expected results" file. See Lib/test/test_support.py's new
5176 sortdict(dict) function for a simple way to display a dict in sorted
5177 order.
5178
5179- Many other small changes to dicts were made, resulting in faster
5180 operation along the most common code paths.
5181
5182- Dictionary objects now support the "in" operator: "x in dict" means
5183 the same as dict.has_key(x).
5184
5185- The update() method of dictionaries now accepts generic mapping
5186 objects. Specifically the argument object must support the .keys()
5187 and __getitem__() methods. This allows you to say, for example,
5188 {}.update(UserDict())
5189
5190- Iterators were added; this is a generalized way of providing values
5191 to a for loop. See PEP 234. There's a new built-in function iter()
5192 to return an iterator. There's a new protocol to get the next value
5193 from an iterator using the next() method (in Python) or the
5194 tp_iternext slot (in C). There's a new protocol to get iterators
5195 using the __iter__() method (in Python) or the tp_iter slot (in C).
5196 Iterating (i.e. a for loop) over a dictionary generates its keys.
5197 Iterating over a file generates its lines.
5198
5199- The following functions were generalized to work nicely with iterator
5200 arguments::
5201
5202 map(), filter(), reduce(), zip()
5203 list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API)
5204 max(), min()
5205 join() method of strings
5206 extend() method of lists
5207 'x in y' and 'x not in y' (PySequence_Contains() in C API)
5208 operator.countOf() (PySequence_Count() in C API)
5209 right-hand side of assignment statements with multiple targets, such as ::
5210 x, y, z = some_iterable_object_returning_exactly_3_values
5211
5212- Accessing module attributes is significantly faster (for example,
5213 random.random or os.path or yourPythonModule.yourAttribute).
5214
5215- Comparing dictionary objects via == and != is faster, and now works even
5216 if the keys and values don't support comparisons other than ==.
5217
5218- Comparing dictionaries in ways other than == and != is slower: there were
5219 insecurities in the dict comparison implementation that could cause Python
5220 to crash if the element comparison routines for the dict keys and/or
5221 values mutated the dicts. Making the code bulletproof slowed it down.
5222
5223- Collisions in dicts are resolved via a new approach, which can help
5224 dramatically in bad cases. For example, looking up every key in a dict
5225 d with d.keys() == [i << 16 for i in range(20000)] is approximately 500x
5226 faster now. Thanks to Christian Tismer for pointing out the cause and
5227 the nature of an effective cure (last December! better late than never).
5228
5229- repr() is much faster for large containers (dict, list, tuple).
5230
5231
5232Library
5233-------
5234
5235- The constants ascii_letters, ascii_lowercase. and ascii_uppercase
5236 were added to the string module. These a locale-independent
5237 constants, unlike letters, lowercase, and uppercase. These are now
5238 use in appropriate locations in the standard library.
5239
5240- The flags used in dlopen calls can now be configured using
5241 sys.setdlopenflags and queried using sys.getdlopenflags.
5242
5243- Fredrik Lundh's xmlrpclib is now a standard library module. This
5244 provides full client-side XML-RPC support. In addition,
5245 Demo/xmlrpc/ contains two server frameworks (one SocketServer-based,
5246 one asyncore-based). Thanks to Eric Raymond for the documentation.
5247
5248- The xrange() object is simplified: it no longer supports slicing,
5249 repetition, comparisons, efficient 'in' checking, the tolist()
5250 method, or the start, stop and step attributes. See PEP 260.
5251
5252- A new function fnmatch.filter to filter lists of file names was added.
5253
5254- calendar.py uses month and day names based on the current locale.
5255
5256- strop is now *really* obsolete (this was announced before with 1.6),
5257 and issues DeprecationWarning when used (except for the four items
5258 that are still imported into string.py).
5259
5260- Cookie.py now sorts key+value pairs by key in output strings.
5261
5262- pprint.isrecursive(object) didn't correctly identify recursive objects.
5263 Now it does.
5264
5265- pprint functions now much faster for large containers (tuple, list, dict).
5266
5267- New 'q' and 'Q' format codes in the struct module, corresponding to C
5268 types "long long" and "unsigned long long" (on Windows, __int64). In
5269 native mode, these can be used only when the platform C compiler supports
5270 these types (when HAVE_LONG_LONG is #define'd by the Python config
5271 process), and then they inherit the sizes and alignments of the C types.
5272 In standard mode, 'q' and 'Q' are supported on all platforms, and are
5273 8-byte integral types.
5274
5275- The site module installs a new built-in function 'help' that invokes
5276 pydoc.help. It must be invoked as 'help()'; when invoked as 'help',
5277 it displays a message reminding the user to use 'help()' or
5278 'help(object)'.
5279
5280Tests
5281-----
5282
5283- New test_mutants.py runs dict comparisons where the key and value
5284 comparison operators mutate the dicts randomly during comparison. This
5285 rapidly causes Python to crash under earlier releases (not for the faint
5286 of heart: it can also cause Win9x to freeze or reboot!).
5287
5288- New test_pprint.py verifies that pprint.isrecursive() and
5289 pprint.isreadable() return sensible results. Also verifies that simple
5290 cases produce correct output.
5291
5292C API
5293-----
5294
5295- Removed the unused last_is_sticky argument from the internal
5296 _PyTuple_Resize(). If this affects you, you were cheating.
5297
Skip Montanaro4cb22042002-09-17 20:55:31 +00005298What's New in Python 2.1 (final)?
5299=================================
5300
5301We only changed a few things since the last release candidate, all in
5302Python library code:
5303
5304- A bug in the locale module was fixed that affected locales which
5305 define no grouping for numeric formatting.
5306
5307- A few bugs in the weakref module's implementations of weak
5308 dictionaries (WeakValueDictionary and WeakKeyDictionary) were fixed,
5309 and the test suite was updated to check for these bugs.
5310
5311- An old bug in the os.path.walk() function (introduced in Python
5312 2.0!) was fixed: a non-existent file would cause an exception
5313 instead of being ignored.
5314
5315- Fixed a few bugs in the new symtable module found by Neil Norwitz's
5316 PyChecker.
5317
5318
5319What's New in Python 2.1c2?
5320===========================
5321
5322A flurry of small changes, and one showstopper fixed in the nick of
5323time made it necessary to release another release candidate. The list
5324here is the *complete* list of patches (except version updates):
5325
5326Core
5327
5328- Tim discovered a nasty bug in the dictionary code, caused by
5329 PyDict_Next() calling dict_resize(), and the GC code's use of
5330 PyDict_Next() violating an assumption in dict_items(). This was
5331 fixed with considerable amounts of band-aid, but the net effect is a
5332 saner and more robust implementation.
5333
5334- Made a bunch of symbols static that were accidentally global.
5335
5336Build and Ports
5337
5338- The setup.py script didn't check for a new enough version of zlib
5339 (1.1.3 is needed). Now it does.
5340
5341- Changed "make clean" target to also remove shared libraries.
5342
5343- Added a more general warning about the SGI Irix optimizer to README.
5344
5345Library
5346
5347- Fix a bug in urllib.basejoin("http://host", "../file.html") which
5348 omitted the slash between host and file.html.
5349
5350- The mailbox module's _Mailbox class contained a completely broken
5351 and undocumented seek() method. Ripped it out.
5352
5353- Fixed a bunch of typos in various library modules (urllib2, smtpd,
5354 sgmllib, netrc, chunk) found by Neil Norwitz's PyChecker.
5355
5356- Fixed a few last-minute bugs in unittest.
5357
5358Extensions
5359
5360- Reverted the patch to the OpenSSL code in socketmodule.c to support
5361 RAND_status() and the EGD, and the subsequent patch that tried to
5362 fix it for pre-0.9.5 versions; the problem with the patch is that on
5363 some systems it issues a warning whenever socket is imported, and
5364 that's unacceptable.
5365
5366Tests
5367
5368- Fixed the pickle tests to work with "import test.test_pickle".
5369
5370- Tweaked test_locale.py to actually run the test Windows.
5371
5372- In distutils/archive_util.py, call zipfile.ZipFile() with mode "w",
5373 not "wb" (which is not a valid mode at all).
5374
5375- Fix pstats browser crashes. Import readline if it exists to make
5376 the user interface nicer.
5377
5378- Add "import thread" to the top of test modules that import the
5379 threading module (test_asynchat and test_threadedtempfile). This
5380 prevents test failures caused by a broken threading module resulting
5381 from a previously caught failed import.
5382
5383- Changed test_asynchat.py to set the SO_REUSEADDR option; this was
5384 needed on some platforms (e.g. Solaris 8) when the tests are run
5385 twice in succession.
5386
5387- Skip rather than fail test_sunaudiodev if no audio device is found.
5388
5389
5390What's New in Python 2.1c1?
5391===========================
5392
5393This list was significantly updated when 2.1c2 was released; the 2.1c1
5394release didn't mention most changes that were actually part of 2.1c1:
5395
5396Legal
5397
5398- Copyright was assigned to the Python Software Foundation (PSF) and a
5399 PSF license (very similar to the CNRI license) was added.
5400
5401- The CNRI copyright notice was updated to include 2001.
5402
5403Core
5404
5405- After a public outcry, assignment to __debug__ is no longer illegal;
5406 instead, a warning is issued. It will become illegal in 2.2.
5407
5408- Fixed a core dump with "%#x" % 0, and changed the semantics so that
5409 "%#x" now always prepends "0x", even if the value is zero.
5410
5411- Fixed some nits in the bytecode compiler.
5412
5413- Fixed core dumps when calling certain kinds of non-functions.
5414
5415- Fixed various core dumps caused by reference count bugs.
5416
5417Build and Ports
5418
5419- Use INSTALL_SCRIPT to install script files.
5420
5421- New port: SCO Unixware 7, by Billy G. Allie.
5422
5423- Updated RISCOS port.
5424
5425- Updated BeOS port and notes.
5426
5427- Various other porting problems resolved.
5428
5429Library
5430
5431- The TERMIOS and SOCKET modules are now truly obsolete and
5432 unnecessary. Their symbols are incorporated in the termios and
5433 socket modules.
5434
5435- Fixed some 64-bit bugs in pickle, cPickle, and struct, and added
5436 better tests for pickling.
5437
5438- threading: make Condition.wait() robust against KeyboardInterrupt.
5439
5440- zipfile: add support to zipfile to support opening an archive
5441 represented by an open file rather than a file name. Fix bug where
5442 the archive was not properly closed. Fixed a bug in this bugfix
5443 where flush() was called for a read-only file.
5444
5445- imputil: added an uninstall() method to the ImportManager.
5446
5447- Canvas: fixed bugs in lower() and tkraise() methods.
5448
5449- SocketServer: API change (added overridable close_request() method)
5450 so that the TCP server can explicitly close the request.
5451
5452- pstats: Eric Raymond added a simple interactive statistics browser,
5453 invoked when the module is run as a script.
5454
5455- locale: fixed a problem in format().
5456
5457- webbrowser: made it work when the BROWSER environment variable has a
5458 value like "/usr/bin/netscape". Made it auto-detect Konqueror for
5459 KDE 2. Fixed some other nits.
5460
5461- unittest: changes to allow using a different exception than
5462 AssertionError, and added a few more function aliases. Some other
5463 small changes.
5464
5465- urllib, urllib2: fixed redirect problems and a coupleof other nits.
5466
5467- asynchat: fixed a critical bug in asynchat that slipped through the
5468 2.1b2 release. Fixed another rare bug.
5469
5470- Fix some unqualified except: clauses (always a bad code example).
5471
5472XML
5473
5474- pyexpat: new API get_version_string().
5475
5476- Fixed some minidom bugs.
5477
5478Extensions
5479
5480- Fixed a core dump in _weakref. Removed the weakref.mapping()
5481 function (it adds nothing to the API).
5482
5483- Rationalized the use of header files in the readline module, to make
5484 it compile (albeit with some warnings) with the very recent readline
5485 4.2, without breaking for earlier versions.
5486
5487- Hopefully fixed a buffering problem in linuxaudiodev.
5488
5489- Attempted a fix to make the OpenSSL support in the socket module
5490 work again with pre-0.9.5 versions of OpenSSL.
5491
5492Tests
5493
5494- Added a test case for asynchat and asyncore.
5495
5496- Removed coupling between tests where one test failing could break
5497 another.
5498
5499Tools
5500
5501- Ping added an interactive help browser to pydoc, fixed some nits
5502 in the rest of the pydoc code, and added some features to his
5503 inspect module.
5504
5505- An updated python-mode.el version 4.1 which integrates Ken
5506 Manheimer's pdbtrack.el. This makes debugging Python code via pdb
5507 much nicer in XEmacs and Emacs. When stepping through your program
5508 with pdb, in either the shell window or the *Python* window, the
5509 source file and line will be tracked by an arrow. Very cool!
5510
5511- IDLE: syntax warnings in interactive mode are changed into errors.
5512
5513- Some improvements to Tools/webchecker (ignore some more URL types,
5514 follow some more links).
5515
5516- Brought the Tools/compiler package up to date.
5517
5518
5519What's New in Python 2.1 beta 2?
5520================================
5521
5522(Unlisted are many fixed bugs, more documentation, etc.)
5523
5524Core language, builtins, and interpreter
5525
5526- The nested scopes work (enabled by "from __future__ import
5527 nested_scopes") is completed; in particular, the future now extends
5528 into code executed through exec, eval() and execfile(), and into the
5529 interactive interpreter.
5530
5531- When calling a base class method (e.g. BaseClass.__init__(self)),
5532 this is now allowed even if self is not strictly spoken a class
5533 instance (e.g. when using metaclasses or the Don Beaudry hook).
5534
5535- Slice objects are now comparable but not hashable; this prevents
5536 dict[:] from being accepted but meaningless.
5537
5538- Complex division is now calculated using less braindead algorithms.
5539 This doesn't change semantics except it's more likely to give useful
5540 results in extreme cases. Complex repr() now uses full precision
5541 like float repr().
5542
5543- sgmllib.py now calls handle_decl() for simple <!...> declarations.
5544
5545- It is illegal to assign to the name __debug__, which is set when the
5546 interpreter starts. It is effectively a compile-time constant.
5547
5548- A warning will be issued if a global statement for a variable
5549 follows a use or assignment of that variable.
5550
5551Standard library
5552
5553- unittest.py, a unit testing framework by Steve Purcell (PyUNIT,
5554 inspired by JUnit), is now part of the standard library. You now
5555 have a choice of two testing frameworks: unittest requires you to
5556 write testcases as separate code, doctest gathers them from
5557 docstrings. Both approaches have their advantages and
5558 disadvantages.
5559
5560- A new module Tix was added, which wraps the Tix extension library
5561 for Tk. With that module, it is not necessary to statically link
5562 Tix with _tkinter, since Tix will be loaded with Tcl's "package
5563 require" command. See Demo/tix/.
5564
5565- tzparse.py is now obsolete.
5566
5567- In gzip.py, the seek() and tell() methods are removed -- they were
5568 non-functional anyway, and it's better if callers can test for their
5569 existence with hasattr().
5570
5571Python/C API
5572
5573- PyDict_Next(): it is now safe to call PyDict_SetItem() with a key
5574 that's already in the dictionary during a PyDict_Next() iteration.
5575 This used to fail occasionally when a dictionary resize operation
5576 could be triggered that would rehash all the keys. All other
5577 modifications to the dictionary are still off-limits during a
5578 PyDict_Next() iteration!
5579
5580- New extended APIs related to passing compiler variables around.
5581
5582- New abstract APIs PyObject_IsInstance(), PyObject_IsSubclass()
5583 implement isinstance() and issubclass().
5584
5585- Py_BuildValue() now has a "D" conversion to create a Python complex
5586 number from a Py_complex C value.
5587
5588- Extensions types which support weak references must now set the
5589 field allocated for the weak reference machinery to NULL themselves;
5590 this is done to avoid the cost of checking each object for having a
5591 weakly referencable type in PyObject_INIT(), since most types are
5592 not weakly referencable.
5593
5594- PyFrame_FastToLocals() and PyFrame_LocalsToFast() copy bindings for
5595 free variables and cell variables to and from the frame's f_locals.
5596
5597- Variants of several functions defined in pythonrun.h have been added
5598 to support the nested_scopes future statement. The variants all end
5599 in Flags and take an extra argument, a PyCompilerFlags *; examples:
5600 PyRun_AnyFileExFlags(), PyRun_InteractiveLoopFlags(). These
5601 variants may be removed in Python 2.2, when nested scopes are
5602 mandatory.
5603
5604Distutils
5605
5606- the sdist command now writes a PKG-INFO file, as described in PEP 241,
5607 into the release tree.
5608
5609- several enhancements to the bdist_wininst command from Thomas Heller
5610 (an uninstaller, more customization of the installer's display)
5611
5612- from Jack Jansen: added Mac-specific code to generate a dialog for
5613 users to specify the command-line (because providing a command-line with
5614 MacPython is awkward). Jack also made various fixes for the Mac
5615 and the Metrowerks compiler.
5616
5617- added 'platforms' and 'keywords' to the set of metadata that can be
5618 specified for a distribution.
5619
5620- applied patches from Jason Tishler to make the compiler class work with
5621 Cygwin.
5622
5623
5624What's New in Python 2.1 beta 1?
5625================================
5626
5627Core language, builtins, and interpreter
5628
5629- Following an outcry from the community about the amount of code
5630 broken by the nested scopes feature introduced in 2.1a2, we decided
5631 to make this feature optional, and to wait until Python 2.2 (or at
5632 least 6 months) to make it standard. The option can be enabled on a
5633 per-module basis by adding "from __future__ import nested_scopes" at
5634 the beginning of a module (before any other statements, but after
5635 comments and an optional docstring). See PEP 236 (Back to the
5636 __future__) for a description of the __future__ statement. PEP 227
5637 (Statically Nested Scopes) has been updated to reflect this change,
5638 and to clarify the semantics in a number of endcases.
5639
5640- The nested scopes code, when enabled, has been hardened, and most
5641 bugs and memory leaks in it have been fixed.
5642
5643- Compile-time warnings are now generated for a number of conditions
5644 that will break or change in meaning when nested scopes are enabled:
5645
5646 - Using "from...import *" or "exec" without in-clause in a function
5647 scope that also defines a lambda or nested function with one or
5648 more free (non-local) variables. The presence of the import* or
5649 bare exec makes it impossible for the compiler to determine the
5650 exact set of local variables in the outer scope, which makes it
5651 impossible to determine the bindings for free variables in the
5652 inner scope. To avoid the warning about import *, change it into
5653 an import of explicitly name object, or move the import* statement
5654 to the global scope; to avoid the warning about bare exec, use
5655 exec...in... (a good idea anyway -- there's a possibility that
5656 bare exec will be deprecated in the future).
5657
5658 - Use of a global variable in a nested scope with the same name as a
5659 local variable in a surrounding scope. This will change in
5660 meaning with nested scopes: the name in the inner scope will
5661 reference the variable in the outer scope rather than the global
5662 of the same name. To avoid the warning, either rename the outer
5663 variable, or use a global statement in the inner function.
5664
5665- An optional object allocator has been included. This allocator is
5666 optimized for Python objects and should be faster and use less memory
5667 than the standard system allocator. It is not enabled by default
5668 because of possible thread safety problems. The allocator is only
5669 protected by the Python interpreter lock and it is possible that some
5670 extension modules require a thread safe allocator. The object
5671 allocator can be enabled by providing the "--with-pymalloc" option to
5672 configure.
5673
5674Standard library
5675
5676- pyexpat now detects the expat version if expat.h defines it. A
5677 number of additional handlers are provided, which are only available
5678 since expat 1.95. In addition, the methods SetParamEntityParsing and
5679 GetInputContext of Parser objects are available with 1.95.x
5680 only. Parser objects now provide the ordered_attributes and
5681 specified_attributes attributes. A new module expat.model was added,
5682 which offers a number of additional constants if 1.95.x is used.
5683
5684- xml.dom offers the new functions registerDOMImplementation and
5685 getDOMImplementation.
5686
5687- xml.dom.minidom offers a toprettyxml method. A number of DOM
5688 conformance issues have been resolved. In particular, Element now
5689 has an hasAttributes method, and the handling of namespaces was
5690 improved.
5691
5692- Ka-Ping Yee contributed two new modules: inspect.py, a module for
5693 getting information about live Python code, and pydoc.py, a module
5694 for interactively converting docstrings to HTML or text.
5695 Tools/scripts/pydoc, which is now automatically installed into
5696 <prefix>/bin, uses pydoc.py to display documentation; try running
5697 "pydoc -h" for instructions. "pydoc -g" pops up a small GUI that
5698 lets you browse the module docstrings using a web browser.
5699
5700- New library module difflib.py, primarily packaging the SequenceMatcher
5701 class at the heart of the popular ndiff.py file-comparison tool.
5702
5703- doctest.py (a framework for verifying Python code examples in docstrings)
5704 is now part of the std library.
5705
5706Windows changes
5707
5708- A new entry in the Start menu, "Module Docs", runs "pydoc -g" -- a
5709 small GUI that lets you browse the module docstrings using your
5710 default web browser.
5711
5712- Import is now case-sensitive. PEP 235 (Import on Case-Insensitive
5713 Platforms) is implemented. See
5714
5715 http://python.sourceforge.net/peps/pep-0235.html
5716
5717 for full details, especially the "Current Lower-Left Semantics" section.
5718 The new Windows import rules are simpler than before:
5719
5720 A. If the PYTHONCASEOK environment variable exists, same as
5721 before: silently accept the first case-insensitive match of any
5722 kind; raise ImportError if none found.
5723
5724 B. Else search sys.path for the first case-sensitive match; raise
5725 ImportError if none found.
5726
5727 The same rules have been implemented on other platforms with case-
5728 insensitive but case-preserving filesystems too (including Cygwin, and
5729 several flavors of Macintosh operating systems).
5730
5731- winsound module: Under Win9x, winsound.Beep() now attempts to simulate
5732 what it's supposed to do (and does do under NT and 2000) via direct
5733 port manipulation. It's unknown whether this will work on all systems,
5734 but it does work on my Win98SE systems now and was known to be useless on
5735 all Win9x systems before.
5736
5737- Build: Subproject _test (effectively) renamed to _testcapi.
5738
5739New platforms
5740
5741- 2.1 should compile and run out of the box under MacOS X, even using HFS+.
5742 Thanks to Steven Majewski!
5743
5744- 2.1 should compile and run out of the box on Cygwin. Thanks to Jason
5745 Tishler!
5746
5747- 2.1 contains new files and patches for RISCOS, thanks to Dietmar
5748 Schwertberger! See RISCOS/README for more information -- it seems
5749 that because of the bizarre filename conventions on RISCOS, no port
5750 to that platform is easy.
5751
5752
5753What's New in Python 2.1 alpha 2?
5754=================================
5755
5756Core language, builtins, and interpreter
5757
5758- Scopes nest. If a name is used in a function or class, but is not
5759 local, the definition in the nearest enclosing function scope will
5760 be used. One consequence of this change is that lambda statements
5761 could reference variables in the namespaces where the lambda is
5762 defined. In some unusual cases, this change will break code.
5763
5764 In all previous version of Python, names were resolved in exactly
5765 three namespaces -- the local namespace, the global namespace, and
5766 the builtin namespace. According to this old definition, if a
5767 function A is defined within a function B, the names bound in B are
5768 not visible in A. The new rules make names bound in B visible in A,
5769 unless A contains a name binding that hides the binding in B.
5770
5771 Section 4.1 of the reference manual describes the new scoping rules
5772 in detail. The test script in Lib/test/test_scope.py demonstrates
5773 some of the effects of the change.
5774
5775 The new rules will cause existing code to break if it defines nested
5776 functions where an outer function has local variables with the same
5777 name as globals or builtins used by the inner function. Example:
5778
5779 def munge(str):
5780 def helper(x):
5781 return str(x)
5782 if type(str) != type(''):
5783 str = helper(str)
5784 return str.strip()
5785
5786 Under the old rules, the name str in helper() is bound to the
5787 builtin function str(). Under the new rules, it will be bound to
5788 the argument named str and an error will occur when helper() is
5789 called.
5790
5791- The compiler will report a SyntaxError if "from ... import *" occurs
5792 in a function or class scope. The language reference has documented
5793 that this case is illegal, but the compiler never checked for it.
5794 The recent introduction of nested scope makes the meaning of this
5795 form of name binding ambiguous. In a future release, the compiler
5796 may allow this form when there is no possibility of ambiguity.
5797
5798- repr(string) is easier to read, now using hex escapes instead of octal,
5799 and using \t, \n and \r instead of \011, \012 and \015 (respectively):
5800
5801 >>> "\texample \r\n" + chr(0) + chr(255)
5802 '\texample \r\n\x00\xff' # in 2.1
5803 '\011example \015\012\000\377' # in 2.0
5804
5805- Functions are now compared and hashed by identity, not by value, since
5806 the func_code attribute is writable.
5807
5808- Weak references (PEP 205) have been added. This involves a few
5809 changes in the core, an extension module (_weakref), and a Python
5810 module (weakref). The weakref module is the public interface. It
5811 includes support for "explicit" weak references, proxy objects, and
5812 mappings with weakly held values.
5813
5814- A 'continue' statement can now appear in a try block within the body
5815 of a loop. It is still not possible to use continue in a finally
5816 clause.
5817
5818Standard library
5819
5820- mailbox.py now has a new class, PortableUnixMailbox which is
5821 identical to UnixMailbox but uses a more portable scheme for
5822 determining From_ separators. Also, the constructors for all the
5823 classes in this module have a new optional `factory' argument, which
5824 is a callable used when new message classes must be instantiated by
5825 the next() method.
5826
5827- random.py is now self-contained, and offers all the functionality of
5828 the now-deprecated whrandom.py. See the docs for details. random.py
5829 also supports new functions getstate() and setstate(), for saving
5830 and restoring the internal state of the generator; and jumpahead(n),
5831 for quickly forcing the internal state to be the same as if n calls to
5832 random() had been made. The latter is particularly useful for multi-
5833 threaded programs, creating one instance of the random.Random() class for
5834 each thread, then using .jumpahead() to force each instance to use a
5835 non-overlapping segment of the full period.
5836
5837- random.py's seed() function is new. For bit-for-bit compatibility with
5838 prior releases, use the whseed function instead. The new seed function
5839 addresses two problems: (1) The old function couldn't produce more than
5840 about 2**24 distinct internal states; the new one about 2**45 (the best
5841 that can be done in the Wichmann-Hill generator). (2) The old function
5842 sometimes produced identical internal states when passed distinct
5843 integers, and there was no simple way to predict when that would happen;
5844 the new one guarantees to produce distinct internal states for all
5845 arguments in [0, 27814431486576L).
5846
5847- The socket module now supports raw packets on Linux. The socket
5848 family is AF_PACKET.
5849
5850- test_capi.py is a start at running tests of the Python C API. The tests
5851 are implemented by the new Modules/_testmodule.c.
5852
5853- A new extension module, _symtable, provides provisional access to the
5854 internal symbol table used by the Python compiler. A higher-level
5855 interface will be added on top of _symtable in a future release.
5856
5857- Removed the obsolete soundex module.
5858
5859- xml.dom.minidom now uses the standard DOM exceptions. Node supports
5860 the isSameNode method; NamedNodeMap the get method.
5861
5862- xml.sax.expatreader supports the lexical handler property; it
5863 generates comment, startCDATA, and endCDATA events.
5864
5865Windows changes
5866
5867- Build procedure: the zlib project is built in a different way that
5868 ensures the zlib header files used can no longer get out of synch with
5869 the zlib binary used. See PCbuild\readme.txt for details. Your old
5870 zlib-related directories can be deleted; you'll need to download fresh
5871 source for zlib and unpack it into a new directory.
5872
5873- Build: New subproject _test for the benefit of test_capi.py (see above).
5874
5875- Build: New subproject _symtable, for new DLL _symtable.pyd (a nascent
5876 interface to some Python compiler internals).
5877
5878- Build: Subproject ucnhash is gone, since the code was folded into the
5879 unicodedata subproject.
5880
5881What's New in Python 2.1 alpha 1?
5882=================================
5883
5884Core language, builtins, and interpreter
5885
5886- There is a new Unicode companion to the PyObject_Str() API
5887 called PyObject_Unicode(). It behaves in the same way as the
5888 former, but assures that the returned value is an Unicode object
5889 (applying the usual coercion if necessary).
5890
5891- The comparison operators support "rich comparison overloading" (PEP
5892 207). C extension types can provide a rich comparison function in
5893 the new tp_richcompare slot in the type object. The cmp() function
5894 and the C function PyObject_Compare() first try the new rich
5895 comparison operators before trying the old 3-way comparison. There
5896 is also a new C API PyObject_RichCompare() (which also falls back on
5897 the old 3-way comparison, but does not constrain the outcome of the
5898 rich comparison to a Boolean result).
5899
5900 The rich comparison function takes two objects (at least one of
5901 which is guaranteed to have the type that provided the function) and
5902 an integer indicating the opcode, which can be Py_LT, Py_LE, Py_EQ,
5903 Py_NE, Py_GT, Py_GE (for <, <=, ==, !=, >, >=), and returns a Python
5904 object, which may be NotImplemented (in which case the tp_compare
5905 slot function is used as a fallback, if defined).
5906
5907 Classes can overload individual comparison operators by defining one
5908 or more of the methods__lt__, __le__, __eq__, __ne__, __gt__,
5909 __ge__. There are no explicit "reflected argument" versions of
5910 these; instead, __lt__ and __gt__ are each other's reflection,
5911 likewise for__le__ and __ge__; __eq__ and __ne__ are their own
5912 reflection (similar at the C level). No other implications are
5913 made; in particular, Python does not assume that == is the Boolean
5914 inverse of !=, or that < is the Boolean inverse of >=. This makes
5915 it possible to define types with partial orderings.
5916
5917 Classes or types that want to implement (in)equality tests but not
5918 the ordering operators (i.e. unordered types) should implement ==
5919 and !=, and raise an error for the ordering operators.
5920
5921 It is possible to define types whose rich comparison results are not
5922 Boolean; e.g. a matrix type might want to return a matrix of bits
5923 for A < B, giving elementwise comparisons. Such types should ensure
5924 that any interpretation of their value in a Boolean context raises
5925 an exception, e.g. by defining __nonzero__ (or the tp_nonzero slot
5926 at the C level) to always raise an exception.
5927
5928- Complex numbers use rich comparisons to define == and != but raise
5929 an exception for <, <=, > and >=. Unfortunately, this also means
5930 that cmp() of two complex numbers raises an exception when the two
5931 numbers differ. Since it is not mathematically meaningful to compare
5932 complex numbers except for equality, I hope that this doesn't break
5933 too much code.
5934
5935- The outcome of comparing non-numeric objects of different types is
5936 not defined by the language, other than that it's arbitrary but
5937 consistent (see the Reference Manual). An implementation detail changed
5938 in 2.1a1 such that None now compares less than any other object. Code
5939 relying on this new behavior (like code that relied on the previous
5940 behavior) does so at its own risk.
5941
5942- Functions and methods now support getting and setting arbitrarily
5943 named attributes (PEP 232). Functions have a new __dict__
5944 (a.k.a. func_dict) which hold the function attributes. Methods get
5945 and set attributes on their underlying im_func. It is a TypeError
5946 to set an attribute on a bound method.
5947
5948- The xrange() object implementation has been improved so that
5949 xrange(sys.maxint) can be used on 64-bit platforms. There's still a
5950 limitation that in this case len(xrange(sys.maxint)) can't be
5951 calculated, but the common idiom "for i in xrange(sys.maxint)" will
5952 work fine as long as the index i doesn't actually reach 2**31.
5953 (Python uses regular ints for sequence and string indices; fixing
5954 that is much more work.)
5955
5956- Two changes to from...import:
5957
5958 1) "from M import X" now works even if (after loading module M)
5959 sys.modules['M'] is not a real module; it's basically a getattr()
5960 operation with AttributeError exceptions changed into ImportError.
5961
5962 2) "from M import *" now looks for M.__all__ to decide which names to
5963 import; if M.__all__ doesn't exist, it uses M.__dict__.keys() but
5964 filters out names starting with '_' as before. Whether or not
5965 __all__ exists, there's no restriction on the type of M.
5966
5967- File objects have a new method, xreadlines(). This is the fastest
5968 way to iterate over all lines in a file:
5969
5970 for line in file.xreadlines():
5971 ...do something to line...
5972
5973 See the xreadlines module (mentioned below) for how to do this for
5974 other file-like objects.
5975
5976- Even if you don't use file.xreadlines(), you may expect a speedup on
5977 line-by-line input. The file.readline() method has been optimized
5978 quite a bit in platform-specific ways: on systems (like Linux) that
5979 support flockfile(), getc_unlocked(), and funlockfile(), those are
5980 used by default. On systems (like Windows) without getc_unlocked(),
5981 a complicated (but still thread-safe) method using fgets() is used by
5982 default.
5983
5984 You can force use of the fgets() method by #define'ing
5985 USE_FGETS_IN_GETLINE at build time (it may be faster than
5986 getc_unlocked()).
5987
5988 You can force fgets() not to be used by #define'ing
5989 DONT_USE_FGETS_IN_GETLINE (this is the first thing to try if std test
5990 test_bufio.py fails -- and let us know if it does!).
5991
5992- In addition, the fileinput module, while still slower than the other
5993 methods on most platforms, has been sped up too, by using
5994 file.readlines(sizehint).
5995
5996- Support for run-time warnings has been added, including a new
5997 command line option (-W) to specify the disposition of warnings.
5998 See the description of the warnings module below.
5999
6000- Extensive changes have been made to the coercion code. This mostly
6001 affects extension modules (which can now implement mixed-type
6002 numerical operators without having to use coercion), but
6003 occasionally, in boundary cases the coercion semantics have changed
6004 subtly. Since this was a terrible gray area of the language, this
6005 is considered an improvement. Also note that __rcmp__ is no longer
6006 supported -- instead of calling __rcmp__, __cmp__ is called with
6007 reflected arguments.
6008
6009- In connection with the coercion changes, a new built-in singleton
6010 object, NotImplemented is defined. This can be returned for
6011 operations that wish to indicate they are not implemented for a
6012 particular combination of arguments. From C, this is
6013 Py_NotImplemented.
6014
6015- The interpreter accepts now bytecode files on the command line even
6016 if they do not have a .pyc or .pyo extension. On Linux, after executing
6017
6018import imp,sys,string
6019magic = string.join(["\\x%.2x" % ord(c) for c in imp.get_magic()],"")
6020reg = ':pyc:M::%s::%s:' % (magic, sys.executable)
6021open("/proc/sys/fs/binfmt_misc/register","wb").write(reg)
6022
6023 any byte code file can be used as an executable (i.e. as an argument
6024 to execve(2)).
6025
6026- %[xXo] formats of negative Python longs now produce a sign
6027 character. In 1.6 and earlier, they never produced a sign,
6028 and raised an error if the value of the long was too large
6029 to fit in a Python int. In 2.0, they produced a sign if and
6030 only if too large to fit in an int. This was inconsistent
6031 across platforms (because the size of an int varies across
6032 platforms), and inconsistent with hex() and oct(). Example:
6033
6034 >>> "%x" % -0x42L
6035 '-42' # in 2.1
6036 'ffffffbe' # in 2.0 and before, on 32-bit machines
6037 >>> hex(-0x42L)
6038 '-0x42L' # in all versions of Python
6039
6040 The behavior of %d formats for negative Python longs remains
6041 the same as in 2.0 (although in 1.6 and before, they raised
6042 an error if the long didn't fit in a Python int).
6043
6044 %u formats don't make sense for Python longs, but are allowed
6045 and treated the same as %d in 2.1. In 2.0, a negative long
6046 formatted via %u produced a sign if and only if too large to
6047 fit in an int. In 1.6 and earlier, a negative long formatted
6048 via %u raised an error if it was too big to fit in an int.
6049
6050- Dictionary objects have an odd new method, popitem(). This removes
6051 an arbitrary item from the dictionary and returns it (in the form of
6052 a (key, value) pair). This can be useful for algorithms that use a
6053 dictionary as a bag of "to do" items and repeatedly need to pick one
6054 item. Such algorithms normally end up running in quadratic time;
6055 using popitem() they can usually be made to run in linear time.
6056
6057Standard library
6058
6059- In the time module, the time argument to the functions strftime,
6060 localtime, gmtime, asctime and ctime is now optional, defaulting to
6061 the current time (in the local timezone).
6062
6063- The ftplib module now defaults to passive mode, which is deemed a
6064 more useful default given that clients are often inside firewalls
6065 these days. Note that this could break if ftplib is used to connect
6066 to a *server* that is inside a firewall, from outside; this is
6067 expected to be a very rare situation. To fix that, you can call
6068 ftp.set_pasv(0).
6069
6070- The module site now treats .pth files not only for path configuration,
6071 but also supports extensions to the initialization code: Lines starting
6072 with import are executed.
6073
6074- There's a new module, warnings, which implements a mechanism for
6075 issuing and filtering warnings. There are some new built-in
6076 exceptions that serve as warning categories, and a new command line
6077 option, -W, to control warnings (e.g. -Wi ignores all warnings, -We
6078 turns warnings into errors). warnings.warn(message[, category])
6079 issues a warning message; this can also be called from C as
6080 PyErr_Warn(category, message).
6081
6082- A new module xreadlines was added. This exports a single factory
6083 function, xreadlines(). The intention is that this code is the
6084 absolutely fastest way to iterate over all lines in an open
6085 file(-like) object:
6086
6087 import xreadlines
6088 for line in xreadlines.xreadlines(file):
6089 ...do something to line...
6090
6091 This is equivalent to the previous the speed record holder using
6092 file.readlines(sizehint). Note that if file is a real file object
6093 (as opposed to a file-like object), this is equivalent:
6094
6095 for line in file.xreadlines():
6096 ...do something to line...
6097
6098- The bisect module has new functions bisect_left, insort_left,
6099 bisect_right and insort_right. The old names bisect and insort
6100 are now aliases for bisect_right and insort_right. XXX_right
6101 and XXX_left methods differ in what happens when the new element
6102 compares equal to one or more elements already in the list: the
6103 XXX_left methods insert to the left, the XXX_right methods to the
6104 right. Code that doesn't care where equal elements end up should
6105 continue to use the old, short names ("bisect" and "insort").
6106
6107- The new curses.panel module wraps the panel library that forms part
6108 of SYSV curses and ncurses. Contributed by Thomas Gellekum.
6109
6110- The SocketServer module now sets the allow_reuse_address flag by
6111 default in the TCPServer class.
6112
6113- A new function, sys._getframe(), returns the stack frame pointer of
6114 the caller. This is intended only as a building block for
6115 higher-level mechanisms such as string interpolation.
6116
6117- The pyexpat module supports a number of new handlers, which are
6118 available only in expat 1.2. If invocation of a callback fails, it
6119 will report an additional frame in the traceback. Parser objects
6120 participate now in garbage collection. If expat reports an unknown
6121 encoding, pyexpat will try to use a Python codec; that works only
6122 for single-byte charsets. The parser type objects is exposed as
6123 XMLParserObject.
6124
6125- xml.dom now offers standard definitions for symbolic node type and
6126 exception code constants, and a hierarchy of DOM exceptions. minidom
6127 was adjusted to use them.
6128
6129- The conformance of xml.dom.minidom to the DOM specification was
6130 improved. It detects a number of additional error cases; the
6131 previous/next relationship works even when the tree is modified;
6132 Node supports the normalize() method; NamedNodeMap, DocumentType and
6133 DOMImplementation classes were added; Element supports the
6134 hasAttribute and hasAttributeNS methods; and Text supports the splitText
6135 method.
6136
6137Build issues
6138
6139- For Unix (and Unix-compatible) builds, configuration and building of
6140 extension modules is now greatly automated. Rather than having to
6141 edit the Modules/Setup file to indicate which modules should be
6142 built and where their include files and libraries are, a
6143 distutils-based setup.py script now takes care of building most
6144 extension modules. All extension modules built this way are built
6145 as shared libraries. Only a few modules that must be linked
6146 statically are still listed in the Setup file; you won't need to
6147 edit their configuration.
6148
6149- Python should now build out of the box on Cygwin. If it doesn't,
6150 mail to Jason Tishler (jlt63 at users.sourceforge.net).
6151
6152- Python now always uses its own (renamed) implementation of getopt()
6153 -- there's too much variation among C library getopt()
6154 implementations.
6155
6156- C++ compilers are better supported; the CXX macro is always set to a
6157 C++ compiler if one is found.
6158
6159Windows changes
6160
6161- select module: By default under Windows, a select() call
6162 can specify no more than 64 sockets. Python now boosts
6163 this Microsoft default to 512. If you need even more than
6164 that, see the MS docs (you'll need to #define FD_SETSIZE
6165 and recompile Python from source).
6166
6167- Support for Windows 3.1, DOS and OS/2 is gone. The Lib/dos-8x3
6168 subdirectory is no more!
6169
6170
6171What's New in Python 2.0?
6172=========================
6173
6174Below is a list of all relevant changes since release 1.6. Older
6175changes are in the file HISTORY. If you are making the jump directly
6176from Python 1.5.2 to 2.0, make sure to read the section for 1.6 in the
6177HISTORY file! Many important changes listed there.
6178
6179Alternatively, a good overview of the changes between 1.5.2 and 2.0 is
6180the document "What's New in Python 2.0" by Kuchling and Moshe Zadka:
Andrew M. Kuchlinge240d9b2004-03-21 18:48:22 +00006181http://www.amk.ca/python/2.0/.
Skip Montanaro4cb22042002-09-17 20:55:31 +00006182
6183--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)
6184
6185======================================================================
6186
6187What's new in 2.0 (since release candidate 1)?
6188==============================================
6189
6190Standard library
6191
6192- The copy_reg module was modified to clarify its intended use: to
6193 register pickle support for extension types, not for classes.
6194 pickle() will raise a TypeError if it is passed a class.
6195
6196- Fixed a bug in gettext's "normalize and expand" code that prevented
6197 it from finding an existing .mo file.
6198
6199- Restored support for HTTP/0.9 servers in httplib.
6200
6201- The math module was changed to stop raising OverflowError in case of
6202 underflow, and return 0 instead in underflow cases. Whether Python
6203 used to raise OverflowError in case of underflow was platform-
6204 dependent (it did when the platform math library set errno to ERANGE
6205 on underflow).
6206
6207- Fixed a bug in StringIO that occurred when the file position was not
6208 at the end of the file and write() was called with enough data to
6209 extend past the end of the file.
6210
6211- Fixed a bug that caused Tkinter error messages to get lost on
6212 Windows. The bug was fixed by replacing direct use of
6213 interp->result with Tcl_GetStringResult(interp).
6214
6215- Fixed bug in urllib2 that caused it to fail when it received an HTTP
6216 redirect response.
6217
6218- Several changes were made to distutils: Some debugging code was
6219 removed from util. Fixed the installer used when an external zip
6220 program (like WinZip) is not found; the source code for this
6221 installer is in Misc/distutils. check_lib() was modified to behave
6222 more like AC_CHECK_LIB by add other_libraries() as a parameter. The
6223 test for whether installed modules are on sys.path was changed to
6224 use both normcase() and normpath().
6225
6226- Several minor bugs were fixed in the xml package (the minidom,
6227 pulldom, expatreader, and saxutils modules).
6228
6229- The regression test driver (regrtest.py) behavior when invoked with
6230 -l changed: It now reports a count of objects that are recognized as
6231 garbage but not freed by the garbage collector.
6232
6233- The regression test for the math module was changed to test
6234 exceptional behavior when the test is run in verbose mode. Python
6235 cannot yet guarantee consistent exception behavior across platforms,
6236 so the exception part of test_math is run only in verbose mode, and
6237 may fail on your platform.
6238
6239Internals
6240
6241- PyOS_CheckStack() has been disabled on Win64, where it caused
6242 test_sre to fail.
6243
6244Build issues
6245
6246- Changed compiler flags, so that gcc is always invoked with -Wall and
6247 -Wstrict-prototypes. Users compiling Python with GCC should see
6248 exactly one warning, except if they have passed configure the
6249 --with-pydebug flag. The expected warning is for getopt() in
6250 Modules/main.c. This warning will be fixed for Python 2.1.
6251
6252- Fixed configure to add -threads argument during linking on OSF1.
6253
6254Tools and other miscellany
6255
6256- The compiler in Tools/compiler was updated to support the new
6257 language features introduced in 2.0: extended print statement, list
6258 comprehensions, and augmented assignments. The new compiler should
6259 also be backwards compatible with Python 1.5.2; the compiler will
6260 always generate code for the version of the interpreter it runs
6261 under.
6262
6263What's new in 2.0 release candidate 1 (since beta 2)?
6264=====================================================
6265
6266What is release candidate 1?
6267
6268We believe that release candidate 1 will fix all known bugs that we
6269intend to fix for the 2.0 final release. This release should be a bit
6270more stable than the previous betas. We would like to see even more
6271widespread testing before the final release, so we are producing this
6272release candidate. The final release will be exactly the same unless
6273any show-stopping (or brown bag) bugs are found by testers of the
6274release candidate.
6275
6276All the changes since the last beta release are bug fixes or changes
6277to support building Python for specific platforms.
6278
6279Core language, builtins, and interpreter
6280
6281- A bug that caused crashes when __coerce__ was used with augmented
6282 assignment, e.g. +=, was fixed.
6283
6284- Raise ZeroDivisionError when raising zero to a negative number,
6285 e.g. 0.0 ** -2.0. Note that math.pow is unrelated to the builtin
6286 power operator and the result of math.pow(0.0, -2.0) will vary by
6287 platform. On Linux, it raises a ValueError.
6288
6289- A bug in Unicode string interpolation was fixed that occasionally
6290 caused errors with formats including "%%". For example, the
6291 following expression "%% %s" % u"abc" no longer raises a TypeError.
6292
6293- Compilation of deeply nested expressions raises MemoryError instead
6294 of SyntaxError, e.g. eval("[" * 50 + "]" * 50).
6295
6296- In 2.0b2 on Windows, the interpreter wrote .pyc files in text mode,
6297 rendering them useless. They are now written in binary mode again.
6298
6299Standard library
6300
6301- Keyword arguments are now accepted for most pattern and match object
6302 methods in SRE, the standard regular expression engine.
6303
6304- In SRE, fixed error with negative lookahead and lookbehind that
6305 manifested itself as a runtime error in patterns like "(?<!abc)(def)".
6306
6307- Several bugs in the Unicode handling and error handling in _tkinter
6308 were fixed.
6309
6310- Fix memory management errors in Merge() and Tkapp_Call() routines.
6311
6312- Several changes were made to cStringIO to make it compatible with
6313 the file-like object interface and with StringIO. If operations are
6314 performed on a closed object, an exception is raised. The truncate
6315 method now accepts a position argument and readline accepts a size
6316 argument.
6317
6318- There were many changes made to the linuxaudiodev module and its
6319 test suite; as a result, a short, unexpected audio sample should now
6320 play when the regression test is run.
6321
6322 Note that this module is named poorly, because it should work
6323 correctly on any platform that supports the Open Sound System
6324 (OSS).
6325
6326 The module now raises exceptions when errors occur instead of
6327 crashing. It also defines the AFMT_A_LAW format (logarithmic A-law
6328 audio) and defines a getptr() method that calls the
6329 SNDCTL_DSP_GETxPTR ioctl defined in the OSS Programmer's Guide.
6330
6331- The library_version attribute, introduced in an earlier beta, was
6332 removed because it can not be supported with early versions of the C
6333 readline library, which provides no way to determine the version at
6334 compile-time.
6335
6336- The binascii module is now enabled on Win64.
6337
6338- tokenize.py no longer suffers "recursion depth" errors when parsing
6339 programs with very long string literals.
6340
6341Internals
6342
6343- Fixed several buffer overflow vulnerabilities in calculate_path(),
6344 which is called when the interpreter starts up to determine where
6345 the standard library is installed. These vulnerabilities affect all
6346 previous versions of Python and can be exploited by setting very
6347 long values for PYTHONHOME or argv[0]. The risk is greatest for a
6348 setuid Python script, although use of the wrapper in
6349 Misc/setuid-prog.c will eliminate the vulnerability.
6350
6351- Fixed garbage collection bugs in instance creation that were
6352 triggered when errors occurred during initialization. The solution,
6353 applied in cPickle and in PyInstance_New(), is to call
6354 PyObject_GC_Init() after the initialization of the object's
6355 container attributes is complete.
6356
6357- pyexpat adds definitions of PyModule_AddStringConstant and
6358 PyModule_AddObject if the Python version is less than 2.0, which
6359 provides compatibility with PyXML on Python 1.5.2.
6360
6361- If the platform has a bogus definition for LONG_BIT (the number of
6362 bits in a long), an error will be reported at compile time.
6363
6364- Fix bugs in _PyTuple_Resize() which caused hard-to-interpret garbage
6365 collection crashes and possibly other, unreported crashes.
6366
6367- Fixed a memory leak in _PyUnicode_Fini().
6368
6369Build issues
6370
6371- configure now accepts a --with-suffix option that specifies the
6372 executable suffix. This is useful for builds on Cygwin and Mac OS
6373 X, for example.
6374
6375- The mmap.PAGESIZE constant is now initialized using sysconf when
6376 possible, which eliminates a dependency on -lucb for Reliant UNIX.
6377
6378- The md5 file should now compile on all platforms.
6379
6380- The select module now compiles on platforms that do not define
6381 POLLRDNORM and related constants.
6382
6383- Darwin (Mac OS X): Initial support for static builds on this
6384 platform.
6385
6386- BeOS: A number of changes were made to the build and installation
6387 process. ar-fake now operates on a directory of object files.
6388 dl_export.h is gone, and its macros now appear on the mwcc command
6389 line during build on PPC BeOS.
6390
6391- Platform directory in lib/python2.0 is "plat-beos5" (or
6392 "plat-beos4", if building on BeOS 4.5), rather than "plat-beos".
6393
6394- Cygwin: Support for shared libraries, Tkinter, and sockets.
6395
6396- SunOS 4.1.4_JL: Fix test for directory existence in configure.
6397
6398Tools and other miscellany
6399
6400- Removed debugging prints from main used with freeze.
6401
6402- IDLE auto-indent no longer crashes when it encounters Unicode
6403 characters.
6404
6405What's new in 2.0 beta 2 (since beta 1)?
6406========================================
6407
6408Core language, builtins, and interpreter
6409
6410- Add support for unbounded ints in %d,i,u,x,X,o formats; for example
6411 "%d" % 2L**64 == "18446744073709551616".
6412
6413- Add -h and -V command line options to print the usage message and
6414 Python version number and exit immediately.
6415
6416- eval() and exec accept Unicode objects as code parameters.
6417
6418- getattr() and setattr() now also accept Unicode objects for the
6419 attribute name, which are converted to strings using the default
6420 encoding before lookup.
6421
6422- Multiplication on string and Unicode now does proper bounds
6423 checking; e.g. 'a' * 65536 * 65536 will raise ValueError, "repeated
6424 string is too long."
6425
6426- Better error message when continue is found in try statement in a
6427 loop.
6428
6429
6430Standard library and extensions
6431
6432- socket module: the OpenSSL code now adds support for RAND_status()
6433 and EGD (Entropy Gathering Device).
6434
6435- array: reverse() method of array now works. buffer_info() now does
6436 argument checking; it still takes no arguments.
6437
6438- asyncore/asynchat: Included most recent version from Sam Rushing.
6439
6440- cgi: Accept '&' or ';' as separator characters when parsing form data.
6441
6442- CGIHTTPServer: Now works on Windows (and perhaps even Mac).
6443
6444- ConfigParser: When reading the file, options spelled in upper case
6445 letters are now correctly converted to lowercase.
6446
6447- copy: Copy Unicode objects atomically.
6448
6449- cPickle: Fail gracefully when copy_reg can't be imported.
6450
6451- cStringIO: Implemented readlines() method.
6452
6453- dbm: Add get() and setdefault() methods to dbm object. Add constant
6454 `library' to module that names the library used. Added doc strings
6455 and method names to error messages. Uses configure to determine
6456 which ndbm.h file to include; Berkeley DB's nbdm and GDBM's ndbm is
6457 now available options.
6458
6459- distutils: Update to version 0.9.3.
6460
6461- dl: Add several dl.RTLD_ constants.
6462
6463- fpectl: Now supported on FreeBSD.
6464
6465- gc: Add DEBUG_SAVEALL option. When enabled all garbage objects
6466 found by the collector will be saved in gc.garbage. This is useful
6467 for debugging a program that creates reference cycles.
6468
6469- httplib: Three changes: Restore support for set_debuglevel feature
6470 of HTTP class. Do not close socket on zero-length response. Do not
6471 crash when server sends invalid content-length header.
6472
6473- mailbox: Mailbox class conforms better to qmail specifications.
6474
6475- marshal: When reading a short, sign-extend on platforms where shorts
6476 are bigger than 16 bits. When reading a long, repair the unportable
6477 sign extension that was being done for 64-bit machines. (It assumed
6478 that signed right shift sign-extends.)
6479
6480- operator: Add contains(), invert(), __invert__() as aliases for
6481 __contains__(), inv(), and __inv__() respectively.
6482
6483- os: Add support for popen2() and popen3() on all platforms where
6484 fork() exists. (popen4() is still in the works.)
6485
6486- os: (Windows only:) Add startfile() function that acts like double-
6487 clicking on a file in Explorer (or passing the file name to the
6488 DOS "start" command).
6489
6490- os.path: (Windows, DOS:) Treat trailing colon correctly in
6491 os.path.join. os.path.join("a:", "b") yields "a:b".
6492
6493- pickle: Now raises ValueError when an invalid pickle that contains
6494 a non-string repr where a string repr was expected. This behavior
6495 matches cPickle.
6496
6497- posixfile: Remove broken __del__() method.
6498
6499- py_compile: support CR+LF line terminators in source file.
6500
6501- readline: Does not immediately exit when ^C is hit when readline and
6502 threads are configured. Adds definition of rl_library_version. (The
6503 latter addition requires GNU readline 2.2 or later.)
6504
6505- rfc822: Domain literals returned by AddrlistClass method
6506 getdomainliteral() are now properly wrapped in brackets.
6507
6508- site: sys.setdefaultencoding() should only be called in case the
6509 standard default encoding ("ascii") is changed. This saves quite a
6510 few cycles during startup since the first call to
6511 setdefaultencoding() will initialize the codec registry and the
6512 encodings package.
6513
6514- socket: Support for size hint in readlines() method of object returned
6515 by makefile().
6516
6517- sre: Added experimental expand() method to match objects. Does not
6518 use buffer interface on Unicode strings. Does not hang if group id
6519 is followed by whitespace.
6520
6521- StringIO: Size hint in readlines() is now supported as documented.
6522
6523- struct: Check ranges for bytes and shorts.
6524
6525- urllib: Improved handling of win32 proxy settings. Fixed quote and
6526 quote_plus functions so that the always encode a comma.
6527
6528- Tkinter: Image objects are now guaranteed to have unique ids. Set
6529 event.delta to zero if Tk version doesn't support mousewheel.
6530 Removed some debugging prints.
6531
6532- UserList: now implements __contains__().
6533
6534- webbrowser: On Windows, use os.startfile() instead of os.popen(),
6535 which works around a bug in Norton AntiVirus 2000 that leads directly
6536 to a Blue Screen freeze.
6537
6538- xml: New version detection code allows PyXML to override standard
6539 XML package if PyXML version is greater than 0.6.1.
6540
6541- xml.dom: DOM level 1 support for basic XML. Includes xml.dom.minidom
6542 (conventional DOM), and xml.dom.pulldom, which allows building the DOM
6543 tree only for nodes which are sufficiently interesting to a specific
6544 application. Does not provide the HTML-specific extensions. Still
6545 undocumented.
6546
6547- xml.sax: SAX 2 support for Python, including all the handler
6548 interfaces needed to process XML 1.0 compliant XML. Some
6549 documentation is already available.
6550
6551- pyexpat: Renamed to xml.parsers.expat since this is part of the new,
6552 packagized XML support.
6553
6554
6555C API
6556
6557- Add three new convenience functions for module initialization --
6558 PyModule_AddObject(), PyModule_AddIntConstant(), and
6559 PyModule_AddStringConstant().
6560
6561- Cleaned up definition of NULL in C source code; all definitions were
6562 removed and add #error to Python.h if NULL isn't defined after
6563 #include of stdio.h.
6564
6565- Py_PROTO() macros that were removed in 2.0b1 have been restored for
6566 backwards compatibility (at the source level) with old extensions.
6567
6568- A wrapper API was added for signal() and sigaction(). Instead of
6569 either function, always use PyOS_getsig() to get a signal handler
6570 and PyOS_setsig() to set one. A new convenience typedef
6571 PyOS_sighandler_t is defined for the type of signal handlers.
6572
6573- Add PyString_AsStringAndSize() function that provides access to the
6574 internal data buffer and size of a string object -- or the default
6575 encoded version of a Unicode object.
6576
6577- PyString_Size() and PyString_AsString() accept Unicode objects.
6578
6579- The standard header <limits.h> is now included by Python.h (if it
6580 exists). INT_MAX and LONG_MAX will always be defined, even if
6581 <limits.h> is not available.
6582
6583- PyFloat_FromString takes a second argument, pend, that was
6584 effectively useless. It is now officially useless but preserved for
6585 backwards compatibility. If the pend argument is not NULL, *pend is
6586 set to NULL.
6587
6588- PyObject_GetAttr() and PyObject_SetAttr() now accept Unicode objects
6589 for the attribute name. See note on getattr() above.
6590
6591- A few bug fixes to argument processing for Unicode.
6592 PyArg_ParseTupleAndKeywords() now accepts "es#" and "es".
6593 PyArg_Parse() special cases "s#" for Unicode objects; it returns a
6594 pointer to the default encoded string data instead of to the raw
6595 UTF-16.
6596
6597- Py_BuildValue accepts B format (for bgen-generated code).
6598
6599
6600Internals
6601
6602- On Unix, fix code for finding Python installation directory so that
6603 it works when argv[0] is a relative path.
6604
6605- Added a true unicode_internal_encode() function and fixed the
6606 unicode_internal_decode function() to support Unicode objects directly
6607 rather than by generating a copy of the object.
6608
6609- Several of the internal Unicode tables are much smaller now, and
6610 the source code should be much friendlier to weaker compilers.
6611
6612- In the garbage collector: Fixed bug in collection of tuples. Fixed
6613 bug that caused some instances to be removed from the container set
6614 while they were still live. Fixed parsing in gc.set_debug() for
6615 platforms where sizeof(long) > sizeof(int).
6616
6617- Fixed refcount problem in instance deallocation that only occurred
6618 when Py_REF_DEBUG was defined and Py_TRACE_REFS was not.
6619
6620- On Windows, getpythonregpath is now protected against null data in
6621 registry key.
6622
6623- On Unix, create .pyc/.pyo files with O_EXCL flag to avoid a race
6624 condition.
6625
6626
6627Build and platform-specific issues
6628
6629- Better support of GNU Pth via --with-pth configure option.
6630
6631- Python/C API now properly exposed to dynamically-loaded extension
6632 modules on Reliant UNIX.
6633
6634- Changes for the benefit of SunOS 4.1.4 (really!). mmapmodule.c:
6635 Don't define MS_SYNC to be zero when it is undefined. Added missing
6636 prototypes in posixmodule.c.
6637
6638- Improved support for HP-UX build. Threads should now be correctly
6639 configured (on HP-UX 10.20 and 11.00).
6640
6641- Fix largefile support on older NetBSD systems and OpenBSD by adding
6642 define for TELL64.
6643
6644
6645Tools and other miscellany
6646
6647- ftpmirror: Call to main() is wrapped in if __name__ == "__main__".
6648
6649- freeze: The modulefinder now works with 2.0 opcodes.
6650
6651- IDLE:
6652 Move hackery of sys.argv until after the Tk instance has been
6653 created, which allows the application-specific Tkinter
6654 initialization to be executed if present; also pass an explicit
6655 className parameter to the Tk() constructor.
6656
6657
6658What's new in 2.0 beta 1?
6659=========================
6660
6661Source Incompatibilities
6662------------------------
6663
6664None. Note that 1.6 introduced several incompatibilities with 1.5.2,
6665such as single-argument append(), connect() and bind(), and changes to
6666str(long) and repr(float).
6667
6668
6669Binary Incompatibilities
6670------------------------
6671
6672- Third party extensions built for Python 1.5.x or 1.6 cannot be used
6673with Python 2.0; these extensions will have to be rebuilt for Python
66742.0.
6675
6676- On Windows, attempting to import a third party extension built for
6677Python 1.5.x or 1.6 results in an immediate crash; there's not much we
6678can do about this. Check your PYTHONPATH environment variable!
6679
6680- Python bytecode files (*.pyc and *.pyo) are not compatible between
6681releases.
6682
6683
6684Overview of Changes Since 1.6
6685-----------------------------
6686
6687There are many new modules (including brand new XML support through
6688the xml package, and i18n support through the gettext module); a list
6689of all new modules is included below. Lots of bugs have been fixed.
6690
6691The process for making major new changes to the language has changed
6692since Python 1.6. Enhancements must now be documented by a Python
6693Enhancement Proposal (PEP) before they can be accepted.
6694
6695There are several important syntax enhancements, described in more
6696detail below:
6697
6698 - Augmented assignment, e.g. x += 1
6699
6700 - List comprehensions, e.g. [x**2 for x in range(10)]
6701
6702 - Extended import statement, e.g. import Module as Name
6703
6704 - Extended print statement, e.g. print >> file, "Hello"
6705
6706Other important changes:
6707
6708 - Optional collection of cyclical garbage
6709
6710Python Enhancement Proposal (PEP)
6711---------------------------------
6712
6713PEP stands for Python Enhancement Proposal. A PEP is a design
6714document providing information to the Python community, or describing
6715a new feature for Python. The PEP should provide a concise technical
6716specification of the feature and a rationale for the feature.
6717
6718We intend PEPs to be the primary mechanisms for proposing new
6719features, for collecting community input on an issue, and for
6720documenting the design decisions that have gone into Python. The PEP
6721author is responsible for building consensus within the community and
6722documenting dissenting opinions.
6723
6724The PEPs are available at http://python.sourceforge.net/peps/.
6725
6726Augmented Assignment
6727--------------------
6728
6729This must have been the most-requested feature of the past years!
6730Eleven new assignment operators were added:
6731
6732 += -= *= /= %= **= <<= >>= &= ^= |=
6733
6734For example,
6735
6736 A += B
6737
6738is similar to
6739
6740 A = A + B
6741
6742except that A is evaluated only once (relevant when A is something
6743like dict[index].attr).
6744
6745However, if A is a mutable object, A may be modified in place. Thus,
6746if A is a number or a string, A += B has the same effect as A = A+B
6747(except A is only evaluated once); but if a is a list, A += B has the
6748same effect as A.extend(B)!
6749
6750Classes and built-in object types can override the new operators in
6751order to implement the in-place behavior; the not-in-place behavior is
6752used automatically as a fallback when an object doesn't implement the
6753in-place behavior. For classes, the method name is derived from the
6754method name for the corresponding not-in-place operator by inserting
6755an 'i' in front of the name, e.g. __iadd__ implements in-place
6756__add__.
6757
6758Augmented assignment was implemented by Thomas Wouters.
6759
6760
6761List Comprehensions
6762-------------------
6763
6764This is a flexible new notation for lists whose elements are computed
6765from another list (or lists). The simplest form is:
6766
6767 [<expression> for <variable> in <sequence>]
6768
6769For example, [i**2 for i in range(4)] yields the list [0, 1, 4, 9].
6770This is more efficient than a for loop with a list.append() call.
6771
6772You can also add a condition:
6773
6774 [<expression> for <variable> in <sequence> if <condition>]
6775
6776For example, [w for w in words if w == w.lower()] would yield the list
6777of words that contain no uppercase characters. This is more efficient
6778than a for loop with an if statement and a list.append() call.
6779
6780You can also have nested for loops and more than one 'if' clause. For
6781example, here's a function that flattens a sequence of sequences::
6782
6783 def flatten(seq):
6784 return [x for subseq in seq for x in subseq]
6785
6786 flatten([[0], [1,2,3], [4,5], [6,7,8,9], []])
6787
6788This prints
6789
6790 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
6791
6792List comprehensions originated as a patch set from Greg Ewing; Skip
6793Montanaro and Thomas Wouters also contributed. Described by PEP 202.
6794
6795
6796Extended Import Statement
6797-------------------------
6798
6799Many people have asked for a way to import a module under a different
6800name. This can be accomplished like this:
6801
6802 import foo
6803 bar = foo
6804 del foo
6805
6806but this common idiom gets old quickly. A simple extension of the
6807import statement now allows this to be written as follows:
6808
6809 import foo as bar
6810
6811There's also a variant for 'from ... import':
6812
6813 from foo import bar as spam
6814
6815This also works with packages; e.g. you can write this:
6816
6817 import test.regrtest as regrtest
6818
6819Note that 'as' is not a new keyword -- it is recognized only in this
6820context (this is only possible because the syntax for the import
6821statement doesn't involve expressions).
6822
6823Implemented by Thomas Wouters. Described by PEP 221.
6824
6825
6826Extended Print Statement
6827------------------------
6828
6829Easily the most controversial new feature, this extension to the print
6830statement adds an option to make the output go to a different file
6831than the default sys.stdout.
6832
6833For example, to write an error message to sys.stderr, you can now
6834write:
6835
6836 print >> sys.stderr, "Error: bad dog!"
6837
6838As a special feature, if the expression used to indicate the file
6839evaluates to None, the current value of sys.stdout is used. Thus:
6840
6841 print >> None, "Hello world"
6842
6843is equivalent to
6844
6845 print "Hello world"
6846
6847Design and implementation by Barry Warsaw. Described by PEP 214.
6848
6849
6850Optional Collection of Cyclical Garbage
6851---------------------------------------
6852
6853Python is now equipped with a garbage collector that can hunt down
6854cyclical references between Python objects. It's no replacement for
6855reference counting; in fact, it depends on the reference counts being
6856correct, and decides that a set of objects belong to a cycle if all
6857their reference counts can be accounted for from their references to
6858each other. This devious scheme was first proposed by Eric Tiedemann,
6859and brought to implementation by Neil Schemenauer.
6860
6861There's a module "gc" that lets you control some parameters of the
6862garbage collection. There's also an option to the configure script
6863that lets you enable or disable the garbage collection. In 2.0b1,
6864it's on by default, so that we (hopefully) can collect decent user
6865experience with this new feature. There are some questions about its
6866performance. If it proves to be too much of a problem, we'll turn it
6867off by default in the final 2.0 release.
6868
6869
6870Smaller Changes
6871---------------
6872
6873A new function zip() was added. zip(seq1, seq2, ...) is equivalent to
6874map(None, seq1, seq2, ...) when the sequences have the same length;
6875i.e. zip([1,2,3], [10,20,30]) returns [(1,10), (2,20), (3,30)]. When
6876the lists are not all the same length, the shortest list wins:
6877zip([1,2,3], [10,20]) returns [(1,10), (2,20)]. See PEP 201.
6878
6879sys.version_info is a tuple (major, minor, micro, level, serial).
6880
6881Dictionaries have an odd new method, setdefault(key, default).
6882dict.setdefault(key, default) returns dict[key] if it exists; if not,
6883it sets dict[key] to default and returns that value. Thus:
6884
6885 dict.setdefault(key, []).append(item)
6886
6887does the same work as this common idiom:
6888
6889 if not dict.has_key(key):
6890 dict[key] = []
6891 dict[key].append(item)
6892
6893There are two new variants of SyntaxError that are raised for
6894indentation-related errors: IndentationError and TabError.
6895
6896Changed \x to consume exactly two hex digits; see PEP 223. Added \U
6897escape that consumes exactly eight hex digits.
6898
6899The limits on the size of expressions and file in Python source code
6900have been raised from 2**16 to 2**32. Previous versions of Python
6901were limited because the maximum argument size the Python VM accepted
6902was 2**16. This limited the size of object constructor expressions,
6903e.g. [1,2,3] or {'a':1, 'b':2}, and the size of source files. This
6904limit was raised thanks to a patch by Charles Waldman that effectively
6905fixes the problem. It is now much more likely that you will be
6906limited by available memory than by an arbitrary limit in Python.
6907
6908The interpreter's maximum recursion depth can be modified by Python
6909programs using sys.getrecursionlimit and sys.setrecursionlimit. This
6910limit is the maximum number of recursive calls that can be made by
6911Python code. The limit exists to prevent infinite recursion from
6912overflowing the C stack and causing a core dump. The default value is
69131000. The maximum safe value for a particular platform can be found
6914by running Misc/find_recursionlimit.py.
6915
6916New Modules and Packages
6917------------------------
6918
6919atexit - for registering functions to be called when Python exits.
6920
6921imputil - Greg Stein's alternative API for writing custom import
6922hooks.
6923
6924pyexpat - an interface to the Expat XML parser, contributed by Paul
6925Prescod.
6926
6927xml - a new package with XML support code organized (so far) in three
6928subpackages: xml.dom, xml.sax, and xml.parsers. Describing these
6929would fill a volume. There's a special feature whereby a
6930user-installed package named _xmlplus overrides the standard
6931xmlpackage; this is intended to give the XML SIG a hook to distribute
6932backwards-compatible updates to the standard xml package.
6933
6934webbrowser - a platform-independent API to launch a web browser.
6935
6936
6937Changed Modules
6938---------------
6939
6940array -- new methods for array objects: count, extend, index, pop, and
6941remove
6942
6943binascii -- new functions b2a_hex and a2b_hex that convert between
6944binary data and its hex representation
6945
6946calendar -- Many new functions that support features including control
6947over which day of the week is the first day, returning strings instead
6948of printing them. Also new symbolic constants for days of week,
6949e.g. MONDAY, ..., SUNDAY.
6950
6951cgi -- FieldStorage objects have a getvalue method that works like a
6952dictionary's get method and returns the value attribute of the object.
6953
6954ConfigParser -- The parser object has new methods has_option,
6955remove_section, remove_option, set, and write. They allow the module
6956to be used for writing config files as well as reading them.
6957
6958ftplib -- ntransfercmd(), transfercmd(), and retrbinary() all now
6959optionally support the RFC 959 REST command.
6960
6961gzip -- readline and readlines now accept optional size arguments
6962
6963httplib -- New interfaces and support for HTTP/1.1 by Greg Stein. See
6964the module doc strings for details.
6965
6966locale -- implement getdefaultlocale for Win32 and Macintosh
6967
6968marshal -- no longer dumps core when marshaling deeply nested or
6969recursive data structures
6970
6971os -- new functions isatty, seteuid, setegid, setreuid, setregid
6972
6973os/popen2 -- popen2/popen3/popen4 support under Windows. popen2/popen3
6974support under Unix.
6975
6976os/pty -- support for openpty and forkpty
6977
6978os.path -- fix semantics of os.path.commonprefix
6979
6980smtplib -- support for sending very long messages
6981
6982socket -- new function getfqdn()
6983
6984readline -- new functions to read, write and truncate history files.
6985The readline section of the library reference manual contains an
6986example.
6987
6988select -- add interface to poll system call
6989
6990shutil -- new copyfileobj function
6991
6992SimpleHTTPServer, CGIHTTPServer -- Fix problems with buffering in the
6993HTTP server.
6994
6995Tkinter -- optimization of function flatten
6996
6997urllib -- scans environment variables for proxy configuration,
6998e.g. http_proxy.
6999
7000whichdb -- recognizes dumbdbm format
7001
7002
7003Obsolete Modules
7004----------------
7005
7006None. However note that 1.6 made a whole slew of modules obsolete:
7007stdwin, soundex, cml, cmpcache, dircache, dump, find, grep, packmail,
7008poly, zmod, strop, util, whatsound.
7009
7010
7011Changed, New, Obsolete Tools
7012----------------------------
7013
7014None.
7015
7016
7017C-level Changes
7018---------------
7019
7020Several cleanup jobs were carried out throughout the source code.
7021
7022All C code was converted to ANSI C; we got rid of all uses of the
7023Py_PROTO() macro, which makes the header files a lot more readable.
7024
7025Most of the portability hacks were moved to a new header file,
7026pyport.h; several other new header files were added and some old
7027header files were removed, in an attempt to create a more rational set
7028of header files. (Few of these ever need to be included explicitly;
7029they are all included by Python.h.)
7030
7031Trent Mick ensured portability to 64-bit platforms, under both Linux
7032and Win64, especially for the new Intel Itanium processor. Mick also
7033added large file support for Linux64 and Win64.
7034
7035The C APIs to return an object's size have been update to consistently
7036use the form PyXXX_Size, e.g. PySequence_Size and PyDict_Size. In
7037previous versions, the abstract interfaces used PyXXX_Length and the
7038concrete interfaces used PyXXX_Size. The old names,
7039e.g. PyObject_Length, are still available for backwards compatibility
7040at the API level, but are deprecated.
7041
7042The PyOS_CheckStack function has been implemented on Windows by
7043Fredrik Lundh. It prevents Python from failing with a stack overflow
7044on Windows.
7045
7046The GC changes resulted in creation of two new slots on object,
7047tp_traverse and tp_clear. The augmented assignment changes result in
7048the creation of a new slot for each in-place operator.
7049
7050The GC API creates new requirements for container types implemented in
7051C extension modules. See Include/objimpl.h for details.
7052
7053PyErr_Format has been updated to automatically calculate the size of
7054the buffer needed to hold the formatted result string. This change
7055prevents crashes caused by programmer error.
7056
7057New C API calls: PyObject_AsFileDescriptor, PyErr_WriteUnraisable.
7058
7059PyRun_AnyFileEx, PyRun_SimpleFileEx, PyRun_FileEx -- New functions
7060that are the same as their non-Ex counterparts except they take an
7061extra flag argument that tells them to close the file when done.
7062
7063XXX There were other API changes that should be fleshed out here.
7064
7065
7066Windows Changes
7067---------------
7068
7069New popen2/popen3/peopen4 in os module (see Changed Modules above).
7070
7071os.popen is much more usable on Windows 95 and 98. See Microsoft
7072Knowledge Base article Q150956. The Win9x workaround described there
7073is implemented by the new w9xpopen.exe helper in the root of your
7074Python installation. Note that Python uses this internally; it is not
7075a standalone program.
7076
7077Administrator privileges are no longer required to install Python
7078on Windows NT or Windows 2000. If you have administrator privileges,
7079Python's registry info will be written under HKEY_LOCAL_MACHINE.
7080Otherwise the installer backs off to writing Python's registry info
7081under HKEY_CURRENT_USER. The latter is sufficient for all "normal"
7082uses of Python, but will prevent some advanced uses from working
7083(for example, running a Python script as an NT service, or possibly
7084from CGI).
7085
7086[This was new in 1.6] The installer no longer runs a separate Tcl/Tk
7087installer; instead, it installs the needed Tcl/Tk files directly in the
7088Python directory. If you already have a Tcl/Tk installation, this
7089wastes some disk space (about 4 Megs) but avoids problems with
7090conflicting Tcl/Tk installations, and makes it much easier for Python
7091to ensure that Tcl/Tk can find all its files.
7092
7093[This was new in 1.6] The Windows installer now installs by default in
7094\Python20\ on the default volume, instead of \Program Files\Python-2.0\.
7095
7096
7097Updates to the changes between 1.5.2 and 1.6
7098--------------------------------------------
7099
7100The 1.6 NEWS file can't be changed after the release is done, so here
7101is some late-breaking news:
7102
7103New APIs in locale.py: normalize(), getdefaultlocale(), resetlocale(),
7104and changes to getlocale() and setlocale().
7105
7106The new module is now enabled per default.
7107
7108It is not true that the encodings codecs cannot be used for normal
7109strings: the string.encode() (which is also present on 8-bit strings
7110!) allows using them for 8-bit strings too, e.g. to convert files from
7111cp1252 (Windows) to latin-1 or vice-versa.
7112
7113Japanese codecs are available from Tamito KAJIYAMA:
7114http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/python/
7115
7116
7117======================================================================
7118
7119
Guido van Rossumf2eac992000-09-04 17:24:24 +00007120=======================================
7121==> Release 1.6 (September 5, 2000) <==
7122=======================================
7123
Guido van Rossuma598c932000-09-04 16:26:03 +00007124What's new in release 1.6?
7125==========================
7126
7127Below is a list of all relevant changes since release 1.5.2.
7128
7129
7130Source Incompatibilities
7131------------------------
7132
7133Several small incompatible library changes may trip you up:
7134
7135 - The append() method for lists can no longer be invoked with more
7136 than one argument. This used to append a single tuple made out of
7137 all arguments, but was undocumented. To append a tuple, use
7138 e.g. l.append((a, b, c)).
7139
7140 - The connect(), connect_ex() and bind() methods for sockets require
7141 exactly one argument. Previously, you could call s.connect(host,
7142 port), but this was undocumented. You must now write
7143 s.connect((host, port)).
7144
7145 - The str() and repr() functions are now different more often. For
7146 long integers, str() no longer appends a 'L'. Thus, str(1L) == '1',
7147 which used to be '1L'; repr(1L) is unchanged and still returns '1L'.
7148 For floats, repr() now gives 17 digits of precision, to ensure no
7149 precision is lost (on all current hardware).
7150
7151 - The -X option is gone. Built-in exceptions are now always
7152 classes. Many more library modules also have been converted to
7153 class-based exceptions.
7154
7155
7156Binary Incompatibilities
7157------------------------
7158
7159- Third party extensions built for Python 1.5.x cannot be used with
7160Python 1.6; these extensions will have to be rebuilt for Python 1.6.
7161
7162- On Windows, attempting to import a third party extension built for
7163Python 1.5.x results in an immediate crash; there's not much we can do
7164about this. Check your PYTHONPATH environment variable!
7165
7166
7167Overview of Changes since 1.5.2
7168-------------------------------
7169
7170For this overview, I have borrowed from the document "What's New in
7171Python 2.0" by Andrew Kuchling and Moshe Zadka:
Andrew M. Kuchlinge240d9b2004-03-21 18:48:22 +00007172http://www.amk.ca/python/2.0/ .
Guido van Rossuma598c932000-09-04 16:26:03 +00007173
7174There are lots of new modules and lots of bugs have been fixed. A
7175list of all new modules is included below.
7176
7177Probably the most pervasive change is the addition of Unicode support.
7178We've added a new fundamental datatype, the Unicode string, a new
7179build-in function unicode(), an numerous C APIs to deal with Unicode
7180and encodings. See the file Misc/unicode.txt for details, or
7181http://starship.python.net/crew/lemburg/unicode-proposal.txt.
7182
7183Two other big changes, related to the Unicode support, are the
7184addition of string methods and (yet another) new regular expression
7185engine.
7186
7187 - String methods mean that you can now say s.lower() etc. instead of
7188 importing the string module and saying string.lower(s) etc. One
7189 peculiarity is that the equivalent of string.join(sequence,
7190 delimiter) is delimiter.join(sequence). Use " ".join(sequence) for
7191 the effect of string.join(sequence); to make this more readable, try
7192 space=" " first. Note that the maxsplit argument defaults in
7193 split() and replace() have changed from 0 to -1.
7194
7195 - The new regular expression engine, SRE by Fredrik Lundh, is fully
7196 backwards compatible with the old engine, and is in fact invoked
7197 using the same interface (the "re" module). You can explicitly
7198 invoke the old engine by import pre, or the SRE engine by importing
7199 sre. SRE is faster than pre, and supports Unicode (which was the
7200 main reason to put effort in yet another new regular expression
7201 engine -- this is at least the fourth!).
7202
7203
7204Other Changes
7205-------------
7206
7207Other changes that won't break code but are nice to know about:
7208
7209Deleting objects is now safe even for deeply nested data structures.
7210
7211Long/int unifications: long integers can be used in seek() calls, as
7212slice indexes.
7213
7214String formatting (s % args) has a new formatting option, '%r', which
7215acts like '%s' but inserts repr(arg) instead of str(arg). (Not yet in
7216alpha 1.)
7217
7218Greg Ward's "distutils" package is included: this will make
7219installing, building and distributing third party packages much
7220simpler.
7221
7222There's now special syntax that you can use instead of the apply()
7223function. f(*args, **kwds) is equivalent to apply(f, args, kwds).
7224You can also use variations f(a1, a2, *args, **kwds) and you can leave
7225one or the other out: f(*args), f(**kwds).
7226
7227The built-ins int() and long() take an optional second argument to
7228indicate the conversion base -- of course only if the first argument
7229is a string. This makes string.atoi() and string.atol() obsolete.
7230(string.atof() was already obsolete).
7231
7232When a local variable is known to the compiler but undefined when
7233used, a new exception UnboundLocalError is raised. This is a class
7234derived from NameError so code catching NameError should still work.
7235The purpose is to provide better diagnostics in the following example:
7236 x = 1
7237 def f():
7238 print x
7239 x = x+1
7240This used to raise a NameError on the print statement, which confused
7241even experienced Python programmers (especially if there are several
7242hundreds of lines of code between the reference and the assignment to
7243x :-).
7244
7245You can now override the 'in' operator by defining a __contains__
7246method. Note that it has its arguments backwards: x in a causes
7247a.__contains__(x) to be called. That's why the name isn't __in__.
7248
7249The exception AttributeError will have a more friendly error message,
7250e.g.: <code>'Spam' instance has no attribute 'eggs'</code>. This may
7251<b>break code</b> that expects the message to be exactly the attribute
7252name.
7253
7254
7255New Modules in 1.6
7256------------------
7257
7258UserString - base class for deriving from the string type.
7259
7260distutils - tools for distributing Python modules.
7261
7262robotparser - parse a robots.txt file, for writing web spiders.
7263(Moved from Tools/webchecker/.)
7264
7265linuxaudiodev - audio for Linux.
7266
7267mmap - treat a file as a memory buffer. (Windows and Unix.)
7268
7269sre - regular expressions (fast, supports unicode). Currently, this
7270code is very rough. Eventually, the re module will be reimplemented
7271using sre (without changes to the re API).
7272
7273filecmp - supersedes the old cmp.py and dircmp.py modules.
7274
7275tabnanny - check Python sources for tab-width dependance. (Moved from
7276Tools/scripts/.)
7277
7278urllib2 - new and improved but incompatible version of urllib (still
7279experimental).
7280
7281zipfile - read and write zip archives.
7282
7283codecs - support for Unicode encoders/decoders.
7284
7285unicodedata - provides access to the Unicode 3.0 database.
7286
7287_winreg - Windows registry access.
7288
7289encodings - package which provides a large set of standard codecs --
7290currently only for the new Unicode support. It has a drop-in extension
7291mechanism which allows you to add new codecs by simply copying them
7292into the encodings package directory. Asian codec support will
7293probably be made available as separate distribution package built upon
7294this technique and the new distutils package.
7295
7296
7297Changed Modules
7298---------------
7299
7300readline, ConfigParser, cgi, calendar, posix, readline, xmllib, aifc,
7301chunk, wave, random, shelve, nntplib - minor enhancements.
7302
7303socket, httplib, urllib - optional OpenSSL support (Unix only).
7304
7305_tkinter - support for 8.0 up to 8.3. Support for versions older than
73068.0 has been dropped.
7307
7308string - most of this module is deprecated now that strings have
7309methods. This no longer uses the built-in strop module, but takes
7310advantage of the new string methods to provide transparent support for
7311both Unicode and ordinary strings.
7312
7313
7314Changes on Windows
7315------------------
7316
7317The installer no longer runs a separate Tcl/Tk installer; instead, it
7318installs the needed Tcl/Tk files directly in the Python directory. If
7319you already have a Tcl/Tk installation, this wastes some disk space
7320(about 4 Megs) but avoids problems with conflincting Tcl/Tk
7321installations, and makes it much easier for Python to ensure that
7322Tcl/Tk can find all its files. Note: the alpha installers don't
7323include the documentation.
7324
7325The Windows installer now installs by default in \Python16\ on the
7326default volume, instead of \Program Files\Python-1.6\.
7327
7328
7329Changed Tools
7330-------------
7331
7332IDLE - complete overhaul. See the <a href="../idle/">IDLE home
7333page</a> for more information. (Python 1.6 alpha 1 will come with
7334IDLE 0.6.)
7335
7336Tools/i18n/pygettext.py - Python equivalent of xgettext(1). A message
7337text extraction tool used for internationalizing applications written
7338in Python.
7339
7340
7341Obsolete Modules
7342----------------
7343
7344stdwin and everything that uses it. (Get Python 1.5.2 if you need
7345it. :-)
7346
7347soundex. (Skip Montanaro has a version in Python but it won't be
7348included in the Python release.)
7349
7350cmp, cmpcache, dircmp. (Replaced by filecmp.)
7351
7352dump. (Use pickle.)
7353
7354find. (Easily coded using os.walk().)
7355
7356grep. (Not very useful as a library module.)
7357
7358packmail. (No longer has any use.)
7359
7360poly, zmod. (These were poor examples at best.)
7361
7362strop. (No longer needed by the string module.)
7363
7364util. (This functionality was long ago built in elsewhere).
7365
7366whatsound. (Use sndhdr.)
7367
7368
7369Detailed Changes from 1.6b1 to 1.6
7370----------------------------------
7371
7372- Slight changes to the CNRI license. A copyright notice has been
7373added; the requirement to indicate the nature of modifications now
7374applies when making a derivative work available "to others" instead of
7375just "to the public"; the version and date are updated. The new
7376license has a new handle.
7377
7378- Added the Tools/compiler package. This is a project led by Jeremy
7379Hylton to write the Python bytecode generator in Python.
7380
7381- The function math.rint() is removed.
7382
7383- In Python.h, "#define _GNU_SOURCE 1" was added.
7384
7385- Version 0.9.1 of Greg Ward's distutils is included (instead of
7386version 0.9).
7387
7388- A new version of SRE is included. It is more stable, and more
7389compatible with the old RE module. Non-matching ranges are indicated
7390by -1, not None. (The documentation said None, but the PRE
7391implementation used -1; changing to None would break existing code.)
7392
7393- The winreg module has been renamed to _winreg. (There are plans for
7394a higher-level API called winreg, but this has not yet materialized in
7395a form that is acceptable to the experts.)
7396
7397- The _locale module is enabled by default.
7398
7399- Fixed the configuration line for the _curses module.
7400
7401- A few crashes have been fixed, notably <file>.writelines() with a
7402list containing non-string objects would crash, and there were
7403situations where a lost SyntaxError could dump core.
7404
7405- The <list>.extend() method now accepts an arbitrary sequence
7406argument.
7407
7408- If __str__() or __repr__() returns a Unicode object, this is
7409converted to an 8-bit string.
7410
7411- Unicode string comparisons is no longer aware of UTF-16
7412encoding peculiarities; it's a straight 16-bit compare.
7413
7414- The Windows installer now installs the LICENSE file and no longer
7415registers the Python DLL version in the registry (this is no longer
7416needed). It now uses Tcl/Tk 8.3.2.
7417
7418- A few portability problems have been fixed, in particular a
7419compilation error involving socklen_t.
7420
7421- The PC configuration is slightly friendlier to non-Microsoft
7422compilers.
7423
7424
7425======================================================================
7426
7427
Guido van Rossumf2eac992000-09-04 17:24:24 +00007428======================================
7429==> Release 1.5.2 (April 13, 1999) <==
7430======================================
7431
Guido van Rossum2001da42000-09-01 22:26:44 +00007432From 1.5.2c1 to 1.5.2 (final)
7433=============================
7434
7435Tue Apr 13 15:44:49 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7436
7437 * PCbuild/python15.wse: Bump version to 1.5.2 (final)
7438
7439 * PCbuild/python15.dsp: Added shamodule.c
7440
7441 * PC/config.c: Added sha module!
7442
7443 * README, Include/patchlevel.h: Prepare for final release.
7444
7445 * Misc/ACKS:
7446 More (Cameron Laird is honorary; the others are 1.5.2c1 testers).
7447
7448 * Python/thread_solaris.h:
7449 While I can't really test this thoroughly, Pat Knight and the Solaris
7450 man pages suggest that the proper thing to do is to add THR_NEW_LWP to
7451 the flags on thr_create(), and that there really isn't a downside, so
7452 I'll do that.
7453
7454 * Misc/ACKS:
7455 Bunch of new names who helped iron out the last wrinkles of 1.5.2.
7456
7457 * PC/python_nt.rc:
7458 Bump the myusterious M$ version number from 1,5,2,1 to 1,5,2,3.
7459 (I can't even display this on NT, maybe Win/98 can?)
7460
7461 * Lib/pstats.py:
7462 Fix mysterious references to jprofile that were in the source since
7463 its creation. I'm assuming these were once valid references to "Jim
7464 Roskind's profile"...
7465
7466 * Lib/Attic/threading_api.py:
7467 Removed; since long subsumed in Doc/lib/libthreading.tex
7468
7469 * Modules/socketmodule.c:
7470 Put back __osf__ support for gethostbyname_r(); the real bug was that
7471 it was being used even without threads. This of course might be an
7472 all-platform problem so now we only use the _r variant when we are
7473 using threads.
7474
7475Mon Apr 12 22:51:20 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7476
7477 * Modules/cPickle.c:
7478 Fix accidentally reversed NULL test in load_mark(). Suggested by
7479 Tamito Kajiyama. (This caused a bug only on platforms where malloc(0)
7480 returns NULL.)
7481
7482 * README:
7483 Add note about popen2 problem on Linux noticed by Pablo Bleyer.
7484
7485 * README: Add note about -D_REENTRANT for HP-UX 10.20.
7486
7487 * Modules/Makefile.pre.in: 'clean' target should remove hassignal.
7488
7489 * PC/Attic/vc40.mak, PC/readme.txt:
7490 Remove all VC++ info (except VC 1.5) from readme.txt;
7491 remove the VC++ 4.0 project file; remove the unused _tkinter extern defs.
7492
7493 * README: Clarify PC build instructions (point to PCbuild).
7494
7495 * Modules/zlibmodule.c: Cast added by Jack Jansen (for Mac port).
7496
7497 * Lib/plat-sunos5/CDIO.py, Lib/plat-linux2/CDROM.py:
7498 Forgot to add this file. CDROM device parameters.
7499
7500 * Lib/gzip.py: Two different changes.
7501
7502 1. Jack Jansen reports that on the Mac, the time may be negative, and
7503 solves this by adding a write32u() function that writes an unsigned
7504 long.
7505
7506 2. On 64-bit platforms the CRC comparison fails; I've fixed this by
7507 casting both values to be compared to "unsigned long" i.e. modulo
7508 0x100000000L.
7509
7510Sat Apr 10 18:42:02 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7511
7512 * PC/Attic/_tkinter.def: No longer needed.
7513
7514 * Misc/ACKS: Correct missed character in Andrew Dalke's name.
7515
7516 * README: Add DEC Ultrix notes (from Donn Cave's email).
7517
7518 * configure: The usual
7519
7520 * configure.in:
7521 Quote a bunch of shell variables used in test, related to long-long.
7522
7523 * Objects/fileobject.c, Modules/shamodule.c, Modules/regexpr.c:
7524 casts for picky compilers.
7525
7526 * Modules/socketmodule.c:
7527 3-arg gethostbyname_r doesn't really work on OSF/1.
7528
7529 * PC/vc15_w31/_.c, PC/vc15_lib/_.c, Tools/pynche/__init__.py:
7530 Avoid totally empty files.
7531
7532Fri Apr 9 14:56:35 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7533
7534 * Tools/scripts/fixps.py: Use re instead of regex.
7535 Don't rewrite the file in place.
7536 (Reported by Andy Dustman.)
7537
7538 * Lib/netrc.py, Lib/shlex.py: Get rid of #! line
7539
7540Thu Apr 8 23:13:37 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7541
7542 * PCbuild/python15.wse: Use the Tcl 8.0.5 installer.
7543 Add a variable %_TCL_% that makes it easier to switch to a different version.
7544
7545
7546======================================================================
7547
7548
7549From 1.5.2b2 to 1.5.2c1
7550=======================
7551
7552Thu Apr 8 23:13:37 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7553
7554 * PCbuild/python15.wse:
7555 Release 1.5.2c1. Add IDLE and Uninstall to program group.
7556 Don't distribute zlib.dll. Tweak some comments.
7557
7558 * PCbuild/zlib.dsp: Now using static zlib 1.1.3
7559
7560 * Lib/dos-8x3/userdict.py, Lib/dos-8x3/userlist.py, Lib/dos-8x3/test_zli.py, Lib/dos-8x3/test_use.py, Lib/dos-8x3/test_pop.py, Lib/dos-8x3/test_pic.py, Lib/dos-8x3/test_ntp.py, Lib/dos-8x3/test_gzi.py, Lib/dos-8x3/test_fcn.py, Lib/dos-8x3/test_cpi.py, Lib/dos-8x3/test_bsd.py, Lib/dos-8x3/posixfil.py, Lib/dos-8x3/mimetype.py, Lib/dos-8x3/nturl2pa.py, Lib/dos-8x3/compilea.py, Lib/dos-8x3/exceptio.py, Lib/dos-8x3/basehttp.py:
7561 The usual
7562
7563 * Include/patchlevel.h: Release 1.5.2c1
7564
7565 * README: Release 1.5.2c1.
7566
7567 * Misc/NEWS: News for the 1.5.2c1 release.
7568
7569 * Lib/test/test_strftime.py:
7570 On Windows, we suddenly find, strftime() may return "" for an
7571 unsupported format string. (I guess this is because the logic for
7572 deciding whether to reallocate the buffer or not has been improved.)
7573 This caused the test code to crash on result[0]. Fix this by assuming
7574 an empty result also means the format is not supported.
7575
7576 * Demo/tkinter/matt/window-creation-w-location.py:
7577 This demo imported some private code from Matt. Make it cripple along.
7578
7579 * Lib/lib-tk/Tkinter.py:
7580 Delete an accidentally checked-in feature that actually broke more
7581 than was worth it: when deleting a canvas item, it would try to
7582 automatically delete the bindings for that item. Since there's
7583 nothing that says you can't reuse the tag and still have the bindings,
7584 this is not correct. Also, it broke at least one demo
7585 (Demo/tkinter/matt/rubber-band-box-demo-1.py).
7586
7587 * Python/thread_wince.h: Win/CE thread support by Mark Hammond.
7588
7589Wed Apr 7 20:23:17 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7590
7591 * Modules/zlibmodule.c:
7592 Patch by Andrew Kuchling to unflush() (flush() for deflating).
7593 Without this, if inflate() returned Z_BUF_ERROR asking for more output
7594 space, we would report the error; now, we increase the buffer size and
7595 try again, just as for Z_OK.
7596
7597 * Lib/test/test_gzip.py: Use binary mode for all gzip files we open.
7598
7599 * Tools/idle/ChangeLog: New change log.
7600
7601 * Tools/idle/README.txt, Tools/idle/NEWS.txt: New version.
7602
7603 * Python/pythonrun.c:
7604 Alas, get rid of the Win specific hack to ask the user to press Return
7605 before exiting when an error happened. This didn't work right when
7606 Python is invoked from a daemon.
7607
7608 * Tools/idle/idlever.py: Version bump awaiting impending new release.
7609 (Not much has changed :-( )
7610
7611 * Lib/lib-tk/Tkinter.py:
7612 lower, tkraise/lift hide Misc.lower, Misc.tkraise/lift,
7613 so the preferred name for them is tag_lower, tag_raise
7614 (similar to tag_bind, and similar to the Text widget);
7615 unfortunately can't delete the old ones yet (maybe in 1.6)
7616
7617 * Python/thread.c, Python/strtod.c, Python/mystrtoul.c, Python/import.c, Python/ceval.c:
7618 Changes by Mark Hammond for Windows CE. Mostly of the form
7619 #ifdef DONT_HAVE_header_H ... #endif around #include <header.h>.
7620
7621 * Python/bltinmodule.c:
7622 Remove unused variable from complex_from_string() code.
7623
7624 * Include/patchlevel.h:
7625 Add the possibility of a gamma release (release candidate).
7626 Add '+' to string version number to indicate we're beyond b2 now.
7627
7628 * Modules/posixmodule.c: Add extern decl for fsync() for SunOS 4.x.
7629
7630 * Lib/smtplib.py: Changes by Per Cederquist and The Dragon.
7631
7632 Per writes:
7633
7634 """
7635 The application where Signum Support uses smtplib needs to be able to
7636 report good error messages to the user when sending email fails. To
7637 help in diagnosing problems it is useful to be able to report the
7638 entire message sent by the server, not only the SMTP error code of the
7639 offending command.
7640
7641 A lot of the functions in sendmail.py unfortunately discards the
7642 message, leaving only the code. The enclosed patch fixes that
7643 problem.
7644
7645 The enclosed patch also introduces a base class for exceptions that
7646 include an SMTP error code and error message, and make the code and
7647 message available on separate attributes, so that surrounding code can
7648 deal with them in whatever way it sees fit. I've also added some
7649 documentation to the exception classes.
7650
7651 The constructor will now raise an exception if it cannot connect to
7652 the SMTP server.
7653
7654 The data() method will raise an SMTPDataError if it doesn't receive
7655 the expected 354 code in the middle of the exchange.
7656
7657 According to section 5.2.10 of RFC 1123 a smtp client must accept "any
7658 text, including no text at all" after the error code. If the response
7659 of a HELO command contains no text self.helo_resp will be set to the
7660 empty string (""). The patch fixes the test in the sendmail() method
7661 so that helo_resp is tested against None; if it has the empty string
7662 as value the sendmail() method would invoke the helo() method again.
7663
7664 The code no longer accepts a -1 reply from the ehlo() method in
7665 sendmail().
7666
7667 [Text about removing SMTPRecipientsRefused deleted --GvR]
7668 """
7669
7670 and also:
7671
7672 """
7673 smtplib.py appends an extra blank line to the outgoing mail if the
7674 `msg' argument to the sendmail method already contains a trailing
7675 newline. This patch should fix the problem.
7676 """
7677
7678 The Dragon writes:
7679
7680 """
7681 Mostly I just re-added the SMTPRecipientsRefused exception
7682 (the exeption object now has the appropriate info in it ) [Per had
7683 removed this in his patch --GvR] and tweaked the behavior of the
7684 sendmail method whence it throws the newly added SMTPHeloException (it
7685 was closing the connection, which it shouldn't. whatever catches the
7686 exception should do that. )
7687
7688 I pondered the change of the return values to tuples all around,
7689 and after some thinking I decided that regularizing the return values was
7690 too much of the Right Thing (tm) to not do.
7691
7692 My one concern is that code expecting an integer & getting a tuple
7693 may fail silently.
7694
7695 (i.e. if it's doing :
7696
7697 x.somemethod() >= 400:
7698 expecting an integer, the expression will always be true if it gets a
7699 tuple instead. )
7700
7701 However, most smtplib code I've seen only really uses the
7702 sendmail() method, so this wouldn't bother it. Usually code I've seen
7703 that calls the other methods usually only calls helo() and ehlo() for
7704 doing ESMTP, a feature which was not in the smtplib included with 1.5.1,
7705 and thus I would think not much code uses it yet.
7706 """
7707
7708Tue Apr 6 19:38:18 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7709
7710 * Lib/test/test_ntpath.py:
7711 Fix the tests now that splitdrive() no longer treats UNC paths special.
7712 (Some tests converted to splitunc() tests.)
7713
7714 * Lib/ntpath.py:
7715 Withdraw the UNC support from splitdrive(). Instead, a new function
7716 splitunc() parses UNC paths. The contributor of the UNC parsing in
7717 splitdrive() doesn't like it, but I haven't heard a good reason to
7718 keep it, and it causes some problems. (I think there's a
7719 philosophical problem -- to me, the split*() functions are purely
7720 syntactical, and the fact that \\foo is not a valid path doesn't mean
7721 that it shouldn't be considered an absolute path.)
7722
7723 Also (quite separately, but strangely related to the philosophical
7724 issue above) fix abspath() so that if win32api exists, it doesn't fail
7725 when the path doesn't actually exist -- if GetFullPathName() fails,
7726 fall back on the old strategy (join with getcwd() if neccessary, and
7727 then use normpath()).
7728
7729 * configure.in, configure, config.h.in, acconfig.h:
7730 For BeOS PowerPC. Chris Herborth.
7731
7732Mon Apr 5 21:54:14 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7733
7734 * Modules/timemodule.c:
7735 Jonathan Giddy notes, and Chris Lawrence agrees, that some comments on
7736 #else/#endif are wrong, and that #if HAVE_TM_ZONE should be #ifdef.
7737
7738 * Misc/ACKS:
7739 Bunch of new contributors, including 9 who contributed to the Docs,
7740 reported by Fred.
7741
7742Mon Apr 5 18:37:59 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
7743
7744 * Lib/gzip.py:
7745 Oops, missed mode parameter to open().
7746
7747 * Lib/gzip.py:
7748 Made the default mode 'rb' instead of 'r', for better cross-platform
7749 support. (Based on comment on the documentation by Bernhard Reiter
7750 <bernhard@csd.uwm.edu>).
7751
7752Fri Apr 2 22:18:25 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7753
7754 * Tools/scripts/dutree.py:
7755 For reasons I dare not explain, this script should always execute
7756 main() when imported (in other words, it is not usable as a module).
7757
7758Thu Apr 1 15:32:30 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7759
7760 * Lib/test/test_cpickle.py: Jonathan Giddy write:
7761
7762 In test_cpickle.py, the module os got imported, but the line to remove
7763 the temp file has gone missing.
7764
7765Tue Mar 30 20:17:31 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7766
7767 * Lib/BaseHTTPServer.py: Per Cederqvist writes:
7768
7769 If you send something like "PUT / HTTP/1.0" to something derived from
7770 BaseHTTPServer that doesn't define do_PUT, you will get a response
7771 that begins like this:
7772
7773 HTTP/1.0 501 Unsupported method ('do_PUT')
7774 Server: SimpleHTTP/0.3 Python/1.5
7775 Date: Tue, 30 Mar 1999 18:53:53 GMT
7776
7777 The server should complain about 'PUT' instead of 'do_PUT'. This
7778 patch should fix the problem.
7779
7780Mon Mar 29 20:33:21 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7781
7782 * Lib/smtplib.py: Patch by Per Cederqvist, who writes:
7783
7784 """
7785 - It needlessly used the makefile() method for each response that is
7786 read from the SMTP server.
7787
7788 - If the remote SMTP server closes the connection unexpectedly the
7789 code raised an IndexError. It now raises an SMTPServerDisconnected
7790 exception instead.
7791
7792 - The code now checks that all lines in a multiline response actually
7793 contains an error code.
7794 """
7795
7796 The Dragon approves.
7797
7798Mon Mar 29 20:25:40 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
7799
7800 * Lib/compileall.py:
7801 When run as a script, report failures in the exit code as well.
7802 Patch largely based on changes by Andrew Dalke, as discussed in the
7803 distutils-sig.
7804
7805Mon Mar 29 20:23:41 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7806
7807 * Lib/urllib.py:
7808 Hack so that if a 302 or 301 redirect contains a relative URL, the
7809 right thing "just happens" (basejoin() with old URL).
7810
7811 * Modules/cPickle.c:
7812 Protection against picling to/from closed (real) file.
7813 The problem was reported by Moshe Zadka.
7814
7815 * Lib/test/test_cpickle.py:
7816 Test protection against picling to/from closed (real) file.
7817
7818 * Modules/timemodule.c: Chris Lawrence writes:
7819
7820 """
7821 The GNU folks, in their infinite wisdom, have decided not to implement
7822 altzone in libc6; this would not be horrible, except that timezone
7823 (which is implemented) includes the current DST setting (i.e. timezone
7824 for Central is 18000 in summer and 21600 in winter). So Python's
7825 timezone and altzone variables aren't set correctly during DST.
7826
7827 Here's a patch relative to 1.5.2b2 that (a) makes timezone and altzone
7828 show the "right" thing on Linux (by using the tm_gmtoff stuff
7829 available in BSD, which is how the GLIBC manual claims things should
7830 be done) and (b) should cope with the southern hemisphere. In pursuit
7831 of (b), I also took the liberty of renaming the "summer" and "winter"
7832 variables to "july" and "jan". This patch should also make certain
7833 time calculations on Linux actually work right (like the tz-aware
7834 functions in the rfc822 module).
7835
7836 (It's hard to find DST that's currently being used in the southern
7837 hemisphere; I tested using Africa/Windhoek.)
7838 """
7839
7840 * Lib/test/output/test_gzip:
7841 Jonathan Giddy discovered this file was missing.
7842
7843 * Modules/shamodule.c:
7844 Avoid warnings from AIX compiler. Reported by Vladimir (AIX is my
7845 middlename) Marangozov, patch coded by Greg Stein.
7846
7847 * Tools/idle/ScriptBinding.py, Tools/idle/PyShell.py:
7848 At Tim Peters' recommendation, add a dummy flush() method to PseudoFile.
7849
7850Sun Mar 28 17:55:32 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7851
7852 * Tools/scripts/ndiff.py: Tim Peters writes:
7853
7854 I should have waited overnight <wink/sigh>. Nothing wrong with the one I
7855 sent, but I couldn't resist going on to add new -r1 / -r2 cmdline options
7856 for recreating the original files from ndiff's output. That's attached, if
7857 you're game! Us Windows guys don't usually have a sed sitting around
7858 <wink>.
7859
7860Sat Mar 27 13:34:01 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7861
7862 * Tools/scripts/ndiff.py: Tim Peters writes:
7863
7864 Attached is a cleaned-up version of ndiff (added useful module
7865 docstring, now echo'ed in case of cmd line mistake); added -q option
7866 to suppress initial file identification lines; + other minor cleanups,
7867 & a slightly faster match engine.
7868
7869Fri Mar 26 22:36:00 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
7870
7871 * Tools/scripts/dutree.py:
7872 During display, if EPIPE is raised, it's probably because a pager was
7873 killed. Discard the error in that case, but propogate it otherwise.
7874
7875Fri Mar 26 16:20:45 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7876
7877 * Lib/test/output/test_userlist, Lib/test/test_userlist.py:
7878 Test suite for UserList.
7879
7880 * Lib/UserList.py: Use isinstance() where appropriate.
7881 Reformatted with 4-space indent.
7882
7883Fri Mar 26 16:11:40 1999 Barry Warsaw <bwarsaw@eric.cnri.reston.va.us>
7884
7885 * Tools/pynche/PyncheWidget.py:
7886 Helpwin.__init__(): The text widget should get focus.
7887
7888 * Tools/pynche/pyColorChooser.py:
7889 Removed unnecessary import `from PyncheWidget import PyncheWidget'
7890
7891Fri Mar 26 15:32:05 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7892
7893 * Lib/test/output/test_userdict, Lib/test/test_userdict.py:
7894 Test suite for UserDict
7895
7896 * Lib/UserDict.py: Improved a bunch of things.
7897 The constructor now takes an optional dictionary.
7898 Use isinstance() where appropriate.
7899
7900Thu Mar 25 22:38:49 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7901
7902 * Lib/test/output/test_pickle, Lib/test/output/test_cpickle, Lib/test/test_pickle.py, Lib/test/test_cpickle.py:
7903 Basic regr tests for pickle/cPickle
7904
7905 * Lib/pickle.py:
7906 Don't use "exec" in find_class(). It's slow, unnecessary, and (as AMK
7907 points out) it doesn't work in JPython Applets.
7908
7909Thu Mar 25 21:50:27 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us>
7910
7911 * Lib/test/test_gzip.py:
7912 Added a simple test suite for gzip. It simply opens a temp file,
7913 writes a chunk of compressed data, closes it, writes another chunk, and
7914 reads the contents back to verify that they are the same.
7915
7916 * Lib/gzip.py:
7917 Based on a suggestion from bruce@hams.com, make a trivial change to
7918 allow using the 'a' flag as a mode for opening a GzipFile. gzip
7919 files, surprisingly enough, can be concatenated and then decompressed;
7920 the effect is to concatenate the two chunks of data.
7921
7922 If we support it on writing, it should also be supported on reading.
7923 This *wasn't* trivial, and required rearranging the code in the
7924 reading path, particularly the _read() method.
7925
7926 Raise IOError instead of RuntimeError in two cases, 'Not a gzipped file'
7927 and 'Unknown compression method'
7928
7929Thu Mar 25 21:25:01 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7930
7931 * Lib/test/test_b1.py:
7932 Add tests for float() and complex() with string args (Nick/Stephanie
7933 Lockwood).
7934
7935Thu Mar 25 21:21:08 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us>
7936
7937 * Modules/zlibmodule.c:
7938 Add an .unused_data attribute to decompressor objects. If .unused_data
7939 is not an empty string, this means that you have arrived at the
7940 end of the stream of compressed data, and the contents of .unused_data are
7941 whatever follows the compressed stream.
7942
7943Thu Mar 25 21:16:07 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7944
7945 * Python/bltinmodule.c:
7946 Patch by Nick and Stephanie Lockwood to implement complex() with a string
7947 argument. This closes TODO item 2.19.
7948
7949Wed Mar 24 19:09:00 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7950
7951 * Tools/webchecker/wcnew.py: Added Samuel Bayer's new webchecker.
7952 Unfortunately his code breaks wcgui.py in a way that's not easy
7953 to fix. I expect that this is a temporary situation --
7954 eventually Sam's changes will be merged back in.
7955 (The changes add a -t option to specify exceptions to the -x
7956 option, and explicit checking for #foo style fragment ids.)
7957
7958 * Objects/dictobject.c:
7959 Vladimir Marangozov contributed updated comments.
7960
7961 * Objects/bufferobject.c: Folded long lines.
7962
7963 * Lib/test/output/test_sha, Lib/test/test_sha.py:
7964 Added Jeremy's test code for the sha module.
7965
7966 * Modules/shamodule.c, Modules/Setup.in:
7967 Added Greg Stein and Andrew Kuchling's sha module.
7968 Fix comments about zlib version and URL.
7969
7970 * Lib/test/test_bsddb.py: Remove the temp file when we're done.
7971
7972 * Include/pythread.h: Conform to standard boilerplate.
7973
7974 * configure.in, configure, BeOS/linkmodule, BeOS/ar-fake:
7975 Chris Herborth: the new compiler in R4.1 needs some new options to work...
7976
7977 * Modules/socketmodule.c:
7978 Implement two suggestions by Jonathan Giddy: (1) in AIX, clear the
7979 data struct before calling gethostby{name,addr}_r(); (2) ignore the
7980 3/5/6 args determinations made by the configure script and switch on
7981 platform identifiers instead:
7982
7983 AIX, OSF have 3 args
7984 Sun, SGI have 5 args
7985 Linux has 6 args
7986
7987 On all other platforms, undef HAVE_GETHOSTBYNAME_R altogether.
7988
7989 * Modules/socketmodule.c:
7990 Vladimir Marangozov implements the AIX 3-arg gethostbyname_r code.
7991
7992 * Lib/mailbox.py:
7993 Add readlines() to _Subfile class. Not clear who would need it, but
7994 Chris Lawrence sent me a broken version; this one is a tad simpler and
7995 more conforming to the standard.
7996
7997Tue Mar 23 23:05:34 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us>
7998
7999 * Lib/gzip.py: use struct instead of bit-manipulate in Python
8000
8001Tue Mar 23 19:00:55 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8002
8003 * Modules/Makefile.pre.in:
8004 Add $(EXE) to various occurrences of python so it will work on Cygwin
8005 with egcs (after setting EXE=.exe). Patch by Norman Vine.
8006
8007 * configure, configure.in:
8008 Ack! It never defined HAVE_GETHOSTBYNAME_R so that code was never tested!
8009
8010Mon Mar 22 22:25:39 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8011
8012 * Include/thread.h:
8013 Adding thread.h -- unused but for b/w compatibility.
8014 As requested by Bill Janssen.
8015
8016 * configure.in, configure:
8017 Add code to test for all sorts of gethostbyname_r variants,
8018 donated by David Arnold.
8019
8020 * config.h.in, acconfig.h:
8021 Add symbols for gethostbyname_r variants (sigh).
8022
8023 * Modules/socketmodule.c: Clean up pass for the previous patches.
8024
8025 - Use HAVE_GETHOSTBYNAME_R_6_ARG instead of testing for Linux and
8026 glibc2.
8027
8028 - If gethostbyname takes 3 args, undefine HAVE_GETHOSTBYNAME_R --
8029 don't know what code should be used.
8030
8031 - New symbol USE_GETHOSTBYNAME_LOCK defined iff the lock should be used.
8032
8033 - Modify the gethostbyaddr() code to also hold on to the lock until
8034 after it is safe to release, overlapping with the Python lock.
8035
8036 (Note: I think that it could in theory be possible that Python code
8037 executed while gethostbyname_lock is held could attempt to reacquire
8038 the lock -- e.g. in a signal handler or destructor. I will simply say
8039 "don't do that then.")
8040
8041 * Modules/socketmodule.c: Jonathan Giddy writes:
8042
8043 Here's a patch to fix the race condition, which wasn't fixed by Rob's
8044 patch. It holds the gethostbyname lock until the results are copied out,
8045 which means that this lock and the Python global lock are held at the same
8046 time. This shouldn't be a problem as long as the gethostbyname lock is
8047 always acquired when the global lock is not held.
8048
8049Mon Mar 22 19:25:30 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us>
8050
8051 * Modules/zlibmodule.c:
8052 Fixed the flush() method of compression objects; the test for
8053 the end of loop was incorrect, and failed when the flushmode != Z_FINISH.
8054 Logic cleaned up and commented.
8055
8056 * Lib/test/test_zlib.py:
8057 Added simple test for the flush() method of compression objects, trying the
8058 different flush values Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH.
8059
8060Mon Mar 22 15:28:08 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8061
8062 * Lib/shlex.py:
8063 Bug reported by Tobias Thelen: missing "self." in assignment target.
8064
8065Fri Mar 19 21:50:11 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8066
8067 * Modules/arraymodule.c:
8068 Use an unsigned cast to avoid a warning in VC++.
8069
8070 * Lib/dospath.py, Lib/ntpath.py:
8071 New code for split() by Tim Peters, behaves more like posixpath.split().
8072
8073 * Objects/floatobject.c:
8074 Fix a problem with Vladimir's PyFloat_Fini code: clear the free list; if
8075 a block cannot be freed, add its free items back to the free list.
8076 This is necessary to avoid leaking when Python is reinitialized later.
8077
8078 * Objects/intobject.c:
8079 Fix a problem with Vladimir's PyInt_Fini code: clear the free list; if
8080 a block cannot be freed, add its free items back to the free list, and
8081 add its valid ints back to the small_ints array if they are in range.
8082 This is necessary to avoid leaking when Python is reinitialized later.
8083
8084 * Lib/types.py:
8085 Added BufferType, the type returned by the new builtin buffer(). Greg Stein.
8086
8087 * Python/bltinmodule.c:
8088 New builtin buffer() creates a derived read-only buffer from any
8089 object that supports the buffer interface (e.g. strings, arrays).
8090
8091 * Objects/bufferobject.c:
8092 Added check for negative offset for PyBuffer_FromObject and check for
8093 negative size for PyBuffer_FromMemory. Greg Stein.
8094
8095Thu Mar 18 15:10:44 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8096
8097 * Lib/urlparse.py: Sjoerd Mullender writes:
8098
8099 If a filename on Windows starts with \\, it is converted to a URL
8100 which starts with ////. If this URL is passed to urlparse.urlparse
8101 you get a path that starts with // (and an empty netloc). If you pass
8102 the result back to urlparse.urlunparse, you get a URL that starts with
8103 //, which is parsed differently by urlparse.urlparse. The fix is to
8104 add the (empty) netloc with accompanying slashes if the path in
8105 urlunparse starts with //. Do this for all schemes that use a netloc.
8106
8107 * Lib/nturl2path.py: Sjoerd Mullender writes:
8108
8109 Pathnames of files on other hosts in the same domain
8110 (\\host\path\to\file) are not translated correctly to URLs and back.
8111 The URL should be something like file:////host/path/to/file.
8112 Note that a combination of drive letter and remote host is not
8113 possible.
8114
8115Wed Mar 17 22:30:10 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8116
8117 * Lib/urlparse.py:
8118 Delete non-standard-conforming code in urljoin() that would use the
8119 netloc from the base url as the default netloc for the resulting url
8120 even if the schemes differ.
8121
8122 Once upon a time, when the web was wild, this was a valuable hack
8123 because some people had a URL referencing an ftp server colocated with
8124 an http server without having the host in the ftp URL (so they could
8125 replicate it or change the hostname easily).
8126
8127 More recently, after the file: scheme got added back to the list of
8128 schemes that accept a netloc, it turns out that this caused weirdness
8129 when joining an http: URL with a file: URL -- the resulting file: URL
8130 would always inherit the host from the http: URL because the file:
8131 scheme supports a netloc but in practice never has one.
8132
8133 There are two reasons to get rid of the old, once-valuable hack,
8134 instead of removing the file: scheme from the uses_netloc list. One,
8135 the RFC says that file: uses the netloc syntax, and does not endorse
8136 the old hack. Two, neither netscape 4.5 nor IE 4.0 support the old
8137 hack.
8138
8139 * Include/ceval.h, Include/abstract.h:
8140 Add DLL level b/w compat for PySequence_In and PyEval_CallObject
8141
8142Tue Mar 16 21:54:50 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8143
8144 * Lib/lib-tk/Tkinter.py: Bug reported by Jim Robinson:
8145
8146 An attempt to execute grid_slaves with arguments (0,0) results in
8147 *all* of the slaves being returned, not just the slave associated with
8148 row 0, column 0. This is because the test for arguments in the method
8149 does not test to see if row (and column) does not equal None, but
8150 rather just whether is evaluates to non-false. A value of 0 fails
8151 this test.
8152
8153Tue Mar 16 14:17:48 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8154
8155 * Modules/cmathmodule.c:
8156 Docstring fix: acosh() returns the hyperbolic arccosine, not the
8157 hyperbolic cosine. Problem report via David Ascher by one of his
8158 students.
8159
8160Mon Mar 15 21:40:59 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8161
8162 * configure.in:
8163 Should test for gethost*by*name_r, not for gethostname_r (which
8164 doesn't exist and doesn't make sense).
8165
8166 * Modules/socketmodule.c:
8167 Patch by Rob Riggs for Linux -- glibc2 has a different argument
8168 converntion for gethostbyname_r() etc. than Solaris!
8169
8170 * Python/thread_pthread.h: Rob Riggs wrote:
8171
8172 """
8173 Spec says that on success pthread_create returns 0. It does not say
8174 that an error code will be < 0. Linux glibc2 pthread_create() returns
8175 ENOMEM (12) when one exceed process limits. (It looks like it should
8176 return EAGAIN, but that's another story.)
8177
8178 For reference, see:
8179 http://www.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html
8180 """
8181
8182 [I have a feeling that similar bugs were fixed before; perhaps someone
8183 could check that all error checks no check for != 0?]
8184
8185 * Tools/bgen/bgen/bgenObjectDefinition.py:
8186 New mixin class that defines cmp and hash that use
8187 the ob_itself pointer. This allows (when using the mixin)
8188 different Python objects pointing to the same C object and
8189 behaving well as dictionary keys.
8190
8191 Or so sez Jack Jansen...
8192
8193 * Lib/urllib.py: Yet another patch by Sjoerd Mullender:
8194
8195 Don't convert URLs to URLs using pathname2url.
8196
8197Fri Mar 12 22:15:43 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8198
8199 * Lib/cmd.py: Patch by Michael Scharf. He writes:
8200
8201 The module cmd requires for each do_xxx command a help_xxx
8202 function. I think this is a little old fashioned.
8203
8204 Here is a patch: use the docstring as help if no help_xxx
8205 function can be found.
8206
8207 [I'm tempted to rip out all the help_* functions from pdb, but I'll
8208 resist it. Any takers? --Guido]
8209
8210 * Tools/freeze/freeze.py: Bug submitted by Wayne Knowles, who writes:
8211
8212 Under Windows, python freeze.py -o hello hello.py
8213 creates all the correct files in the hello subdirectory, but the
8214 Makefile has the directory prefix in it for frozen_extensions.c
8215 nmake fails because it tries to locate hello/frozen_extensions.c
8216
8217 (His fix adds a call to os.path.basename() in the appropriate place.)
8218
8219 * Objects/floatobject.c, Objects/intobject.c:
8220 Vladimir has restructured his code somewhat so that the blocks are now
8221 represented by an explicit structure. (There are still too many casts
8222 in the code, but that may be unavoidable.)
8223
8224 Also added code so that with -vv it is very chatty about what it does.
8225
8226 * Demo/zlib/zlibdemo.py, Demo/zlib/minigzip.py:
8227 Change #! line to modern usage; also chmod +x
8228
8229 * Demo/pdist/rrcs, Demo/pdist/rcvs, Demo/pdist/rcsbump:
8230 Change #! line to modern usage
8231
8232 * Lib/nturl2path.py, Lib/urllib.py: From: Sjoerd Mullender
8233
8234 The filename to URL conversion didn't properly quote special
8235 characters.
8236 The URL to filename didn't properly unquote special chatacters.
8237
8238 * Objects/floatobject.c:
8239 OK, try again. Vladimir gave me a fix for the alignment bus error,
8240 so here's his patch again. This time it works (at least on Solaris,
8241 Linux and Irix).
8242
8243Thu Mar 11 23:21:23 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8244
8245 * Tools/idle/PathBrowser.py:
8246 Don't crash when sys.path contains an empty string.
8247
8248 * Tools/idle/PathBrowser.py:
8249 - Don't crash in the case where a superclass is a string instead of a
8250 pyclbr.Class object; this can happen when the superclass is
8251 unrecognizable (to pyclbr), e.g. when module renaming is used.
8252
8253 - Show a watch cursor when calling pyclbr (since it may take a while
8254 recursively parsing imported modules!).
8255
8256Thu Mar 11 16:04:04 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8257
8258 * Lib/mimetypes.py:
8259 Added .rdf and .xsl as application/xml types. (.rdf is for the
8260 Resource Description Framework, a metadata encoding, and .xsl is for
8261 the Extensible Stylesheet Language.)
8262
8263Thu Mar 11 13:26:23 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8264
8265 * Lib/test/output/test_popen2, Lib/test/test_popen2.py:
8266 Test for popen2 module, by Chris Tismer.
8267
8268 * Objects/floatobject.c:
8269 Alas, Vladimir's patch caused a bus error (probably double
8270 alignment?), and I didn't test it. Withdrawing it for now.
8271
8272Wed Mar 10 22:55:47 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8273
8274 * Objects/floatobject.c:
8275 Patch by Vladimir Marangoz to allow freeing of the allocated blocks of
8276 floats on finalization.
8277
8278 * Objects/intobject.c:
8279 Patch by Vladimir Marangoz to allow freeing of the allocated blocks of
8280 integers on finalization.
8281
8282 * Tools/idle/EditorWindow.py, Tools/idle/Bindings.py:
8283 Add PathBrowser to File module
8284
8285 * Tools/idle/PathBrowser.py:
8286 "Path browser" - 4 scrolled lists displaying:
8287 directories on sys.path
8288 modules in selected directory
8289 classes in selected module
8290 methods of selected class
8291
8292 Sinlge clicking in a directory, module or class item updates the next
8293 column with info about the selected item. Double clicking in a
8294 module, class or method item opens the file (and selects the clicked
8295 item if it is a class or method).
8296
8297 I guess eventually I should be using a tree widget for this, but the
8298 ones I've seen don't work well enough, so for now I use the old
8299 Smalltalk or NeXT style multi-column hierarchical browser.
8300
8301 * Tools/idle/MultiScrolledLists.py:
8302 New utility: multiple scrolled lists in parallel
8303
8304 * Tools/idle/ScrolledList.py: - White background.
8305 - Display "(None)" (or text of your choosing) when empty.
8306 - Don't set the focus.
8307
8308Tue Mar 9 19:31:21 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8309
8310 * Lib/urllib.py:
8311 open_http also had the 'data is None' test backwards. don't call with the
8312 extra argument if data is None.
8313
8314 * Demo/embed/demo.c:
8315 Call Py_SetProgramName() instead of redefining getprogramname(),
8316 reflecting changes in the runtime around 1.5 or earlier.
8317
8318 * Python/ceval.c:
8319 Always test for an error return (usually NULL or -1) without setting
8320 an exception.
8321
8322 * Modules/timemodule.c: Patch by Chris Herborth for BeOS code.
8323 He writes:
8324
8325 I had an off-by-1000 error in floatsleep(),
8326 and the problem with time.clock() is that it's not implemented properly
8327 on QNX... ANSI says it's supposed to return _CPU_ time used by the
8328 process, but on QNX it returns the amount of real time used... so I was
8329 confused.
8330
8331 * Tools/bgen/bgen/macsupport.py: Small change by Jack Jansen.
8332 Test for self.returntype behaving like OSErr rather than being it.
8333
8334Thu Feb 25 16:14:58 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us>
8335
8336 * Lib/urllib.py:
8337 http_error had the 'data is None' test backwards. don't call with the
8338 extra argument if data is None.
8339
8340 * Lib/urllib.py: change indentation from 8 spaces to 4 spaces
8341
8342 * Lib/urllib.py: pleasing the tabnanny
8343
8344Thu Feb 25 14:26:02 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8345
8346 * Lib/colorsys.py:
8347 Oops, one more "x, y, z" to convert...
8348
8349 * Lib/colorsys.py:
8350 Adjusted comment at the top to be less confusing, following Fredrik
8351 Lundh's example.
8352
8353 Converted comment to docstring.
8354
8355Wed Feb 24 18:49:15 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8356
8357 * Lib/toaiff.py:
8358 Use sndhdr instead of the obsolete whatsound module.
8359
8360Wed Feb 24 18:42:38 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us>
8361
8362 * Lib/urllib.py:
8363 When performing a POST request, i.e. when the second argument to
8364 urlopen is used to specify form data, make sure the second argument is
8365 threaded through all of the http_error_NNN calls. This allows error
8366 handlers like the redirect and authorization handlers to properly
8367 re-start the connection.
8368
8369Wed Feb 24 16:25:17 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8370
8371 * Lib/mhlib.py: Patch by Lars Wirzenius:
8372
8373 o the initial comment is wrong: creating messages is already
8374 implemented
8375
8376 o Message.getbodytext: if the mail or it's part contains an
8377 empty content-transfer-encoding header, the code used to
8378 break; the change below treats an empty encoding value the same
8379 as the other types that do not need decoding
8380
8381 o SubMessage.getbodytext was missing the decode argument; the
8382 change below adds it; I also made it unconditionally return
8383 the raw text if decoding was not desired, because my own
8384 routines needed that (and it was easier than rewriting my
8385 own routines ;-)
8386
8387Wed Feb 24 00:35:43 1999 Barry Warsaw <bwarsaw@eric.cnri.reston.va.us>
8388
8389 * Python/bltinmodule.c (initerrors):
8390 Make sure that the exception tuples ("base-classes" when
8391 string-based exceptions are used) reflect the real class hierarchy,
8392 i.e. that SystemExit derives from Exception not StandardError.
8393
8394 * Lib/exceptions.py:
8395 Document the correct class hierarchy for SystemExit. It is not an
8396 error and so it derives from Exception and not SystemError. The
8397 docstring was incorrect but the implementation was fine.
8398
8399Tue Feb 23 23:07:51 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8400
8401 * Lib/shutil.py:
8402 Add import sys, needed by reference to sys.exc_info() in rmtree().
8403 Discovered by Mitch Chapman.
8404
8405 * config.h.in:
8406 Now that we don't have AC_CHECK_LIB(m, pow), the HAVE_LIBM symbol
8407 disappears. It wasn't used anywhere anyway...
8408
8409 * Modules/arraymodule.c:
8410 Carefully check for overflow when allocating the memory for fromfile
8411 -- someone tried to pass in sys.maxint and got bitten by the bogus
8412 calculations.
8413
8414 * configure.in:
8415 Get rid of AC_CHECK_LIB(m, pow) since this is taken care of later with
8416 LIBM (from --with-libm=...); this actually broke the customizability
8417 offered by the latter option. Thanks go to Clay Spence for reporting
8418 this.
8419
8420 * Lib/test/test_dl.py:
8421 1. Print the error message (carefully) when a dl.open() fails in verbose mode.
8422 2. When no test case worked, raise ImportError instead of failing.
8423
8424 * Python/bltinmodule.c:
8425 Patch by Tim Peters to improve the range checks for range() and
8426 xrange(), especially for platforms where int and long are different
8427 sizes (so sys.maxint isn't actually the theoretical limit for the
8428 length of a list, but the largest C int is -- sys.maxint is the
8429 largest Python int, which is actually a C long).
8430
8431 * Makefile.in:
8432 1. Augment the DG/UX rule so it doesn't break the BeOS build.
8433 2. Add $(EXE) to various occurrences of python so it will work on
8434 Cygwin with egcs (after setting EXE=.exe). These patches by
8435 Norman Vine.
8436
8437 * Lib/posixfile.py:
8438 According to Jeffrey Honig, bsd/os 2.0 - 4.0 should be added to the
8439 list (of bsd variants that have a different lock structure).
8440
8441 * Lib/test/test_fcntl.py:
8442 According to Jeffrey Honig, bsd/os 4.0 should be added to the list.
8443
8444 * Modules/timemodule.c:
8445 Patch by Tadayoshi Funaba (with some changes) to be smarter about
8446 guessing what happened when strftime() returns 0. Is it buffer
8447 overflow or was the result simply 0 bytes long? (This happens for an
8448 empty format string, or when the format string is a single %Z and the
8449 timezone is unknown.) if the buffer is at least 256 times as long as
8450 the format, assume the latter.
8451
8452Mon Feb 22 19:01:42 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8453
8454 * Lib/urllib.py:
8455 As Des Barry points out, we need to call pathname2url(file) in two
8456 calls to addinfourl() in open_file().
8457
8458 * Modules/Setup.in: Document *static* -- in two places!
8459
8460 * Modules/timemodule.c:
8461 We don't support leap seconds, so the seconds field of a time 9-tuple
8462 should be in the range [0-59]. Noted by Tadayoshi Funaba.
8463
8464 * Modules/stropmodule.c:
8465 In atoi(), don't use isxdigit() to test whether the last character
8466 converted was a "digit" -- use isalnum(). This test is there only to
8467 guard against "+" or "-" being interpreted as a valid int literal.
8468 Reported by Takahiro Nakayama.
8469
8470 * Lib/os.py:
8471 As Finn Bock points out, _P_WAIT etc. don't have a leading underscore
8472 so they don't need to be treated specially here.
8473
8474Mon Feb 22 15:38:58 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8475
8476 * Misc/NEWS:
8477 Typo: "apparentlt" --> "apparently"
8478
8479Mon Feb 22 15:38:46 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8480
8481 * Lib/urlparse.py: Steve Clift pointed out that 'file' allows a netloc.
8482
8483 * Modules/posixmodule.c:
8484 The docstring for ttyname(..) claims a second "mode" argument. The
8485 actual code does not allow such an argument. (Finn Bock.)
8486
8487 * Lib/lib-old/poly.py:
8488 Dang. Even though this is obsolete code, somebody found a bug, and I
8489 fix it. Oh well.
8490
8491Thu Feb 18 20:51:50 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8492
8493 * Lib/pyclbr.py:
8494 Bow to font-lock at the end of the docstring, since it throws stuff
8495 off.
8496
8497 Make sure the path paramter to readmodule() is a list before adding it
8498 with sys.path, or the addition could fail.
8499
8500
8501======================================================================
8502
8503
8504From 1.5.2b1 to 1.5.2b2
8505=======================
8506
8507General
8508-------
8509
8510- Many memory leaks fixed.
8511
8512- Many small bugs fixed.
8513
8514- Command line option -OO (or -O -O) suppresses inclusion of doc
8515strings in resulting bytecode.
8516
8517Windows-specific changes
8518------------------------
8519
8520- New built-in module winsound provides an interface to the Win32
8521PlaySound() call.
8522
8523- Re-enable the audioop module in the config.c file.
8524
8525- On Windows, support spawnv() and associated P_* symbols.
8526
8527- Fixed the conversion of times() return values on Windows.
8528
8529- Removed freeze from the installer -- it doesn't work without the
8530source tree. (See FAQ 8.11.)
8531
8532- On Windows 95/98, the Tkinter module now is smart enough to find
8533Tcl/Tk even when the PATH environment variable hasn't been set -- when
8534the import of _tkinter fails, it searches in a standard locations,
8535patches os.environ["PATH"], and tries again. When it still fails, a
8536clearer error message is produced. This should avoid most
8537installation problems with Tkinter use (e.g. in IDLE).
8538
8539- The -i option doesn't make any calls to set[v]buf() for stdin --
8540this apparently screwed up _kbhit() and the _tkinter main loop.
8541
8542- The ntpath module (and hence, os.path on Windows) now parses out UNC
8543paths (e.g. \\host\mountpoint\dir\file) as "drive letters", so that
8544splitdrive() will \\host\mountpoint as the drive and \dir\file as the
8545path. ** EXPERIMENTAL **
8546
8547- Added a hack to the exit code so that if (1) the exit status is
8548nonzero and (2) we think we have our own DOS box (i.e. we're not
8549started from a command line shell), we print a message and wait for
8550the user to hit a key before the DOS box is closed.
8551
8552- Updated the installer to WISE 5.0g. Added a dialog warning about
8553the imminent Tcl installation. Added a dialog to specify the program
8554group name in the start menu. Upgraded the Tcl installer to Tcl
85558.0.4.
8556
8557Changes to intrinsics
8558---------------------
8559
8560- The repr() or str() of a module object now shows the __file__
8561attribute (i.e., the file which it was loaded), or the string
8562"(built-in)" if there is no __file__ attribute.
8563
8564- The range() function now avoids overflow during its calculations (if
8565at all possible).
8566
8567- New info string sys.hexversion, which is an integer encoding the
8568version in hexadecimal. In other words, hex(sys.hexversion) ==
85690x010502b2 for Python 1.5.2b2.
8570
8571New or improved ports
8572---------------------
8573
8574- Support for Nextstep descendants (future Mac systems).
8575
8576- Improved BeOS support.
8577
8578- Support dynamic loading of shared libraries on NetBSD platforms that
8579use ELF (i.e., MIPS and Alpha systems).
8580
8581Configuration/build changes
8582---------------------------
8583
8584- The Lib/test directory is no longer included in the default module
8585search path (sys.path) -- "test" has been a package ever since 1.5.
8586
8587- Now using autoconf 2.13.
8588
8589New library modules
8590-------------------
8591
8592- New library modules asyncore and asynchat: these form Sam Rushing's
8593famous asynchronous socket library. Sam has gracefully allowed me to
8594incorporate these in the standard Python library.
8595
8596- New module statvfs contains indexing constants for [f]statvfs()
8597return tuple.
8598
8599Changes to the library
8600----------------------
8601
8602- The wave module (platform-independent support for Windows sound
8603files) has been fixed to actually make it work.
8604
8605- The sunau module (platform-independent support for Sun/NeXT sound
8606files) has been fixed to work across platforms. Also, a weird
8607encoding bug in the header of the audio test data file has been
8608corrected.
8609
8610- Fix a bug in the urllib module that occasionally tripped up
8611webchecker and other ftp retrieves.
8612
8613- ConfigParser's get() method now accepts an optional keyword argument
8614(vars) that is substituted on top of the defaults that were setup in
8615__init__. You can now also have recusive references in your
8616configuration file.
8617
8618- Some improvements to the Queue module, including a put_nowait()
8619module and an optional "block" second argument, to get() and put(),
8620defaulting to 1.
8621
8622- The updated xmllib module is once again compatible with the version
8623present in Python 1.5.1 (this was accidentally broken in 1.5.2b1).
8624
8625- The bdb module (base class for the debugger) now supports
8626canonicalizing pathnames used in breakpoints. The derived class must
8627override the new canonical() method for this to work. Also changed
8628clear_break() to the backwards compatible old signature, and added
8629clear_bpbynumber() for the new functionality.
8630
8631- In sgmllib (and hence htmllib), recognize attributes even if they
8632don't have space in front of them. I.e. '<a
8633name="foo"href="bar.html">' will now have two attributes recognized.
8634
8635- In the debugger (pdb), change clear syntax to support three
8636alternatives: clear; clear file:line; clear bpno bpno ...
8637
8638- The os.path module now pretends to be a submodule within the os
8639"package", so you can do things like "from os.path import exists".
8640
8641- The standard exceptions now have doc strings.
8642
8643- In the smtplib module, exceptions are now classes. Also avoid
8644inserting a non-standard space after "TO" in rcpt() command.
8645
8646- The rfc822 module's getaddrlist() method now uses all occurrences of
8647the specified header instead of just the first. Some other bugfixes
8648too (to handle more weird addresses found in a very large test set,
8649and to avoid crashes on certain invalid dates), and a small test
8650module has been added.
8651
8652- Fixed bug in urlparse in the common-case code for HTTP URLs; it
8653would lose the query, fragment, and/or parameter information.
8654
8655- The sndhdr module no longer supports whatraw() -- it depended on a
8656rare extenral program.
8657
8658- The UserList module/class now supports the extend() method, like
8659real list objects.
8660
8661- The uu module now deals better with trailing garbage generated by
8662some broke uuencoders.
8663
8664- The telnet module now has an my_interact() method which uses threads
8665instead of select. The interact() method uses this by default on
8666Windows (where the single-threaded version doesn't work).
8667
8668- Add a class to mailbox.py for dealing with qmail directory
8669mailboxes. The test code was extended to notice these being used as
8670well.
8671
8672Changes to extension modules
8673----------------------------
8674
8675- Support for the [f]statvfs() system call, where it exists.
8676
8677- Fixed some bugs in cPickle where bad input could cause it to dump
8678core.
8679
8680- Fixed cStringIO to make the writelines() function actually work.
8681
8682- Added strop.expandtabs() so string.expandtabs() is now much faster.
8683
8684- Added fsync() and fdatasync(), if they appear to exist.
8685
8686- Support for "long files" (64-bit seek pointers).
8687
8688- Fixed a bug in the zlib module's flush() function.
8689
8690- Added access() system call. It returns 1 if access granted, 0 if
8691not.
8692
8693- The curses module implements an optional nlines argument to
8694w.scroll(). (It then calls wscrl(win, nlines) instead of scoll(win).)
8695
8696Changes to tools
8697----------------
8698
8699- Some changes to IDLE; see Tools/idle/NEWS.txt.
8700
8701- Latest version of Misc/python-mode.el included.
8702
8703Changes to Tkinter
8704------------------
8705
8706- Avoid tracebacks when an image is deleted after its root has been
8707destroyed.
8708
8709Changes to the Python/C API
8710---------------------------
8711
8712- When parentheses are used in a PyArg_Parse[Tuple]() call, any
8713sequence is now accepted, instead of requiring a tuple. This is in
8714line with the general trend towards accepting arbitrary sequences.
8715
8716- Added PyModule_GetFilename().
8717
8718- In PyNumber_Power(), remove unneeded and even harmful test for float
8719to the negative power (which is already and better done in
8720floatobject.c).
8721
8722- New version identification symbols; read patchlevel.h for info. The
8723version numbers are now exported by Python.h.
8724
8725- Rolled back the API version change -- it's back to 1007!
8726
8727- The frozenmain.c function calls PyInitFrozenExtensions().
8728
8729- Added 'N' format character to Py_BuildValue -- like 'O' but doesn't
8730INCREF.
8731
8732
8733======================================================================
8734
8735
8736From 1.5.2a2 to 1.5.2b1
8737=======================
8738
8739Changes to intrinsics
8740---------------------
8741
8742- New extension NotImplementedError, derived from RuntimeError. Not
8743used, but recommended use is for "abstract" methods to raise this.
8744
8745- The parser will now spit out a warning or error when -t or -tt is
8746used for parser input coming from a string, too.
8747
8748- The code generator now inserts extra SET_LINENO opcodes when
8749compiling multi-line argument lists.
8750
8751- When comparing bound methods, use identity test on the objects, not
8752equality test.
8753
8754New or improved ports
8755---------------------
8756
8757- Chris Herborth has redone his BeOS port; it now works on PowerPC
8758(R3/R4) and x86 (R4 only). Threads work too in this port.
8759
8760Renaming
8761--------
8762
8763- Thanks to Chris Herborth, the thread primitives now have proper Py*
8764names in the source code (they already had those for the linker,
8765through some smart macros; but the source still had the old, un-Py
8766names).
8767
8768Configuration/build changes
8769---------------------------
8770
8771- Improved support for FreeBSD/3.
8772
8773- Check for pthread_detach instead of pthread_create in libc.
8774
8775- The makesetup script now searches EXECINCLUDEPY before INCLUDEPY.
8776
8777- Misc/Makefile.pre.in now also looks at Setup.thread and Setup.local.
8778Otherwise modules such as thread didn't get incorporated in extensions.
8779
8780New library modules
8781-------------------
8782
8783- shlex.py by Eric Raymond provides a lexical analyzer class for
8784simple shell-like syntaxes.
8785
8786- netrc.py by Eric Raymond provides a parser for .netrc files. (The
8787undocumented Netrc class in ftplib.py is now obsolete.)
8788
8789- codeop.py is a new module that contains the compile_command()
8790function that was previously in code.py. This is so that JPython can
8791provide its own version of this function, while still sharing the
8792higher-level classes in code.py.
8793
8794- turtle.py is a new module for simple turtle graphics. I'm still
8795working on it; let me know if you use this to teach Python to children
8796or other novices without prior programming experience.
8797
8798Obsoleted library modules
8799-------------------------
8800
8801- poly.py and zmod.py have been moved to Lib/lib-old to emphasize
8802their status of obsoleteness. They don't do a particularly good job
8803and don't seem particularly relevant to the Python core.
8804
8805New tools
8806---------
8807
8808- I've added IDLE: my Integrated DeveLopment Environment for Python.
8809Requires Tcl/Tk (and Tkinter). Works on Windows and Unix (and should
8810work on Macintosh, but I haven't been able to test it there; it does
8811depend on new features in 1.5.2 and perhaps even new features in
88121.5.2b1, especially the new code module). This is very much a work in
8813progress. I'd like to hear how people like it compared to PTUI (or
8814any other IDE they are familiar with).
8815
8816- New tools by Barry Warsaw:
8817
8818 = audiopy: controls the Solaris Audio device
8819 = pynche: The PYthonically Natural Color and Hue Editor
8820 = world: Print mappings between country names and DNS country codes
8821
8822New demos
8823---------
8824
8825- Demo/scripts/beer.py prints the lyrics to an arithmetic drinking
8826song.
8827
8828- Demo/tkinter/guido/optionmenu.py shows how to do an option menu in
8829Tkinter. (By Fredrik Lundh -- not by me!)
8830
8831Changes to the library
8832----------------------
8833
8834- compileall.py now avoids recompiling .py files that haven't changed;
8835it adds a -f option to force recompilation.
8836
8837- New version of xmllib.py by Sjoerd Mullender (0.2 with latest
8838patches).
8839
8840- nntplib.py: statparse() no longer lowercases the message-id.
8841
8842- types.py: use type(__stdin__) for FileType.
8843
8844- urllib.py: fix translations for filenames with "funny" characters.
8845Patch by Sjoerd Mullender. Note that if you subclass one of the
8846URLopener classes, and you have copied code from the old urllib.py,
8847your subclass may stop working. A long-term solution is to provide
8848more methods so that you don't have to copy code.
8849
8850- cgi.py: In read_multi, allow a subclass to override the class we
8851instantiate when we create a recursive instance, by setting the class
8852variable 'FieldStorageClass' to the desired class. By default, this
8853is set to None, in which case we use self.__class__ (as before).
8854Also, a patch by Jim Fulton to pass additional arguments to recursive
8855calls to the FieldStorage constructor from its read_multi method.
8856
8857- UserList.py: In __getslice__, use self.__class__ instead of
8858UserList.
8859
8860- In SimpleHTTPServer.py, the server specified in test() should be
8861BaseHTTPServer.HTTPServer, in case the request handler should want to
8862reference the two attributes added by BaseHTTPServer.server_bind. (By
8863Jeff Rush, for Bobo). Also open the file in binary mode, so serving
8864images from a Windows box might actually work.
8865
8866- In CGIHTTPServer.py, the list of acceptable formats is -split-
8867on spaces but -joined- on commas, resulting in double commas
8868in the joined text. (By Jeff Rush.)
8869
8870- SocketServer.py, patch by Jeff Bauer: a minor change to declare two
8871new threaded versions of Unix Server classes, using the ThreadingMixIn
8872class: ThreadingUnixStreamServer, ThreadingUnixDatagramServer.
8873
8874- bdb.py: fix bomb on deleting a temporary breakpoint: there's no
8875method do_delete(); do_clear() was meant. By Greg Ward.
8876
8877- getopt.py: accept a non-list sequence for the long options (request
8878by Jack Jansen). Because it might be a common mistake to pass a
8879single string, this situation is treated separately. Also added
8880docstrings (copied from the library manual) and removed the (now
8881redundant) module comments.
8882
8883- tempfile.py: improvements to avoid security leaks.
8884
8885- code.py: moved compile_command() to new module codeop.py.
8886
8887- pickle.py: support pickle format 1.3 (binary float added). By Jim
8888Fulton. Also get rid of the undocumented obsolete Pickler dump_special
8889method.
8890
8891- uu.py: Move 'import sys' to top of module, as noted by Tim Peters.
8892
8893- imaplib.py: fix problem with some versions of IMAP4 servers that
8894choose to mix the case in their CAPABILITIES response.
8895
8896- cmp.py: use (f1, f2) as cache key instead of f1 + ' ' + f2. Noted
8897by Fredrik Lundh.
8898
8899Changes to extension modules
8900----------------------------
8901
8902- More doc strings for several modules were contributed by Chris
8903Petrilli: math, cmath, fcntl.
8904
8905- Fixed a bug in zlibmodule.c that could cause core dumps on
8906decompression of rarely occurring input.
8907
8908- cPickle.c: new version from Jim Fulton, with Open Source copyright
8909notice. Also, initialize self->safe_constructors early on to prevent
8910crash in early dealloc.
8911
8912- cStringIO.c: new version from Jim Fulton, with Open Source copyright
8913notice. Also fixed a core dump in cStringIO.c when doing seeks.
8914
8915- mpzmodule.c: fix signed character usage in mpz.mpz(stringobjecty).
8916
8917- readline.c: Bernard Herzog pointed out that rl_parse_and_bind
8918modifies its argument string (bad function!), so we make a temporary
8919copy.
8920
8921- sunaudiodev.c: Barry Warsaw added more smarts to get the device and
8922control pseudo-device, per audio(7I).
8923
8924Changes to tools
8925----------------
8926
8927- New, improved version of Barry Warsaw's Misc/python-mode.el (editing
8928support for Emacs).
8929
8930- tabnanny.py: added a -q ('quiet') option to tabnanny, which causes
8931only the names of offending files to be printed.
8932
8933- freeze: when printing missing modules, also print the module they
8934were imported from.
8935
8936- untabify.py: patch by Detlef Lannert to implement -t option
8937(set tab size).
8938
8939Changes to Tkinter
8940------------------
8941
8942- grid_bbox(): support new Tk API: grid bbox ?column row? ?column2
8943row2?
8944
8945- _tkinter.c: RajGopal Srinivasan noted that the latest code (1.5.2a2)
8946doesn't work when running in a non-threaded environment. He added
8947some #ifdefs that fix this.
8948
8949Changes to the Python/C API
8950---------------------------
8951
8952- Bumped API version number to 1008 -- enough things have changed!
8953
8954- There's a new macro, PyThreadState_GET(), which does the same work
8955as PyThreadState_Get() without the overhead of a function call (it
8956also avoids the error check). The two top calling locations of
8957PyThreadState_Get() have been changed to use this macro.
8958
8959- All symbols intended for export from a DLL or shared library are now
8960marked as such (with the DL_IMPORT() macro) in the header file that
8961declares them. This was needed for the BeOS port, and should also
8962make some other ports easier. The PC port no longer needs the file
8963with exported symbols (PC/python_nt.def). There's also a DL_EXPORT
8964macro which is only used for init methods in extension modules, and
8965for Py_Main().
8966
8967Invisible changes to internals
8968------------------------------
8969
8970- Fixed a bug in new_buffersize() in fileobject.c which could
8971return a buffer size that was way too large.
8972
8973- Use PySys_WriteStderr instead of fprintf in most places.
8974
8975- dictobject.c: remove dead code discovered by Vladimir Marangozov.
8976
8977- tupleobject.c: make tuples less hungry -- an extra item was
8978allocated but never used. Tip by Vladimir Marangozov.
8979
8980- mymath.h: Metrowerks PRO4 finally fixes the hypot snafu. (Jack
8981Jansen)
8982
8983- import.c: Jim Fulton fixes a reference count bug in
8984PyEval_GetGlobals.
8985
8986- glmodule.c: check in the changed version after running the stubber
8987again -- this solves the conflict with curses over the 'clear' entry
8988point much nicer. (Jack Jansen had checked in the changes to cstubs
8989eons ago, but I never regenrated glmodule.c :-( )
8990
8991- frameobject.c: fix reference count bug in PyFrame_New. Vladimir
8992Marangozov.
8993
8994- stropmodule.c: add a missing DECREF in an error exit. Submitted by
8995Jonathan Giddy.
8996
8997
8998======================================================================
8999
9000
9001From 1.5.2a1 to 1.5.2a2
9002=======================
9003
9004General
9005-------
9006
9007- It is now a syntax error to have a function argument without a
9008default following one with a default.
9009
9010- __file__ is now set to the .py file if it was parsed (it used to
9011always be the .pyc/.pyo file).
9012
9013- Don't exit with a fatal error during initialization when there's a
9014problem with the exceptions.py module.
9015
9016- New environment variable PYTHONOPTIMIZE can be used to set -O.
9017
9018- New version of python-mode.el for Emacs.
9019
9020Miscellaneous fixed bugs
9021------------------------
9022
9023- No longer print the (confusing) error message about stack underflow
9024while compiling.
9025
9026- Some threading and locking bugs fixed.
9027
9028- When errno is zero, report "Error", not "Success".
9029
9030Documentation
9031-------------
9032
9033- Documentation will be released separately.
9034
9035- Doc strings added to array and md5 modules by Chris Petrilli.
9036
9037Ports and build procedure
9038-------------------------
9039
9040- Stop installing when a move or copy fails.
9041
9042- New version of the OS/2 port code by Jeff Rush.
9043
9044- The makesetup script handles absolute filenames better.
9045
9046- The 'new' module is now enabled by default in the Setup file.
9047
9048- I *think* I've solved the problem with the Linux build blowing up
9049sometimes due to a conflict between sigcheck/intrcheck and
9050signalmodule.
9051
9052Built-in functions
9053------------------
9054
9055- The second argument to apply() can now be any sequence, not just a
9056tuple.
9057
9058Built-in types
9059--------------
9060
9061- Lists have a new method: L1.extend(L2) is equivalent to the common
9062idiom L1[len(L1):] = L2.
9063
9064- Better error messages when a sequence is indexed with a non-integer.
9065
9066- Bettter error message when calling a non-callable object (include
9067the type in the message).
9068
9069Python services
9070---------------
9071
9072- New version of cPickle.c fixes some bugs.
9073
9074- pickle.py: improved instantiation error handling.
9075
9076- code.py: reworked quite a bit. New base class
9077InteractiveInterpreter and derived class InteractiveConsole. Fixed
9078several problems in compile_command().
9079
9080- py_compile.py: print error message and continue on syntax errors.
9081Also fixed an old bug with the fstat code (it was never used).
9082
9083- pyclbr.py: support submodules of packages.
9084
9085String Services
9086---------------
9087
9088- StringIO.py: raise the right exception (ValueError) for attempted
9089I/O on closed StringIO objects.
9090
9091- re.py: fixed a bug in subn(), which caused .groups() to fail inside
9092the replacement function called by sub().
9093
9094- The struct module has a new format 'P': void * in native mode.
9095
9096Generic OS Services
9097-------------------
9098
9099- Module time: Y2K robustness. 2-digit year acceptance depends on
9100value of time.accept2dyear, initialized from env var PYTHONY2K,
9101default 0. Years 00-68 mean 2000-2068, while 69-99 mean 1969-1999
9102(POSIX or X/Open recommendation).
9103
9104- os.path: normpath(".//x") should return "x", not "/x".
9105
9106- getpass.py: fall back on default_getpass() when sys.stdin.fileno()
9107doesn't work.
9108
9109- tempfile.py: regenerate the template after a fork() call.
9110
9111Optional OS Services
9112--------------------
9113
9114- In the signal module, disable restarting interrupted system calls
9115when we have siginterrupt().
9116
9117Debugger
9118--------
9119
9120- No longer set __args__; this feature is no longer supported and can
9121affect the debugged code.
9122
9123- cmd.py, pdb.py and bdb.py have been overhauled by Richard Wolff, who
9124added aliases and some other useful new features, e.g. much better
9125breakpoint support: temporary breakpoint, disabled breakpoints,
9126breakpoints with ignore counts, and conditions; breakpoints can be set
9127on a file before it is loaded.
9128
9129Profiler
9130--------
9131
9132- Changes so that JPython can use it. Also fix the calibration code
9133so it actually works again
9134.
9135Internet Protocols and Support
9136------------------------------
9137
9138- imaplib.py: new version from Piers Lauder.
9139
9140- smtplib.py: change sendmail() method to accept a single string or a
9141list or strings as the destination (commom newbie mistake).
9142
9143- poplib.py: LIST with a msg argument fixed.
9144
9145- urlparse.py: some optimizations for common case (http).
9146
9147- urllib.py: support content-length in info() for ftp protocol;
9148support for a progress meter through a third argument to
9149urlretrieve(); commented out gopher test (the test site is dead).
9150
9151Internet Data handling
9152----------------------
9153
9154- sgmllib.py: support tags with - or . in their name.
9155
9156- mimetypes.py: guess_type() understands 'data' URLs.
9157
9158Restricted Execution
9159--------------------
9160
9161- The classes rexec.RModuleLoader and rexec.RModuleImporter no
9162longer exist.
9163
9164Tkinter
9165-------
9166
9167- When reporting an exception, store its info in sys.last_*. Also,
9168write all of it to stderr.
9169
9170- Added NS, EW, and NSEW constants, for grid's sticky option.
9171
9172- Fixed last-minute bug in 1.5.2a1 release: need to include "mytime.h".
9173
9174- Make bind variants without a sequence return a tuple of sequences
9175(formerly it returned a string, which wasn't very convenient).
9176
9177- Add image commands to the Text widget (these are new in Tk 8.0).
9178
9179- Added new listbox and canvas methods: {xview,yview}_{scroll,moveto}.)
9180
9181- Improved the thread code (but you still can't call update() from
9182another thread on Windows).
9183
9184- Fixed unnecessary references to _default_root in the new dialog
9185modules.
9186
9187- Miscellaneous problems fixed.
9188
9189
9190Windows General
9191---------------
9192
9193- Call LoadLibraryEx(..., ..., LOAD_WITH_ALTERED_SEARCH_PATH) to
9194search for dependent dlls in the directory containing the .pyd.
9195
9196- In debugging mode, call DebugBreak() in Py_FatalError().
9197
9198Windows Installer
9199-----------------
9200
9201- Install zlib.dll in the DLLs directory instead of in the win32
9202system directory, to avoid conflicts with other applications that have
9203their own zlib.dll.
9204
9205Test Suite
9206----------
9207
9208- test_long.py: new test for long integers, by Tim Peters.
9209
9210- regrtest.py: improved so it can be used for other test suites as
9211well.
9212
9213- test_strftime.py: use re to compare test results, to support legal
9214variants (e.g. on Linux).
9215
9216Tools and Demos
9217---------------
9218
9219- Four new scripts in Tools/scripts: crlf.py and lfcr.py (to
9220remove/add Windows style '\r\n' line endings), untabify.py (to remove
9221tabs), and rgrep.yp (reverse grep).
9222
9223- Improvements to Tools/freeze/. Each Python module is now written to
9224its own C file. This prevents some compilers or assemblers from
9225blowing up on large frozen programs, and saves recompilation time if
9226only a few modules are changed. Other changes too, e.g. new command
9227line options -x and -i.
9228
9229- Much improved (and smaller!) version of Tools/scripts/mailerdaemon.py.
9230
9231Python/C API
9232------------
9233
9234- New mechanism to support extensions of the type object while
9235remaining backward compatible with extensions compiled for previous
9236versions of Python 1.5. A flags field indicates presence of certain
9237fields.
9238
9239- Addition to the buffer API to differentiate access to bytes and
92408-bit characters (in anticipation of Unicode characters).
9241
9242- New argument parsing format t# ("text") to indicate 8-bit
9243characters; s# simply means 8-bit bytes, for backwards compatibility.
9244
9245- New object type, bufferobject.c is an example and can be used to
9246create buffers from memory.
9247
9248- Some support for 64-bit longs, including some MS platforms.
9249
9250- Many calls to fprintf(stderr, ...) have been replaced with calls to
9251PySys_WriteStderr(...).
9252
9253- The calling context for PyOS_Readline() has changed: it must now be
9254called with the interpreter lock held! It releases the lock around
9255the call to the function pointed to by PyOS_ReadlineFunctionPointer
9256(default PyOS_StdioReadline()).
9257
9258- New APIs PyLong_FromVoidPtr() and PyLong_AsVoidPtr().
9259
9260- Renamed header file "thread.h" to "pythread.h".
9261
9262- The code string of code objects may now be anything that supports the
9263buffer API.
9264
9265
9266======================================================================
9267
9268
9269From 1.5.1 to 1.5.2a1
9270=====================
9271
9272General
9273-------
9274
9275- When searching for the library, a landmark that is a compiled module
9276(string.pyc or string.pyo) is also accepted.
9277
9278- When following symbolic links to the python executable, use a loop
9279so that a symlink to a symlink can work.
9280
9281- Added a hack so that when you type 'quit' or 'exit' at the
9282interpreter, you get a friendly explanation of how to press Ctrl-D (or
9283Ctrl-Z) to exit.
9284
9285- New and improved Misc/python-mode.el (Python mode for Emacs).
9286
9287- Revert a new feature in Unix dynamic loading: for one or two
9288revisions, modules were loaded using the RTLD_GLOBAL flag. It turned
9289out to be a bad idea.
9290
9291Miscellaneous fixed bugs
9292------------------------
9293
9294- All patches on the patch page have been integrated. (But much more
9295has been done!)
9296
9297- Several memory leaks plugged (e.g. the one for classes with a
9298__getattr__ method).
9299
9300- Removed the only use of calloc(). This triggered an obscure bug on
9301multiprocessor Sparc Solaris 2.6.
9302
9303- Fix a peculiar bug that would allow "import sys.time" to succeed
9304(believing the built-in time module to be a part of the sys package).
9305
9306- Fix a bug in the overflow checking when converting a Python long to
9307a C long (failed to convert -2147483648L, and some other cases).
9308
9309Documentation
9310-------------
9311
9312- Doc strings have been added to many extension modules: __builtin__,
9313errno, select, signal, socket, sys, thread, time. Also to methods of
9314list objects (try [].append.__doc__). A doc string on a type will now
9315automatically be propagated to an instance if the instance has methods
9316that are accessed in the usual way.
9317
9318- The documentation has been expanded and the formatting improved.
9319(Remember that the documentation is now unbundled and has its own
9320release cycle though; see http://www.python.org/doc/.)
9321
9322- Added Misc/Porting -- a mini-FAQ on porting to a new platform.
9323
9324Ports and build procedure
9325-------------------------
9326
9327- The BeOS port is now integrated. Courtesy Chris Herborth.
9328
9329- Symbol files for FreeBSD 2.x and 3.x have been contributed
9330(Lib/plat-freebsd[23]/*).
9331
9332- Support HPUX 10.20 DCE threads.
9333
9334- Finally fixed the configure script so that (on SGI) if -OPT:Olimit=0
9335works, it won't also use -Olimit 1500 (which gives a warning for every
9336file). Also support the SGI_ABI environment variable better.
9337
9338- The makesetup script now understands absolute pathnames ending in .o
9339in the module -- it assumes it's a file for which we have no source.
9340
9341- Other miscellaneous improvements to the configure script and
9342Makefiles.
9343
9344- The test suite now uses a different sound sample.
9345
9346Built-in functions
9347------------------
9348
9349- Better checks for invalid input to int(), long(), string.atoi(),
9350string.atol(). (Formerly, a sign without digits would be accepted as
9351a legal ways to spell zero.)
9352
9353- Changes to map() and filter() to use the length of a sequence only
9354as a hint -- if an IndexError happens earlier, take that. (Formerly,
9355this was considered an error.)
9356
9357- Experimental feature in getattr(): a third argument can specify a
9358default (instead of raising AttributeError).
9359
9360- Implement round() slightly different, so that for negative ndigits
9361no additional errors happen in the last step.
9362
9363- The open() function now adds the filename to the exception when it
9364fails.
9365
9366Built-in exceptions
9367-------------------
9368
9369- New standard exceptions EnvironmentError and PosixError.
9370EnvironmentError is the base class for IOError and PosixError;
9371PosixError is the same as os.error. All this so that either exception
9372class can be instantiated with a third argument indicating a filename.
9373The built-in function open() and most os/posix functions that take a
9374filename argument now use this.
9375
9376Built-in types
9377--------------
9378
9379- List objects now have an experimental pop() method; l.pop() returns
9380and removes the last item; l.pop(i) returns and removes the item at
9381i. Also, the sort() method is faster again. Sorting is now also
9382safer: it is impossible for the sorting function to modify the list
9383while the sort is going on (which could cause core dumps).
9384
9385- Changes to comparisons: numbers are now smaller than any other type.
9386This is done to prevent the circularity where [] < 0L < 1 < [] is
9387true. As a side effect, cmp(None, 0) is now positive instead of
9388negative. This *shouldn't* affect any working code, but I've found
9389that the change caused several "sleeping" bugs to become active, so
9390beware!
9391
9392- Instance methods may now have other callable objects than just
9393Python functions as their im_func. Use new.instancemethod() or write
9394your own C code to create them; new.instancemethod() may be called
9395with None for the instance to create an unbound method.
9396
9397- Assignment to __name__, __dict__ or __bases__ of a class object is
9398now allowed (with stringent type checks); also allow assignment to
9399__getattr__ etc. The cached values for __getattr__ etc. are
9400recomputed after such assignments (but not for derived classes :-( ).
9401
9402- Allow assignment to some attributes of function objects: func_code,
9403func_defaults and func_doc / __doc__. (With type checks except for
9404__doc__ / func_doc .)
9405
9406Python services
9407---------------
9408
9409- New tests (in Lib/test): reperf.py (regular expression benchmark),
9410sortperf.py (list sorting benchmark), test_MimeWriter.py (test case
9411for the MimeWriter module).
9412
9413- Generalized test/regrtest.py so that it is useful for testing other
9414packages.
9415
9416- The ihooks.py module now understands package imports.
9417
9418- In code.py, add a class that subsumes Fredrik Lundh's
9419PythonInterpreter class. The interact() function now uses this.
9420
9421- In rlcompleter.py, in completer(), return None instead of raising an
9422IndexError when there are no more completions left.
9423
9424- Fixed the marshal module to test for certain common kinds of invalid
9425input. (It's still not foolproof!)
9426
9427- In the operator module, add an alias (now the preferred name)
9428"contains" for "sequenceincludes".
9429
9430String Services
9431---------------
9432
9433- In the string and strop modules, in the replace() function, treat an
9434empty pattern as an error (since it's not clear what was meant!).
9435
9436- Some speedups to re.py, especially the string substitution and split
9437functions. Also added new function/method findall(), to find all
9438occurrences of a given substring.
9439
9440- In cStringIO, add better argument type checking and support the
9441readonly 'closed' attribute (like regular files).
9442
9443- In the struct module, unsigned 1-2 byte sized formats no longer
9444result in long integer values.
9445
9446Miscellaneous services
9447----------------------
9448
9449- In whrandom.py, added new method and function randrange(), same as
9450choice(range(start, stop, step)) but faster. This addresses the
9451problem that randint() was accidentally defined as taking an inclusive
9452range. Also, randint(a, b) is now redefined as randrange(a, b+1),
9453adding extra range and type checking to its arguments!
9454
9455- Add some semi-thread-safety to random.gauss() (it used to be able to
9456crash when invoked from separate threads; now the worst it can do is
9457give a duplicate result occasionally).
9458
9459- Some restructuring and generalization done to cmd.py.
9460
9461- Major upgrade to ConfigParser.py; converted to using 're', added new
9462exceptions, support underscore in section header and option name. No
9463longer add 'name' option to every section; instead, add '__name__'.
9464
9465- In getpass.py, don't use raw_input() to ask for the password -- we
9466don't want it to show up in the readline history! Also don't catch
9467interrupts (the try-finally already does all necessary cleanup).
9468
9469Generic OS Services
9470-------------------
9471
9472- New functions in os.py: makedirs(), removedirs(), renames(). New
9473variable: linesep (the line separator as found in binary files,
9474i.e. '\n' on Unix, '\r\n' on DOS/Windows, '\r' on Mac. Do *not* use
9475this with files opened in (default) text mode; the line separator used
9476will always be '\n'!
9477
9478- Changes to the 'os.path' submodule of os.py: added getsize(),
9479getmtime(), getatime() -- these fetch the most popular items from the
9480stat return tuple.
9481
9482- In the time module, add strptime(), if it exists. (This parses a
9483time according to a format -- the inverse of strftime().) Also,
9484remove the call to mktime() from strftime() -- it messed up the
9485formatting of some non-local times.
9486
9487- In the socket module, added a new function gethostbyname_ex().
9488Also, don't use #ifdef to test for some symbols that are enums on some
9489platforms (and should exist everywhere).
9490
9491Optional OS Services
9492--------------------
9493
9494- Some fixes to gzip.py. In particular, the readlines() method now
9495returns the lines *with* trailing newline characters, like readlines()
9496of regular file objects. Also, it didn't work together with cPickle;
9497fixed that.
9498
9499- In whichdb.py, support byte-swapped dbhash (bsddb) files.
9500
9501- In anydbm.py, look at the type of an existing database to determine
9502which module to use to open it. (The anydbm.error exception is now a
9503tuple.)
9504
9505Unix Services
9506-------------
9507
9508- In the termios module, in tcsetattr(), initialize the structure vy
9509calling tcgetattr().
9510
9511- Added some of the "wait status inspection" macros as functions to
9512the posix module (and thus to the os module): WEXITSTATUS(),
9513WIFEXITED(), WIFSIGNALED(), WIFSTOPPED(), WSTOPSIG(), WTERMSIG().
9514
9515- In the syslog module, make the default facility more intuitive
9516(matching the docs).
9517
9518Debugger
9519--------
9520
9521- In pdb.py, support for setting breaks on files/modules that haven't
9522been loaded yet.
9523
9524Internet Protocols and Support
9525------------------------------
9526
9527- Changes in urllib.py; sped up unquote() and quote(). Fixed an
9528obscure bug in quote_plus(). Added urlencode(dict) -- convenience
9529function for sending a POST request with urlopen(). Use the getpass
9530module to ask for a password. Rewrote the (test) main program so that
9531when used as a script, it can retrieve one or more URLs to stdout.
9532Use -t to run the self-test. Made the proxy code work again.
9533
9534- In cgi.py, treat "HEAD" the same as "GET", so that CGI scripts don't
9535fail when someone asks for their HEAD. Also, for POST, set the
9536default content-type to application/x-www-form-urlencoded. Also, in
9537FieldStorage.__init__(), when method='GET', always get the query
9538string from environ['QUERY_STRING'] or sys.argv[1] -- ignore an
9539explicitly passed in fp.
9540
9541- The smtplib.py module now supports ESMTP and has improved standard
9542compliance, for picky servers.
9543
9544- Improved imaplib.py.
9545
9546- Fixed UDP support in SocketServer.py (it never worked).
9547
9548- Fixed a small bug in CGIHTTPServer.py.
9549
9550Internet Data handling
9551----------------------
9552
9553- In rfc822.py, add a new class AddressList. Also support a new
9554overridable method, isheader(). Also add a get() method similar to
9555dictionaries (and make getheader() an alias for it). Also, be smarter
9556about seekable (test whether fp.tell() works) and test for presence of
9557unread() method before trying seeks.
9558
9559- In sgmllib.py, restore the call to report_unbalanced() that was lost
9560long ago. Also some other improvements: handle <? processing
9561instructions >, allow . and - in entity names, and allow \r\n as line
9562separator.
9563
9564- Some restructuring and generalization done to multifile.py; support
9565a 'seekable' flag.
9566
9567Restricted Execution
9568--------------------
9569
9570- Improvements to rexec.py: package support; support a (minimal)
9571sys.exc_info(). Also made the (test) main program a bit fancier (you
9572can now use it to run arbitrary Python scripts in restricted mode).
9573
9574Tkinter
9575-------
9576
9577- On Unix, Tkinter can now safely be used from a multi-threaded
9578application. (Formerly, no threads would make progress while
9579Tkinter's mainloop() was active, because it didn't release the Python
9580interpreter lock.) Unfortunately, on Windows, threads other than the
9581main thread should not call update() or update_idletasks() because
9582this will deadlock the application.
9583
9584- An interactive interpreter that uses readline and Tkinter no longer
9585uses up all available CPU time.
9586
9587- Even if readline is not used, Tk windows created in an interactive
9588interpreter now get continuously updated. (This even works in Windows
9589as long as you don't hit a key.)
9590
9591- New demos in Demo/tkinter/guido/: brownian.py, redemo.py, switch.py.
9592
9593- No longer register Tcl_finalize() as a low-level exit handler. It
9594may call back into Python, and that's a bad idea.
9595
9596- Allow binding of Tcl commands (given as a string).
9597
9598- Some minor speedups; replace explicitly coded getint() with int() in
9599most places.
9600
9601- In FileDialog.py, remember the directory of the selected file, if
9602given.
9603
9604- Change the names of all methods in the Wm class: they are now
9605wm_title(), etc. The old names (title() etc.) are still defined as
9606aliases.
9607
9608- Add a new method of interpreter objects, interpaddr(). This returns
9609the address of the Tcl interpreter object, as an integer. Not very
9610useful for the Python programmer, but this can be called by another C
9611extension that needs to make calls into the Tcl/Tk C API and needs to
9612get the address of the Tcl interpreter object. A simple cast of the
9613return value to (Tcl_Interp *) will do the trick.
9614
9615Windows General
9616---------------
9617
9618- Don't insist on proper case for module source files if the filename
9619is all uppercase (e.g. FOO.PY now matches foo; but FOO.py still
9620doesn't). This should address problems with this feature on
9621oldfashioned filesystems (Novell servers?).
9622
9623Windows Library
9624---------------
9625
9626- os.environ is now all uppercase, but accesses are case insensitive,
9627and the putenv() calls made as a side effect of changing os.environ
9628are case preserving.
9629
9630- Removed samefile(), sameopenfile(), samestat() from os.path (aka
9631ntpath.py) -- these cannot be made to work reliably (at least I
9632wouldn't know how).
9633
9634- Fixed os.pipe() so that it returns file descriptors acceptable to
9635os.read() and os.write() (like it does on Unix), rather than Windows
9636file handles.
9637
9638- Added a table of WSA error codes to socket.py.
9639
9640- In the select module, put the (huge) file descriptor arrays on the
9641heap.
9642
9643- The getpass module now raises KeyboardInterrupt when it sees ^C.
9644
9645- In mailbox.py, fix tell/seek when using files opened in text mode.
9646
9647- In rfc822.py, fix tell/seek when using files opened in text mode.
9648
9649- In the msvcrt extension module, release the interpreter lock for
9650calls that may block: _locking(), _getch(), _getche(). Also fix a
9651bogus error return when open_osfhandle() doesn't have the right
9652argument list.
9653
9654Windows Installer
9655-----------------
9656
9657- The registry key used is now "1.5" instead of "1.5.x" -- so future
9658versions of 1.5 and Mark Hammond's win32all installer don't need to be
9659resynchronized.
9660
9661Windows Tools
9662-------------
9663
9664- Several improvements to freeze specifically for Windows.
9665
9666Windows Build Procedure
9667-----------------------
9668
9669- The VC++ project files and the WISE installer have been moved to the
9670PCbuild subdirectory, so they are distributed in the same subdirectory
9671where they must be used. This avoids confusion.
9672
9673- New project files for Windows 3.1 port by Jim Ahlstrom.
9674
9675- Got rid of the obsolete subdirectory PC/setup_nt/.
9676
9677- The projects now use distinct filenames for the .exe, .dll, .lib and
9678.pyd files built in debug mode (by appending "_d" to the base name,
9679before the extension). This makes it easier to switch between the two
9680and get the right versions. There's a pragma in config.h that directs
9681the linker to include the appropriate .lib file (so python15.lib no
9682longer needs to be explicit in your project).
9683
9684- The installer now installs more files (e.g. config.h). The idea is
9685that you shouldn't need the source distribution if you want build your
9686own extensions in C or C++.
9687
9688Tools and Demos
9689---------------
9690
9691- New script nm2def.py by Marc-Andre Lemburg, to construct
9692PC/python_nt.def automatically (some hand editing still required).
9693
9694- New tool ndiff.py: Tim Peters' text diffing tool.
9695
9696- Various and sundry improvements to the freeze script.
9697
9698- The script texi2html.py (which was part of the Doc tree but is no
9699longer used there) has been moved to the Tools/scripts subdirectory.
9700
9701- Some generalizations in the webchecker code. There's now a
9702primnitive gui for websucker.py: wsgui.py. (In Tools/webchecker/.)
9703
9704- The ftpmirror.py script now handles symbolic links properly, and
9705also files with multiple spaces in their names.
9706
9707- The 1.5.1 tabnanny.py suffers an assert error if fed a script whose
9708last line is both indented and lacks a newline. This is now fixed.
9709
9710Python/C API
9711------------
9712
9713- Added missing prototypes for PyEval_CallFunction() and
9714PyEval_CallMethod().
9715
9716- New macro PyList_SET_ITEM().
9717
9718- New macros to access object members for PyFunction, PyCFunction
9719objects.
9720
9721- New APIs PyImport_AppendInittab() an PyImport_ExtendInittab() to
9722dynamically add one or many entries to the table of built-in modules.
9723
9724- New macro Py_InitModule3(name, methods, doc) which calls
9725Py_InitModule4() with appropriate arguments. (The -4 variant requires
9726you to pass an obscure version number constant which is always the same.)
9727
9728- New APIs PySys_WriteStdout() and PySys_WriteStderr() to write to
9729sys.stdout or sys.stderr using a printf-like interface. (Used in
9730_tkinter.c, for example.)
9731
9732- New APIs for conversion between Python longs and C 'long long' if
9733your compiler supports it.
9734
9735- PySequence_In() is now called PySequence_Contains().
9736(PySequence_In() is still supported for b/w compatibility; it is
9737declared obsolete because its argument order is confusing.)
9738
9739- PyDict_GetItem() and PyDict_GetItemString() are changed so that they
9740*never* raise an exception -- (even if the hash() fails, simply clear
9741the error). This was necessary because there is lots of code out
9742there that already assumes this.
9743
9744- Changes to PySequence_Tuple() and PySequence_List() to use the
9745length of a sequence only as a hint -- if an IndexError happens
9746earlier, take that. (Formerly, this was considered an error.)
9747
9748- Reformatted abstract.c to give it a more familiar "look" and fixed
9749many error checking bugs.
9750
9751- Add NULL pointer checks to all calls of a C function through a type
9752object and extensions (e.g. nb_add).
9753
9754- The code that initializes sys.path now calls Py_GetPythonHome()
9755instead of getenv("PYTHONHOME"). This, together with the new API
9756Py_SetPythonHome(), makes it easier for embedding applications to
9757change the notion of Python's "home" directory (where the libraries
9758etc. are sought).
9759
9760- Fixed a very old bug in the parsing of "O?" format specifiers.
9761
9762
9763======================================================================
9764
9765
Guido van Rossumf2eac992000-09-04 17:24:24 +00009766========================================
9767==> Release 1.5.1 (October 31, 1998) <==
9768========================================
9769
Guido van Rossum439d1fa1998-12-21 21:41:14 +00009770From 1.5 to 1.5.1
9771=================
9772
9773General
9774-------
9775
9776- The documentation is now unbundled. It has also been extensively
9777modified (mostly to implement a new and more uniform formatting
9778style). We figure that most people will prefer to download one of the
9779preformatted documentation sets (HTML, PostScript or PDF) and that
9780only a minority have a need for the LaTeX or FrameMaker sources. Of
9781course, the unbundled documentation sources still released -- just not
9782in the same archive file, and perhaps not on the same date.
9783
9784- All bugs noted on the errors page (and many unnoted) are fixed. All
9785new bugs take their places.
9786
9787- No longer a core dump when attempting to print (or repr(), or str())
9788a list or dictionary that contains an instance of itself; instead, the
9789recursive entry is printed as [...] or {...}. See Py_ReprEnter() and
9790Py_ReprLeave() below. Comparisons of such objects still go beserk,
9791since this requires a different kind of fix; fortunately, this is a
9792less common scenario in practice.
9793
9794Syntax change
9795-------------
9796
9797- The raise statement can now be used without arguments, to re-raise
9798a previously set exception. This should be used after catching an
9799exception with an except clause only, either in the except clause or
9800later in the same function.
9801
9802Import and module handling
9803--------------------------
9804
9805- The implementation of import has changed to use a mutex (when
9806threading is supported). This means that when two threads
9807simultaneously import the same module, the import statements are
9808serialized. Recursive imports are not affected.
9809
9810- Rewrote the finalization code almost completely, to be much more
9811careful with the order in which modules are destroyed. Destructors
9812will now generally be able to reference built-in names such as None
9813without trouble.
9814
9815- Case-insensitive platforms such as Mac and Windows require the case
9816of a module's filename to match the case of the module name as
9817specified in the import statement (see below).
9818
9819- The code for figuring out the default path now distinguishes between
9820files, modules, executable files, and directories. When expecting a
9821module, we also look for the .pyc or .pyo file.
9822
9823Parser/tokenizer changes
9824------------------------
9825
9826- The tokenizer can now warn you when your source code mixes tabs and
9827spaces for indentation in a manner that depends on how much a tab is
9828worth in spaces. Use "python -t" or "python -v" to enable this
9829option. Use "python -tt" to turn the warnings into errors. (See also
9830tabnanny.py and tabpolice.py below.)
9831
9832- Return unsigned characters from tok_nextc(), so '\377' isn't
9833mistaken for an EOF character.
9834
9835- Fixed two pernicious bugs in the tokenizer that only affected AIX.
9836One was actually a general bug that was triggered by AIX's smaller I/O
9837buffer size. The other was a bug in the AIX optimizer's loop
9838unrolling code; swapping two statements made the problem go away.
9839
9840Tools, demos and miscellaneous files
9841------------------------------------
9842
9843- There's a new version of Misc/python-mode.el (the Emacs mode for
9844Python) which is much smarter about guessing the indentation style
9845used in a particular file. Lots of other cool features too!
9846
9847- There are two new tools in Tools/scripts: tabnanny.py and
9848tabpolice.py, implementing two different ways of checking whether a
9849file uses indentation in a way that is sensitive to the interpretation
9850of a tab. The preferred module is tabnanny.py (by Tim Peters).
9851
9852- Some new demo programs:
9853
9854 Demo/tkinter/guido/paint.py -- Dave Mitchell
9855 Demo/sockets/unixserver.py -- Piet van Oostrum
9856
9857
9858- Much better freeze support. The freeze script can now freeze
9859hierarchical module names (with a corresponding change to import.c),
9860and has a few extra options (e.g. to suppress freezing specific
9861modules). It also does much more on Windows NT.
9862
9863- Version 1.0 of the faq wizard is included (only very small changes
9864since version 0.9.0).
9865
9866- New feature for the ftpmirror script: when removing local files
9867(i.e., only when -r is used), do a recursive delete.
9868
9869Configuring and building Python
9870-------------------------------
9871
9872- Get rid of the check for -linet -- recent Sequent Dynix systems don't
9873need this any more and apparently it screws up their configuration.
9874
9875- Some changes because gcc on SGI doesn't support '-all'.
9876
9877- Changed the build rules to use $(LIBRARY) instead of
9878 -L.. -lpython$(VERSION)
9879since the latter trips up the SunOS 4.1.x linker (sigh).
9880
9881- Fix the bug where the '# dgux is broken' comment in the Makefile
9882tripped over Make on some platforms.
9883
9884- Changes for AIX: install the python.exp file; properly use
9885$(srcdir); the makexp_aix script now removes C++ entries of the form
9886Class::method.
9887
9888- Deleted some Makefile targets only used by the (long obsolete)
9889gMakefile hacks.
9890
9891Extension modules
9892-----------------
9893
9894- Performance and threading improvements to the socket and bsddb
9895modules, by Christopher Lindblad of Infoseek.
9896
9897- Added operator.__not__ and operator.not_.
9898
9899- In the thread module, when a thread exits due to an unhandled
9900exception, don't store the exception information in sys.last_*; it
9901prevents proper calling of destructors of local variables.
9902
9903- Fixed a number of small bugs in the cPickle module.
9904
9905- Changed find() and rfind() in the strop module so that
9906find("x","",2) returns -1, matching the implementation in string.py.
9907
9908- In the time module, be more careful with the result of ctime(), and
9909test for HAVE_MKTIME before usinmg mktime().
9910
9911- Doc strings contributed by Mitch Chapman to the termios, pwd, gdbm
9912modules.
9913
9914- Added the LOG_SYSLOG constant to the syslog module, if defined.
9915
9916Standard library modules
9917------------------------
9918
9919- All standard library modules have been converted to an indentation
9920style using either only tabs or only spaces -- never a mixture -- if
9921they weren't already consistent according to tabnanny. This means
9922that the new -t option (see above) won't complain about standard
9923library modules.
9924
9925- New standard library modules:
9926
9927 threading -- GvR and the thread-sig
9928 Java style thread objects -- USE THIS!!!
9929
9930 getpass -- Piers Lauder
9931 simple utilities to prompt for a password and to
9932 retrieve the current username
9933
9934 imaplib -- Piers Lauder
9935 interface for the IMAP4 protocol
9936
9937 poplib -- David Ascher, Piers Lauder
9938 interface for the POP3 protocol
9939
9940 smtplib -- Dragon De Monsyne
9941 interface for the SMTP protocol
9942
9943- Some obsolete modules moved to a separate directory (Lib/lib-old)
9944which is *not* in the default module search path:
9945
9946 Para
9947 addpack
9948 codehack
9949 fmt
9950 lockfile
9951 newdir
9952 ni
9953 rand
9954 tb
9955
9956- New version of the PCRE code (Perl Compatible Regular Expressions --
9957the re module and the supporting pcre extension) by Andrew Kuchling.
9958Incompatible new feature in re.sub(): the handling of escapes in the
9959replacement string has changed.
9960
9961- Interface change in the copy module: a __deepcopy__ method is now
9962called with the memo dictionary as an argument.
9963
9964- Feature change in the tokenize module: differentiate between NEWLINE
9965token (an official newline) and NL token (a newline that the grammar
9966ignores).
9967
9968- Several bugfixes to the urllib module. It is now truly thread-safe,
9969and several bugs and a portability problem have been fixed. New
9970features, all due to Sjoerd Mullender: When creating a temporary file,
9971it gives it an appropriate suffix. Support the "data:" URL scheme.
9972The open() method uses the tempcache.
9973
9974- New version of the xmllib module (this time with a test suite!) by
9975Sjoerd Mullender.
9976
9977- Added debugging code to the telnetlib module, to be able to trace
9978the actual traffic.
9979
9980- In the rfc822 module, added support for deleting a header (still no
9981support for adding headers, though). Also fixed a bug where an
9982illegal address would cause a crash in getrouteaddr(), fixed a
9983sign reversal in mktime_tz(), and use the local timezone by default
9984(the latter two due to Bill van Melle).
9985
9986- The normpath() function in the dospath and ntpath modules no longer
9987does case normalization -- for that, use the separate function
9988normcase() (which always existed); normcase() has been sped up and
9989fixed (it was the cause of a crash in Mark Hammond's installer in
9990certain locales).
9991
9992- New command supported by the ftplib module: rmd(); also fixed some
9993minor bugs.
9994
9995- The profile module now uses a different timer function by default --
9996time.clock() is generally better than os.times(). This makes it work
9997better on Windows NT, too.
9998
9999- The tempfile module now recovers when os.getcwd() raises an
10000exception.
10001
10002- Fixed some bugs in the random module; gauss() was subtly wrong, and
10003vonmisesvariate() should return a full circle. Courtesy Mike Miller,
10004Lambert Meertens (gauss()), and Magnus Kessler (vonmisesvariate()).
10005
10006- Better default seed in the whrandom module, courtesy Andrew Kuchling.
10007
10008- Fix slow close() in shelve module.
10009
10010- The Unix mailbox class in the mailbox module is now more robust when
10011a line begins with the string "From " but is definitely not the start
10012of a new message. The pattern used can be changed by overriding a
10013method or class variable.
10014
10015- Added a rmtree() function to the copy module.
10016
10017- Fixed several typos in the pickle module. Also fixed problems when
10018unpickling in restricted execution environments.
10019
10020- Added docstrings and fixed a typo in the py_compile and compileall
10021modules. At Mark Hammond's repeated request, py_compile now append a
10022newline to the source if it needs one. Both modules support an extra
10023parameter to specify the purported source filename (to be used in
10024error messages).
10025
10026- Some performance tweaks by Jeremy Hylton to the gzip module.
10027
10028- Fixed a bug in the merge order of dictionaries in the ConfigParser
10029module. Courtesy Barry Warsaw.
10030
10031- In the multifile module, support the optional second parameter to
10032seek() when possible.
10033
10034- Several fixes to the gopherlib module by Lars Marius Garshol. Also,
10035urlparse now correctly handles Gopher URLs with query strings.
10036
10037- Fixed a tiny bug in format_exception() in the traceback module.
10038Also rewrite tb_lineno() to be compatible with JPython (and not
10039disturb the current exception!); by Jim Hugunin.
10040
10041- The httplib module is more robust when servers send a short response
10042-- courtesy Tim O'Malley.
10043
10044Tkinter and friends
10045-------------------
10046
10047- Various typos and bugs fixed.
10048
10049- New module Tkdnd implements a drag-and-drop protocol (within one
10050application only).
10051
10052- The event_*() widget methods have been restructured slightly -- they
10053no longer use the default root.
10054
10055- The interfaces for the bind*() and unbind() widget methods have been
10056redesigned; the bind*() methods now return the name of the Tcl command
10057created for the callback, and this can be passed as a optional
10058argument to unbind() in order to delete the command (normally, such
10059commands are automatically unbound when the widget is destroyed, but
10060for some applications this isn't enough).
10061
10062- Variable objects now have trace methods to interface to Tcl's
10063variable tracing facilities.
10064
10065- Image objects now have an optional keyword argument, 'master', to
10066specify a widget (tree) to which they belong. The image_names() and
10067image_types() calls are now also widget methods.
10068
10069- There's a new global call, Tkinter.NoDefaultRoot(), which disables
10070all use of the default root by the Tkinter library. This is useful to
10071debug applications that are in the process of being converted from
10072relying on the default root to explicit specification of the root
10073widget.
10074
10075- The 'exit' command is deleted from the Tcl interpreter, since it
10076provided a loophole by which one could (accidentally) exit the Python
10077interpreter without invoking any cleanup code.
10078
10079- Tcl_Finalize() is now registered as a Python low-level exit handle,
10080so Tcl will be finalized when Python exits.
10081
10082The Python/C API
10083----------------
10084
10085- New function PyThreadState_GetDict() returns a per-thread dictionary
10086intended for storing thread-local global variables.
10087
10088- New functions Py_ReprEnter() and Py_ReprLeave() use the per-thread
10089dictionary to allow recursive container types to detect recursion in
10090their repr(), str() and print implementations.
10091
10092- New function PyObject_Not(x) calculates (not x) according to Python's
10093standard rules (basically, it negates the outcome PyObject_IsTrue(x).
10094
10095- New function _PyModule_Clear(), which clears a module's dictionary
10096carefully without removing the __builtins__ entry. This is implied
10097when a module object is deallocated (this used to clear the dictionary
10098completely).
10099
10100- New function PyImport_ExecCodeModuleEx(), which extends
10101PyImport_ExecCodeModule() by adding an extra parameter to pass it the
10102true file.
10103
10104- New functions Py_GetPythonHome() and Py_SetPythonHome(), intended to
10105allow embedded applications to force a different value for PYTHONHOME.
10106
10107- New global flag Py_FrozenFlag is set when this is a "frozen" Python
10108binary; it suppresses warnings about not being able to find the
10109standard library directories.
10110
10111- New global flag Py_TabcheckFlag is incremented by the -t option and
10112causes the tokenizer to issue warnings or errors about inconsistent
10113mixing of tabs and spaces for indentation.
10114
10115Miscellaneous minor changes and bug fixes
10116-----------------------------------------
10117
10118- Improved the error message when an attribute of an attribute-less
10119object is requested -- include the name of the attribute and the type
10120of the object in the message.
10121
10122- Sped up int(), long(), float() a bit.
10123
10124- Fixed a bug in list.sort() that would occasionally dump core.
10125
10126- Fixed a bug in PyNumber_Power() that caused numeric arrays to fail
10127when taken tothe real power.
10128
10129- Fixed a number of bugs in the file reading code, at least one of
10130which could cause a core dump on NT, and one of which would
10131occasionally cause file.read() to return less than the full contents
10132of the file.
10133
10134- Performance hack by Vladimir Marangozov for stack frame creation.
10135
10136- Make sure setvbuf() isn't used unless HAVE_SETVBUF is defined.
10137
10138Windows 95/NT
10139-------------
10140
10141- The .lib files are now part of the distribution; they are collected
10142in the subdirectory "libs" of the installation directory.
10143
10144- The extension modules (.pyd files) are now collected in a separate
10145subdirectory of the installation directory named "DLLs".
10146
10147- The case of a module's filename must now match the case of the
10148module name as specified in the import statement. This is an
10149experimental feature -- if it turns out to break in too many
10150situations, it will be removed (or disabled by default) in the future.
10151It can be disabled on a per-case basis by setting the environment
10152variable PYTHONCASEOK (to any value).
10153
10154
10155======================================================================
10156
10157
Guido van Rossumf2eac992000-09-04 17:24:24 +000010158=====================================
10159==> Release 1.5 (January 3, 1998) <==
10160=====================================
10161
10162
Guido van Rossum439d1fa1998-12-21 21:41:14 +000010163From 1.5b2 to 1.5
10164=================
10165
10166- Newly documentated module: BaseHTTPServer.py, thanks to Greg Stein.
10167
10168- Added doc strings to string.py, stropmodule.c, structmodule.c,
10169thanks to Charles Waldman.
10170
10171- Many nits fixed in the manuals, thanks to Fred Drake and many others
10172(especially Rob Hooft and Andrew Kuchling). The HTML version now uses
10173HTML markup instead of inline GIF images for tables; only two images
10174are left (for obsure bits of math). The index of the HTML version has
10175also been much improved. Finally, it is once again possible to
10176generate an Emacs info file from the library manual (but I don't
10177commit to supporting this in future versions).
10178
10179- New module: telnetlib.py (a simple telnet client library).
10180
10181- New tool: Tools/versioncheck/, by Jack Jansen.
10182
10183- Ported zlibmodule.c and bsddbmodule.c to NT; The project file for MS
10184DevStudio 5.0 now includes new subprojects to build the zlib and bsddb
10185extension modules.
10186
10187- Many small changes again to Tkinter.py -- mostly bugfixes and adding
10188missing routines. Thanks to Greg McFarlane for reporting a bunch of
10189problems and proofreading my fixes.
10190
10191- The re module and its documentation are up to date with the latest
10192version released to the string-sig (Dec. 22).
10193
10194- Stop test_grp.py from failing when the /etc/group file is empty
10195(yes, this happens!).
10196
10197- Fix bug in integer conversion (mystrtoul.c) that caused
101984294967296==0 to be true!
10199
10200- The VC++ 4.2 project file should be complete again.
10201
10202- In tempfile.py, use a better template on NT, and add a new optional
10203argument "suffix" with default "" to specify a specific extension for
10204the temporary filename (needed sometimes on NT but perhaps also handy
10205elsewhere).
10206
10207- Fixed some bugs in the FAQ wizard, and converted it to use re
10208instead of regex.
10209
10210- Fixed a mysteriously undetected error in dlmodule.c (it was using a
10211totally bogus routine name to raise an exception).
10212
10213- Fixed bug in import.c which wasn't using the new "dos-8x3" name yet.
10214
10215- Hopefully harmless changes to the build process to support shared
10216libraries on DG/UX. This adds a target to create
10217libpython$(VERSION).so; however this target is *only* for DG/UX.
10218
10219- Fixed a bug in the new format string error checking in getargs.c.
10220
10221- A simple fix for infinite recursion when printing __builtins__:
10222reset '_' to None before printing and set it to the printed variable
10223*after* printing (and only when printing is successful).
10224
10225- Fixed lib-tk/SimpleDialog.py to keep the dialog visible even if the
10226parent window is not (Skip Montanaro).
10227
10228- Fixed the two most annoying problems with ftp URLs in
10229urllib.urlopen(); an empty file now correctly raises an error, and it
10230is no longer required to explicitly close the returned "file" object
10231before opening another ftp URL to the same host and directory.
10232
10233
10234======================================================================
10235
10236
10237From 1.5b1 to 1.5b2
10238===================
10239
10240- Fixed a bug in cPickle.c that caused it to crash right away because
10241the version string had a different format.
10242
10243- Changes in pickle.py and cPickle.c: when unpickling an instance of a
10244class that doesn't define the __getinitargs__() method, the __init__()
10245constructor is no longer called. This makes a much larger group of
10246classes picklable by default, but may occasionally change semantics.
10247To force calling __init__() on unpickling, define a __getinitargs__()
10248method. Other changes too, in particular cPickle now handles classes
10249defined in packages correctly. The same change applies to copying
10250instances with copy.py. The cPickle.c changes and some pickle.py
10251changes are courtesy Jim Fulton.
10252
10253- Locale support in he "re" (Perl regular expressions) module. Use
10254the flag re.L (or re.LOCALE) to enable locale-specific matching
10255rules for \w and \b. The in-line syntax for this flag is (?L).
10256
10257- The built-in function isinstance(x, y) now also succeeds when y is
10258a type object and type(x) is y.
10259
10260- repr() and str() of class and instance objects now reflect the
10261package/module in which the class is defined.
10262
10263- Module "ni" has been removed. (If you really need it, it's been
10264renamed to "ni1". Let me know if this causes any problems for you.
10265Package authors are encouraged to write __init__.py files that
10266support both ni and 1.5 package support, so the same version can be
10267used with Python 1.4 as well as 1.5.)
10268
10269- The thread module is now automatically included when threads are
10270configured. (You must remove it from your existing Setup file,
10271since it is now in its own Setup.thread file.)
10272
10273- New command line option "-x" to skip the first line of the script;
10274handy to make executable scripts on non-Unix platforms.
10275
10276- In importdl.c, add the RTLD_GLOBAL to the dlopen() flags. I
10277haven't checked how this affects things, but it should make symbols
10278in one shared library available to the next one.
10279
10280- The Windows installer now installs in the "Program Files" folder on
10281the proper volume by default.
10282
10283- The Windows configuration adds a new main program, "pythonw", and
10284registers a new extension, ".pyw" that invokes this. This is a
10285pstandard Python interpreter that does not pop up a console window;
10286handy for pure Tkinter applications. All output to the original
10287stdout and stderr is lost; reading from the original stdin yields
10288EOF. Also, both python.exe and pythonw.exe now have a pretty icon
10289(a green snake in a box, courtesy Mark Hammond).
10290
10291- Lots of improvements to emacs-mode.el again. See Barry's web page:
10292http://www.python.org/ftp/emacs/pmdetails.html.
10293
10294- Lots of improvements and additions to the library reference manual;
10295many by Fred Drake.
10296
10297- Doc strings for the following modules: rfc822.py, posixpath.py,
10298ntpath.py, httplib.py. Thanks to Mitch Chapman and Charles Waldman.
10299
10300- Some more regression testing.
10301
10302- An optional 4th (maxsplit) argument to strop.replace().
10303
10304- Fixed handling of maxsplit in string.splitfields().
10305
10306- Tweaked os.environ so it can be pickled and copied.
10307
10308- The portability problems caused by indented preprocessor commands
10309and C++ style comments should be gone now.
10310
10311- In random.py, added Pareto and Weibull distributions.
10312
10313- The crypt module is now disabled in Modules/Setup.in by default; it
10314is rarely needed and causes errors on some systems where users often
10315don't know how to deal with those.
10316
10317- Some improvements to the _tkinter build line suggested by Case Roole.
10318
10319- A full suite of platform specific files for NetBSD 1.x, submitted by
10320Anders Andersen.
10321
10322- New Solaris specific header STROPTS.py.
10323
10324- Moved a confusing occurrence of *shared* from the comments in
10325Modules/Setup.in (people would enable this one instead of the real
10326one, and get disappointing results).
10327
10328- Changed the default mode for directories to be group-writable when
10329the installation process creates them.
10330
10331- Check for pthread support in "-l_r" for FreeBSD/NetBSD, and support
10332shared libraries for both.
10333
10334- Support FreeBSD and NetBSD in posixfile.py.
10335
10336- Support for the "event" command, new in Tk 4.2. By Case Roole.
10337
10338- Add Tix_SafeInit() support to tkappinit.c.
10339
10340- Various bugs fixed in "re.py" and "pcre.c".
10341
10342- Fixed a bug (broken use of the syntax table) in the old "regexpr.c".
10343
10344- In frozenmain.c, stdin is made unbuffered too when PYTHONUNBUFFERED
10345is set.
10346
10347- Provide default blocksize for retrbinary in ftplib.py (Skip
10348Montanaro).
10349
10350- In NT, pick the username up from different places in user.py (Jeff
10351Bauer).
10352
10353- Patch to urlparse.urljoin() for ".." and "..#1", Marc Lemburg.
10354
10355- Many small improvements to Jeff Rush' OS/2 support.
10356
10357- ospath.py is gone; it's been obsolete for so many years now...
10358
10359- The reference manual is now set up to prepare better HTML (still
10360using webmaker, alas).
10361
10362- Add special handling to /Tools/freeze for Python modules that are
10363imported implicitly by the Python runtime: 'site' and 'exceptions'.
10364
10365- Tools/faqwiz 0.8.3 -- add an option to suppress URL processing
10366inside <PRE>, by "Scott".
10367
10368- Added ConfigParser.py, a generic parser for sectioned configuration
10369files.
10370
10371- In _localemodule.c, LC_MESSAGES is not always defined; put it
10372between #ifdefs.
10373
10374- Typo in resource.c: RUSAGE_CHILDERN -> RUSAGE_CHILDREN.
10375
10376- Demo/scripts/newslist.py: Fix the way the version number is gotten
10377out of the RCS revision.
10378
10379- PyArg_Parse[Tuple] now explicitly check for bad characters at the
10380end of the format string.
10381
10382- Revamped PC/example_nt to support VC++ 5.x.
10383
10384- <listobject>.sort() now uses a modified quicksort by Raymund Galvin,
10385after studying the GNU libg++ quicksort. This should be much faster
10386if there are lots of duplicates, and otherwise at least as good.
10387
10388- Added "uue" as an alias for "uuencode" to mimetools.py. (Hm, the
10389uudecode bug where it complaints about trailing garbage is still there
10390:-( ).
10391
10392- pickle.py requires integers in text mode to be in decimal notation
10393(it used to accept octal and hex, even though it would only generate
10394decimal numbers).
10395
10396- In string.atof(), don't fail when the "re" module is unavailable.
10397Plug the ensueing security leak by supplying an empty __builtins__
10398directory to eval().
10399
10400- A bunch of small fixes and improvements to Tkinter.py.
10401
10402- Fixed a buffer overrun in PC/getpathp.c.
10403
10404
10405======================================================================
10406
10407
10408From 1.5a4 to 1.5b1
10409===================
10410
10411- The Windows NT/95 installer now includes full HTML of all manuals.
10412It also has a checkbox that lets you decide whether to install the
10413interpreter and library. The WISE installer script for the installer
10414is included in the source tree as PC/python15.wse, and so are the
10415icons used for Python files. The config.c file for the Windows build
10416is now complete with the pcre module.
10417
10418- sys.ps1 and sys.ps2 can now arbitrary objects; their str() is
10419evaluated for the prompt.
10420
10421- The reference manual is brought up to date (more or less -- it still
10422needs work, e.g. in the area of package import).
10423
10424- The icons used by latex2html are now included in the Doc
10425subdirectory (mostly so that tarring up the HTML files can be fully
10426automated). A simple index.html is also added to Doc (it only works
10427after you have successfully run latex2html).
10428
10429- For all you would-be proselytizers out there: a new version of
10430Misc/BLURB describes Python more concisely, and Misc/comparisons
10431compares Python to several other languages. Misc/BLURB.WINDOWS
10432contains a blurb specifically aimed at Windows programmers (by Mark
10433Hammond).
10434
10435- A new version of the Python mode for Emacs is included as
10436Misc/python-mode.el. There are too many new features to list here.
10437See http://www.python.org/ftp/emacs/pmdetails.html for more info.
10438
10439- New module fileinput makes iterating over the lines of a list of
10440files easier. (This still needs some more thinking to make it more
10441extensible.)
10442
10443- There's full OS/2 support, courtesy Jeff Rush. To build the OS/2
10444version, see PC/readme.txt and PC/os2vacpp. This is for IBM's Visual
10445Age C++ compiler. I expect that Jeff will also provide a binary
10446release for this platform.
10447
10448- On Linux, the configure script now uses '-Xlinker -export-dynamic'
10449instead of '-rdynamic' to link the main program so that it exports its
10450symbols to shared libraries it loads dynamically. I hope this doesn't
10451break on older Linux versions; it is needed for mklinux and appears to
10452work on Linux 2.0.30.
10453
10454- Some Tkinter resstructuring: the geometry methods that apply to a
10455master are now properly usable on toplevel master widgets. There's a
10456new (internal) widget class, BaseWidget. New, longer "official" names
10457for the geometry manager methods have been added,
10458e.g. "grid_columnconfigure()" instead of "columnconfigure()". The old
10459shorter names still work, and where there's ambiguity, pack wins over
10460place wins over grid. Also, the bind_class method now returns its
10461value.
10462
10463- New, RFC-822 conformant parsing of email addresses and address lists
10464in the rfc822 module, courtesy Ben Escoto.
10465
10466- New, revamped tkappinit.c with support for popular packages (PIL,
10467TIX, BLT, TOGL). For the last three, you need to execute the Tcl
10468command "load {} Tix" (or Blt, or Togl) to gain access to them.
10469The Modules/Setup line for the _tkinter module has been rewritten
10470using the cool line-breaking feature of most Bourne shells.
10471
10472- New socket method connect_ex() returns the error code from connect()
10473instead of raising an exception on errors; this makes the logic
10474required for asynchronous connects simpler and more efficient.
10475
10476- New "locale" module with (still experimental) interface to the
10477standard C library locale interface, courtesy Martin von Loewis. This
10478does not repeat my mistake in 1.5a4 of always calling
10479setlocale(LC_ALL, ""). In fact, we've pretty much decided that
10480Python's standard numerical formatting operations should always use
10481the conventions for the C locale; the locale module contains utility
10482functions to format numbers according to the user specified locale.
10483(All this is accomplished by an explicit call to setlocale(LC_NUMERIC,
10484"C") after locale-changing calls.) See the library manual. (Alas, the
10485promised changes to the "re" module for locale support have not been
10486materialized yet. If you care, volunteer!)
10487
10488- Memory leak plugged in Py_BuildValue when building a dictionary.
10489
10490- Shared modules can now live inside packages (hierarchical module
10491namespaces). No changes to the shared module itself are needed.
10492
10493- Improved policy for __builtins__: this is a module in __main__ and a
10494dictionary everywhere else.
10495
10496- Python no longer catches SIGHUP and SIGTERM by default. This was
10497impossible to get right in the light of thread contexts. If you want
10498your program to clean up when a signal happens, use the signal module
10499to set up your own signal handler.
10500
10501- New Python/C API PyNumber_CoerceEx() does not return an exception
10502when no coercion is possible. This is used to fix a problem where
10503comparing incompatible numbers for equality would raise an exception
10504rather than return false as in Python 1.4 -- it once again will return
10505false.
10506
10507- The errno module is changed again -- the table of error messages
10508(errorstr) is removed. Instead, you can use os.strerror(). This
10509removes redundance and a potential locale dependency.
10510
10511- New module xmllib, to parse XML files. By Sjoerd Mullender.
10512
10513- New C API PyOS_AfterFork() is called after fork() in posixmodule.c.
10514It resets the signal module's notion of what the current process ID
10515and thread are, so that signal handlers will work after (and across)
10516calls to os.fork().
10517
10518- Fixed most occurrences of fatal errors due to missing thread state.
10519
10520- For vgrind (a flexible source pretty printer) fans, there's a simple
10521Python definition in Misc/vgrindefs, courtesy Neale Pickett.
10522
10523- Fixed memory leak in exec statement.
10524
10525- The test.pystone module has a new function, pystones(loops=LOOPS),
10526which returns a (benchtime, stones) tuple. The main() function now
10527calls this and prints the report.
10528
10529- Package directories now *require* the presence of an __init__.py (or
10530__init__.pyc) file before they are considered as packages. This is
10531done to prevent accidental subdirectories with common names from
10532overriding modules with the same name.
10533
10534- Fixed some strange exceptions in __del__ methods in library modules
10535(e.g. urllib). This happens because the builtin names are already
10536deleted by the time __del__ is called. The solution (a hack, but it
10537works) is to set some instance variables to 0 instead of None.
10538
10539- The table of built-in module initializers is replaced by a pointer
10540variable. This makes it possible to switch to a different table at
10541run time, e.g. when a collection of modules is loaded from a shared
10542library. (No example code of how to do this is given, but it is
10543possible.) The table is still there of course, its name prefixed with
10544an underscore and used to initialize the pointer.
10545
10546- The warning about a thread still having a frame now only happens in
10547verbose mode.
10548
10549- Change the signal finialization so that it also resets the signal
10550handlers. After this has been called, our signal handlers are no
10551longer active!
10552
10553- New version of tokenize.py (by Ka-Ping Yee) recognizes raw string
10554literals. There's now also a test fort this module.
10555
10556- The copy module now also uses __dict__.update(state) instead of
10557going through individual attribute assignments, for class instances
10558without a __setstate__ method.
10559
10560- New module reconvert translates old-style (regex module) regular
10561expressions to new-style (re module, Perl-style) regular expressions.
10562
10563- Most modules that used to use the regex module now use the re
10564module. The grep module has a new pgrep() function which uses
10565Perl-style regular expressions.
10566
10567- The (very old, backwards compatibility) regexp.py module has been
10568deleted.
10569
10570- Restricted execution (rexec): added the pcre module (support for the
10571re module) to the list of trusted extension modules.
10572
10573- New version of Jim Fulton's CObject object type, adds
10574PyCObject_FromVoidPtrAndDesc() and PyCObject_GetDesc() APIs.
10575
10576- Some patches to Lee Busby's fpectl mods that accidentally didn't
10577make it into 1.5a4.
10578
10579- In the string module, add an optional 4th argument to count(),
10580matching find() etc.
10581
10582- Patch for the nntplib module by Charles Waldman to add optional user
10583and password arguments to NNTP.__init__(), for nntp servers that need
10584them.
10585
10586- The str() function for class objects now returns
10587"modulename.classname" instead of returning the same as repr().
10588
10589- The parsing of \xXX escapes no longer relies on sscanf().
10590
10591- The "sharedmodules" subdirectory of the installation is renamed to
10592"lib-dynload". (You may have to edit your Modules/Setup file to fix
10593this in an existing installation!)
10594
10595- Fixed Don Beaudry's mess-up with the OPT test in the configure
10596script. Certain SGI platforms will still issue a warning for each
10597compile; there's not much I can do about this since the compiler's
10598exit status doesn't indicate that I was using an obsolete option.
10599
10600- Fixed Barry's mess-up with {}.get(), and added test cases for it.
10601
10602- Shared libraries didn't quite work under AIX because of the change
10603in status of the GNU readline interface. Fix due to by Vladimir
10604Marangozov.
10605
10606
10607======================================================================
10608
10609
10610From 1.5a3 to 1.5a4
10611===================
10612
10613- faqwiz.py: version 0.8; Recognize https:// as URL; <html>...</html>
10614feature; better install instructions; removed faqmain.py (which was an
10615older version).
10616
10617- nntplib.py: Fixed some bugs reported by Lars Wirzenius (to Debian)
10618about the treatment of lines starting with '.'. Added a minimal test
10619function.
10620
10621- struct module: ignore most whitespace in format strings.
10622
10623- urllib.py: close the socket and temp file in URLopener.retrieve() so
10624that multiple retrievals using the same connection work.
10625
10626- All standard exceptions are now classes by default; use -X to make
10627them strings (for backward compatibility only).
10628
10629- There's a new standard exception hierarchy, defined in the standard
10630library module exceptions.py (which you never need to import
10631explicitly). See
10632http://grail.cnri.reston.va.us/python/essays/stdexceptions.html for
10633more info.
10634
10635- Three new C API functions:
10636
10637 - int PyErr_GivenExceptionMatches(obj1, obj2)
10638
10639 Returns 1 if obj1 and obj2 are the same object, or if obj1 is an
10640 instance of type obj2, or of a class derived from obj2
10641
10642 - int PyErr_ExceptionMatches(obj)
10643
10644 Higher level wrapper around PyErr_GivenExceptionMatches() which uses
10645 PyErr_Occurred() as obj1. This will be the more commonly called
10646 function.
10647
10648 - void PyErr_NormalizeException(typeptr, valptr, tbptr)
10649
10650 Normalizes exceptions, and places the normalized values in the
10651 arguments. If type is not a class, this does nothing. If type is a
10652 class, then it makes sure that value is an instance of the class by:
10653
10654 1. if instance is of the type, or a class derived from type, it does
10655 nothing.
10656
10657 2. otherwise it instantiates the class, using the value as an
10658 argument. If value is None, it uses an empty arg tuple, and if
10659 the value is a tuple, it uses just that.
10660
10661- Another new C API function: PyErr_NewException() creates a new
10662exception class derived from Exception; when -X is given, it creates a
10663new string exception.
10664
10665- core interpreter: remove the distinction between tuple and list
10666unpacking; allow an arbitrary sequence on the right hand side of any
10667unpack instruction. (UNPACK_LIST and UNPACK_TUPLE now do the same
10668thing, which should really be called UNPACK_SEQUENCE.)
10669
10670- classes: Allow assignments to an instance's __dict__ or __class__,
10671so you can change ivars (including shared ivars -- shock horror) and
10672change classes dynamically. Also make the check on read-only
10673attributes of classes less draconic -- only the specials names
10674__dict__, __bases__, __name__ and __{get,set,del}attr__ can't be
10675assigned.
10676
10677- Two new built-in functions: issubclass() and isinstance(). Both
10678take classes as their second arguments. The former takes a class as
10679the first argument and returns true iff first is second, or is a
10680subclass of second. The latter takes any object as the first argument
10681and returns true iff first is an instance of the second, or any
10682subclass of second.
10683
10684- configure: Added configuration tests for presence of alarm(),
10685pause(), and getpwent().
10686
10687- Doc/Makefile: changed latex2html targets.
10688
10689- classes: Reverse the search order for the Don Beaudry hook so that
10690the first class with an applicable hook wins. Makes more sense.
10691
10692- Changed the checks made in Py_Initialize() and Py_Finalize(). It is
10693now legal to call these more than once. The first call to
10694Py_Initialize() initializes, the first call to Py_Finalize()
10695finalizes. There's also a new API, Py_IsInitalized() which checks
10696whether we are already initialized (in case you want to leave things
10697as they were).
10698
10699- Completely disable the declarations for malloc(), realloc() and
10700free(). Any 90's C compiler has these in header files, and the tests
10701to decide whether to suppress the declarations kept failing on some
10702platforms.
10703
10704- *Before* (instead of after) signalmodule.o is added, remove both
10705intrcheck.o and sigcheck.o. This should get rid of warnings in ar or
10706ld on various systems.
10707
10708- Added reop to PC/config.c
10709
10710- configure: Decided to use -Aa -D_HPUX_SOURCE on HP-UX platforms.
10711Removed outdated HP-UX comments from README. Added Cray T3E comments.
10712
10713- Various renames of statically defined functions that had name
10714conflicts on some systems, e.g. strndup (GNU libc), join (Cray),
10715roundup (sys/types.h).
10716
10717- urllib.py: Interpret three slashes in file: URL as local file (for
10718Netscape on Windows/Mac).
10719
10720- copy.py: Make sure the objects returned by __getinitargs__() are
10721kept alive (in the memo) to avoid a certain kind of nasty crash. (Not
10722easily reproducable because it requires a later call to
10723__getinitargs__() to return a tuple that happens to be allocated at
10724the same address.)
10725
10726- Added definition of AR to toplevel Makefile. Renamed @buildno temp
10727file to buildno1.
10728
10729- Moved Include/assert.h to Parser/assert.h, which seems to be the
10730only place where it's needed.
10731
10732- Tweaked the dictionary lookup code again for some more speed
10733(Vladimir Marangozov).
10734
10735- NT build: Changed the way python15.lib is included in the other
10736projects. Per Mark Hammond's suggestion, add it to the extra libs in
10737Settings instead of to the project's source files.
10738
10739- regrtest.py: Change default verbosity so that there are only three
10740levels left: -q, default and -v. In default mode, the name of each
10741test is now printed. -v is the same as the old -vv. -q is more quiet
10742than the old default mode.
10743
10744- Removed the old FAQ from the distribution. You now have to get it
10745from the web!
10746
10747- Removed the PC/make_nt.in file from the distribution; it is no
10748longer needed.
10749
10750- Changed the build sequence so that shared modules are built last.
10751This fixes things for AIX and doesn't hurt elsewhere.
10752
10753- Improved test for GNU MP v1 in mpzmodule.c
10754
10755- fileobject.c: ftell() on Linux discards all buffered data; changed
10756read() code to use lseek() instead to get the same effect
10757
10758- configure.in, configure, importdl.c: NeXT sharedlib fixes
10759
10760- tupleobject.c: PyTuple_SetItem asserts refcnt==1
10761
10762- resource.c: Different strategy regarding whether to declare
10763getrusage() and getpagesize() -- #ifdef doesn't work, Linux has
10764conflicting decls in its headers. Choice: only declare the return
10765type, not the argument prototype, and not on Linux.
10766
10767- importdl.c, configure*: set sharedlib extensions properly for NeXT
10768
10769- configure*, Makefile.in, Modules/Makefile.pre.in: AIX shared libraries
10770fixed; moved addition of PURIFY to LINKCC to configure
10771
10772- reopmodule.c, regexmodule.c, regexpr.c, zlibmodule.c: needed casts
10773added to shup up various compilers.
10774
10775- _tkinter.c: removed buggy mac #ifndef
10776
10777- Doc: various Mac documentation changes, added docs for 'ic' module
10778
10779- PC/make_nt.in: deleted
10780
10781- test_time.py, test_strftime.py: tweaks to catch %Z (which may return
10782"")
10783
10784- test_rotor.py: print b -> print `b`
10785
10786- Tkinter.py: (tagOrId) -> (tagOrId,)
10787
10788- Tkinter.py: the Tk class now also has a configure() method and
10789friends (they have been moved to the Misc class to accomplish this).
10790
10791- dict.get(key[, default]) returns dict[key] if it exists, or default
10792if it doesn't. The default defaults to None. This is quicker for
10793some applications than using either has_key() or try:...except
10794KeyError:....
10795
10796- Tools/webchecker/: some small changes to webchecker.py; added
10797websucker.py (a simple web site mirroring script).
10798
10799- Dictionary objects now have a get() method (also in UserDict.py).
10800dict.get(key, default) returns dict[key] if it exists and default
10801otherwise; default defaults to None.
10802
10803- Tools/scripts/logmerge.py: print the author, too.
10804
10805- Changes to import: support for "import a.b.c" is now built in. See
10806http://grail.cnri.reston.va.us/python/essays/packages.html
10807for more info. Most important deviations from "ni.py": __init__.py is
10808executed in the package's namespace instead of as a submodule; and
10809there's no support for "__" or "__domain__". Note that "ni.py" is not
10810changed to match this -- it is simply declared obsolete (while at the
10811same time, it is documented...:-( ).
10812Unfortunately, "ihooks.py" has not been upgraded (but see "knee.py"
10813for an example implementation of hierarchical module import written in
10814Python).
10815
10816- More changes to import: the site.py module is now imported by
10817default when Python is initialized; use -S to disable it. The site.py
10818module extends the path with several more directories: site-packages
10819inside the lib/python1.5/ directory, site-python in the lib/
10820directory, and pathnames mentioned in *.pth files found in either of
10821those directories. See
10822http://grail.cnri.reston.va.us/python/essays/packages.html
10823for more info.
10824
10825- Changes to standard library subdirectory names: those subdirectories
10826that are not packages have been renamed with a hypen in their name,
10827e.g. lib-tk, lib-stdwin, plat-win, plat-linux2, plat-sunos5, dos-8x3.
10828The test suite is now a package -- to run a test, you must now use
10829"import test.test_foo".
10830
10831- A completely new re.py module is provided (thanks to Andrew
10832Kuchling, Tim Peters and Jeffrey Ollie) which uses Philip Hazel's
10833"pcre" re compiler and engine. For a while, the "old" re.py (which
10834was new in 1.5a3!) will be kept around as re1.py. The "old" regex
10835module and underlying parser and engine are still present -- while
10836regex is now officially obsolete, it will probably take several major
10837release cycles before it can be removed.
10838
10839- The posix module now has a strerror() function which translates an
10840error code to a string.
10841
10842- The emacs.py module (which was long obsolete) has been removed.
10843
10844- The universal makefile Misc/Makefile.pre.in now features an
10845"install" target. By default, installed shared libraries go into
10846$exec_prefix/lib/python$VERSION/site-packages/.
10847
10848- The install-sh script is installed with the other configuration
10849specific files (in the config/ subdirectory).
10850
10851- It turns out whatsound.py and sndhdr.py were identical modules.
10852Since there's also an imghdr.py file, I propose to make sndhdr.py the
10853official one. For compatibility, whatsound.py imports * from
10854sndhdr.py.
10855
10856- Class objects have a new attribute, __module__, giving the name of
10857the module in which they were declared. This is useful for pickle and
10858for printing the full name of a class exception.
10859
10860- Many extension modules no longer issue a fatal error when their
10861initialization fails; the importing code now checks whether an error
10862occurred during module initialization, and correctly propagates the
10863exception to the import statement.
10864
10865- Most extension modules now raise class-based exceptions (except when
10866-X is used).
10867
10868- Subtle changes to PyEval_{Save,Restore}Thread(): always swap the
10869thread state -- just don't manipulate the lock if it isn't there.
10870
10871- Fixed a bug in Python/getopt.c that made it do the wrong thing when
10872an option was a single '-'. Thanks to Andrew Kuchling.
10873
10874- New module mimetypes.py will guess a MIME type from a filename's
10875extension.
10876
10877- Windows: the DLL version is now settable via a resource rather than
10878being hardcoded. This can be used for "branding" a binary Python
10879distribution.
10880
10881- urllib.py is now threadsafe -- it now uses re instead of regex, and
10882sys.exc_info() instead of sys.exc_{type,value}.
10883
10884- Many other library modules that used to use
10885sys.exc_{type,value,traceback} are now more thread-safe by virtue of
10886using sys.exc_info().
10887
10888- The functions in popen2 have an optional buffer size parameter.
10889Also, the command argument can now be either a string (passed to the
10890shell) or a list of arguments (passed directly to execv).
10891
10892- Alas, the thread support for _tkinter released with 1.5a3 didn't
10893work. It's been rewritten. The bad news is that it now requires a
10894modified version of a file in the standard Tcl distribution, which you
10895must compile with a -I option pointing to the standard Tcl source
10896tree. For this reason, the thread support is disabled by default.
10897
10898- The errno extension module adds two tables: errorcode maps errno
10899numbers to errno names (e.g. EINTR), and errorstr maps them to
10900message strings. (The latter is redundant because the new call
10901posix.strerror() now does the same, but alla...) (Marc-Andre Lemburg)
10902
10903- The readline extension module now provides some interfaces to
10904internal readline routines that make it possible to write a completer
10905in Python. An example completer, rlcompleter.py, is provided.
10906
10907 When completing a simple identifier, it completes keywords,
10908 built-ins and globals in __main__; when completing
10909 NAME.NAME..., it evaluates (!) the expression up to the last
10910 dot and completes its attributes.
10911
10912 It's very cool to do "import string" type "string.", hit the
10913 completion key (twice), and see the list of names defined by
10914 the string module!
10915
10916 Tip: to use the tab key as the completion key, call
10917
10918 readline.parse_and_bind("tab: complete")
10919
10920- The traceback.py module has a new function tb_lineno() by Marc-Andre
10921Lemburg which extracts the line number from the linenumber table in
10922the code object. Apparently the traceback object doesn't contains the
10923right linenumber when -O is used. Rather than guessing whether -O is
10924on or off, the module itself uses tb_lineno() unconditionally.
10925
10926- Fixed Demo/tkinter/matt/canvas-moving-or-creating.py: change bind()
10927to tag_bind() so it works again.
10928
10929- The pystone script is now a standard library module. Example use:
10930"import test.pystone; test.pystone.main()".
10931
10932- The import of the readline module in interactive mode is now also
10933attempted when -i is specified. (Yes, I know, giving in to Marc-Andre
10934Lemburg, who asked for this. :-)
10935
10936- rfc822.py: Entirely rewritten parseaddr() function by Sjoerd
10937Mullender, to be closer to the standard. This fixes the getaddr()
10938method. Unfortunately, getaddrlist() is as broken as ever, since it
10939splits on commas without regard for RFC 822 quoting conventions.
10940
10941- pprint.py: correctly emit trailing "," in singleton tuples.
10942
10943- _tkinter.c: export names for its type objects, TkappType and
10944TkttType.
10945
10946- pickle.py: use __module__ when defined; fix a particularly hard to
10947reproduce bug that confuses the memo when temporary objects are
10948returned by custom pickling interfaces; and a semantic change: when
10949unpickling the instance variables of an instance, use
10950inst.__dict__.update(value) instead of a for loop with setattr() over
10951the value.keys(). This is more consistent (the pickling doesn't use
10952getattr() either but pickles inst.__dict__) and avoids problems with
10953instances that have a __setattr__ hook. But it *is* a semantic change
10954(because the setattr hook is no longer used). So beware!
10955
10956- config.h is now installed (at last) in
10957$exec_prefix/include/python1.5/. For most sites, this means that it
10958is actually in $prefix/include/python1.5/, with all the other Python
10959include files, since $prefix and $exec_prefix are the same by
10960default.
10961
10962- The imp module now supports parts of the functionality to implement
10963import of hierarchical module names. It now supports find_module()
10964and load_module() for all types of modules. Docstrings have been
10965added for those functions in the built-in imp module that are still
10966relevant (some old interfaces are obsolete). For a sample
10967implementation of hierarchical module import in Python, see the new
10968library module knee.py.
10969
10970- The % operator on string objects now allows arbitrary nested parens
10971in a %(...)X style format. (Brad Howes)
10972
10973- Reverse the order in which Setup and Setup.local are passed to the
10974makesetup script. This allows variable definitions in Setup.local to
10975override definitions in Setup. (But you'll still have to edit Setup
10976if you want to disable modules that are enabled by default, or if such
10977modules need non-standard options.)
10978
10979- Added PyImport_ImportModuleEx(name, globals, locals, fromlist); this
10980is like PyImport_ImporModule(name) but receives the globals and locals
10981dict and the fromlist arguments as well. (The name is a char*; the
10982others are PyObject*s).
10983
10984- The 'p' format in the struct extension module alloded to above is
10985new in 1.5a4.
10986
10987- The types.py module now uses try-except in a few places to make it
10988more likely that it can be imported in restricted mode. Some type
10989names are undefined in that case, e.g. CodeType (inaccessible),
10990FileType (not always accessible), and TracebackType and FrameType
10991(inaccessible).
10992
10993- In urllib.py: added separate administration of temporary files
10994created y URLopener.retrieve() so cleanup() can properly remove them.
10995The old code removed everything in tempcache which was a bad idea if
10996the user had passed a non-temp file into it. Also, in basejoin(),
10997interpret relative paths starting in "../". This is necessary if the
10998server uses symbolic links.
10999
11000- The Windows build procedure and project files are now based on
11001Microsoft Visual C++ 5.x. The build now takes place in the PCbuild
11002directory. It is much more robust, and properly builds separate Debug
11003and Release versions. (The installer will be added shortly.)
11004
11005- Added casts and changed some return types in regexpr.c to avoid
11006compiler warnings or errors on some platforms.
11007
11008- The AIX build tools for shared libraries now supports VPATH. (Donn
11009Cave)
11010
11011- By default, disable the "portable" multimedia modules audioop,
11012imageop, and rgbimg, since they don't work on 64-bit platforms.
11013
11014- Fixed a nasty bug in cStringIO.c when code was actually using the
11015close() method (the destructors would try to free certain fields a
11016second time).
11017
11018- For those who think they need it, there's a "user.py" module. This
11019is *not* imported by default, but can be imported to run user-specific
11020setup commands, ~/.pythonrc.py.
11021
11022- Various speedups suggested by Fredrik Lundh, Marc-Andre Lemburg,
11023Vladimir Marangozov, and others.
11024
11025- Added os.altsep; this is '/' on DOS/Windows, and None on systems
11026with a sane filename syntax.
11027
11028- os.py: Write out the dynamic OS choice, to avoid exec statements.
11029Adding support for a new OS is now a bit more work, but I bet that
11030'dos' or 'nt' will cover most situations...
11031
11032- The obsolete exception AccessError is now really gone.
11033
11034- Tools/faqwiz/: New installation instructions show how to maintain
11035multiple FAQs. Removed bootstrap script from end of faqwiz.py module.
11036Added instructions to bootstrap script, too. Version bumped to 0.8.1.
11037Added <html>...</html> feature suggested by Skip Montanaro. Added
11038leading text for Roulette, default to 'Hit Reload ...'. Fix typo in
11039default SRCDIR.
11040
11041- Documentation for the relatively new modules "keyword" and "symbol"
11042has been added (to the end of the section on the parser extension
11043module).
11044
11045- In module bisect.py, but functions have two optional argument 'lo'
11046and 'hi' which allow you to specify a subsequence of the array to
11047operate on.
11048
11049- In ftplib.py, changed most methods to return their status (even when
11050it is always "200 OK") rather than swallowing it.
11051
11052- main() now calls setlocale(LC_ALL, ""), if setlocale() and
11053<locale.h> are defined.
11054
11055- Changes to configure.in, the configure script, and both
11056Makefile.pre.in files, to support SGI's SGI_ABI platform selection
11057environment variable.
11058
11059
11060======================================================================
11061
11062
11063From 1.4 to 1.5a3
11064=================
11065
11066Security
11067--------
11068
11069- If you are using the setuid script C wrapper (Misc/setuid-prog.c),
11070please use the new version. The old version has a huge security leak.
11071
11072Miscellaneous
11073-------------
11074
11075- Because of various (small) incompatible changes in the Python
11076bytecode interpreter, the magic number for .pyc files has changed
11077again.
11078
11079- The default module search path is now much saner. Both on Unix and
11080Windows, it is essentially derived from the path to the executable
11081(which can be overridden by setting the environment variable
11082$PYTHONHOME). The value of $PYTHONPATH on Windows is now inserted in
11083front of the default path, like in Unix (instead of overriding the
11084default path). On Windows, the directory containing the executable is
11085added to the end of the path.
11086
11087- A new version of python-mode.el for Emacs has been included. Also,
11088a new file ccpy-style.el has been added to configure Emacs cc-mode for
11089the preferred style in Python C sources.
11090
11091- On Unix, when using sys.argv[0] to insert the script directory in
11092front of sys.path, expand a symbolic link. You can now install a
11093program in a private directory and have a symbolic link to it in a
11094public bin directory, and it will put the private directory in the
11095module search path. Note that the symlink is expanded in sys.path[0]
11096but not in sys.argv[0], so you can still tell the name by which you
11097were invoked.
11098
11099- It is now recommended to use ``#!/usr/bin/env python'' instead of
11100``#!/usr/local/bin/python'' at the start of executable scripts, except
11101for CGI scripts. It has been determined that the use of /usr/bin/env
11102is more portable than that of /usr/local/bin/python -- scripts almost
11103never have to be edited when the Python interpreter lives in a
11104non-standard place. Note that this doesn't work for CGI scripts since
11105the python executable often doesn't live in the HTTP server's default
11106search path.
11107
11108- The silly -s command line option and the corresponding
11109PYTHONSUPPRESS environment variable (and the Py_SuppressPrint global
11110flag in the Python/C API) are gone.
11111
11112- Most problems on 64-bit platforms should now be fixed. Andrew
11113Kuchling helped. Some uncommon extension modules are still not
11114clean (image and audio ops?).
11115
11116- Fixed a bug where multiple anonymous tuple arguments would be mixed up
11117when using the debugger or profiler (reported by Just van Rossum).
11118The simplest example is ``def f((a,b),(c,d)): print a,b,c,d''; this
11119would print the wrong value when run under the debugger or profiler.
11120
11121- The hacks that the dictionary implementation used to speed up
11122repeated lookups of the same C string were removed; these were a
11123source of subtle problems and don't seem to serve much of a purpose
11124any longer.
11125
11126- All traces of support for the long dead access statement have been
11127removed from the sources.
11128
11129- Plugged the two-byte memory leak in the tokenizer when reading an
11130interactive EOF.
11131
11132- There's a -O option to the interpreter that removes SET_LINENO
11133instructions and assert statements (see below); it uses and produces
11134.pyo files instead of .pyc files. The speedup is only a few percent
11135in most cases. The line numbers are still available in the .pyo file,
11136as a separate table (which is also available in .pyc files). However,
11137the removal of the SET_LINENO instructions means that the debugger
11138(pdb) can't set breakpoints on lines in -O mode. The traceback module
11139contains a function to extract a line number from the code object
11140referenced in a traceback object. In the future it should be possible
11141to write external bytecode optimizers that create better optimized
11142.pyo files, and there should be more control over optimization;
11143consider the -O option a "teaser". Without -O, the assert statement
11144actually generates code that first checks __debug__; if this variable
11145is false, the assertion is not checked. __debug__ is a built-in
11146variable whose value is initialized to track the -O flag (it's true
11147iff -O is not specified). With -O, no code is generated for assert
11148statements, nor for code of the form ``if __debug__: <something>''.
11149Sorry, no further constant folding happens.
11150
11151
11152Performance
11153-----------
11154
11155- It's much faster (almost twice for pystone.py -- see
11156Tools/scripts). See the entry on string interning below.
11157
11158- Some speedup by using separate free lists for method objects (both
11159the C and the Python variety) and for floating point numbers.
11160
11161- Big speedup by allocating frame objects with a single malloc() call.
11162The Python/C API for frames is changed (you shouldn't be using this
11163anyway).
11164
11165- Significant speedup by inlining some common opcodes for common operand
11166types (e.g. i+i, i-i, and list[i]). Fredrik Lundh.
11167
11168- Small speedup by reordering the method tables of some common
11169objects (e.g. list.append is now first).
11170
11171- Big optimization to the read() method of file objects. A read()
11172without arguments now attempts to use fstat to allocate a buffer of
11173the right size; for pipes and sockets, it will fall back to doubling
11174the buffer size. While that the improvement is real on all systems,
11175it is most dramatic on Windows.
11176
11177
11178Documentation
11179-------------
11180
11181- Many new pieces of library documentation were contributed, mostly by
11182Andrew Kuchling. Even cmath is now documented! There's also a
11183chapter of the library manual, "libundoc.tex", which provides a
11184listing of all undocumented modules, plus their status (e.g. internal,
11185obsolete, or in need of documentation). Also contributions by Sue
11186Williams, Skip Montanaro, and some module authors who succumbed to
11187pressure to document their own contributed modules :-). Note that
11188printing the documentation now kills fewer trees -- the margins have
11189been reduced.
11190
11191- I have started documenting the Python/C API. Unfortunately this project
11192hasn't been completed yet. It will be complete before the final release of
11193Python 1.5, though. At the moment, it's better to read the LaTeX source
11194than to attempt to run it through LaTeX and print the resulting dvi file.
11195
11196- The posix module (and hence os.py) now has doc strings! Thanks to Neil
11197Schemenauer. I received a few other contributions of doc strings. In most
11198other places, doc strings are still wishful thinking...
11199
11200
11201Language changes
11202----------------
11203
11204- Private variables with leading double underscore are now a permanent
11205feature of the language. (These were experimental in release 1.4. I have
11206favorable experience using them; I can't label them "experimental"
11207forever.)
11208
11209- There's new string literal syntax for "raw strings". Prefixing a string
11210literal with the letter r (or R) disables all escape processing in the
11211string; for example, r'\n' is a two-character string consisting of a
11212backslash followed by the letter n. This combines with all forms of string
11213quotes; it is actually useful for triple quoted doc strings which might
11214contain references to \n or \t. An embedded quote prefixed with a
11215backslash does not terminate the string, but the backslash is still
11216included in the string; for example, r'\'' is a two-character string
11217consisting of a backslash and a quote. (Raw strings are also
11218affectionately known as Robin strings, after their inventor, Robin
11219Friedrich.)
11220
11221- There's a simple assert statement, and a new exception
11222AssertionError. For example, ``assert foo > 0'' is equivalent to ``if
11223not foo > 0: raise AssertionError''. Sorry, the text of the asserted
11224condition is not available; it would be too complicated to generate
11225code for this (since the code is generated from a parse tree).
11226However, the text is displayed as part of the traceback!
11227
11228- The raise statement has a new feature: when using "raise SomeClass,
11229somevalue" where somevalue is not an instance of SomeClass, it
11230instantiates SomeClass(somevalue). In 1.5a4, if somevalue is an
11231instance of a *derived* class of SomeClass, the exception class raised
11232is set to somevalue.__class__, and SomeClass is ignored after that.
11233
11234- Duplicate keyword arguments are now detected at compile time;
11235f(a=1,a=2) is now a syntax error.
11236
11237
11238Changes to builtin features
11239---------------------------
11240
11241- There's a new exception FloatingPointError (used only by Lee Busby's
11242patches to catch floating point exceptions, at the moment).
11243
11244- The obsolete exception ConflictError (presumably used by the long
11245obsolete access statement) has been deleted.
11246
11247- There's a new function sys.exc_info() which returns the tuple
11248(sys.exc_type, sys.exc_value, sys.exc_traceback) in a thread-safe way.
11249
11250- There's a new variable sys.executable, pointing to the executable file
11251for the Python interpreter.
11252
11253- The sort() methods for lists no longer uses the C library qsort(); I
11254wrote my own quicksort implementation, with lots of help (in the form
11255of a kind of competition) from Tim Peters. This solves a bug in
11256dictionary comparisons on some Solaris versions when Python is built
11257with threads, and makes sorting lists even faster.
11258
11259- The semantics of comparing two dictionaries have changed, to make
11260comparison of unequal dictionaries faster. A shorter dictionary is
11261always considered smaller than a larger dictionary. For dictionaries
11262of the same size, the smallest differing element determines the
11263outcome (which yields the same results as before in this case, without
11264explicit sorting). Thanks to Aaron Watters for suggesting something
11265like this.
11266
11267- The semantics of try-except have changed subtly so that calling a
11268function in an exception handler that itself raises and catches an
11269exception no longer overwrites the sys.exc_* variables. This also
11270alleviates the problem that objects referenced in a stack frame that
11271caught an exception are kept alive until another exception is caught
11272-- the sys.exc_* variables are restored to their previous value when
11273returning from a function that caught an exception.
11274
11275- There's a new "buffer" interface. Certain objects (e.g. strings and
11276arrays) now support the "buffer" protocol. Buffer objects are acceptable
11277whenever formerly a string was required for a write operation; mutable
11278buffer objects can be the target of a read operation using the call
11279f.readinto(buffer). A cool feature is that regular expression matching now
11280also work on array objects. Contribution by Jack Jansen. (Needs
11281documentation.)
11282
11283- String interning: dictionary lookups are faster when the lookup
11284string object is the same object as the key in the dictionary, not
11285just a string with the same value. This is done by having a pool of
11286"interned" strings. Most names generated by the interpreter are now
11287automatically interned, and there's a new built-in function intern(s)
11288that returns the interned version of a string. Interned strings are
11289not a different object type, and interning is totally optional, but by
11290interning most keys a speedup of about 15% was obtained for the
11291pystone benchmark.
11292
11293- Dictionary objects have several new methods; clear() and copy() have
11294the obvious semantics, while update(d) merges the contents of another
11295dictionary d into this one, overriding existing keys. The dictionary
11296implementation file is now called dictobject.c rather than the
11297confusing mappingobject.c.
11298
11299- The intrinsic function dir() is much smarter; it looks in __dict__,
11300__members__ and __methods__.
11301
11302- The intrinsic functions int(), long() and float() can now take a
11303string argument and then do the same thing as string.atoi(),
11304string.atol(), and string.atof(). No second 'base' argument is
11305allowed, and complex() does not take a string (nobody cared enough).
11306
11307- When a module is deleted, its globals are now deleted in two phases.
11308In the first phase, all variables whose name begins with exactly one
11309underscore are replaced by None; in the second phase, all variables
11310are deleted. This makes it possible to have global objects whose
11311destructors depend on other globals. The deletion order within each
11312phase is still random.
11313
11314- It is no longer an error for a function to be called without a
11315global variable __builtins__ -- an empty directory will be provided
11316by default.
11317
11318- Guido's corollary to the "Don Beaudry hook": it is now possible to
11319do metaprogramming by using an instance as a base class. Not for the
11320faint of heart; and undocumented as yet, but basically if a base class
11321is an instance, its class will be instantiated to create the new
11322class. Jim Fulton will love it -- it also works with instances of his
11323"extension classes", since it is triggered by the presence of a
11324__class__ attribute on the purported base class. See
11325Demo/metaclasses/index.html for an explanation and see that directory
11326for examples.
11327
11328- Another change is that the Don Beaudry hook is now invoked when
11329*any* base class is special. (Up to 1.5a3, the *last* special base
11330class is used; in 1.5a4, the more rational choice of the *first*
11331special base class is used.)
11332
11333- New optional parameter to the readlines() method of file objects.
11334This indicates the number of bytes to read (the actual number of bytes
11335read will be somewhat larger due to buffering reading until the end of
11336the line). Some optimizations have also been made to speed it up (but
11337not as much as read()).
11338
11339- Complex numbers no longer have the ".conj" pseudo attribute; use
11340z.conjugate() instead, or complex(z.real, -z.imag). Complex numbers
11341now *do* support the __members__ and __methods__ special attributes.
11342
11343- The complex() function now looks for a __complex__() method on class
11344instances before giving up.
11345
11346- Long integers now support arbitrary shift counts, so you can now
11347write 1L<<1000000, memory permitting. (Python 1.4 reports "outrageous
11348shift count for this.)
11349
11350- The hex() and oct() functions have been changed so that for regular
11351integers, they never emit a minus sign. For example, on a 32-bit
11352machine, oct(-1) now returns '037777777777' and hex(-1) returns
11353'0xffffffff'. While this may seem inconsistent, it is much more
11354useful. (For long integers, a minus sign is used as before, to fit
11355the result in memory :-)
11356
11357- The hash() function computes better hashes for several data types,
11358including strings, floating point numbers, and complex numbers.
11359
11360
11361New extension modules
11362---------------------
11363
11364- New extension modules cStringIO.c and cPickle.c, written by Jim
11365Fulton and other folks at Digital Creations. These are much more
11366efficient than their Python counterparts StringIO.py and pickle.py,
11367but don't support subclassing. cPickle.c clocks up to 1000 times
11368faster than pickle.py; cStringIO.c's improvement is less dramatic but
11369still significant.
11370
11371- New extension module zlibmodule.c, interfacing to the free zlib
11372library (gzip compatible compression). There's also a module gzip.py
11373which provides a higher level interface. Written by Andrew Kuchling
11374and Jeremy Hylton.
11375
11376- New module readline; see the "miscellaneous" section above.
11377
11378- New Unix extension module resource.c, by Jeremy Hylton, provides
11379access to getrlimit(), getrusage(), setrusage(), getpagesize(), and
11380related symbolic constants.
11381
11382- New extension puremodule.c, by Barry Warsaw, which interfaces to the
11383Purify(TM) C API. See also the file Misc/PURIFY.README. It is also
11384possible to enable Purify by simply setting the PURIFY Makefile
11385variable in the Modules/Setup file.
11386
11387
11388Changes in extension modules
11389----------------------------
11390
11391- The struct extension module has several new features to control byte
11392order and word size. It supports reading and writing IEEE floats even
11393on platforms where this is not the native format. It uses uppercase
11394format codes for unsigned integers of various sizes (always using
11395Python long ints for 'I' and 'L'), 's' with a size prefix for strings,
11396and 'p' for "Pascal strings" (with a leading length byte, included in
11397the size; blame Hannu Krosing; new in 1.5a4). A prefix '>' forces
11398big-endian data and '<' forces little-endian data; these also select
11399standard data sizes and disable automatic alignment (use pad bytes as
11400needed).
11401
11402- The array module supports uppercase format codes for unsigned data
11403formats (like the struct module).
11404
11405- The fcntl extension module now exports the needed symbolic
11406constants. (Formerly these were in FCNTL.py which was not available
11407or correct for all platforms.)
11408
11409- The extension modules dbm, gdbm and bsddb now check that the
11410database is still open before making any new calls.
11411
11412- The dbhash module is no more. Use bsddb instead. (There's a third
11413party interface for the BSD 2.x code somewhere on the web; support for
11414bsddb will be deprecated.)
11415
11416- The gdbm module now supports a sync() method.
11417
11418- The socket module now has some new functions: getprotobyname(), and
11419the set {ntoh,hton}{s,l}().
11420
11421- Various modules now export their type object: socket.SocketType,
11422array.ArrayType.
11423
11424- The socket module's accept() method now returns unknown addresses as
11425a tuple rather than raising an exception. (This can happen in
11426promiscuous mode.) Theres' also a new function getprotobyname().
11427
11428- The pthread support for the thread module now works on most platforms.
11429
11430- STDWIN is now officially obsolete. Support for it will eventually
11431be removed from the distribution.
11432
11433- The binascii extension module is now hopefully fully debugged.
11434(XXX Oops -- Fredrik Lundh promised me a uuencode fix that I never
11435received.)
11436
11437- audioop.c: added a ratecv() function; better handling of overflow in
11438add().
11439
11440- posixmodule.c: now exports the O_* flags (O_APPEND etc.). On
11441Windows, also O_TEXT and O_BINARY. The 'error' variable (the
11442exception is raises) is renamed -- its string value is now "os.error",
11443so newbies don't believe they have to import posix (or nt) to catch
11444it when they see os.error reported as posix.error. The execve()
11445function now accepts any mapping object for the environment.
11446
11447- A new version of the al (audio library) module for SGI was
11448contributed by Sjoerd Mullender.
11449
11450- The regex module has a new function get_syntax() which retrieves the
11451syntax setting set by set_syntax(). The code was also sanitized,
11452removing worries about unclean error handling. See also below for its
11453successor, re.py.
11454
11455- The "new" module (which creates new objects of various types) once
11456again has a fully functioning new.function() method. Dangerous as
11457ever! Also, new.code() has several new arguments.
11458
11459- A problem has been fixed in the rotor module: on systems with signed
11460characters, rotor-encoded data was not portable when the key contained
114618-bit characters. Also, setkey() now requires its argument rather
11462than having broken code to default it.
11463
11464- The sys.builtin_module_names variable is now a tuple. Another new
11465variables in sys is sys.executable (the full path to the Python
11466binary, if known).
11467
11468- The specs for time.strftime() have undergone some revisions. It
11469appears that not all format characters are supported in the same way
11470on all platforms. Rather than reimplement it, we note these
11471differences in the documentation, and emphasize the shared set of
11472features. There's also a thorough test set (that occasionally finds
11473problems in the C library implementation, e.g. on some Linuxes),
11474thanks to Skip Montanaro.
11475
11476- The nis module seems broken when used with NIS+; unfortunately
11477nobody knows how to fix it. It should still work with old NIS.
11478
11479
11480New library modules
11481-------------------
11482
11483- New (still experimental) Perl-style regular expression module,
11484re.py, which uses a new interface for matching as well as a new
11485syntax; the new interface avoids the thread-unsafety of the regex
11486interface. This comes with a helper extension reopmodule.c and vastly
11487rewritten regexpr.c. Most work on this was done by Jeffrey Ollie, Tim
11488Peters, and Andrew Kuchling. See the documentation libre.tex. In
114891.5, the old regex module is still fully supported; in the future, it
11490will become obsolete.
11491
11492- New module gzip.py; see zlib above.
11493
11494- New module keyword.py exports knowledge about Python's built-in
11495keywords. (New version by Ka-Ping Yee.)
11496
11497- New module pprint.py (with documentation) which supports
11498pretty-printing of lists, tuples, & dictionaries recursively. By Fred
11499Drake.
11500
11501- New module code.py. The function code.compile_command() can
11502determine whether an interactively entered command is complete or not,
11503distinguishing incomplete from invalid input. (XXX Unfortunately,
11504this seems broken at this moment, and I don't have the time to fix
11505it. It's probably better to add an explicit interface to the parser
11506for this.)
11507
11508- There is now a library module xdrlib.py which can read and write the
11509XDR data format as used by Sun RPC, for example. It uses the struct
11510module.
11511
11512
11513Changes in library modules
11514--------------------------
11515
11516- Module codehack.py is now completely obsolete.
11517
11518- The pickle.py module has been updated to make it compatible with the
11519new binary format that cPickle.c produces. By default it produces the
11520old all-ASCII format compatible with the old pickle.py, still much
11521faster than pickle.py; it will read both formats automatically. A few
11522other updates have been made.
11523
11524- A new helper module, copy_reg.py, is provided to register extensions
11525to the pickling code.
11526
11527- Revamped module tokenize.py is much more accurate and has an
11528interface that makes it a breeze to write code to colorize Python
11529source code. Contributed by Ka-Ping Yee.
11530
11531- In ihooks.py, ModuleLoader.load_module() now closes the file under
11532all circumstances.
11533
11534- The tempfile.py module has a new class, TemporaryFile, which creates
11535an open temporary file that will be deleted automatically when
11536closed. This works on Windows and MacOS as well as on Unix. (Jim
11537Fulton.)
11538
11539- Changes to the cgi.py module: Most imports are now done at the
11540top of the module, which provides a speedup when using ni (Jim
11541Fulton). The problem with file upload to a Windows platform is solved
11542by using the new tempfile.TemporaryFile class; temporary files are now
11543always opened in binary mode (Jim Fulton). The cgi.escape() function
11544now takes an optional flag argument that quotes '"' to '&quot;'. It
11545is now possible to invoke cgi.py from a command line script, to test
11546cgi scripts more easily outside an http server. There's an optional
11547limit to the size of uploads to POST (Skip Montanaro). Added a
11548'strict_parsing' option to all parsing functions (Jim Fulton). The
11549function parse_qs() now uses urllib.unquote() on the name as well as
11550the value of fields (Clarence Gardner). The FieldStorage class now
11551has a __len__() method.
11552
11553- httplib.py: the socket object is no longer closed; all HTTP/1.*
11554responses are now accepted; and it is now thread-safe (by not using
11555the regex module).
11556
11557- BaseHTTPModule.py: treat all HTTP/1.* versions the same.
11558
11559- The popen2.py module is now rewritten using a class, which makes
11560access to the standard error stream and the process id of the
11561subprocess possible.
11562
11563- Added timezone support to the rfc822.py module, in the form of a
11564getdate_tz() method and a parsedate_tz() function; also a mktime_tz().
11565Also added recognition of some non-standard date formats, by Lars
11566Wirzenius, and RFC 850 dates (Chris Lawrence).
11567
11568- mhlib.py: various enhancements, including almost compatible parsing
11569of message sequence specifiers without invoking a subprocess. Also
11570added a createmessage() method by Lars Wirzenius.
11571
11572- The StringIO.StringIO class now supports readline(nbytes). (Lars
11573Wirzenius.) (Of course, you should be using cStringIO for performance.)
11574
11575- UserDict.py supports the new dictionary methods as well.
11576
11577- Improvements for whrandom.py by Tim Peters: use 32-bit arithmetic to
11578speed it up, and replace 0 seed values by 1 to avoid degeneration.
11579A bug was fixed in the test for invalid arguments.
11580
11581- Module ftplib.py: added support for parsing a .netrc file (Fred
11582Drake). Also added an ntransfercmd() method to the FTP class, which
11583allows access to the expected size of a transfer when available, and a
11584parse150() function to the module which parses the corresponding 150
11585response.
11586
11587- urllib.py: the ftp cache is now limited to 10 entries. Added
11588quote_plus() and unquote_plus() functions which are like quote() and
11589unquote() but also replace spaces with '+' or vice versa, for
11590encoding/decoding CGI form arguments. Catch all errors from the ftp
11591module. HTTP requests now add the Host: header line. The proxy
11592variable names are now mapped to lower case, for Windows. The
11593spliturl() function no longer erroneously throws away all data past
11594the first newline. The basejoin() function now intereprets "../"
11595correctly. I *believe* that the problems with "exception raised in
11596__del__" under certain circumstances have been fixed (mostly by
11597changes elsewher in the interpreter).
11598
11599- In urlparse.py, there is a cache for results in urlparse.urlparse();
11600its size limit is set to 20. Also, new URL schemes shttp, https, and
11601snews are "supported".
11602
11603- shelve.py: use cPickle and cStringIO when available. Also added
11604a sync() method, which calls the database's sync() method if there is
11605one.
11606
11607- The mimetools.py module now uses the available Python modules for
11608decoding quoted-printable, uuencode and base64 formats, rather than
11609creating a subprocess.
11610
11611- The python debugger (pdb.py, and its base class bdb.py) now support
11612conditional breakpoints. See the docs.
11613
11614- The modules base64.py, uu.py and quopri.py can now be used as simple
11615command line utilities.
11616
11617- Various small fixes to the nntplib.py module that I can't bother to
11618document in detail.
11619
11620- Sjoerd Mullender's mimify.py module now supports base64 encoding and
11621includes functions to handle the funny encoding you sometimes see in mail
11622headers. It is now documented.
11623
11624- mailbox.py: Added BabylMailbox. Improved the way the mailbox is
11625gotten from the environment.
11626
11627- Many more modules now correctly open files in binary mode when this
11628is necessary on non-Unix platforms.
11629
11630- The copying functions in the undocumented module shutil.py are
11631smarter.
11632
11633- The Writer classes in the formatter.py module now have a flush()
11634method.
11635
11636- The sgmllib.py module accepts hyphens and periods in the middle of
11637attribute names. While this is against the SGML standard, there is
11638some HTML out there that uses this...
11639
11640- The interface for the Python bytecode disassembler module, dis.py,
11641has been enhanced quite a bit. There's now one main function,
11642dis.dis(), which takes almost any kind of object (function, module,
11643class, instance, method, code object) and disassembles it; without
11644arguments it disassembles the last frame of the last traceback. The
11645other functions have changed slightly, too.
11646
11647- The imghdr.py module recognizes new image types: BMP, PNG.
11648
11649- The string.py module has a new function replace(str, old, new,
11650[maxsplit]) which does substring replacements. It is actually
11651implemented in C in the strop module. The functions [r]find() an
11652[r]index() have an optional 4th argument indicating the end of the
11653substring to search, alsoo implemented by their strop counterparts.
11654(Remember, never import strop -- import string uses strop when
11655available with zero overhead.)
11656
11657- The string.join() function now accepts any sequence argument, not
11658just lists and tuples.
11659
11660- The string.maketrans() requires its first two arguments to be
11661present. The old version didn't require them, but there's not much
11662point without them, and the documentation suggests that they are
11663required, so we fixed the code to match the documentation.
11664
11665- The regsub.py module has a function clear_cache(), which clears its
11666internal cache of compiled regular expressions. Also, the cache now
11667takes the current syntax setting into account. (However, this module
11668is now obsolete -- use the sub() or subn() functions or methods in the
11669re module.)
11670
11671- The undocumented module Complex.py has been removed, now that Python
11672has built-in complex numbers. A similar module remains as
11673Demo/classes/Complex.py, as an example.
11674
11675
11676Changes to the build process
11677----------------------------
11678
11679- The way GNU readline is configured is totally different. The
11680--with-readline configure option is gone. It is now an extension
11681module, which may be loaded dynamically. You must enable it (and
Thomas Wouters89f507f2006-12-13 04:49:30 +000011682specify the correct libraries to link with) in the Modules/Setup file.
Guido van Rossum439d1fa1998-12-21 21:41:14 +000011683Importing the module installs some hooks which enable command line
11684editing. When the interpreter shell is invoked interactively, it
11685attempts to import the readline module; when this fails, the default
11686input mechanism is used. The hook variables are PyOS_InputHook and
11687PyOS_ReadlineFunctionPointer. (Code contributed by Lee Busby, with
11688ideas from William Magro.)
11689
11690- New build procedure: a single library, libpython1.5.a, is now built,
11691which contains absolutely everything except for a one-line main()
11692program (which calls Py_Main(argc, argv) to start the interpreter
11693shell). This makes life much simpler for applications that need to
11694embed Python. The serial number of the build is now included in the
11695version string (sys.version).
11696
11697- As far as I can tell, neither gcc -Wall nor the Microsoft compiler
11698emits a single warning any more when compiling Python.
11699
11700- A number of new Makefile variables have been added for special
11701situations, e.g. LDLAST is appended to the link command. These are
11702used by editing the Makefile or passing them on the make command
11703line.
11704
11705- A set of patches from Lee Busby has been integrated that make it
11706possible to catch floating point exceptions. Use the configure option
11707--with-fpectl to enable the patches; the extension modules fpectl and
11708fpetest provide control to enable/disable and test the feature,
11709respectively.
11710
11711- The support for shared libraries under AIX is now simpler and more
11712robust. Thanks to Vladimir Marangozov for revamping his own patches!
11713
11714- The Modules/makesetup script now reads a file Setup.local as well as
11715a file Setup. Most changes to the Setup script can be done by editing
11716Setup.local instead, which makes it easier to carry a particular setup
11717over from one release to the next.
11718
11719- The Modules/makesetup script now copies any "include" lines it
11720encounters verbatim into the output Makefile. It also recognizes .cxx
11721and .cpp as C++ source files.
11722
11723- The configure script is smarter about C compiler options; e.g. with
11724gcc it uses -O2 and -g when possible, and on some other platforms it
11725uses -Olimit 1500 to avoid a warning from the optimizer about the main
11726loop in ceval.c (which has more than 1000 basic blocks).
11727
11728- The configure script now detects whether malloc(0) returns a NULL
11729pointer or a valid block (of length zero). This avoids the nonsense
11730of always adding one byte to all malloc() arguments on most platforms.
11731
11732- The configure script has a new option, --with-dec-threads, to enable
11733DEC threads on DEC Alpha platforms. Also, --with-threads is now an
11734alias for --with-thread (this was the Most Common Typo in configure
11735arguments).
11736
11737- Many changes in Doc/Makefile; amongst others, latex2html is now used
11738to generate HTML from all latex documents.
11739
11740
11741Change to the Python/C API
11742--------------------------
11743
11744- Because some interfaces have changed, the PYTHON_API macro has been
11745bumped. Most extensions built for the old API version will still run,
11746but I can't guarantee this. Python prints a warning message on
11747version mismatches; it dumps core when the version mismatch causes a
11748serious problem :-)
11749
11750- I've completed the Grand Renaming, with the help of Roger Masse and
11751Barry Warsaw. This makes reading or debugging the code much easier.
11752Many other unrelated code reorganizations have also been carried out.
11753The allobjects.h header file is gone; instead, you would have to
11754include Python.h followed by rename2.h. But you're better off running
11755Tools/scripts/fixcid.py -s Misc/RENAME on your source, so you can omit
11756the rename2.h; it will disappear in the next release.
11757
11758- Various and sundry small bugs in the "abstract" interfaces have been
11759fixed. Thanks to all the (involuntary) testers of the Python 1.4
11760version! Some new functions have been added, e.g. PySequence_List(o),
11761equivalent to list(o) in Python.
11762
11763- New API functions PyLong_FromUnsignedLong() and
11764PyLong_AsUnsignedLong().
11765
11766- The API functions in the file cgensupport.c are no longer
11767supported. This file has been moved to Modules and is only ever
11768compiled when the SGI specific 'gl' module is built.
11769
11770- PyObject_Compare() can now raise an exception. Check with
11771PyErr_Occurred(). The comparison function in an object type may also
11772raise an exception.
11773
11774- The slice interface uses an upper bound of INT_MAX when no explicit
11775upper bound is given (e.x. for a[1:]). It used to ask the object for
11776its length and do the calculations.
11777
11778- Support for multiple independent interpreters. See Doc/api.tex,
11779functions Py_NewInterpreter() and Py_EndInterpreter(). Since the
11780documentation is incomplete, also see the new Demo/pysvr example
11781(which shows how to use these in a threaded application) and the
11782source code.
11783
11784- There is now a Py_Finalize() function which "de-initializes"
11785Python. It is possible to completely restart the interpreter
11786repeatedly by calling Py_Finalize() followed by Py_Initialize(). A
11787change of functionality in Py_Initialize() means that it is now a
11788fatal error to call it while the interpreter is already initialized.
11789The old, half-hearted Py_Cleanup() routine is gone. Use of Py_Exit()
11790is deprecated (it is nothing more than Py_Finalize() followed by
11791exit()).
11792
11793- There are no known memory leaks left. While Py_Finalize() doesn't
11794free *all* allocated memory (some of it is hard to track down),
11795repeated calls to Py_Finalize() and Py_Initialize() do not create
11796unaccessible heap blocks.
11797
11798- There is now explicit per-thread state. (Inspired by, but not the
11799same as, Greg Stein's free threading patches.)
11800
11801- There is now better support for threading C applications. There are
11802now explicit APIs to manipulate the interpreter lock. Read the source
11803or the Demo/pysvr example; the new functions are
11804PyEval_{Acquire,Release}{Lock,Thread}().
11805
11806- The test macro DEBUG has changed to Py_DEBUG, to avoid interference
11807with other libraries' DEBUG macros. Likewise for any other test
11808macros that didn't yet start with Py_.
11809
11810- New wrappers around malloc() and friends: Py_Malloc() etc. call
11811malloc() and call PyErr_NoMemory() when it fails; PyMem_Malloc() call
11812just malloc(). Use of these wrappers could be essential if multiple
11813memory allocators exist (e.g. when using certain DLL setups under
11814Windows). (Idea by Jim Fulton.)
11815
11816- New C API PyImport_Import() which uses whatever __import__() hook
11817that is installed for the current execution environment. By Jim
11818Fulton.
11819
11820- It is now possible for an extension module's init function to fail
11821non-fatally, by calling one of the PyErr_* functions and returning.
11822
11823- The PyInt_AS_LONG() and PyFloat_AS_DOUBLE() macros now cast their
11824argument to the proper type, like the similar PyString macros already
11825did. (Suggestion by Marc-Andre Lemburg.) Similar for PyList_GET_SIZE
11826and PyList_GET_ITEM.
11827
11828- Some of the Py_Get* function, like Py_GetVersion() (but not yet
11829Py_GetPath()) are now declared as returning a const char *. (More
11830should follow.)
11831
11832- Changed the run-time library to check for exceptions after object
11833comparisons. PyObject_Compare() can now return an exception; use
11834PyErr_Occurred() to check (there is *no* special return value).
11835
11836- PyFile_WriteString() and Py_Flushline() now return error indicators
11837instead of clearing exceptions. This fixes an obscure bug where using
11838these would clear a pending exception, discovered by Just van Rossum.
11839
11840- There's a new function, PyArg_ParseTupleAndKeywords(), which parses
11841an argument list including keyword arguments. Contributed by Geoff
11842Philbrick.
11843
11844- PyArg_GetInt() is gone.
11845
11846- It's no longer necessary to include graminit.h when calling one of
11847the extended parser API functions. The three public grammar start
11848symbols are now in Python.h as Py_single_input, Py_file_input, and
11849Py_eval_input.
11850
11851- The CObject interface has a new function,
11852PyCObject_Import(module, name). It calls PyCObject_AsVoidPtr()
11853on the object referenced by "module.name".
11854
11855
11856Tkinter
11857-------
11858
11859- On popular demand, _tkinter once again installs a hook for readline
11860that processes certain Tk events while waiting for the user to type
11861(using PyOS_InputHook).
11862
11863- A patch by Craig McPheeters plugs the most obnoxious memory leaks,
11864caused by command definitions referencing widget objects beyond their
11865lifetime.
11866
11867- New standard dialog modules: tkColorChooser.py, tkCommonDialog.py,
11868tkMessageBox.py, tkFileDialog.py, tkSimpleDialog.py These interface
11869with the new Tk dialog scripts, and provide more "native platform"
11870style file selection dialog boxes on some platforms. Contributed by
11871Fredrik Lundh.
11872
11873- Tkinter.py: when the first Tk object is destroyed, it sets the
11874hiddel global _default_root to None, so that when another Tk object is
11875created it becomes the new default root. Other miscellaneous
11876changes and fixes.
11877
11878- The Image class now has a configure method.
11879
11880- Added a bunch of new winfo options to Tkinter.py; we should now be
11881up to date with Tk 4.2. The new winfo options supported are:
11882mananger, pointerx, pointerxy, pointery, server, viewable, visualid,
11883visualsavailable.
11884
11885- The broken bind() method on Canvas objects defined in the Canvas.py
11886module has been fixed. The CanvasItem and Group classes now also have
11887an unbind() method.
11888
11889- The problem with Tkinter.py falling back to trying to import
11890"tkinter" when "_tkinter" is not found has been fixed -- it no longer
11891tries "tkinter", ever. This makes diagnosing the problem "_tkinter
11892not configured" much easier and will hopefully reduce the newsgroup
11893traffic on this topic.
11894
11895- The ScrolledText module once again supports the 'cnf' parameter, to
11896be compatible with the examples in Mark Lutz' book (I know, I know,
11897too late...)
11898
11899- The _tkinter.c extension module has been revamped. It now support
11900Tk versions 4.1 through 8.0; support for 4.0 has been dropped. It
11901works well under Windows and Mac (with the latest Tk ports to those
11902platforms). It also supports threading -- it is safe for one
11903(Python-created) thread to be blocked in _tkinter.mainloop() while
11904other threads modify widgets. To make the changes visible, those
11905threads must use update_idletasks()method. (The patch for threading
11906in 1.5a3 was broken; in 1.5a4, it is back in a different version,
11907which requires access to the Tcl sources to get it to work -- hence it
11908is disabled by default.)
11909
11910- A bug in _tkinter.c has been fixed, where Split() with a string
11911containing an unmatched '"' could cause an exception or core dump.
11912
11913- Unfortunately, on Windows and Mac, Tk 8.0 no longer supports
11914CreateFileHandler, so _tkinter.createfilehandler is not available on
11915those platforms when using Tk 8.0 or later. I will have to rethink
11916how to interface with Tcl's lower-level event mechanism, or with its
11917channels (which are like Python's file-like objects). Jack Jansen has
11918provided a fix for the Mac, so createfilehandler *is* actually
11919supported there; maybe I can adapt his fix for Windows.
11920
11921
11922Tools and Demos
11923---------------
11924
11925- A new regression test suite is provided, which tests most of the
11926standard and built-in modules. The regression test is run by invoking
11927the script Lib/test/regrtest.py. Barry Warsaw wrote the test harnass;
11928he and Roger Masse contributed most of the new tests.
11929
11930- New tool: faqwiz -- the CGI script that is used to maintain the
11931Python FAQ (http://grail.cnri.reston.va.us/cgi-bin/faqw.py). In
11932Tools/faqwiz.
11933
11934- New tool: webchecker -- a simple extensible web robot that, when
11935aimed at a web server, checks that server for dead links. Available
11936are a command line utility as well as a Tkinter based GUI version. In
11937Tools/webchecker. A simplified version of this program is dissected
11938in my article in O'Reilly's WWW Journal, the issue on Scripting
11939Languages (Vol 2, No 2); Scripting the Web with Python (pp 97-120).
11940Includes a parser for robots.txt files by Skip Montanaro.
11941
11942- New small tools: cvsfiles.py (prints a list of all files under CVS
11943n a particular directory tree), treesync.py (a rather Guido-specific
11944script to synchronize two source trees, one on Windows NT, the other
11945one on Unix under CVS but accessible from the NT box), and logmerge.py
11946(sort a collection of RCS or CVS logs by date). In Tools/scripts.
11947
11948- The freeze script now also works under Windows (NT). Another
11949feature allows the -p option to be pointed at the Python source tree
11950instead of the installation prefix. This was loosely based on part of
11951xfreeze by Sam Rushing and Bill Tutt.
11952
11953- New examples (Demo/extend) that show how to use the generic
11954extension makefile (Misc/Makefile.pre.in).
11955
11956- Tools/scripts/h2py.py now supports C++ comments.
11957
11958- Tools/scripts/pystone.py script is upgraded to version 1.1; there
11959was a bug in version 1.0 (distributed with Python 1.4) that leaked
11960memory. Also, in 1.1, the LOOPS variable is incremented to 10000.
11961
11962- Demo/classes/Rat.py completely rewritten by Sjoerd Mullender.
11963
11964
11965Windows (NT and 95)
11966-------------------
11967
11968- New project files for Developer Studio (Visual C++) 5.0 for Windows
11969NT (the old VC++ 4.2 Makefile is also still supported, but will
11970eventually be withdrawn due to its bulkiness).
11971
11972- See the note on the new module search path in the "Miscellaneous" section
11973above.
11974
11975- Support for Win32s (the 32-bit Windows API under Windows 3.1) is
11976basically withdrawn. If it still works for you, you're lucky.
11977
11978- There's a new extension module, msvcrt.c, which provides various
11979low-level operations defined in the Microsoft Visual C++ Runtime Library.
11980These include locking(), setmode(), get_osfhandle(), set_osfhandle(), and
11981console I/O functions like kbhit(), getch() and putch().
11982
11983- The -u option not only sets the standard I/O streams to unbuffered
11984status, but also sets them in binary mode. (This can also be done
11985using msvcrt.setmode(), by the way.)
11986
11987- The, sys.prefix and sys.exec_prefix variables point to the directory
11988where Python is installed, or to the top of the source tree, if it was run
11989from there.
11990
11991- The various os.path modules (posixpath, ntpath, macpath) now support
11992passing more than two arguments to the join() function, so
11993os.path.join(a, b, c) is the same as os.path.join(a, os.path.join(b,
11994c)).
11995
11996- The ntpath module (normally used as os.path) supports ~ to $HOME
11997expansion in expanduser().
11998
11999- The freeze tool now works on Windows.
12000
12001- See also the Tkinter category for a sad note on
12002_tkinter.createfilehandler().
12003
12004- The truncate() method for file objects now works on Windows.
12005
12006- Py_Initialize() is no longer called when the DLL is loaded. You
12007must call it yourself.
12008
12009- The time module's clock() function now has good precision through
12010the use of the Win32 API QueryPerformanceCounter().
12011
12012- Mark Hammond will release Python 1.5 versions of PythonWin and his
12013other Windows specific code: the win32api extensions, COM/ActiveX
12014support, and the MFC interface.
12015
12016
12017Mac
12018---
12019
12020- As always, the Macintosh port will be done by Jack Jansen. He will
12021make a separate announcement for the Mac specific source code and the
12022binary distribution(s) when these are ready.
12023
12024
12025======================================================================
Guido van Rossuma7925f11994-01-26 10:20:16 +000012026
Guido van Rossumaa253861994-10-06 17:18:57 +000012027
Guido van Rossumc30e95f1996-07-30 18:53:51 +000012028=====================================
Guido van Rossum821a5581997-05-23 04:05:31 +000012029==> Release 1.4 (October 25 1996) <==
12030=====================================
12031
12032(Starting in reverse chronological order:)
12033
12034- Changed disclaimer notice.
12035
12036- Added SHELL=/bin/sh to Misc/Makefile.pre.in -- some Make versions
12037default to the user's login shell.
12038
12039- In Lib/tkinter/Tkinter.py, removed bogus binding of <Delete> in Text
12040widget, and bogus bspace() function.
12041
12042- In Lib/cgi.py, bumped __version__ to 2.0 and restored a truncated
12043paragraph.
12044
12045- Fixed the NT Makefile (PC/vc40.mak) for VC 4.0 to set /MD for all
12046subprojects, and to remove the (broken) experimental NumPy
12047subprojects.
12048
12049- In Lib/py_compile.py, cast mtime to long() so it will work on Mac
12050(where os.stat() returns mtimes as floats.)
12051- Set self.rfile unbuffered (like self.wfile) in SocketServer.py, to
12052fix POST in CGIHTTPServer.py.
12053
12054- Version 2.83 of Misc/python-mode.el for Emacs is included.
12055
12056- In Modules/regexmodule.c, fixed symcomp() to correctly handle a new
12057group starting immediately after a group tag.
12058
12059- In Lib/SocketServer.py, changed the mode for rfile to unbuffered.
12060
12061- In Objects/stringobject.c, fixed the compare function to do the
12062first char comparison in unsigned mode, for consistency with the way
12063other characters are compared by memcmp().
12064
12065- In Lib/tkinter/Tkinter.py, fixed Scale.get() to support floats.
12066
12067- In Lib/urllib.py, fix another case where openedurl wasn't set.
12068
12069(XXX Sorry, the rest is in totally random order. No time to fix it.)
12070
12071- SyntaxError exceptions detected during code generation
12072(e.g. assignment to an expression) now include a line number.
12073
12074- Don't leave trailing / or \ in script directory inserted in front of
12075sys.path.
12076
12077- Added a note to Tools/scripts/classfix.py abouts its historical
12078importance.
12079
12080- Added Misc/Makefile.pre.in, a universal Makefile for extensions
12081built outside the distribution.
12082
12083- Rewritten Misc/faq2html.py, by Ka-Ping Yee.
12084
12085- Install shared modules with mode 555 (needed for performance on some
12086platforms).
12087
12088- Some changes to standard library modules to avoid calling append()
12089with more than one argument -- while supported, this should be
12090outlawed, and I don't want to set a bad example.
12091
12092- bdb.py (and hence pdb.py) supports calling run() with a code object
12093instead of a code string.
12094
12095- Fixed an embarrassing bug cgi.py which prevented correct uploading
12096of binary files from Netscape (which doesn't distinguish between
12097binary and text files). Also added dormant logging support, which
12098makes it easier to debug the cgi module itself.
12099
12100- Added default writer to constructor of NullFormatter class.
12101
12102- Use binary mode for socket.makefile() calls in ftplib.py.
12103
12104- The ihooks module no longer "installs" itself upon import -- this
12105was an experimental feature that helped ironing out some bugs but that
12106slowed down code that imported it without the need to install it
12107(e.g. the rexec module). Also close the file in some cases and add
12108the __file__ attribute to loaded modules.
12109
12110- The test program for mailbox.py is now more useful.
12111
12112- Added getparamnames() to Message class in mimetools.py -- it returns
12113the names of parameters to the content-type header.
12114
12115- Fixed a typo in ni that broke the loop stripping "__." from names.
12116
12117- Fix sys.path[0] for scripts run via pdb.py's new main program.
12118
12119- profile.py can now also run a script, like pdb.
12120
12121- Fix a small bug in pyclbr -- don't add names starting with _ when
12122emulating from ... import *.
12123
12124- Fixed a series of embarrassing typos in rexec's handling of standard
12125I/O redirection. Added some more "safe" built-in modules: cmath,
12126errno, operator.
12127
12128- Fixed embarrassing typo in shelve.py.
12129
12130- Added SliceType and EllipsisType to types.py.
12131
12132- In urllib.py, added handling for error 301 (same as 302); added
12133geturl() method to get the URL after redirection.
12134
12135- Fixed embarrassing typo in xdrlib.py. Also fixed typo in Setup.in
12136for _xdrmodule.c and removed redundant #include from _xdrmodule.c.
12137
12138- Fixed bsddbmodule.c to add binary mode indicator on platforms that
12139have it. This should make it working on Windows NT.
12140
12141- Changed last uses of #ifdef NT to #ifdef MS_WINDOWS or MS_WIN32,
12142whatever applies. Also rationalized some other tests for various MS
12143platforms.
12144
12145- Added the sources for the NT installer script used for Python
121461.4beta3. Not tested with this release, but better than nothing.
12147
12148- A compromise in pickle's defenses against Trojan horses: a
12149user-defined function is now okay where a class is expected. A
12150built-in function is not okay, to prevent pickling something that
12151will execute os.system("rm -f *") when unpickling.
12152
12153- dis.py will print the name of local variables referenced by local
12154load/store/delete instructions.
12155
12156- Improved portability of SimpleHTTPServer module to non-Unix
12157platform.
12158
12159- The thread.h interface adds an extra argument to down_sema(). This
12160only affects other C code that uses thread.c; the Python thread module
12161doesn't use semaphores (which aren't provided on all platforms where
12162Python threads are supported). Note: on NT, this change is not
12163implemented.
12164
12165- Fixed some typos in abstract.h; corrected signature of
12166PyNumber_Coerce, added PyMapping_DelItem. Also fixed a bug in
12167abstract.c's PyObject_CallMethod().
12168
12169- apply(classname, (), {}) now works even if the class has no
12170__init__() method.
12171
12172- Implemented complex remainder and divmod() (these would dump core!).
12173Conversion of complex numbers to int, long int or float now raises an
12174exception, since there is no meaningful way to do it without losing
12175information.
12176
12177- Fixed bug in built-in complex() function which gave the wrong result
12178for two real arguments.
12179
12180- Change the hash algorithm for strings -- the multiplier is now
121811000003 instead of 3, which gives better spread for short strings.
12182
12183- New default path for Windows NT, the registry structure now supports
12184default paths for different install packages. (Mark Hammond -- the
12185next PythonWin release will use this.)
12186
12187- Added more symbols to the python_nt.def file.
12188
12189- When using GNU readline, set rl_readline_name to "python".
12190
12191- The Ellipses built-in name has been renamed to Ellipsis -- this is
12192the correct singular form. Thanks to Ka-Ping Yee, who saved us from
12193eternal embarrassment.
12194
12195- Bumped the PYTHON_API_VERSION to 1006, due to the Ellipses ->
12196Ellipsis name change.
12197
12198- Updated the library reference manual. Added documentation of
12199restricted mode (rexec, Bastion) and the formatter module (for use
12200with the htmllib module). Fixed the documentation of htmllib
12201(finally).
12202
12203- The reference manual is now maintained in FrameMaker.
12204
12205- Upgraded scripts Doc/partparse.py and Doc/texi2html.py.
12206
12207- Slight improvements to Doc/Makefile.
12208
12209- Added fcntl.lockf(). This should be used for Unix file locking
12210instead of the posixfile module; lockf() is more portable.
12211
12212- The getopt module now supports long option names, thanks to Lars
12213Wizenius.
12214
12215- Plenty of changes to Tkinter and Canvas, mostly due to Fred Drake
12216and Nils Fischbeck.
12217
12218- Use more bits of time.time() in whrandom's default seed().
12219
12220- Performance hack for regex module's regs attribute.
12221
12222- Don't close already closed socket in socket module.
12223
12224- Correctly handle separators containing embedded nulls in
12225strop.split, strop.find and strop.rfind. Also added more detail to
12226error message for strop.atoi and friends.
12227
12228- Moved fallback definition for hypot() to Python/hypot.c.
12229
12230- Added fallback definition for strdup, in Python/strdup.c.
12231
12232- Fixed some bugs where a function would return 0 to indicate an error
12233where it should return -1.
12234
12235- Test for error returned by time.localtime(), and rationalized its MS
12236tests.
12237
12238- Added Modules/Setup.local file, which is processed after Setup.
12239
12240- Corrected bug in toplevel Makefile.in -- execution of regen script
12241would not use the right PATH and PYTHONPATH.
12242
12243- Various and sundry NeXT configuration changes (sigh).
12244
12245- Support systems where libreadline needs neither termcap nor curses.
12246
12247- Improved ld_so_aix script and python.exp file (for AIX).
12248
12249- More stringent test for working <stdarg.h> in configure script.
12250
12251- Removed Demo/www subdirectory -- it was totally out of date.
12252
12253- Improved demos and docs for Fred Drake's parser module; fixed one
12254typo in the module itself.
12255
12256
12257=========================================
12258==> Release 1.4beta3 (August 26 1996) <==
12259=========================================
12260
12261
12262(XXX This is less readable that it should. I promise to restructure
12263it for the final 1.4 release.)
12264
12265
12266What's new in 1.4beta3 (since beta2)?
12267-------------------------------------
12268
12269- Name mangling to implement a simple form of class-private variables.
12270A name of the form "__spam" can't easily be used outside the class.
12271(This was added in 1.4beta3, but left out of the 1.4beta3 release
12272message.)
12273
12274- In urllib.urlopen(): HTTP URLs containing user:passwd@host are now
12275handled correctly when using a proxy server.
12276
12277- In ntpath.normpath(): don't truncate to 8+3 format.
12278
12279- In mimetools.choose_boundary(): don't die when getuid() or getpid()
12280aren't defined.
12281
12282- Module urllib: some optimizations to (un)quoting.
12283
12284- New module MimeWriter for writing MIME documents.
12285
12286- More changes to formatter module.
12287
12288- The freeze script works once again and is much more robust (using
12289sys.prefix etc.). It also supports a -o option to specify an
12290output directory.
12291
12292- New module whichdb recognizes dbm, gdbm and bsddb/dbhash files.
12293
12294- The Doc/Makefile targets have been reorganized somewhat to remove the
12295insistence on always generating PostScript.
12296
12297- The texinfo to html filter (Doc/texi2html.py) has been improved somewhat.
12298
12299- "errors.h" has been renamed to "pyerrors.h" to resolve a long-standing
12300name conflict on the Mac.
12301
12302- Linking a module compiled with a different setting for Py_TRACE_REFS now
12303generates a linker error rather than a core dump.
12304
12305- The cgi module has a new convenience function print_exception(), which
12306formats a python exception using HTML. It also fixes a bug in the
12307compatibility code and adds a dubious feature which makes it possible to
12308have two query strings, one in the URL and one in the POST data.
12309
12310- A subtle change in the unpickling of class instances makes it possible
12311to unpickle in restricted execution mode, where the __dict__ attribute is
12312not available (but setattr() is).
12313
12314- Documentation for os.path.splitext() (== posixpath.splitext()) has been
12315cleared up. It splits at the *last* dot.
12316
12317- posixfile locking is now also correctly supported on AIX.
12318
12319- The tempfile module once again honors an initial setting of tmpdir. It
12320now works on Windows, too.
12321
12322- The traceback module has some new functions to extract, format and print
12323the active stack.
12324
12325- Some translation functions in the urllib module have been made a little
12326less sluggish.
12327
12328- The addtag_* methods for Canvas widgets in Tkinter as well as in the
12329separate Canvas class have been fixed so they actually do something
12330meaningful.
12331
12332- A tiny _test() function has been added to Tkinter.py.
12333
12334- A generic Makefile for dynamically loaded modules is provided in the Misc
12335subdirectory (Misc/gMakefile).
12336
12337- A new version of python-mode.el for Emacs is provided. See
12338http://www.python.org/ftp/emacs/pmdetails.html for details. The
12339separate file pyimenu.el is no longer needed, imenu support is folded
12340into python-mode.el.
12341
12342- The configure script can finally correctly find the readline library in a
Walter Dörwaldf0dfc7a2003-10-20 14:01:56 +000012343non-standard location. The LDFLAGS variable is passed on the Makefiles
Guido van Rossum821a5581997-05-23 04:05:31 +000012344from the configure script.
12345
12346- Shared libraries are now installed as programs (i.e. with executable
12347permission). This is required on HP-UX and won't hurt on other systems.
12348
12349- The objc.c module is no longer part of the distribution. Objective-C
12350support may become available as contributed software on the ftp site.
12351
12352- The sybase module is no longer part of the distribution. A much
12353improved sybase module is available as contributed software from the
12354ftp site.
12355
12356- _tkinter is now compatible with Tcl 7.5 / Tk 4.1 patch1 on Windows and
12357Mac (don't use unpatched Tcl/Tk!). The default line in the Setup.in file
12358now links with Tcl 7.5 / Tk 4.1 rather than 7.4/4.0.
12359
12360- In Setup, you can now write "*shared*" instead of "*noconfig*", and you
12361can use *.so and *.sl as shared libraries.
12362
12363- Some more fidgeting for AIX shared libraries.
12364
12365- The mpz module is now compatible with GMP 2.x. (Not tested by me.)
12366(Note -- a complete replacement by Niels Mo"ller, called gpmodule, is
12367available from the contrib directory on the ftp site.)
12368
12369- A warning is written to sys.stderr when a __del__ method raises an
12370exception (formerly, such exceptions were completely ignored).
12371
12372- The configure script now defines HAVE_OLD_CPP if the C preprocessor is
12373incapable of ANSI style token concatenation and stringification.
12374
12375- All source files (except a few platform specific modules) are once again
12376compatible with K&R C compilers as well as ANSI compilers. In particular,
12377ANSI-isms have been removed or made conditional in complexobject.c,
12378getargs.c and operator.c.
12379
12380- The abstract object API has three new functions, PyObject_DelItem,
12381PySequence_DelItem, and PySequence_DelSlice.
12382
12383- The operator module has new functions delitem and delslice, and the
12384functions "or" and "and" are renamed to "or_" and "and_" (since "or" and
12385"and" are reserved words). ("__or__" and "__and__" are unchanged.)
12386
12387- The environment module is no longer supported; putenv() is now a function
12388in posixmodule (also under NT).
12389
12390- Error in filter(<function>, "") has been fixed.
12391
12392- Unrecognized keyword arguments raise TypeError, not KeyError.
12393
12394- Better portability, fewer bugs and memory leaks, fewer compiler warnings,
12395some more documentation.
12396
12397- Bug in float power boundary case (0.0 to the negative integer power)
12398fixed.
12399
12400- The test of negative number to the float power has been moved from the
12401built-in pow() functin to floatobject.c (so complex numbers can yield the
12402correct result).
12403
12404- The bug introduced in beta2 where shared libraries loaded (using
12405dlopen()) from the current directory would fail, has been fixed.
12406
12407- Modules imported as shared libraries now also have a __file__ attribute,
12408giving the filename from which they were loaded. The only modules without
12409a __file__ attribute now are built-in modules.
12410
12411- On the Mac, dynamically loaded modules can end in either ".slb" or
12412".<platform>.slb" where <platform> is either "CFM68K" or "ppc". The ".slb"
12413extension should only be used for "fat" binaries.
12414
12415- C API addition: marshal.c now supports
12416PyMarshal_WriteObjectToString(object).
12417
12418- C API addition: getargs.c now supports
12419PyArg_ParseTupleAndKeywords(args, kwdict, format, kwnames, ...)
12420to parse keyword arguments.
12421
12422- The PC versioning scheme (sys.winver) has changed once again. the
12423version number is now "<digit>.<digit>.<digit>.<apiversion>", where the
12424first three <digit>s are the Python version (e.g. "1.4.0" for Python 1.4,
12425"1.4.1" for Python 1.4.1 -- the beta level is not included) and
12426<apiversion> is the four-digit PYTHON_API_VERSION (currently 1005).
12427
12428- h2py.py accepts whitespace before the # in CPP directives
12429
12430- On Solaris 2.5, it should now be possible to use either Posix threads or
12431Solaris threads (XXX: how do you select which is used???). (Note: the
12432Python pthreads interface doesn't fully support semaphores yet -- anyone
12433care to fix this?)
12434
12435- Thread support should now work on AIX, using either DCE threads or
12436pthreads.
12437
12438- New file Demo/sockets/unicast.py
12439
12440- Working Mac port, with CFM68K support, with Tk 4.1 support (though not
12441both) (XXX)
12442
12443- New project setup for PC port, now compatible with PythonWin, with
12444_tkinter and NumPy support (XXX)
12445
12446- New module site.py (XXX)
12447
12448- New module xdrlib.py and optional support module _xdrmodule.c (XXX)
12449
12450- parser module adapted to new grammar, complete w/ Doc & Demo (XXX)
12451
12452- regen script fixed (XXX)
12453
12454- new machdep subdirectories Lib/{aix3,aix4,next3_3,freebsd2,linux2} (XXX)
12455
12456- testall now also tests math module (XXX)
12457
12458- string.atoi c.s. now raise an exception for an empty input string.
12459
12460- At last, it is no longer necessary to define HAVE_CONFIG_H in order to
12461have config.h included at various places.
12462
12463- Unrecognized keyword arguments now raise TypeError rather than KeyError.
12464
12465- The makesetup script recognizes files with extension .so or .sl as
12466(shared) libraries.
12467
12468- 'access' is no longer a reserved word, and all code related to its
12469implementation is gone (or at least #ifdef'ed out). This should make
12470Python a little speedier too!
12471
12472- Performance enhancements suggested by Sjoerd Mullender. This includes
12473the introduction of two new optional function pointers in type object,
12474getattro and setattro, which are like getattr and setattr but take a
12475string object instead of a C string pointer.
12476
12477- New operations in string module: lstrip(s) and rstrip(s) strip whitespace
12478only on the left or only on the right, A new optional third argument to
12479split() specifies the maximum number of separators honored (so
12480splitfields(s, sep, n) returns a list of at most n+1 elements). (Since
124811.3, splitfields(s, None) is totally equivalent to split(s).)
12482string.capwords() has an optional second argument specifying the
12483separator (which is passed to split()).
12484
12485- regsub.split() has the same addition as string.split(). regsub.splitx(s,
12486sep, maxsep) implements the functionality that was regsub.split(s, 1) in
124871.4beta2 (return a list containing the delimiters as well as the words).
12488
12489- Final touch for AIX loading, rewritten Misc/AIX-NOTES.
12490
12491- In Modules/_tkinter.c, when using Tk 4.1 or higher, use className
12492argument to _tkinter.create() to set Tcl's argv0 variable, so X
12493resources use the right resource class again.
12494
12495- Add #undef fabs to Modules/mathmodule.c for macintosh.
12496
12497- Added some macro renames for AIX in Modules/operator.c.
12498
12499- Removed spurious 'E' from Doc/liberrno.tex.
12500
12501- Got rid of some cruft in Misc/ (dlMakefile, pyimenu.el); added new
12502Misc/gMakefile and new version of Misc/python-mode.el.
12503
12504- Fixed typo in Lib/ntpath.py (islink has "return false" which gives a
12505NameError).
12506
12507- Added missing "from types import *" to Lib/tkinter/Canvas.py.
12508
12509- Added hint about using default args for __init__ to pickle docs.
12510
12511- Corrected typo in Inclide/abstract.h: PySequence_Lenth ->
12512PySequence_Length.
12513
12514- Some improvements to Doc/texi2html.py.
12515
12516- In Python/import.c, Cast unsigned char * in struct _frozen to char *
12517in calls to rds_object().
12518
12519- In doc/ref4.tex, added note about scope of lambda bodies.
12520
12521What's new in 1.4beta2 (since beta1)?
12522-------------------------------------
12523
12524- Portability bug in the md5.h header solved.
12525
12526- The PC build procedure now really works, and sets sys.platform to a
12527meaningful value (a few things were botched in beta 1). Lib/dos_8x3
12528is now a standard part of the distribution (alas).
12529
12530- More improvements to the installation procedure. Typing "make install"
12531now inserts the version number in the pathnames of almost everything
12532installed, and creates the machine dependent modules (FCNTL.py etc.) if not
12533supplied by the distribution. (XXX There's still a problem with the latter
12534because the "regen" script requires that Python is installed. Some manual
12535intervention may still be required.) (This has been fixed in 1.4beta3.)
12536
12537- New modules: errno, operator (XXX).
12538
12539- Changes for use with Numerical Python: builtin function slice() and
12540Ellipses object, and corresponding syntax:
12541
12542 x[lo:hi:stride] == x[slice(lo, hi, stride)]
12543 x[a, ..., z] == x[(a, Ellipses, z)]
12544
Raymond Hettinger565ea5a2004-10-02 11:02:59 +000012545- New documentation for errno and cgi modules.
Guido van Rossum821a5581997-05-23 04:05:31 +000012546
12547- The directory containing the script passed to the interpreter is
12548inserted in from of sys.path; "." is no longer a default path
12549component.
12550
12551- Optional third string argument to string.translate() specifies
12552characters to delete. New function string.maketrans() creates a
12553translation table for translate() or for regex.compile().
12554
12555- Module posix (and hence module os under Unix) now supports putenv().
12556Moreover, module os is enhanced so that if putenv() is supported,
12557assignments to os.environ entries make the appropriate putenv() call.
12558(XXX the putenv() implementation can leak a small amount of memory per
12559call.)
12560
12561- pdb.py can now be invoked from the command line to debug a script:
12562python pdb.py <script> <arg> ...
12563
12564- Much improved parseaddr() in rfc822.
12565
12566- In cgi.py, you can now pass an alternative value for environ to
12567nearly all functions.
12568
12569- You can now assign to instance variables whose name begins and ends
12570with '__'.
12571
12572- New version of Fred Drake's parser module and associates (token,
12573symbol, AST).
12574
12575- New PYTHON_API_VERSION value and .pyc file magic number (again!).
12576
12577- The "complex" internal structure type is now called "Py_complex" to
12578avoid name conflicts.
12579
12580- Numerous small bugs fixed.
12581
12582- Slight pickle speedups.
12583
12584- Some slight speedups suggested by Sjoerd (more coming in 1.4 final).
12585
12586- NeXT portability mods by Bill Bumgarner integrated.
12587
12588- Modules regexmodule.c, bsddbmodule.c and xxmodule.c have been
12589converted to new naming style.
12590
12591
12592What's new in 1.4beta1 (since 1.3)?
12593-----------------------------------
12594
12595- Added sys.platform and sys.exec_platform for Bill Janssen.
12596
12597- Installation has been completely overhauled. "make install" now installs
12598everything, not just the python binary. Installation uses the install-sh
12599script (borrowed from X11) to install each file.
12600
12601- New functions in the posix module: mkfifo, plock, remove (== unlink),
12602and ftruncate. More functions are also available under NT.
12603
12604- New function in the fcntl module: flock.
12605
12606- Shared library support for FreeBSD.
12607
12608- The --with-readline option can now be used without a DIRECTORY argument,
12609for systems where libreadline.* is in one of the standard places. It is
12610also possible for it to be a shared library.
12611
12612- The extension tkinter has been renamed to _tkinter, to avoid confusion
12613with Tkinter.py oncase insensitive file systems. It now supports Tk 4.1 as
12614well as 4.0.
12615
12616- Author's change of address from CWI in Amsterdam, The Netherlands, to
12617CNRI in Reston, VA, USA.
12618
12619- The math.hypot() function is now always available (if it isn't found in
12620the C math library, Python provides its own implementation).
12621
12622- The latex documentation is now compatible with latex2e, thanks to David
12623Ascher.
12624
12625- The expression x**y is now equivalent to pow(x, y).
12626
12627- The indexing expression x[a, b, c] is now equivalent to x[(a, b, c)].
12628
12629- Complex numbers are now supported. Imaginary constants are written with
12630a 'j' or 'J' prefix, general complex numbers can be formed by adding a real
12631part to an imaginary part, like 3+4j. Complex numbers are always stored in
12632floating point form, so this is equivalent to 3.0+4.0j. It is also
12633possible to create complex numbers with the new built-in function
12634complex(re, [im]). For the footprint-conscious, complex number support can
12635be disabled by defining the symbol WITHOUT_COMPLEX.
12636
12637- New built-in function list() is the long-awaited counterpart of tuple().
12638
12639- There's a new "cmath" module which provides the same functions as the
12640"math" library but with complex arguments and results. (There are very
12641good reasons why math.sqrt(-1) still raises an exception -- you have to use
12642cmath.sqrt(-1) to get 1j for an answer.)
12643
12644- The Python.h header file (which is really the same as allobjects.h except
12645it disables support for old style names) now includes several more files,
12646so you have to have fewer #include statements in the average extension.
12647
12648- The NDEBUG symbol is no longer used. Code that used to be dependent on
12649the presence of NDEBUG is now present on the absence of DEBUG. TRACE_REFS
12650and REF_DEBUG have been renamed to Py_TRACE_REFS and Py_REF_DEBUG,
12651respectively. At long last, the source actually compiles and links without
12652errors when this symbol is defined.
12653
12654- Several symbols that didn't follow the new naming scheme have been
12655renamed (usually by adding to rename2.h) to use a Py or _Py prefix. There
12656are no external symbols left without a Py or _Py prefix, not even those
12657defined by sources that were incorporated from elsewhere (regexpr.c,
12658md5c.c). (Macros are a different story...)
12659
12660- There are now typedefs for the structures defined in config.c and
12661frozen.c.
12662
12663- New PYTHON_API_VERSION value and .pyc file magic number.
12664
12665- New module Bastion. (XXX)
12666
12667- Improved performance of StringIO module.
12668
12669- UserList module now supports + and * operators.
12670
12671- The binhex and binascii modules now actually work.
12672
12673- The cgi module has been almost totally rewritten and documented.
12674It now supports file upload and a new data type to handle forms more
12675flexibly.
12676
12677- The formatter module (for use with htmllib) has been overhauled (again).
12678
12679- The ftplib module now supports passive mode and has doc strings.
12680
12681- In (ideally) all places where binary files are read or written, the file
12682is now correctly opened in binary mode ('rb' or 'wb') so the code will work
12683on Mac or PC.
12684
12685- Dummy versions of os.path.expandvars() and expanduser() are now provided
12686on non-Unix platforms.
12687
12688- Module urllib now has two new functions url2pathname and pathname2url
12689which turn local filenames into "file:..." URLs using the same rules as
12690Netscape (why be different). it also supports urlretrieve() with a
12691pathname parameter, and honors the proxy environment variables (http_proxy
12692etc.). The URL parsing has been improved somewhat, too.
12693
12694- Micro improvements to urlparse. Added urlparse.urldefrag() which
12695removes a trailing ``#fragment'' if any.
12696
12697- The mailbox module now supports MH style message delimiters as well.
12698
12699- The mhlib module contains some new functionality: setcontext() to set the
12700current folder and parsesequence() to parse a sequence as commonly passed
12701to MH commands (e.g. 1-10 or last:5).
12702
12703- New module mimify for conversion to and from MIME format of email
12704messages.
12705
12706- Module ni now automatically installs itself when first imported -- this
12707is against the normal rule that modules should define classes and functions
12708but not invoke them, but appears more useful in the case that two
12709different, independent modules want to use ni's features.
12710
12711- Some small performance enhancements in module pickle.
12712
12713- Small interface change to the profile.run*() family of functions -- more
12714sensible handling of return values.
12715
12716- The officially registered Mac creator for Python files is 'Pyth'. This
12717replaces 'PYTH' which was used before but never registered.
12718
12719- Added regsub.capwords(). (XXX)
12720
12721- Added string.capwords(), string.capitalize() and string.translate().
12722(XXX)
12723
12724- Fixed an interface bug in the rexec module: it was impossible to pass a
12725hooks instance to the RExec class. rexec now also supports the dynamic
12726loading of modules from shared libraries. Some other interfaces have been
12727added too.
12728
12729- Module rfc822 now caches the headers in a dictionary for more efficient
12730lookup.
12731
12732- The sgmllib module now understands a limited number of SGML "shorthands"
12733like <A/.../ for <A>...</A>. (It's not clear that this was a good idea...)
12734
12735- The tempfile module actually tries a number of different places to find a
12736usable temporary directory. (This was prompted by certain Linux
12737installations that appear to be missing a /usr/tmp directory.) [A bug in
12738the implementation that would ignore a pre-existing tmpdir global has been
12739fixed in beta3.]
12740
12741- Much improved and enhanved FileDialog module for Tkinter.
12742
12743- Many small changes to Tkinter, to bring it more in line with Tk 4.0 (as
12744well as Tk 4.1).
12745
12746- New socket interfaces include ntohs(), ntohl(), htons(), htonl(), and
12747s.dup(). Sockets now work correctly on Windows. On Windows, the built-in
12748extension is called _socket and a wrapper module win/socket.py provides
12749"makefile()" and "dup()" functionality. On Windows, the select module
12750works only with socket objects.
12751
12752- Bugs in bsddb module fixed (e.g. missing default argument values).
12753
12754- The curses extension now includes <ncurses.h> when available.
12755
12756- The gdbm module now supports opening databases in "fast" mode by
12757specifying 'f' as the second character or the mode string.
12758
12759- new variables sys.prefix and sys.exec_prefix pass corresponding
12760configuration options / Makefile variables to the Python programmer.
12761
12762- The ``new'' module now supports creating new user-defined classes as well
12763as instances thereof.
12764
12765- The soundex module now sports get_soundex() to get the soundex value for an
12766arbitrary string (formerly it would only do soundex-based string
12767comparison) as well as doc strings.
12768
12769- New object type "cobject" to safely wrap void pointers for passing them
12770between various extension modules.
12771
12772- More efficient computation of float**smallint.
12773
12774- The mysterious bug whereby "x.x" (two occurrences of the same
12775one-character name) typed from the commandline would sometimes fail
12776mysteriously.
12777
12778- The initialization of the readline function can now be invoked by a C
12779extension through PyOS_ReadlineInit().
12780
12781- There's now an externally visible pointer PyImport_FrozenModules which
12782can be changed by an embedding application.
12783
12784- The argument parsing functions now support a new format character 'D' to
12785specify complex numbers.
12786
12787- Various memory leaks plugged and bugs fixed.
12788
12789- Improved support for posix threads (now that real implementations are
12790beginning to apepar). Still no fully functioning semaphores.
12791
12792- Some various and sundry improvements and new entries in the Tools
12793directory.
12794
12795
12796=====================================
Guido van Rossumc30e95f1996-07-30 18:53:51 +000012797==> Release 1.3 (13 October 1995) <==
12798=====================================
12799
12800Major change
12801============
12802
12803Two words: Keyword Arguments. See the first section of Chapter 12 of
12804the Tutorial.
12805
12806(The rest of this file is textually the same as the remaining sections
12807of that chapter.)
12808
12809
12810Changes to the WWW and Internet tools
12811=====================================
12812
12813The "htmllib" module has been rewritten in an incompatible fashion.
12814The new version is considerably more complete (HTML 2.0 except forms,
12815but including all ISO-8859-1 entity definitions), and easy to use.
12816Small changes to "sgmllib" have also been made, to better match the
12817tokenization of HTML as recognized by other web tools.
12818
12819A new module "formatter" has been added, for use with the new
12820"htmllib" module.
12821
12822The "urllib"and "httplib" modules have been changed somewhat to allow
12823overriding unknown URL types and to support authentication. They now
12824use "mimetools.Message" instead of "rfc822.Message" to parse headers.
12825The "endrequest()" method has been removed from the HTTP class since
12826it breaks the interaction with some servers.
12827
12828The "rfc822.Message" class has been changed to allow a flag to be
12829passed in that says that the file is unseekable.
12830
12831The "ftplib" module has been fixed to be (hopefully) more robust on
12832Linux.
12833
12834Several new operations that are optionally supported by servers have
12835been added to "nntplib": "xover", "xgtitle", "xpath" and "date".
12836
12837Other Language Changes
12838======================
12839
12840The "raise" statement now takes an optional argument which specifies
12841the traceback to be used when printing the exception's stack trace.
12842This must be a traceback object, such as found in "sys.exc_traceback".
12843When omitted or given as "None", the old behavior (to generate a stack
12844trace entry for the current stack frame) is used.
12845
12846The tokenizer is now more tolerant of alien whitespace. Control-L in
12847the leading whitespace of a line resets the column number to zero,
12848while Control-R just before the end of the line is ignored.
12849
12850Changes to Built-in Operations
12851==============================
12852
12853For file objects, "f.read(0)" and "f.readline(0)" now return an empty
12854string rather than reading an unlimited number of bytes. For the
12855latter, omit the argument altogether or pass a negative value.
12856
12857A new system variable, "sys.platform", has been added. It specifies
12858the current platform, e.g. "sunos5" or "linux1".
12859
12860The built-in functions "input()" and "raw_input()" now use the GNU
12861readline library when it has been configured (formerly, only
12862interactive input to the interpreter itself was read using GNU
12863readline). The GNU readline library provides elaborate line editing
12864and history. The Python debugger ("pdb") is the first beneficiary of
12865this change.
12866
12867Two new built-in functions, "globals()" and "locals()", provide access
12868to dictionaries containming current global and local variables,
12869respectively. (These augment rather than replace "vars()", which
12870returns the current local variables when called without an argument,
12871and a module's global variables when called with an argument of type
12872module.)
12873
12874The built-in function "compile()" now takes a third possible value for
12875the kind of code to be compiled: specifying "'single'" generates code
12876for a single interactive statement, which prints the output of
12877expression statements that evaluate to something else than "None".
12878
12879Library Changes
12880===============
12881
12882There are new module "ni" and "ihooks" that support importing modules
12883with hierarchical names such as "A.B.C". This is enabled by writing
12884"import ni; ni.ni()" at the very top of the main program. These
12885modules are amply documented in the Python source.
12886
12887The module "rexec" has been rewritten (incompatibly) to define a class
12888and to use "ihooks".
12889
12890The "string.split()" and "string.splitfields()" functions are now the
12891same function (the presence or absence of the second argument
12892determines which operation is invoked); similar for "string.join()"
12893and "string.joinfields()".
12894
12895The "Tkinter" module and its helper "Dialog" have been revamped to use
12896keyword arguments. Tk 4.0 is now the standard. A new module
12897"FileDialog" has been added which implements standard file selection
12898dialogs.
12899
12900The optional built-in modules "dbm" and "gdbm" are more coordinated
12901--- their "open()" functions now take the same values for their "flag"
12902argument, and the "flag" and "mode" argument have default values (to
12903open the database for reading only, and to create the database with
12904mode "0666" minuse the umask, respectively). The memory leaks have
12905finally been fixed.
12906
12907A new dbm-like module, "bsddb", has been added, which uses the BSD DB
12908package's hash method.
12909
12910A portable (though slow) dbm-clone, implemented in Python, has been
12911added for systems where none of the above is provided. It is aptly
12912dubbed "dumbdbm".
12913
12914The module "anydbm" provides a unified interface to "bsddb", "gdbm",
12915"dbm", and "dumbdbm", choosing the first one available.
12916
12917A new extension module, "binascii", provides a variety of operations
12918for conversion of text-encoded binary data.
12919
12920There are three new or rewritten companion modules implemented in
12921Python that can encode and decode the most common such formats: "uu"
12922(uuencode), "base64" and "binhex".
12923
12924A module to handle the MIME encoding quoted-printable has also been
12925added: "quopri".
12926
12927The parser module (which provides an interface to the Python parser's
12928abstract syntax trees) has been rewritten (incompatibly) by Fred
12929Drake. It now lets you change the parse tree and compile the result!
12930
12931The \code{syslog} module has been upgraded and documented.
12932
12933Other Changes
12934=============
12935
12936The dynamic module loader recognizes the fact that different filenames
12937point to the same shared library and loads the library only once, so
12938you can have a single shared library that defines multiple modules.
12939(SunOS / SVR4 style shared libraries only.)
12940
12941Jim Fulton's ``abstract object interface'' has been incorporated into
12942the run-time API. For more detailes, read the files
12943"Include/abstract.h" and "Objects/abstract.c".
12944
12945The Macintosh version is much more robust now.
12946
12947Numerous things I have forgotten or that are so obscure no-one will
12948notice them anyway :-)
12949
12950
Guido van Rossumf456b6d1995-01-04 19:20:37 +000012951===================================
Guido van Rossumd462f3d1995-10-09 21:30:37 +000012952==> Release 1.2 (13 April 1995) <==
12953===================================
12954
12955- Changes to Misc/python-mode.el:
12956 - Wrapping and indentation within triple quote strings should work
12957 properly now.
12958 - `Standard' bug reporting mechanism (use C-c C-b)
12959 - py-mark-block was moved to C-c C-m
12960 - C-c C-v shows you the python-mode version
12961 - a basic python-font-lock-keywords has been added for Emacs 19
12962 font-lock colorizations.
12963 - proper interaction with pending-del and del-sel modes.
12964 - New py-electric-colon (:) command for improved outdenting. Also
12965 py-indent-line (TAB) should handle outdented lines better.
12966 - New commands py-outdent-left (C-c C-l) and py-indent-right (C-c C-r)
12967
12968- The Library Reference has been restructured, and many new and
12969existing modules are now documented, in particular the debugger and
12970the profiler, as well as the persistency and the WWW/Internet support
12971modules.
12972
12973- All known bugs have been fixed. For example the pow(2,2,3L) bug on
12974Linux has been fixed. Also the re-entrancy problems with __del__ have
12975been fixed.
12976
12977- All known memory leaks have been fixed.
12978
12979- Phase 2 of the Great Renaming has been executed. The header files
12980now use the new names (PyObject instead of object, etc.). The linker
12981also sees the new names. Most source files still use the old names,
12982by virtue of the rename2.h header file. If you include Python.h, you
12983only see the new names. Dynamically linked modules have to be
12984recompiled. (Phase 3, fixing the rest of the sources, will be
12985executed gradually with the release later versions.)
12986
12987- The hooks for implementing "safe-python" (better called "restricted
12988execution") are in place. Specifically, the import statement is
12989implemented by calling the built-in function __import__, and the
12990built-in names used in a particular scope are taken from the
12991dictionary __builtins__ in that scope's global dictionary. See also
12992the new (unsupported, undocumented) module rexec.py.
12993
12994- The import statement now supports the syntax "import a.b.c" and
12995"from a.b.c import name". No officially supported implementation
12996exists, but one can be prototyped by replacing the built-in __import__
12997function. A proposal by Ken Manheimer is provided as newimp.py.
12998
12999- All machinery used by the import statement (or the built-in
13000__import__ function) is now exposed through the new built-in module
13001"imp" (see the library reference manual). All dynamic loading
13002machinery is moved to the new file importdl.c.
13003
13004- Persistent storage is supported through the use of the modules
13005"pickle" and "shelve" (implemented in Python). There's also a "copy"
13006module implementing deepcopy and normal (shallow) copy operations.
13007See the library reference manual.
13008
13009- Documentation strings for many objects types are accessible through
13010the __doc__ attribute. Modules, classes and functions support special
13011syntax to initialize the __doc__ attribute: if the first statement
13012consists of just a string literal, that string literal becomes the
13013value of the __doc__ attribute. The default __doc__ attribute is
13014None. Documentation strings are also supported for built-in
13015functions, types and modules; however this feature hasn't been widely
13016used yet. See the 'new' module for an example. (Basically, the type
13017object's tp_doc field contains the doc string for the type, and the
130184th member of the methodlist structure contains the doc string for the
13019method.)
13020
13021- The __coerce__ and __cmp__ methods for user-defined classes once
13022again work as expected. As an example, there's a new standard class
13023Complex in the library.
13024
13025- The functions posix.popen() and posix.fdopen() now have an optional
13026third argument to specify the buffer size, and default their second
13027(mode) argument to 'r' -- in analogy to the builtin open() function.
13028The same applies to posixfile.open() and the socket method makefile().
13029
13030- The thread.exit_thread() function now raises SystemExit so that
13031'finally' clauses are honored and a memory leak is plugged.
13032
13033- Improved X11 and Motif support, by Sjoerd Mullender. This extension
13034is being maintained and distributed separately.
13035
13036- Improved support for the Apple Macintosh, in part by Jack Jansen,
13037e.g. interfaces to (a few) resource mananger functions, get/set file
13038type and creator, gestalt, sound manager, speech manager, MacTCP, comm
13039toolbox, and the think C console library. This is being maintained
13040and distributed separately.
13041
13042- Improved version for Windows NT, by Mark Hammond. This is being
13043maintained and distributed separately.
13044
13045- Used autoconf 2.0 to generate the configure script. Adapted
13046configure.in to use the new features in autoconf 2.0.
13047
13048- It now builds on the NeXT without intervention, even on the 3.3
13049Sparc pre-release.
13050
13051- Characters passed to isspace() and friends are masked to nonnegative
13052values.
13053
13054- Correctly compute pow(-3.0, 3).
13055
13056- Fix portability problems with getopt (configure now checks for a
13057non-GNU getopt).
13058
13059- Don't add frozenmain.o to libPython.a.
13060
13061- Exceptions can now be classes. ALl built-in exceptions are still
13062string objects, but this will change in the future.
13063
13064- The socket module exports a long list of socket related symbols.
13065(More built-in modules will export their symbolic constants instead of
13066relying on a separately generated Python module.)
13067
13068- When a module object is deleted, it clears out its own dictionary.
13069This fixes a circularity in the references between functions and
13070their global dictionary.
13071
13072- Changed the error handling by [new]getargs() e.g. for "O&".
13073
13074- Dynamic loading of modules using shared libraries is supported for
13075several new platforms.
13076
13077- Support "O&", "[...]" and "{...}" in mkvalue().
13078
13079- Extension to findmethod(): findmethodinchain() (where a chain is a
13080linked list of methodlist arrays). The calling interface for
13081findmethod() has changed: it now gets a pointer to the (static!)
13082methodlist structure rather than just to the function name -- this
13083saves copying flags etc. into the (short-lived) method object.
13084
13085- The callable() function is now public.
13086
13087- Object types can define a few new operations by setting function
13088pointers in the type object structure: tp_call defines how an object
13089is called, and tp_str defines how an object's str() is computed.
13090
13091
13092===================================
Guido van Rossumf456b6d1995-01-04 19:20:37 +000013093==> Release 1.1.1 (10 Nov 1994) <==
13094===================================
13095
13096This is a pure bugfix release again. See the ChangeLog file for details.
13097
13098One exception: a few new features were added to tkinter.
13099
13100
13101=================================
13102==> Release 1.1 (11 Oct 1994) <==
13103=================================
13104
13105This release adds several new features, improved configuration and
13106portability, and fixes more bugs than I can list here (including some
13107memory leaks).
13108
13109The source compiles and runs out of the box on more platforms than
13110ever -- including Windows NT. Makefiles or projects for a variety of
13111non-UNIX platforms are provided.
13112
13113APOLOGY: some new features are badly documented or not at all. I had
13114the choice -- postpone the new release indefinitely, or release it
13115now, with working code but some undocumented areas. The problem with
13116postponing the release is that people continue to suffer from existing
13117bugs, and send me patches based on the previous release -- which I
13118can't apply directly because my own source has changed. Also, some
13119new modules (like signal) have been ready for release for quite some
13120time, and people are anxiously waiting for them. In the case of
13121signal, the interface is simple enough to figure out without
13122documentation (if you're anxious enough :-). In this case it was not
13123simple to release the module on its own, since it relies on many small
13124patches elsewhere in the source.
13125
13126For most new Python modules, the source code contains comments that
13127explain how to use them. Documentation for the Tk interface, written
13128by Matt Conway, is available as tkinter-doc.tar.gz from the Python
13129home and mirror ftp sites (see Misc/FAQ for ftp addresses). For the
13130new operator overloading facilities, have a look at Demo/classes:
13131Complex.py and Rat.py show how to implement a numeric type without and
13132with __coerce__ method. Also have a look at the end of the Tutorial
13133document (Doc/tut.tex). If you're still confused: use the newsgroup
13134or mailing list.
13135
13136
13137New language features:
13138
13139 - More flexible operator overloading for user-defined classes
13140 (INCOMPATIBLE WITH PREVIOUS VERSIONS!) See end of tutorial.
13141
13142 - Classes can define methods named __getattr__, __setattr__ and
13143 __delattr__ to trap attribute accesses. See end of tutorial.
13144
13145 - Classes can define method __call__ so instances can be called
13146 directly. See end of tutorial.
13147
13148
13149New support facilities:
13150
13151 - The Makefiles (for the base interpreter as well as for extensions)
13152 now support creating dynamically loadable modules if the platform
13153 supports shared libraries.
13154
13155 - Passing the interpreter a .pyc file as script argument will execute
13156 the code in that file. (On the Mac such files can be double-clicked!)
13157
13158 - New Freeze script, to create independently distributable "binaries"
13159 of Python programs -- look in Demo/freeze
13160
13161 - Improved h2py script (in Demo/scripts) follows #includes and
13162 supports macros with one argument
13163
13164 - New module compileall generates .pyc files for all modules in a
13165 directory (tree) without also executing them
13166
13167 - Threads should work on more platforms
13168
13169
13170New built-in modules:
13171
13172 - tkinter (support for Tcl's Tk widget set) is now part of the base
13173 distribution
13174
13175 - signal allows catching or ignoring UNIX signals (unfortunately still
13176 undocumented -- any taker?)
13177
13178 - termios provides portable access to POSIX tty settings
13179
13180 - curses provides an interface to the System V curses library
13181
13182 - syslog provides an interface to the (BSD?) syslog daemon
13183
13184 - 'new' provides interfaces to create new built-in object types
13185 (e.g. modules and functions)
13186
13187 - sybase provides an interface to SYBASE database
13188
13189
13190New/obsolete built-in methods:
13191
13192 - callable(x) tests whether x can be called
13193
13194 - sockets now have a setblocking() method
13195
13196 - sockets no longer have an allowbroadcast() method
13197
13198 - socket methods send() and sendto() return byte count
13199
13200
13201New standard library modules:
13202
13203 - types.py defines standard names for built-in types, e.g. StringType
13204
13205 - urlparse.py parses URLs according to the latest Internet draft
13206
13207 - uu.py does uuencode/uudecode (not the fastest in the world, but
13208 quicker than installing uuencode on a non-UNIX machine :-)
13209
13210 - New, faster and more powerful profile module.py
13211
13212 - mhlib.py provides interface to MH folders and messages
13213
13214
13215New facilities for extension writers (unfortunately still
13216undocumented):
13217
13218 - newgetargs() supports optional arguments and improved error messages
13219
13220 - O!, O& O? formats for getargs allow more versatile type checking of
13221 non-standard types
13222
13223 - can register pending asynchronous callback, to be called the next
13224 time the Python VM begins a new instruction (Py_AddPendingCall)
13225
13226 - can register cleanup routines to be called when Python exits
13227 (Py_AtExit)
13228
13229 - makesetup script understands C++ files in Setup file (use file.C
13230 or file.cc)
13231
13232 - Make variable OPT is passed on to sub-Makefiles
13233
13234 - An init<module>() routine may signal an error by not entering
13235 the module in the module table and raising an exception instead
13236
13237 - For long module names, instead of foobarbletchmodule.c you can
13238 use foobarbletch.c
13239
13240 - getintvalue() and getfloatvalue() try to convert any object
13241 instead of requiring an "intobject" or "floatobject"
13242
13243 - All the [new]getargs() formats that retrieve an integer value
13244 will now also work if a float is passed
13245
13246 - C function listtuple() converts list to tuple, fast
13247
13248 - You should now call sigcheck() instead of intrcheck();
13249 sigcheck() also sets an exception when it returns nonzero
13250
13251
Guido van Rossumaa253861994-10-06 17:18:57 +000013252====================================
13253==> Release 1.0.3 (14 July 1994) <==
13254====================================
13255
13256This release consists entirely of bug fixes to the C sources; see the
13257head of ../ChangeLog for a complete list. Most important bugs fixed:
13258
13259- Sometimes the format operator (string%expr) would drop the last
13260character of the format string
13261
13262- Tokenizer looped when last line did not end in \n
13263
13264- Bug when triple-quoted string ended in quote plus newline
13265
13266- Typo in socketmodule (listen) (== instead of =)
13267
13268- typing vars() at the >>> prompt would cause recursive output
13269
13270
13271==================================
13272==> Release 1.0.2 (4 May 1994) <==
13273==================================
13274
13275Overview of the most visible changes. Bug fixes are not listed. See
13276also ChangeLog.
13277
13278Tokens
13279------
13280
13281* String literals follow Standard C rules: they may be continued on
13282the next line using a backslash; adjacent literals are concatenated
13283at compile time.
13284
13285* A new kind of string literals, surrounded by triple quotes (""" or
13286'''), can be continued on the next line without a backslash.
13287
13288Syntax
13289------
13290
13291* Function arguments may have a default value, e.g. def f(a, b=1);
13292defaults are evaluated at function definition time. This also applies
13293to lambda.
13294
13295* The try-except statement has an optional else clause, which is
13296executed when no exception occurs in the try clause.
13297
13298Interpreter
13299-----------
13300
13301* The result of a statement-level expression is no longer printed,
13302except_ for expressions entered interactively. Consequently, the -k
13303command line option is gone.
13304
13305* The result of the last printed interactive expression is assigned to
13306the variable '_'.
13307
13308* Access to implicit global variables has been speeded up by removing
13309an always-failing dictionary lookup in the dictionary of local
13310variables (mod suggested by Steve Makewski and Tim Peters).
13311
13312* There is a new command line option, -u, to force stdout and stderr
13313to be unbuffered.
13314
13315* Incorporated Steve Majewski's mods to import.c for dynamic loading
13316under AIX.
13317
13318* Fewer chances of dumping core when trying to reload or re-import
13319static built-in, dynamically loaded built-in, or frozen modules.
13320
13321* Loops over sequences now don't ask for the sequence's length when
13322they start, but try to access items 0, 1, 2, and so on until they hit
13323an IndexError. This makes it possible to create classes that generate
13324infinite or indefinite sequences a la Steve Majewski. This affects
13325for loops, the (not) in operator, and the built-in functions filter(),
13326map(), max(), min(), reduce().
13327
13328Changed Built-in operations
13329---------------------------
13330
13331* The '%' operator on strings (printf-style formatting) supports a new
13332feature (adapted from a patch by Donald Beaudry) to allow
13333'%(<key>)<format>' % {...} to take values from a dictionary by name
13334instead of from a tuple by position (see also the new function
13335vars()).
13336
13337* The '%s' formatting operator is changed to accept any type and
13338convert it to a string using str().
13339
13340* Dictionaries with more than 20,000 entries can now be created
13341(thanks to Steve Kirsch).
13342
13343New Built-in Functions
13344----------------------
13345
13346* vars() returns a dictionary containing the local variables; vars(m)
13347returns a dictionary containing the variables of module m. Note:
13348dir(x) is now equivalent to vars(x).keys().
13349
13350Changed Built-in Functions
13351--------------------------
13352
13353* open() has an optional third argument to specify the buffer size: 0
13354for unbuffered, 1 for line buffered, >1 for explicit buffer size, <0
13355for default.
13356
13357* open()'s second argument is now optional; it defaults to "r".
13358
13359* apply() now checks that its second argument is indeed a tuple.
13360
13361New Built-in Modules
13362--------------------
13363
13364Changed Built-in Modules
13365------------------------
13366
13367The thread module no longer supports exit_prog().
13368
13369New Python Modules
13370------------------
13371
13372* Module addpack contains a standard interface to modify sys.path to
13373find optional packages (groups of related modules).
13374
13375* Module urllib contains a number of functions to access
13376World-Wide-Web files specified by their URL.
13377
13378* Module httplib implements the client side of the HTTP protocol used
13379by World-Wide-Web servers.
13380
13381* Module gopherlib implements the client side of the Gopher protocol.
13382
13383* Module mailbox (by Jack Jansen) contains a parser for UNIX and MMDF
13384style mailbox files.
13385
13386* Module random contains various random distributions, e.g. gauss().
13387
13388* Module lockfile locks and unlocks open files using fcntl (inspired
13389by a similar module by Andy Bensky).
13390
13391* Module ntpath (by Jaap Vermeulen) implements path operations for
13392Windows/NT.
13393
13394* Module test_thread (in Lib/test) contains a small test set for the
13395thread module.
13396
13397Changed Python Modules
13398----------------------
13399
13400* The string module's expandvars() function is now documented and is
13401implemented in Python (using regular expressions) instead of forking
13402off a shell process.
13403
13404* Module rfc822 now supports accessing the header fields using the
13405mapping/dictionary interface, e.g. h['subject'].
13406
13407* Module pdb now makes it possible to set a break on a function
13408(syntax: break <expression>, where <expression> yields a function
13409object).
13410
13411Changed Demos
13412-------------
13413
13414* The Demo/scripts/freeze.py script is working again (thanks to Jaap
13415Vermeulen).
13416
13417New Demos
13418---------
13419
13420* Demo/threads/Generator.py is a proposed interface for restartable
13421functions a la Tim Peters.
13422
13423* Demo/scripts/newslist.py, by Quentin Stafford-Fraser, generates a
13424directory full of HTML pages which between them contain links to all
13425the newsgroups available on your server.
13426
13427* Demo/dns contains a DNS (Domain Name Server) client.
13428
13429* Demo/lutz contains miscellaneous demos by Mark Lutz (e.g. psh.py, a
13430nice enhanced Python shell!!!).
13431
13432* Demo/turing contains a Turing machine by Amrit Prem.
13433
13434Documentation
13435-------------
13436
13437* Documented new language features mentioned above (but not all new
13438modules).
13439
13440* Added a chapter to the Tutorial describing recent additions to
13441Python.
13442
13443* Clarified some sentences in the reference manual,
13444e.g. break/continue, local/global scope, slice assignment.
13445
13446Source Structure
13447----------------
13448
13449* Moved Include/tokenizer.h to Parser/tokenizer.h.
13450
13451* Added Python/getopt.c for systems that don't have it.
13452
13453Emacs mode
13454----------
13455
13456* Indentation of continuated lines is done more intelligently;
13457consequently the variable py-continuation-offset is gone.
13458
Guido van Rossumf2eac992000-09-04 17:24:24 +000013459
Guido van Rossumaa253861994-10-06 17:18:57 +000013460========================================
13461==> Release 1.0.1 (15 February 1994) <==
13462========================================
13463
13464* Many portability fixes should make it painless to build Python on
13465several new platforms, e.g. NeXT, SEQUENT, WATCOM, DOS, and Windows.
13466
13467* Fixed test for <stdarg.h> -- this broke on some platforms.
13468
13469* Fixed test for shared library dynalic loading -- this broke on SunOS
134704.x using the GNU loader.
13471
13472* Changed order and number of SVR4 networking libraries (it is now
13473-lsocket -linet -lnsl, if these libraries exist).
13474
13475* Installing the build intermediate stages with "make libainstall" now
13476also installs config.c.in, Setup and makesetup, which are used by the
13477new Extensions mechanism.
13478
13479* Improved README file contains more hints and new troubleshooting
13480section.
13481
13482* The built-in module strop now defines fast versions of three more
13483functions of the standard string module: atoi(), atol() and atof().
13484The strop versions of atoi() and atol() support an optional second
13485argument to specify the base (default 10). NOTE: you don't have to
13486explicitly import strop to use the faster versions -- the string
13487module contains code to let versions from stop override the default
13488versions.
13489
13490* There is now a working Lib/dospath.py for those who use Python under
13491DOS (or Windows). Thanks, Jaap!
13492
13493* There is now a working Modules/dosmodule.c for DOS (or Windows)
13494system calls.
13495
13496* Lib.os.py has been reorganized (making it ready for more operating
13497systems).
13498
13499* Lib/ospath.py is now obsolete (use os.path instead).
13500
13501* Many fixes to the tutorial to make it match Python 1.0. Thanks,
13502Tim!
13503
13504* Fixed Doc/Makefile, Doc/README and various scripts there.
13505
13506* Added missing description of fdopen to Doc/libposix.tex.
13507
13508* Made cleanup() global, for the benefit of embedded applications.
13509
13510* Added parsing of addresses and dates to Lib/rfc822.py.
13511
13512* Small fixes to Lib/aifc.py, Lib/sunau.py, Lib/tzparse.py to make
13513them usable at all.
13514
13515* New module Lib/wave.py reads RIFF (*.wav) audio files.
13516
13517* Module Lib/filewin.py moved to Lib/stdwin/filewin.py where it
13518belongs.
13519
13520* New options and comments for Modules/makesetup (used by new
13521Extension mechanism).
13522
13523* Misc/HYPE contains text of announcement of 1.0.0 in comp.lang.misc
13524and elsewhere.
13525
13526* Fixed coredump in filter(None, 'abcdefg').
13527
13528
13529=======================================
13530==> Release 1.0.0 (26 January 1994) <==
13531=======================================
13532
13533As is traditional, so many things have changed that I can't pretend to
13534be complete in these release notes, but I'll try anyway :-)
13535
13536Note that the very last section is labeled "remaining bugs".
13537
13538
13539Source organization and build process
13540-------------------------------------
13541
13542* The sources have finally been split: instead of a single src
13543subdirectory there are now separate directories Include, Parser,
13544Grammar, Objects, Python and Modules. Other directories also start
13545with a capital letter: Misc, Doc, Lib, Demo.
13546
13547* A few extensions (notably Amoeba and X support) have been moved to a
13548separate subtree Extensions, which is no longer in the core
13549distribution, but separately ftp'able as extensions.tar.Z. (The
13550distribution contains a placeholder Ext-dummy with a description of
13551the Extensions subtree as well as the most recent versions of the
13552scripts used there.)
13553
13554* A few large specialized demos (SGI video and www) have been
13555moved to a separate subdirectory Demo2, which is no longer in the core
13556distribution, but separately ftp'able as demo2.tar.Z.
13557
13558* Parts of the standard library have been moved to subdirectories:
13559there are now standard subdirectories stdwin, test, sgi and sun4.
13560
13561* The configuration process has radically changed: I now use GNU
13562autoconf. This makes it much easier to build on new Unix flavors, as
13563well as fully supporting VPATH (if your Make has it). The scripts
13564Configure.py and Addmodule.sh are no longer needed. Many source files
13565have been adapted in order to work with the symbols that the configure
13566script generated by autoconf defines (or not); the resulting source is
13567much more portable to different C compilers and operating systems,
13568even non Unix systems (a Mac port was done in an afternoon). See the
13569toplevel README file for a description of the new build process.
13570
13571* GNU readline (a slightly newer version) is now a subdirectory of the
13572Python toplevel. It is still not automatically configured (being
13573totally autoconf-unaware :-). One problem has been solved: typing
13574Control-C to a readline prompt will now work. The distribution no
13575longer contains a "super-level" directory (above the python toplevel
13576directory), and dl, dl-dld and GNU dld are no longer part of the
13577Python distribution (you can still ftp them from
13578ftp.cwi.nl:/pub/dynload).
13579
13580* The DOS functions have been taken out of posixmodule.c and moved
13581into a separate file dosmodule.c.
13582
13583* There's now a separate file version.c which contains nothing but
13584the version number.
13585
13586* The actual main program is now contained in config.c (unless NO_MAIN
13587is defined); pythonmain.c now contains a function realmain() which is
13588called from config.c's main().
13589
13590* All files needed to use the built-in module md5 are now contained in
13591the distribution. The module has been cleaned up considerably.
13592
13593
13594Documentation
13595-------------
13596
13597* The library manual has been split into many more small latex files,
13598so it is easier to edit Doc/lib.tex file to create a custom library
13599manual, describing only those modules supported on your system. (This
13600is not automated though.)
13601
13602* A fourth manual has been added, titled "Extending and Embedding the
13603Python Interpreter" (Doc/ext.tex), which collects information about
13604the interpreter which was previously spread over several files in the
13605misc subdirectory.
13606
13607* The entire documentation is now also available on-line for those who
13608have a WWW browser (e.g. NCSA Mosaic). Point your browser to the URL
13609"http://www.cwi.nl/~guido/Python.html".
13610
13611
13612Syntax
13613------
13614
13615* Strings may now be enclosed in double quotes as well as in single
13616quotes. There is no difference in interpretation. The repr() of
13617string objects will use double quotes if the string contains a single
13618quote and no double quotes. Thanks to Amrit Prem for these changes!
13619
13620* There is a new keyword 'exec'. This replaces the exec() built-in
13621function. If a function contains an exec statement, local variable
13622optimization is not performed for that particular function, thus
13623making assignment to local variables in exec statements less
13624confusing. (As a consequence, os.exec and python.exec have been
13625renamed to execv.)
13626
13627* There is a new keyword 'lambda'. An expression of the form
13628
13629 lambda <parameters> : <expression>
13630
13631yields an anonymous function. This is really only syntactic sugar;
13632you can just as well define a local function using
13633
13634 def some_temporary_name(<parameters>): return <expression>
13635
13636Lambda expressions are particularly useful in combination with map(),
13637filter() and reduce(), described below. Thanks to Amrit Prem for
13638submitting this code (as well as map(), filter(), reduce() and
13639xrange())!
13640
13641
13642Built-in functions
13643------------------
13644
13645* The built-in module containing the built-in functions is called
13646__builtin__ instead of builtin.
13647
13648* New built-in functions map(), filter() and reduce() perform standard
13649functional programming operations (though not lazily):
13650
13651- map(f, seq) returns a new sequence whose items are the items from
13652seq with f() applied to them.
13653
13654- filter(f, seq) returns a subsequence of seq consisting of those
13655items for which f() is true.
13656
13657- reduce(f, seq, initial) returns a value computed as follows:
13658 acc = initial
13659 for item in seq: acc = f(acc, item)
13660 return acc
13661
13662* New function xrange() creates a "range object". Its arguments are
13663the same as those of range(), and when used in a for loop a range
13664objects also behaves identical. The advantage of xrange() over
13665range() is that its representation (if the range contains many
13666elements) is much more compact than that of range(). The disadvantage
13667is that the result cannot be used to initialize a list object or for
13668the "Python idiom" [RED, GREEN, BLUE] = range(3). On some modern
13669architectures, benchmarks have shown that "for i in range(...): ..."
13670actually executes *faster* than "for i in xrange(...): ...", but on
13671memory starved machines like PCs running DOS range(100000) may be just
13672too big to be represented at all...
13673
13674* Built-in function exec() has been replaced by the exec statement --
13675see above.
13676
13677
13678The interpreter
13679---------------
13680
13681* Syntax errors are now not printed to stderr by the parser, but
13682rather the offending line and other relevant information are packed up
13683in the SyntaxError exception argument. When the main loop catches a
13684SyntaxError exception it will print the error in the same format as
13685previously, but at the proper position in the stack traceback.
13686
13687* You can now set a maximum to the number of traceback entries
13688printed by assigning to sys.tracebacklimit. The default is 1000.
13689
13690* The version number in .pyc files has changed yet again.
13691
13692* It is now possible to have a .pyc file without a corresponding .py
13693file. (Warning: this may break existing installations if you have an
13694old .pyc file lingering around somewhere on your module search path
13695without a corresponding .py file, when there is a .py file for a
13696module of the same name further down the path -- the new interpreter
13697will find the first .pyc file and complain about it, while the old
13698interpreter would ignore it and use the .py file further down.)
13699
13700* The list sys.builtin_module_names is now sorted and also contains
13701the names of a few hardwired built-in modules (sys, __main__ and
13702__builtin__).
13703
13704* A module can now find its own name by accessing the global variable
13705__name__. Assigning to this variable essentially renames the module
13706(it should also be stored under a different key in sys.modules).
13707A neat hack follows from this: a module that wants to execute a main
13708program when called as a script no longer needs to compare
13709sys.argv[0]; it can simply do "if __name__ == '__main__': main()".
13710
13711* When an object is printed by the print statement, its implementation
13712of str() is used. This means that classes can define __str__(self) to
13713direct how their instances are printed. This is different from
13714__repr__(self), which should define an unambigous string
13715representation of the instance. (If __str__() is not defined, it
13716defaults to __repr__().)
13717
13718* Functions and code objects can now be compared meaningfully.
13719
13720* On systems supporting SunOS or SVR4 style shared libraries, dynamic
13721loading of modules using shared libraries is automatically configured.
13722Thanks to Bill Jansen and Denis Severson for contributing this change!
13723
13724
13725Built-in objects
13726----------------
13727
13728* File objects have acquired a new method writelines() which is the
13729reverse of readlines(). (It does not actually write lines, just a
13730list of strings, but the symmetry makes the choice of name OK.)
13731
13732
13733Built-in modules
13734----------------
13735
13736* Socket objects no longer support the avail() method. Use the select
13737module instead, or use this function to replace it:
13738
13739 def avail(f):
13740 import select
13741 return f in select.select([f], [], [], 0)[0]
13742
13743* Initialization of stdwin is done differently. It actually modifies
13744sys.argv (taking out the options the X version of stdwin recognizes)
13745the first time it is imported.
13746
13747* A new built-in module parser provides a rudimentary interface to the
13748python parser. Corresponding standard library modules token and symbol
13749defines the numeric values of tokens and non-terminal symbols.
13750
13751* The posix module has aquired new functions setuid(), setgid(),
13752execve(), and exec() has been renamed to execv().
13753
13754* The array module is extended with 8-byte object swaps, the 'i'
13755format character, and a reverse() method. The read() and write()
13756methods are renamed to fromfile() and tofile().
13757
13758* The rotor module has freed of portability bugs. This introduces a
13759backward compatibility problem: strings encoded with the old rotor
13760module can't be decoded by the new version.
13761
13762* For select.select(), a timeout (4th) argument of None means the same
13763as leaving the timeout argument out.
13764
13765* Module strop (and hence standard library module string) has aquired
13766a new function: rindex(). Thanks to Amrit Prem!
13767
13768* Module regex defines a new function symcomp() which uses an extended
13769regular expression syntax: parenthesized subexpressions may be labeled
13770using the form "\(<labelname>...\)", and the group() method can return
13771sub-expressions by name. Thanks to Tracy Tims for these changes!
13772
13773* Multiple threads are now supported on Solaris 2. Thanks to Sjoerd
13774Mullender!
13775
13776
13777Standard library modules
13778------------------------
13779
13780* The library is now split in several subdirectories: all stuff using
13781stdwin is in Lib/stdwin, all SGI specific (or SGI Indigo or GL) stuff
13782is in Lib/sgi, all Sun Sparc specific stuff is in Lib/sun4, and all
13783test modules are in Lib/test. The default module search path will
13784include all relevant subdirectories by default.
13785
13786* Module os now knows about trying to import dos. It defines
13787functions execl(), execle(), execlp() and execvp().
13788
13789* New module dospath (should be attacked by a DOS hacker though).
13790
13791* All modules defining classes now define __init__() constructors
13792instead of init() methods. THIS IS AN INCOMPATIBLE CHANGE!
13793
13794* Some minor changes and bugfixes module ftplib (mostly Steve
13795Majewski's suggestions); the debug() method is renamed to
13796set_debuglevel().
13797
13798* Some new test modules (not run automatically by testall though):
13799test_audioop, test_md5, test_rgbimg, test_select.
13800
13801* Module string now defines rindex() and rfind() in analogy of index()
13802and find(). It also defines atof() and atol() (and corresponding
13803exceptions) in analogy to atoi().
13804
13805* Added help() functions to modules profile and pdb.
13806
13807* The wdb debugger (now in Lib/stdwin) now shows class or instance
13808variables on a double click. Thanks to Sjoerd Mullender!
13809
13810* The (undocumented) module lambda has gone -- you couldn't import it
13811any more, and it was basically more a demo than a library module...
13812
13813
13814Multimedia extensions
13815---------------------
13816
13817* The optional built-in modules audioop and imageop are now standard
13818parts of the interpreter. Thanks to Sjoerd Mullender and Jack Jansen
13819for contributing this code!
13820
13821* There's a new operation in audioop: minmax().
13822
13823* There's a new built-in module called rgbimg which supports portable
13824efficient reading of SGI RCG image files. Thanks also to Paul
13825Haeberli for the original code! (Who will contribute a GIF reader?)
13826
13827* The module aifc is gone -- you should now always use aifc, which has
13828received a facelift.
13829
13830* There's a new module sunau., for reading Sun (and NeXT) audio files.
13831
13832* There's a new module audiodev which provides a uniform interface to
13833(SGI Indigo and Sun Sparc) audio hardware.
13834
13835* There's a new module sndhdr which recognizes various sound files by
13836looking in their header and checking for various magic words.
13837
13838
13839Optimizations
13840-------------
13841
13842* Most optimizations below can be configured by compile-time flags.
13843Thanks to Sjoerd Mullender for submitting these optimizations!
13844
13845* Small integers (default -1..99) are shared -- i.e. if two different
13846functions compute the same value it is possible (but not
13847guaranteed!!!) that they return the same *object*. Python programs
13848can detect this but should *never* rely on it.
13849
13850* Empty tuples (which all compare equal) are shared in the same
13851manner.
13852
13853* Tuples of size up to 20 (default) are put in separate free lists
13854when deallocated.
13855
13856* There is a compile-time option to cache a string's hash function,
13857but this appeared to have a negligeable effect, and as it costs 4
13858bytes per string it is disabled by default.
13859
13860
13861Embedding Python
13862----------------
13863
13864* The initialization interface has been simplified somewhat. You now
13865only call "initall()" to initialize the interpreter.
13866
13867* The previously announced renaming of externally visible identifiers
13868has not been carried out. It will happen in a later release. Sorry.
13869
13870
13871Miscellaneous bugs that have been fixed
13872---------------------------------------
13873
13874* All known portability bugs.
13875
13876* Version 0.9.9 dumped core in <listobject>.sort() which has been
13877fixed. Thanks to Jaap Vermeulen for fixing this and posting the fix
13878on the mailing list while I was away!
13879
13880* Core dump on a format string ending in '%', e.g. in the expression
13881'%' % None.
13882
13883* The array module yielded a bogus result for concatenation (a+b would
13884yield a+a).
13885
13886* Some serious memory leaks in strop.split() and strop.splitfields().
13887
13888* Several problems with the nis module.
13889
13890* Subtle problem when copying a class method from another class
13891through assignment (the method could not be called).
13892
13893
13894Remaining bugs
13895--------------
13896
13897* One problem with 64-bit machines remains -- since .pyc files are
13898portable and use only 4 bytes to represent an integer object, 64-bit
13899integer literals are silently truncated when written into a .pyc file.
13900Work-around: use eval('123456789101112').
13901
13902* The freeze script doesn't work any more. A new and more portable
13903one can probably be cooked up using tricks from Extensions/mkext.py.
13904
13905* The dos support hasn't been tested yet. (Really Soon Now we should
13906have a PC with a working C compiler!)
13907
13908
Guido van Rossuma7925f11994-01-26 10:20:16 +000013909===================================
13910==> Release 0.9.9 (29 Jul 1993) <==
13911===================================
13912
13913I *believe* these are the main user-visible changes in this release,
13914but there may be others. SGI users may scan the {src,lib}/ChangeLog
13915files for improvements of some SGI specific modules, e.g. aifc and
13916cl. Developers of extension modules should also read src/ChangeLog.
13917
13918
13919Naming of C symbols used by the Python interpreter
13920--------------------------------------------------
13921
13922* This is the last release using the current naming conventions. New
13923naming conventions are explained in the file misc/NAMING.
13924Summarizing, all externally visible symbols get (at least) a "Py"
13925prefix, and most functions are renamed to the standard form
13926PyModule_FunctionName.
13927
13928* Writers of extensions are urged to start using the new naming
13929conventions. The next release will use the new naming conventions
13930throughout (it will also have a different source directory
13931structure).
13932
13933* As a result of the preliminary work for the great renaming, many
13934functions that were accidentally global have been made static.
13935
13936
13937BETA X11 support
13938----------------
13939
13940* There are now modules interfacing to the X11 Toolkit Intrinsics, the
13941Athena widgets, and the Motif 1.1 widget set. These are not yet
13942documented except through the examples and README file in the demo/x11
13943directory. It is expected that this interface will be replaced by a
13944more powerful and correct one in the future, which may or may not be
13945backward compatible. In other words, this part of the code is at most
13946BETA level software! (Note: the rest of Python is rock solid as ever!)
13947
13948* I understand that the above may be a bit of a disappointment,
13949however my current schedule does not allow me to change this situation
13950before putting the release out of the door. By releasing it
13951undocumented and buggy, at least some of the (working!) demo programs,
13952like itr (my Internet Talk Radio browser) become available to a larger
13953audience.
13954
13955* There are also modules interfacing to SGI's "Glx" widget (a GL
13956window wrapped in a widget) and to NCSA's "HTML" widget (which can
13957format HyperText Markup Language, the document format used by the
13958World Wide Web).
13959
13960* I've experienced some problems when building the X11 support. In
13961particular, the Xm and Xaw widget sets don't go together, and it
13962appears that using X11R5 is better than using X11R4. Also the threads
13963module and its link time options may spoil things. My own strategy is
13964to build two Python binaries: one for use with X11 and one without
13965it, which can contain a richer set of built-in modules. Don't even
13966*think* of loading the X11 modules dynamically...
13967
13968
13969Environmental changes
13970---------------------
13971
13972* Compiled files (*.pyc files) created by this Python version are
13973incompatible with those created by the previous version. Both
13974versions detect this and silently create a correct version, but it
13975means that it is not a good idea to use the same library directory for
13976an old and a new interpreter, since they will start to "fight" over
13977the *.pyc files...
13978
13979* When a stack trace is printed, the exception is printed last instead
13980of first. This means that if the beginning of the stack trace
13981scrolled out of your window you can still see what exception caused
13982it.
13983
13984* Sometimes interrupting a Python operation does not work because it
13985hangs in a blocking system call. You can now kill the interpreter by
13986interrupting it three times. The second time you interrupt it, a
13987message will be printed telling you that the third interrupt will kill
13988the interpreter. The "sys.exitfunc" feature still makes limited
13989clean-up possible in this case.
13990
13991
13992Changes to the command line interface
13993-------------------------------------
13994
13995* The python usage message is now much more informative.
13996
13997* New option -i enters interactive mode after executing a script --
13998useful for debugging.
13999
14000* New option -k raises an exception when an expression statement
14001yields a value other than None.
14002
14003* For each option there is now also a corresponding environment
14004variable.
14005
14006
14007Using Python as an embedded language
14008------------------------------------
14009
14010* The distribution now contains (some) documentation on the use of
14011Python as an "embedded language" in other applications, as well as a
14012simple example. See the file misc/EMBEDDING and the directory embed/.
14013
14014
14015Speed improvements
14016------------------
14017
14018* Function local variables are now generally stored in an array and
14019accessed using an integer indexing operation, instead of through a
14020dictionary lookup. (This compensates the somewhat slower dictionary
14021lookup caused by the generalization of the dictionary module.)
14022
14023
14024Changes to the syntax
14025---------------------
14026
14027* Continuation lines can now *sometimes* be written without a
14028backslash: if the continuation is contained within nesting (), [] or
14029{} brackets the \ may be omitted. There's a much improved
14030python-mode.el in the misc directory which knows about this as well.
14031
14032* You can no longer use an empty set of parentheses to define a class
14033without base classes. That is, you no longer write this:
14034
14035 class Foo(): # syntax error
14036 ...
14037
14038You must write this instead:
14039
14040 class Foo:
14041 ...
14042
14043This was already the preferred syntax in release 0.9.8 but many
14044people seemed not to have picked it up. There's a Python script that
14045fixes old code: demo/scripts/classfix.py.
14046
14047* There's a new reserved word: "access". The syntax and semantics are
14048still subject of of research and debate (as well as undocumented), but
14049the parser knows about the keyword so you must not use it as a
14050variable, function, or attribute name.
14051
14052
14053Changes to the semantics of the language proper
14054-----------------------------------------------
14055
14056* The following compatibility hack is removed: if a function was
14057defined with two or more arguments, and called with a single argument
14058that was a tuple with just as many arguments, the items of this tuple
14059would be used as the arguments. This is no longer supported.
14060
14061
14062Changes to the semantics of classes and instances
14063-------------------------------------------------
14064
14065* Class variables are now also accessible as instance variables for
14066reading (assignment creates an instance variable which overrides the
14067class variable of the same name though).
14068
14069* If a class attribute is a user-defined function, a new kind of
14070object is returned: an "unbound method". This contains a pointer to
14071the class and can only be called with a first argument which is a
14072member of that class (or a derived class).
14073
14074* If a class defines a method __init__(self, arg1, ...) then this
14075method is called when a class instance is created by the classname()
14076construct. Arguments passed to classname() are passed to the
14077__init__() method. The __init__() methods of base classes are not
14078automatically called; the derived __init__() method must call these if
14079necessary (this was done so the derived __init__() method can choose
14080the call order and arguments for the base __init__() methods).
14081
14082* If a class defines a method __del__(self) then this method is called
14083when an instance of the class is about to be destroyed. This makes it
14084possible to implement clean-up of external resources attached to the
14085instance. As with __init__(), the __del__() methods of base classes
14086are not automatically called. If __del__ manages to store a reference
14087to the object somewhere, its destruction is postponed; when the object
14088is again about to be destroyed its __del__() method will be called
14089again.
14090
14091* Classes may define a method __hash__(self) to allow their instances
14092to be used as dictionary keys. This must return a 32-bit integer.
14093
14094
14095Minor improvements
14096------------------
14097
14098* Function and class objects now know their name (the name given in
14099the 'def' or 'class' statement that created them).
14100
14101* Class instances now know their class name.
14102
14103
14104Additions to built-in operations
14105--------------------------------
14106
14107* The % operator with a string left argument implements formatting
14108similar to sprintf() in C. The right argument is either a single
14109value or a tuple of values. All features of Standard C sprintf() are
14110supported except %p.
14111
14112* Dictionaries now support almost any key type, instead of just
14113strings. (The key type must be an immutable type or must be a class
14114instance where the class defines a method __hash__(), in order to
14115avoid losing track of keys whose value may change.)
14116
14117* Built-in methods are now compared properly: when comparing x.meth1
14118and y.meth2, if x is equal to y and the methods are defined by the
14119same function, x.meth1 compares equal to y.meth2.
14120
14121
14122Additions to built-in functions
14123-------------------------------
14124
14125* str(x) returns a string version of its argument. If the argument is
14126a string it is returned unchanged, otherwise it returns `x`.
14127
14128* repr(x) returns the same as `x`. (Some users found it easier to
14129have this as a function.)
14130
14131* round(x) returns the floating point number x rounded to an whole
14132number, represented as a floating point number. round(x, n) returns x
14133rounded to n digits.
14134
14135* hasattr(x, name) returns true when x has an attribute with the given
14136name.
14137
14138* hash(x) returns a hash code (32-bit integer) of an arbitrary
14139immutable object's value.
14140
14141* id(x) returns a unique identifier (32-bit integer) of an arbitrary
14142object.
14143
14144* compile() compiles a string to a Python code object.
14145
14146* exec() and eval() now support execution of code objects.
14147
14148
14149Changes to the documented part of the library (standard modules)
14150----------------------------------------------------------------
14151
14152* os.path.normpath() (a.k.a. posixpath.normpath()) has been fixed so
14153the border case '/foo/..' returns '/' instead of ''.
14154
14155* A new function string.find() is added with similar semantics to
14156string.index(); however when it does not find the given substring it
14157returns -1 instead of raising string.index_error.
14158
14159
14160Changes to built-in modules
14161---------------------------
14162
14163* New optional module 'array' implements operations on sequences of
14164integers or floating point numbers of a particular size. This is
14165useful to manipulate large numerical arrays or to read and write
14166binary files consisting of numerical data.
14167
14168* Regular expression objects created by module regex now support a new
14169method named group(), which returns one or more \(...\) groups by number.
14170The number of groups is increased from 10 to 100.
14171
14172* Function compile() in module regex now supports an optional mapping
14173argument; a variable casefold is added to the module which can be used
14174as a standard uppercase to lowercase mapping.
14175
14176* Module time now supports many routines that are defined in the
14177Standard C time interface (<time.h>): gmtime(), localtime(),
14178asctime(), ctime(), mktime(), as well as these variables (taken from
14179System V): timezone, altzone, daylight and tzname. (The corresponding
14180functions in the undocumented module calendar have been removed; the
14181undocumented and unfinished module tzparse is now obsolete and will
14182disappear in a future release.)
14183
14184* Module strop (the fast built-in version of standard module string)
14185now uses C's definition of whitespace instead of fixing it to space,
14186tab and newline; in practice this usually means that vertical tab,
14187form feed and return are now also considered whitespace. It exports
14188the string of characters that are considered whitespace as well as the
14189characters that are considered lowercase or uppercase.
14190
14191* Module sys now defines the variable builtin_module_names, a list of
14192names of modules built into the current interpreter (including not
14193yet imported, but excluding two special modules that always have to be
14194defined -- sys and builtin).
14195
14196* Objects created by module sunaudiodev now also support flush() and
14197close() methods.
14198
14199* Socket objects created by module socket now support an optional
14200flags argument for their methods sendto() and recvfrom().
14201
14202* Module marshal now supports dumping to and loading from strings,
14203through the functions dumps() and loads().
14204
14205* Module stdwin now supports some new functionality. You may have to
14206ftp the latest version: ftp.cwi.nl:/pub/stdwin/stdwinforviews.tar.Z.)
14207
14208
14209Bugs fixed
14210----------
14211
14212* Fixed comparison of negative long integers.
14213
14214* The tokenizer no longer botches input lines longer than BUFSIZ.
14215
14216* Fixed several severe memory leaks in module select.
14217
14218* Fixed memory leaks in modules socket and sv.
14219
14220* Fixed memory leak in divmod() for long integers.
14221
14222* Problems with definition of floatsleep() on Suns fixed.
14223
14224* Many portability bugs fixed (and undoubtedly new ones added :-).
14225
14226
14227Changes to the build procedure
14228------------------------------
14229
14230* The Makefile supports some new targets: "make default" and "make
14231all". Both are by normally equivalent to "make python".
14232
14233* The Makefile no longer uses $> since it's not supported by all
14234versions of Make.
14235
14236* The header files now all contain #ifdef constructs designed to make
14237it safe to include the same header file twice, as well as support for
14238inclusion from C++ programs (automatic extern "C" { ... } added).
14239
14240
14241Freezing Python scripts
14242-----------------------
14243
14244* There is now some support for "freezing" a Python script as a
14245stand-alone executable binary file. See the script
14246demo/scripts/freeze.py. It will require some site-specific tailoring
14247of the script to get this working, but is quite worthwhile if you write
14248Python code for other who may not have built and installed Python.
14249
14250
14251MS-DOS
14252------
14253
14254* A new MS-DOS port has been done, using MSC 6.0 (I believe). Thanks,
14255Marcel van der Peijl! This requires fewer compatibility hacks in
14256posixmodule.c. The executable is not yet available but will be soon
14257(check the mailing list).
14258
14259* The default PYTHONPATH has changed.
14260
14261
14262Changes for developers of extension modules
14263-------------------------------------------
14264
14265* Read src/ChangeLog for full details.
14266
14267
14268SGI specific changes
14269--------------------
14270
14271* Read src/ChangeLog for full details.
14272
Guido van Rossumaa253861994-10-06 17:18:57 +000014273
Guido van Rossuma7925f11994-01-26 10:20:16 +000014274==================================
14275==> Release 0.9.8 (9 Jan 1993) <==
14276==================================
14277
14278I claim no completeness here, but I've tried my best to scan the log
14279files throughout my source tree for interesting bits of news. A more
14280complete account of the changes is to be found in the various
14281ChangeLog files. See also "News for release 0.9.7beta" below if you're
14282still using release 0.9.6, and the file HISTORY if you have an even
14283older release.
14284
14285 --Guido
14286
14287
14288Changes to the language proper
14289------------------------------
14290
14291There's only one big change: the conformance checking for function
14292argument lists (of user-defined functions only) is stricter. Earlier,
14293you could get away with the following:
14294
14295 (a) define a function of one argument and call it with any
14296 number of arguments; if the actual argument count wasn't
14297 one, the function would receive a tuple containing the
14298 arguments arguments (an empty tuple if there were none).
14299
14300 (b) define a function of two arguments, and call it with more
14301 than two arguments; if there were more than two arguments,
14302 the second argument would be passed as a tuple containing
14303 the second and further actual arguments.
14304
14305(Note that an argument (formal or actual) that is a tuple is counted as
14306one; these rules don't apply inside such tuples, only at the top level
14307of the argument list.)
14308
14309Case (a) was needed to accommodate variable-length argument lists;
14310there is now an explicit "varargs" feature (precede the last argument
14311with a '*'). Case (b) was needed for compatibility with old class
14312definitions: up to release 0.9.4 a method with more than one argument
14313had to be declared as "def meth(self, (arg1, arg2, ...)): ...".
14314Version 0.9.6 provide better ways to handle both casees, bot provided
14315backward compatibility; version 0.9.8 retracts the compatibility hacks
14316since they also cause confusing behavior if a function is called with
14317the wrong number of arguments.
14318
14319There's a script that helps converting classes that still rely on (b),
14320provided their methods' first argument is called "self":
14321demo/scripts/methfix.py.
14322
14323If this change breaks lots of code you have developed locally, try
14324#defining COMPAT_HACKS in ceval.c.
14325
14326(There's a third compatibility hack, which is the reverse of (a): if a
14327function is defined with two or more arguments, and called with a
14328single argument that is a tuple with just as many arguments, the items
14329of this tuple will be used as the arguments. Although this can (and
14330should!) be done using the built-in function apply() instead, it isn't
14331withdrawn yet.)
14332
14333
14334One minor change: comparing instance methods works like expected, so
14335that if x is an instance of a user-defined class and has a method m,
14336then (x.m==x.m) yields 1.
14337
14338
14339The following was already present in 0.9.7beta, but not explicitly
14340mentioned in the NEWS file: user-defined classes can now define types
14341that behave in almost allrespects like numbers. See
14342demo/classes/Rat.py for a simple example.
14343
14344
14345Changes to the build process
14346----------------------------
14347
14348The Configure.py script and the Makefile has been made somewhat more
14349bullet-proof, after reports of (minor) trouble on certain platforms.
14350
14351There is now a script to patch Makefile and config.c to add a new
14352optional built-in module: Addmodule.sh. Read the script before using!
14353
14354Useing Addmodule.sh, all optional modules can now be configured at
14355compile time using Configure.py, so there are no modules left that
14356require dynamic loading.
14357
14358The Makefile has been fixed to make it easier to use with the VPATH
14359feature of some Make versions (e.g. SunOS).
14360
14361
14362Changes affecting portability
14363-----------------------------
14364
14365Several minor portability problems have been solved, e.g. "malloc.h"
14366has been renamed to "mymalloc.h", "strdup.c" is no longer used, and
14367the system now tolerates malloc(0) returning 0.
14368
14369For dynamic loading on the SGI, Jack Jansen's dl 1.6 is now
14370distributed with Python. This solves several minor problems, in
14371particular scripts invoked using #! can now use dynamic loading.
14372
14373
14374Changes to the interpreter interface
14375------------------------------------
14376
14377On popular demand, there's finally a "profile" feature for interactive
14378use of the interpreter. If the environment variable $PYTHONSTARTUP is
14379set to the name of an existing file, Python statements in this file
14380are executed when the interpreter is started in interactive mode.
14381
14382There is a new clean-up mechanism, complementing try...finally: if you
14383assign a function object to sys.exitfunc, it will be called when
14384Python exits or receives a SIGTERM or SIGHUP signal.
14385
14386The interpreter is now generally assumed to live in
14387/usr/local/bin/python (as opposed to /usr/local/python). The script
14388demo/scripts/fixps.py will update old scripts in place (you can easily
14389modify it to do other similar changes).
14390
14391Most I/O that uses sys.stdin/stdout/stderr will now use any object
14392assigned to those names as long as the object supports readline() or
14393write() methods.
14394
14395The parser stack has been increased to 500 to accommodate more
14396complicated expressions (7 levels used to be the practical maximum,
14397it's now about 38).
14398
14399The limit on the size of the *run-time* stack has completely been
14400removed -- this means that tuple or list displays can contain any
14401number of elements (formerly more than 50 would crash the
14402interpreter).
14403
14404
14405Changes to existing built-in functions and methods
14406--------------------------------------------------
14407
14408The built-in functions int(), long(), float(), oct() and hex() now
14409also apply to class instalces that define corresponding methods
14410(__int__ etc.).
14411
14412
14413New built-in functions
14414----------------------
14415
14416The new functions str() and repr() convert any object to a string.
14417The function repr(x) is in all respects equivalent to `x` -- some
14418people prefer a function for this. The function str(x) does the same
14419except if x is already a string -- then it returns x unchanged
14420(repr(x) adds quotes and escapes "funny" characters as octal escapes).
14421
14422The new function cmp(x, y) returns -1 if x<y, 0 if x==y, 1 if x>y.
14423
14424
14425Changes to general built-in modules
14426-----------------------------------
14427
14428The time module's functions are more general: time() returns a
14429floating point number and sleep() accepts one. Their accuracies
14430depends on the precision of the system clock. Millisleep is no longer
14431needed (although it still exists for now), but millitimer is still
14432needed since on some systems wall clock time is only available with
14433seconds precision, while a source of more precise time exists that
14434isn't synchronized with the wall clock. (On UNIX systems that support
14435the BSD gettimeofday() function, time.time() is as time.millitimer().)
14436
14437The string representation of a file object now includes an address:
14438'<file 'filename', mode 'r' at #######>' where ###### is a hex number
14439(the object's address) to make it unique.
14440
14441New functions added to posix: nice(), setpgrp(), and if your system
14442supports them: setsid(), setpgid(), tcgetpgrp(), tcsetpgrp().
14443
14444Improvements to the socket module: socket objects have new methods
14445getpeername() and getsockname(), and the {get,set}sockopt methods can
14446now get/set any kind of option using strings built with the new struct
14447module. And there's a new function fromfd() which creates a socket
14448object given a file descriptor (useful for servers started by inetd,
14449which have a socket connected to stdin and stdout).
14450
14451
14452Changes to SGI-specific built-in modules
14453----------------------------------------
14454
14455The FORMS library interface (fl) now requires FORMS 2.1a. Some new
14456functions have been added and some bugs have been fixed.
14457
14458Additions to al (audio library interface): added getname(),
14459getdefault() and getminmax().
14460
14461The gl modules doesn't call "foreground()" when initialized (this
14462caused some problems) like it dit in 0.9.7beta (but not before).
14463There's a new gl function 'gversion() which returns a version string.
14464
14465The interface to sv (Indigo video interface) has totally changed.
14466(Sorry, still no documentation, but see the examples in
14467demo/sgi/{sv,video}.)
14468
14469
14470Changes to standard library modules
14471-----------------------------------
14472
14473Most functions in module string are now much faster: they're actually
14474implemented in C. The module containing the C versions is called
14475"strop" but you should still import "string" since strop doesn't
14476provide all the interfaces defined in string (and strop may be renamed
14477to string when it is complete in a future release).
14478
14479string.index() now accepts an optional third argument giving an index
14480where to start searching in the first argument, so you can find second
14481and further occurrences (this is similar to the regular expression
14482functions in regex).
14483
14484The definition of what string.splitfields(anything, '') should return
14485is changed for the last time: it returns a singleton list containing
14486its whole first argument unchanged. This is compatible with
14487regsub.split() which also ignores empty delimiter matches.
14488
14489posixpath, macpath: added dirname() and normpath() (and basename() to
14490macpath).
14491
14492The mainloop module (for use with stdwin) can now demultiplex input
14493from other sources, as long as they can be polled with select().
14494
14495
14496New built-in modules
14497--------------------
14498
14499Module struct defines functions to pack/unpack values to/from strings
14500representing binary values in native byte order.
14501
14502Module strop implements C versions of many functions from string (see
14503above).
14504
14505Optional module fcntl defines interfaces to fcntl() and ioctl() --
14506UNIX only. (Not yet properly documented -- see however src/fcntl.doc.)
14507
14508Optional module mpz defines an interface to an altaernative long
14509integer implementation, the GNU MPZ library.
14510
14511Optional module md5 uses the GNU MPZ library to calculate MD5
14512signatures of strings.
14513
14514There are also optional new modules specific to SGI machines: imageop
14515defines some simple operations to images represented as strings; sv
14516interfaces to the Indigo video board; cl interfaces to the (yet
14517unreleased) compression library.
14518
14519
14520New standard library modules
14521----------------------------
14522
14523(Unfortunately the following modules are not all documented; read the
14524sources to find out more about them!)
14525
14526autotest: run testall without showing any output unless it differs
14527from the expected output
14528
14529bisect: use bisection to insert or find an item in a sorted list
14530
14531colorsys: defines conversions between various color systems (e.g. RGB
14532<-> YUV)
14533
14534nntplib: a client interface to NNTP servers
14535
14536pipes: utility to construct pipeline from templates, e.g. for
14537conversion from one file format to another using several utilities.
14538
14539regsub: contains three functions that are more or less compatible with
14540awk functions of the same name: sub() and gsub() do string
14541substitution, split() splits a string using a regular expression to
14542define how separators are define.
14543
14544test_types: test operations on the built-in types of Python
14545
14546toaiff: convert various audio file formats to AIFF format
14547
14548tzparse: parse the TZ environment parameter (this may be less general
14549than it could be, let me know if you fix it).
14550
14551(Note that the obsolete module "path" no longer exists.)
14552
14553
14554New SGI-specific library modules
14555--------------------------------
14556
14557CL: constants for use with the built-in compression library interface (cl)
14558
14559Queue: a multi-producer, multi-consumer queue class implemented for
14560use with the built-in thread module
14561
14562SOCKET: constants for use with built-in module socket, e.g. to set/get
14563socket options. This is SGI-specific because the constants to be
14564passed are system-dependent. You can generate a version for your own
14565system by running the script demo/scripts/h2py.py with
14566/usr/include/sys/socket.h as input.
14567
Walter Dörwaldf0dfc7a2003-10-20 14:01:56 +000014568cddb: interface to the database used by the CD player
Guido van Rossuma7925f11994-01-26 10:20:16 +000014569
14570torgb: convert various image file types to rgb format (requires pbmplus)
14571
14572
14573New demos
14574---------
14575
14576There's an experimental interface to define Sun RPC clients and
14577servers in demo/rpc.
14578
14579There's a collection of interfaces to WWW, WAIS and Gopher (both
14580Python classes and program providing a user interface) in demo/www.
14581This includes a program texi2html.py which converts texinfo files to
14582HTML files (the format used hy WWW).
14583
14584The ibrowse demo has moved from demo/stdwin/ibrowse to demo/ibrowse.
14585
14586For SGI systems, there's a whole collection of programs and classes
14587that make use of the Indigo video board in demo/sgi/{sv,video}. This
14588represents a significant amount of work that we're giving away!
14589
14590There are demos "rsa" and "md5test" that exercise the mpz and md5
14591modules, respectively. The rsa demo is a complete implementation of
14592the RSA public-key cryptosystem!
14593
14594A bunch of games and examples submitted by Stoffel Erasmus have been
14595included in demo/stoffel.
14596
14597There are miscellaneous new files in some existing demo
14598subdirectories: classes/bitvec.py, scripts/{fixps,methfix}.py,
14599sgi/al/cmpaf.py, sockets/{mcast,gopher}.py.
14600
14601There are also many minor changes to existing files, but I'm too lazy
14602to run a diff and note the differences -- you can do this yourself if
14603you save the old distribution's demos. One highlight: the
14604stdwin/python.py demo is much improved!
14605
14606
14607Changes to the documentation
14608----------------------------
14609
14610The LaTeX source for the library uses different macros to enable it to
14611be converted to texinfo, and from there to INFO or HTML format so it
14612can be browsed as a hypertext. The net result is that you can now
14613read the Python library documentation in Emacs info mode!
14614
14615
14616Changes to the source code that affect C extension writers
14617----------------------------------------------------------
14618
14619The function strdup() no longer exists (it was used only in one places
14620and is somewhat of a a portability problem sice some systems have the
14621same function in their C library.
14622
14623The functions NEW() and RENEW() allocate one spare byte to guard
14624against a NULL return from malloc(0) being taken for an error, but
14625this should not be relied upon.
14626
14627
14628=========================
14629==> Release 0.9.7beta <==
14630=========================
14631
14632
14633Changes to the language proper
14634------------------------------
14635
14636User-defined classes can now implement operations invoked through
14637special syntax, such as x[i] or `x` by defining methods named
14638__getitem__(self, i) or __repr__(self), etc.
14639
14640
14641Changes to the build process
14642----------------------------
14643
14644Instead of extensive manual editing of the Makefile to select
14645compile-time options, you can now run a Configure.py script.
14646The Makefile as distributed builds a minimal interpreter sufficient to
14647run Configure.py. See also misc/BUILD
14648
14649The Makefile now includes more "utility" targets, e.g. install and
14650tags/TAGS
14651
14652Using the provided strtod.c and strtol.c are now separate options, as
14653on the Sun the provided strtod.c dumps core :-(
14654
14655The regex module is now an option chosen by the Makefile, since some
14656(old) C compilers choke on regexpr.c
14657
14658
14659Changes affecting portability
14660-----------------------------
14661
14662You need STDWIN version 0.9.7 (released 30 June 1992) for the stdwin
14663interface
14664
14665Dynamic loading is now supported for Sun (and other non-COFF systems)
14666throug dld-3.2.3, as well as for SGI (a new version of Jack Jansen's
14667DL is out, 1.4)
14668
14669The system-dependent code for the use of the select() system call is
14670moved to one file: myselect.h
14671
14672Thanks to Jaap Vermeulen, the code should now port cleanly to the
14673SEQUENT
14674
14675
14676Changes to the interpreter interface
14677------------------------------------
14678
14679The interpretation of $PYTHONPATH in the environment is different: it
14680is inserted in front of the default path instead of overriding it
14681
14682
14683Changes to existing built-in functions and methods
14684--------------------------------------------------
14685
14686List objects now support an optional argument to their sort() method,
14687which is a comparison function similar to qsort(3) in C
14688
14689File objects now have a method fileno(), used by the new select module
14690(see below)
14691
14692
14693New built-in function
14694---------------------
14695
14696coerce(x, y): take two numbers and return a tuple containing them
14697both converted to a common type
14698
14699
14700Changes to built-in modules
14701---------------------------
14702
14703sys: fixed core dumps in settrace() and setprofile()
14704
14705socket: added socket methods setsockopt() and getsockopt(); and
14706fileno(), used by the new select module (see below)
14707
14708stdwin: added fileno() == connectionnumber(), in support of new module
14709select (see below)
14710
14711posix: added get{eg,eu,g,u}id(); waitpid() is now a separate function.
14712
14713gl: added qgetfd()
14714
14715fl: added several new functions, fixed several obscure bugs, adapted
14716to FORMS 2.1
14717
14718
14719Changes to standard modules
14720---------------------------
14721
14722posixpath: changed implementation of ismount()
14723
14724string: atoi() no longer mistakes leading zero for octal number
14725
14726...
14727
14728
14729New built-in modules
14730--------------------
14731
14732Modules marked "dynamic only" are not configured at compile time but
14733can be loaded dynamically. You need to turn on the DL or DLD option in
14734the Makefile for support dynamic loading of modules (this requires
14735external code).
14736
14737select: interfaces to the BSD select() system call
14738
14739dbm: interfaces to the (new) dbm library (dynamic only)
14740
14741nis: interfaces to some NIS functions (aka yellow pages)
14742
14743thread: limited form of multiple threads (sgi only)
14744
14745audioop: operations useful for audio programs, e.g. u-LAW and ADPCM
14746coding (dynamic only)
14747
14748cd: interface to Indigo SCSI CDROM player audio library (sgi only)
14749
14750jpeg: read files in JPEG format (dynamic only, sgi only; needs
14751external code)
14752
14753imgfile: read SGI image files (dynamic only, sgi only)
14754
14755sunaudiodev: interface to sun's /dev/audio (dynamic only, sun only)
14756
14757sv: interface to Indigo video library (sgi only)
14758
14759pc: a minimal set of MS-DOS interfaces (MS-DOS only)
14760
14761rotor: encryption, by Lance Ellinghouse (dynamic only)
14762
14763
14764New standard modules
14765--------------------
14766
14767Not all these modules are documented. Read the source:
14768lib/<modulename>.py. Sometimes a file lib/<modulename>.doc contains
14769additional documentation.
14770
14771imghdr: recognizes image file headers
14772
14773sndhdr: recognizes sound file headers
14774
14775profile: print run-time statistics of Python code
14776
14777readcd, cdplayer: companion modules for built-in module cd (sgi only)
14778
14779emacs: interface to Emacs using py-connect.el (see below).
14780
14781SOCKET: symbolic constant definitions for socket options
14782
14783SUNAUDIODEV: symbolic constant definitions for sunaudiodef (sun only)
14784
14785SV: symbolic constat definitions for sv (sgi only)
14786
14787CD: symbolic constat definitions for cd (sgi only)
14788
14789
14790New demos
14791---------
14792
14793scripts/pp.py: execute Python as a filter with a Perl-like command
14794line interface
14795
14796classes/: examples using the new class features
14797
14798threads/: examples using the new thread module
14799
14800sgi/cd/: examples using the new cd module
14801
14802
14803Changes to the documentation
14804----------------------------
14805
14806The last-minute syntax changes of release 0.9.6 are now reflected
14807everywhere in the manuals
14808
14809The reference manual has a new section (3.2) on implementing new kinds
14810of numbers, sequences or mappings with user classes
14811
14812Classes are now treated extensively in the tutorial (chapter 9)
14813
14814Slightly restructured the system-dependent chapters of the library
14815manual
14816
14817The file misc/EXTENDING incorporates documentation for mkvalue() and
14818a new section on error handling
14819
14820The files misc/CLASSES and misc/ERRORS are no longer necessary
14821
14822The doc/Makefile now creates PostScript files automatically
14823
14824
14825Miscellaneous changes
14826---------------------
14827
14828Incorporated Tim Peters' changes to python-mode.el, it's now version
148291.06
14830
14831A python/Emacs bridge (provided by Terrence M. Brannon) lets a Python
14832program running in an Emacs buffer execute Emacs lisp code. The
14833necessary Python code is in lib/emacs.py. The Emacs code is
14834misc/py-connect.el (it needs some external Emacs lisp code)
14835
14836
14837Changes to the source code that affect C extension writers
14838----------------------------------------------------------
14839
14840New service function mkvalue() to construct a Python object from C
14841values according to a "format" string a la getargs()
14842
14843Most functions from pythonmain.c moved to new pythonrun.c which is
14844in libpython.a. This should make embedded versions of Python easier
14845
14846ceval.h is split in eval.h (which needs compile.h and only declares
14847eval_code) and ceval.h (which doesn't need compile.hand declares the
14848rest)
14849
14850ceval.h defines macros BGN_SAVE / END_SAVE for use with threads (to
14851improve the parallellism of multi-threaded programs by letting other
14852Python code run when a blocking system call or something similar is
14853made)
14854
14855In structmember.[ch], new member types BYTE, CHAR and unsigned
14856variants have been added
14857
14858New file xxmodule.c is a template for new extension modules.
14859
Guido van Rossumaa253861994-10-06 17:18:57 +000014860
Guido van Rossuma7925f11994-01-26 10:20:16 +000014861==================================
Guido van Rossumf2eac992000-09-04 17:24:24 +000014862==> Release 0.9.6 (6 Apr 1992) <==
Guido van Rossuma7925f11994-01-26 10:20:16 +000014863==================================
14864
14865Misc news in 0.9.6:
14866- Restructured the misc subdirectory
14867- Reference manual completed, library manual much extended (with indexes!)
14868- the GNU Readline library is now distributed standard with Python
14869- the script "../demo/scripts/classfix.py" fixes Python modules using old
14870 class syntax
14871- Emacs python-mode.el (was python.el) vastly improved (thanks, Tim!)
14872- Because of the GNU copyleft business I am not using the GNU regular
14873 expression implementation but a free re-implementation by Tatu Ylonen
14874 that recently appeared in comp.sources.misc (Bravo, Tatu!)
14875
14876New features in 0.9.6:
14877- stricter try stmt syntax: cannot mix except and finally clauses on 1 try
14878- New module 'os' supplants modules 'mac' and 'posix' for most cases;
14879 module 'path' is replaced by 'os.path'
14880- os.path.split() return value differs from that of old path.split()
14881- sys.exc_type, sys.exc_value, sys.exc_traceback are set to the exception
14882 currently being handled
14883- sys.last_type, sys.last_value, sys.last_traceback remember last unhandled
14884 exception
14885- New function string.expandtabs() expands tabs in a string
14886- Added times() interface to posix (user & sys time of process & children)
14887- Added uname() interface to posix (returns OS type, hostname, etc.)
14888- New built-in function execfile() is like exec() but from a file
14889- Functions exec() and eval() are less picky about whitespace/newlines
14890- New built-in functions getattr() and setattr() access arbitrary attributes
14891- More generic argument handling in built-in functions (see "./EXTENDING")
14892- Dynamic loading of modules written in C or C++ (see "./DYNLOAD")
14893- Division and modulo for long and plain integers with negative operands
14894 have changed; a/b is now floor(float(a)/float(b)) and a%b is defined
14895 as a-(a/b)*b. So now the outcome of divmod(a,b) is the same as
14896 (a/b, a%b) for integers. For floats, % is also changed, but of course
14897 / is unchanged, and divmod(x,y) does not yield (x/y, x%y)...
14898- A function with explicit variable-length argument list can be declared
14899 like this: def f(*args): ...; or even like this: def f(a, b, *rest): ...
14900- Code tracing and profiling features have been added, and two source
14901 code debuggers are provided in the library (pdb.py, tty-oriented,
14902 and wdb, window-oriented); you can now step through Python programs!
14903 See sys.settrace() and sys.setprofile(), and "../lib/pdb.doc"
14904- '==' is now the only equality operator; "../demo/scripts/eqfix.py" is
14905 a script that fixes old Python modules
14906- Plain integer right shift now uses sign extension
14907- Long integer shift/mask operations now simulate 2's complement
14908 to give more useful results for negative operands
14909- Changed/added range checks for long/plain integer shifts
14910- Options found after "-c command" are now passed to the command in sys.argv
14911 (note subtle incompatiblity with "python -c command -- -options"!)
14912- Module stdwin is better protected against touching objects after they've
14913 been closed; menus can now also be closed explicitly
14914- Stdwin now uses its own exception (stdwin.error)
14915
14916New features in 0.9.5 (released as Macintosh application only, 2 Jan 1992):
14917- dictionary objects can now be compared properly; e.g., {}=={} is true
14918- new exception SystemExit causes termination if not caught;
14919 it is raised by sys.exit() so that 'finally' clauses can clean up,
14920 and it may even be caught. It does work interactively!
14921- new module "regex" implements GNU Emacs style regular expressions;
14922 module "regexp" is rewritten in Python for backward compatibility
14923- formal parameter lists may contain trailing commas
14924
14925Bugs fixed in 0.9.6:
14926- assigning to or deleting a list item with a negative index dumped core
14927- divmod(-10L,5L) returned (-3L, 5L) instead of (-2L, 0L)
14928
14929Bugs fixed in 0.9.5:
14930- masking operations involving negative long integers gave wrong results
14931
14932
14933===================================
Guido van Rossumf2eac992000-09-04 17:24:24 +000014934==> Release 0.9.4 (24 Dec 1991) <==
Guido van Rossuma7925f11994-01-26 10:20:16 +000014935===================================
14936
14937- new function argument handling (see below)
14938- built-in apply(func, args) means func(args[0], args[1], ...)
14939- new, more refined exceptions
14940- new exception string values (NameError = 'NameError' etc.)
14941- better checking for math exceptions
14942- for sequences (string/tuple/list), x[-i] is now equivalent to x[len(x)-i]
14943- fixed list assignment bug: "a[1:1] = a" now works correctly
14944- new class syntax, without extraneous parentheses
14945- new 'global' statement to assign global variables from within a function
14946
14947
14948New class syntax
14949----------------
14950
14951You can now declare a base class as follows:
14952
14953 class B: # Was: class B():
14954 def some_method(self): ...
14955 ...
14956
14957and a derived class thusly:
14958
14959 class D(B): # Was: class D() = B():
14960 def another_method(self, arg): ...
14961
14962Multiple inheritance looks like this:
14963
14964 class M(B, D): # Was: class M() = B(), D():
14965 def this_or_that_method(self, arg): ...
14966
14967The old syntax is still accepted by Python 0.9.4, but will disappear
14968in Python 1.0 (to be posted to comp.sources).
14969
14970
14971New 'global' statement
14972----------------------
14973
14974Every now and then you have a global variable in a module that you
14975want to change from within a function in that module -- say, a count
14976of calls to a function, or an option flag, etc. Until now this was
14977not directly possible. While several kludges are known that
14978circumvent the problem, and often the need for a global variable can
14979be avoided by rewriting the module as a class, this does not always
14980lead to clearer code.
14981
14982The 'global' statement solves this dilemma. Its occurrence in a
14983function body means that, for the duration of that function, the
14984names listed there refer to global variables. For instance:
14985
14986 total = 0.0
14987 count = 0
14988
14989 def add_to_total(amount):
14990 global total, count
14991 total = total + amount
14992 count = count + 1
14993
14994'global' must be repeated in each function where it is needed. The
14995names listed in a 'global' statement must not be used in the function
14996before the statement is reached.
14997
14998Remember that you don't need to use 'global' if you only want to *use*
14999a global variable in a function; nor do you need ot for assignments to
15000parts of global variables (e.g., list or dictionary items or
15001attributes of class instances). This has not changed; in fact
15002assignment to part of a global variable was the standard workaround.
15003
15004
15005New exceptions
15006--------------
15007
15008Several new exceptions have been defined, to distinguish more clearly
15009between different types of errors.
15010
15011name meaning was
15012
15013AttributeError reference to non-existing attribute NameError
15014IOError unexpected I/O error RuntimeError
15015ImportError import of non-existing module or name NameError
15016IndexError invalid string, tuple or list index RuntimeError
15017KeyError key not in dictionary RuntimeError
15018OverflowError numeric overflow RuntimeError
15019SyntaxError invalid syntax RuntimeError
15020ValueError invalid argument value RuntimeError
15021ZeroDivisionError division by zero RuntimeError
15022
15023The string value of each exception is now its name -- this makes it
15024easier to experimentally find out which operations raise which
15025exceptions; e.g.:
15026
15027 >>> KeyboardInterrupt
15028 'KeyboardInterrupt'
15029 >>>
15030
15031
15032New argument passing semantics
15033------------------------------
15034
15035Off-line discussions with Steve Majewski and Daniel LaLiberte have
15036convinced me that Python's parameter mechanism could be changed in a
15037way that made both of them happy (I hope), kept me happy, fixed a
15038number of outstanding problems, and, given some backward compatibility
15039provisions, would only break a very small amount of existing code --
15040probably all mine anyway. In fact I suspect that most Python users
15041will hardly notice the difference. And yet it has cost me at least
15042one sleepless night to decide to make the change...
15043
15044Philosophically, the change is quite radical (to me, anyway): a
15045function is no longer called with either zero or one argument, which
15046is a tuple if there appear to be more arguments. Every function now
15047has an argument list containing 0, 1 or more arguments. This list is
15048always implemented as a tuple, and it is a (run-time) error if a
15049function is called with a different number of arguments than expected.
15050
15051What's the difference? you may ask. The answer is, very little unless
15052you want to write variadic functions -- functions that may be called
15053with a variable number of arguments. Formerly, you could write a
15054function that accepted one or more arguments with little trouble, but
15055writing a function that could be called with either 0 or 1 argument
15056(or more) was next to impossible. This is now a piece of cake: you
15057can simply declare an argument that receives the entire argument
15058tuple, and check its length -- it will be of size 0 if there are no
15059arguments.
15060
15061Another anomaly of the old system was the way multi-argument methods
15062(in classes) had to be declared, e.g.:
15063
15064 class Point():
15065 def init(self, (x, y, color)): ...
15066 def setcolor(self, color): ...
15067 dev moveto(self, (x, y)): ...
15068 def draw(self): ...
15069
15070Using the new scheme there is no need to enclose the method arguments
15071in an extra set of parentheses, so the above class could become:
15072
15073 class Point:
15074 def init(self, x, y, color): ...
15075 def setcolor(self, color): ...
15076 dev moveto(self, x, y): ...
15077 def draw(self): ...
15078
15079That is, the equivalence rule between methods and functions has
15080changed so that now p.moveto(x,y) is equivalent to Point.moveto(p,x,y)
15081while formerly it was equivalent to Point.moveto(p,(x,y)).
15082
15083A special backward compatibility rule makes that the old version also
15084still works: whenever a function with exactly two arguments (at the top
15085level) is called with more than two arguments, the second and further
15086arguments are packed into a tuple and passed as the second argument.
15087This rule is invoked independently of whether the function is actually a
15088method, so there is a slight chance that some erroneous calls of
15089functions expecting two arguments with more than that number of
15090arguments go undetected at first -- when the function tries to use the
15091second argument it may find it is a tuple instead of what was expected.
15092Note that this rule will be removed from future versions of the
15093language; it is a backward compatibility provision *only*.
15094
15095Two other rules and a new built-in function handle conversion between
15096tuples and argument lists:
15097
15098Rule (a): when a function with more than one argument is called with a
15099single argument that is a tuple of the right size, the tuple's items
15100are used as arguments.
15101
15102Rule (b): when a function with exactly one argument receives no
15103arguments or more than one, that one argument will receive a tuple
15104containing the arguments (the tuple will be empty if there were no
15105arguments).
15106
15107
15108A new built-in function, apply(), was added to support functions that
15109need to call other functions with a constructed argument list. The call
15110
15111 apply(function, tuple)
15112
15113is equivalent to
15114
15115 function(tuple[0], tuple[1], ..., tuple[len(tuple)-1])
15116
15117
15118While no new argument syntax was added in this phase, it would now be
15119quite sensible to add explicit syntax to Python for default argument
15120values (as in C++ or Modula-3), or a "rest" argument to receive the
15121remaining arguments of a variable-length argument list.
15122
15123
15124========================================================
15125==> Release 0.9.3 (never made available outside CWI) <==
15126========================================================
15127
15128- string sys.version shows current version (also printed on interactive entry)
15129- more detailed exceptions, e.g., IOError, ZeroDivisionError, etc.
15130- 'global' statement to declare module-global variables assigned in functions.
15131- new class declaration syntax: class C(Base1, Base2, ...): suite
15132 (the old syntax is still accepted -- be sure to convert your classes now!)
15133- C shifting and masking operators: << >> ~ & ^ | (for ints and longs).
15134- C comparison operators: == != (the old = and <> remain valid).
15135- floating point numbers may now start with a period (e.g., .14).
15136- definition of integer division tightened (always truncates towards zero).
15137- new builtins hex(x), oct(x) return hex/octal string from (long) integer.
15138- new list method l.count(x) returns the number of occurrences of x in l.
15139- new SGI module: al (Indigo and 4D/35 audio library).
15140- the FORMS interface (modules fl and FL) now uses FORMS 2.0
15141- module gl: added lrect{read,write}, rectzoom and pixmode;
15142 added (non-GL) functions (un)packrect.
15143- new socket method: s.allowbroadcast(flag).
15144- many objects support __dict__, __methods__ or __members__.
15145- dir() lists anything that has __dict__.
15146- class attributes are no longer read-only.
15147- classes support __bases__, instances support __class__ (and __dict__).
15148- divmod() now also works for floats.
15149- fixed obscure bug in eval('1 ').
15150
15151
15152===================================
15153==> Release 0.9.2 (Autumn 1991) <==
15154===================================
15155
15156Highlights
15157----------
15158
15159- tutorial now (almost) complete; library reference reorganized
15160- new syntax: continue statement; semicolons; dictionary constructors;
15161 restrictions on blank lines in source files removed
15162- dramatically improved module load time through precompiled modules
15163- arbitrary precision integers: compute 2 to the power 1000 and more...
15164- arithmetic operators now accept mixed type operands, e.g., 3.14/4
15165- more operations on list: remove, index, reverse; repetition
15166- improved/new file operations: readlines, seek, tell, flush, ...
15167- process management added to the posix module: fork/exec/wait/kill etc.
15168- BSD socket operations (with example servers and clients!)
15169- many new STDWIN features (color, fonts, polygons, ...)
15170- new SGI modules: font manager and FORMS library interface
15171
15172
15173Extended list of changes in 0.9.2
15174---------------------------------
15175
15176Here is a summary of the most important user-visible changes in 0.9.2,
15177in somewhat arbitrary order. Changes in later versions are listed in
15178the "highlights" section above.
15179
15180
151811. Changes to the interpreter proper
15182
15183- Simple statements can now be separated by semicolons.
15184 If you write "if t: s1; s2", both s1 and s2 are executed
15185 conditionally.
15186- The 'continue' statement was added, with semantics as in C.
15187- Dictionary displays are now allowed on input: {key: value, ...}.
15188- Blank lines and lines bearing only a comment no longer need to
15189 be indented properly. (A completely empty line still ends a multi-
15190 line statement interactively.)
15191- Mixed arithmetic is supported, 1 compares equal to 1.0, etc.
15192- Option "-c command" to execute statements from the command line
15193- Compiled versions of modules are cached in ".pyc" files, giving a
15194 dramatic improvement of start-up time
15195- Other, smaller speed improvements, e.g., extracting characters from
15196 strings, looking up single-character keys, and looking up global
15197 variables
15198- Interrupting a print operation raises KeyboardInterrupt instead of
15199 only cancelling the print operation
15200- Fixed various portability problems (it now passes gcc with only
15201 warnings -- more Standard C compatibility will be provided in later
15202 versions)
15203- Source is prepared for porting to MS-DOS
15204- Numeric constants are now checked for overflow (this requires
15205 standard-conforming strtol() and strtod() functions; a correct
15206 strtol() implementation is provided, but the strtod() provided
15207 relies on atof() for everything, including error checking
15208
15209
152102. Changes to the built-in types, functions and modules
15211
15212- New module socket: interface to BSD socket primitives
15213- New modules pwd and grp: access the UNIX password and group databases
15214- (SGI only:) New module "fm" interfaces to the SGI IRIX Font Manager
15215- (SGI only:) New module "fl" interfaces to Mark Overmars' FORMS library
15216- New numeric type: long integer, for unlimited precision
15217 - integer constants suffixed with 'L' or 'l' are long integers
15218 - new built-in function long(x) converts int or float to long
15219 - int() and float() now also convert from long integers
15220- New built-in function:
15221 - pow(x, y) returns x to the power y
15222- New operation and methods for lists:
15223 - l*n returns a new list consisting of n concatenated copies of l
15224 - l.remove(x) removes the first occurrence of the value x from l
15225 - l.index(x) returns the index of the first occurrence of x in l
15226 - l.reverse() reverses l in place
15227- New operation for tuples:
15228 - t*n returns a tuple consisting of n concatenated copies of t
15229- Improved file handling:
15230 - f.readline() no longer restricts the line length, is faster,
15231 and isn't confused by null bytes; same for raw_input()
15232 - f.read() without arguments reads the entire (rest of the) file
15233 - mixing of print and sys.stdout.write() has different effect
15234- New methods for files:
15235 - f.readlines() returns a list containing the lines of the file,
15236 as read with f.readline()
15237 - f.flush(), f.tell(), f.seek() call their stdio counterparts
15238 - f.isatty() tests for "tty-ness"
15239- New posix functions:
15240 - _exit(), exec(), fork(), getpid(), getppid(), kill(), wait()
15241 - popen() returns a file object connected to a pipe
15242 - utime() replaces utimes() (the latter is not a POSIX name)
15243- New stdwin features, including:
15244 - font handling
15245 - color drawing
15246 - scroll bars made optional
15247 - polygons
15248 - filled and xor shapes
15249 - text editing objects now have a 'settext' method
15250
15251
152523. Changes to the standard library
15253
15254- Name change: the functions path.cat and macpath.cat are now called
15255 path.join and macpath.join
15256- Added new modules: formatter, mutex, persist, sched, mainloop
15257- Added some modules and functionality to the "widget set" (which is
15258 still under development, so please bear with me):
15259 DirList, FormSplit, TextEdit, WindowSched
15260- Fixed module testall to work non-interactively
15261- Module string:
15262 - added functions join() and joinfields()
15263 - fixed center() to work correct and make it "transitive"
15264- Obsolete modules were removed: util, minmax
15265- Some modules were moved to the demo directory
15266
15267
152684. Changes to the demonstration programs
15269
15270- Added new useful scipts: byteyears, eptags, fact, from, lfact,
15271 objgraph, pdeps, pi, primes, ptags, which
15272- Added a bunch of socket demos
15273- Doubled the speed of ptags
15274- Added new stdwin demos: microedit, miniedit
15275- Added a windowing interface to the Python interpreter: python (most
15276 useful on the Mac)
15277- Added a browser for Emacs info files: demo/stdwin/ibrowse
15278 (yes, I plan to put all STDWIN and Python documentation in texinfo
15279 form in the future)
15280
15281
152825. Other changes to the distribution
15283
15284- An Emacs Lisp file "python.el" is provided to facilitate editing
15285 Python programs in GNU Emacs (slightly improved since posted to
15286 gnu.emacs.sources)
15287- Some info on writing an extension in C is provided
15288- Some info on building Python on non-UNIX platforms is provided
15289
15290
15291=====================================
15292==> Release 0.9.1 (February 1991) <==
15293=====================================
15294
15295- Micro changes only
15296- Added file "patchlevel.h"
15297
15298
15299=====================================
15300==> Release 0.9.0 (February 1991) <==
15301=====================================
15302
15303Original posting to alt.sources.