blob: 7ab7e370760f16709dbc23f652c2ebd7e6301fbf [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
Skip Montanaro7a98be22007-08-16 14:35:24 +00002614- the platform dependent path related variables sep, altsep,
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00002615 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
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00004199- mimetypes.py has optional support for non-standard, but commonly
4200 found types. guess_type() and guess_extension() now accept an
4201 optional 'strict' flag, defaulting to true, which controls whether
4202 recognize non-standard types or not. A few non-standard types we
4203 know about have been added. Also, when run as a script, there are
4204 new -l and -e options.
4205
4206- statcache is now deprecated.
4207
4208- email.Utils.formatdate() now produces the preferred RFC 2822 style
4209 dates with numeric timezones (it used to produce obsolete dates
4210 hard coded to "GMT" timezone). An optional 'localtime' flag is
4211 added to produce dates in the local timezone, with daylight savings
4212 time properly taken into account.
4213
4214- In pickle and cPickle, instead of masking errors in load() by
4215 transforming them into SystemError, we let the original exception
4216 propagate out. Also, implement support for __safe_for_unpickling__
4217 in pickle, as it already was supported in cPickle.
4218
4219Tools/Demos
4220-----------
4221
4222Build
4223-----
4224
4225- The dbm module is built using libdb1 if available. The bsddb module
4226 is built with libdb3 if available.
4227
4228- Misc/Makefile.pre.in has been removed by BDFL pronouncement.
4229
4230C API
4231-----
4232
4233- New function PySequence_Fast_GET_SIZE() returns the size of a non-
4234 NULL result from PySequence_Fast(), more quickly than calling
4235 PySequence_Size().
4236
4237- New argument unpacking function PyArg_UnpackTuple() added.
4238
4239- New functions PyObject_CallFunctionObjArgs() and
4240 PyObject_CallMethodObjArgs() have been added to make it more
4241 convenient and efficient to call functions and methods from C.
4242
4243- PyArg_ParseTupleAndKeywords() no longer masks errors, so it's
4244 possible that this will propagate errors it didn't before.
4245
4246- New function PyObject_CheckReadBuffer(), which returns true if its
4247 argument supports the single-segment readable buffer interface.
4248
4249New platforms
4250-------------
4251
4252- We've finally confirmed that this release builds on HP-UX 11.00,
4253 *with* threads, and passes the test suite.
4254
4255- Thanks to a series of patches from Michael Muller, Python may build
4256 again under OS/2 Visual Age C++.
4257
4258- Updated RISCOS port by Dietmar Schwertberger.
4259
4260Tests
4261-----
4262
4263- Added a test script for the curses module. It isn't run automatically;
4264 regrtest.py must be run with '-u curses' to enable it.
4265
4266Windows
4267-------
4268
4269Mac
4270----
4271
4272- PythonScript has been moved to unsupported and is slated to be
4273 removed completely in the next release.
4274
4275- It should now be possible to build applets that work on both OS9 and
4276 OSX.
4277
4278- The core is now linked with CoreServices not Carbon; as a side
4279 result, default 8bit encoding on OSX is now ASCII.
4280
4281- Python should now build on OSX 10.1.1
4282
4283
4284What's New in Python 2.2b1?
4285===========================
4286
4287*Release date: 19-Oct-2001*
4288
4289Type/class unification and new-style classes
4290--------------------------------------------
4291
4292- New-style classes are now always dynamic (except for built-in and
4293 extension types). There is no longer a performance penalty, and I
4294 no longer see another reason to keep this baggage around. One relic
4295 remains: the __dict__ of a new-style class is a read-only proxy; you
4296 must set the class's attribute to modify it. As a consequence, the
4297 __defined__ attribute of new-style types no longer exists, for lack
4298 of need: there is once again only one __dict__ (although in the
4299 future a __cache__ may be resurrected with a similar function, if I
4300 can prove that it actually speeds things up).
4301
4302- C.__doc__ now works as expected for new-style classes (in 2.2a4 it
4303 always returned None, even when there was a class docstring).
4304
4305- doctest now finds and runs docstrings attached to new-style classes,
4306 class methods, static methods, and properties.
4307
4308Core and builtins
4309-----------------
4310
4311- A very subtle syntactical pitfall in list comprehensions was fixed.
4312 For example: [a+b for a in 'abc', for b in 'def']. The comma in
4313 this example is a mistake. Previously, this would silently let 'a'
4314 iterate over the singleton tuple ('abc',), yielding ['abcd', 'abce',
4315 'abcf'] rather than the intended ['ad', 'ae', 'af', 'bd', 'be',
4316 'bf', 'cd', 'ce', 'cf']. Now, this is flagged as a syntax error.
4317 Note that [a for a in <singleton>] is a convoluted way to say
4318 [<singleton>] anyway, so it's not like any expressiveness is lost.
4319
4320- getattr(obj, name, default) now only catches AttributeError, as
4321 documented, rather than returning the default value for all
4322 exceptions (which could mask bugs in a __getattr__ hook, for
4323 example).
4324
4325- Weak reference objects are now part of the core and offer a C API.
4326 A bug which could allow a core dump when binary operations involved
4327 proxy reference has been fixed. weakref.ReferenceError is now a
4328 built-in exception.
4329
4330- unicode(obj) now behaves more like str(obj), accepting arbitrary
4331 objects, and calling a __unicode__ method if it exists.
4332 unicode(obj, encoding) and unicode(obj, encoding, errors) still
4333 require an 8-bit string or character buffer argument.
4334
4335- isinstance() now allows any object as the first argument and a
4336 class, a type or something with a __bases__ tuple attribute for the
4337 second argument. The second argument may also be a tuple of a
4338 class, type, or something with __bases__, in which case isinstance()
4339 will return true if the first argument is an instance of any of the
4340 things contained in the second argument tuple. E.g.
4341
4342 isinstance(x, (A, B))
4343
4344 returns true if x is an instance of A or B.
4345
4346Extension modules
4347-----------------
4348
4349- thread.start_new_thread() now returns the thread ID (previously None).
4350
4351- binascii has now two quopri support functions, a2b_qp and b2a_qp.
4352
4353- readline now supports setting the startup_hook and the
4354 pre_event_hook, and adds the add_history() function.
4355
4356- os and posix supports chroot(), setgroups() and unsetenv() where
4357 available. The stat(), fstat(), statvfs() and fstatvfs() functions
4358 now return "pseudo-sequences" -- the various fields can now be
4359 accessed as attributes (e.g. os.stat("/").st_mtime) but for
4360 backwards compatibility they also behave as a fixed-length sequence.
4361 Some platform-specific fields (e.g. st_rdev) are only accessible as
4362 attributes.
4363
4364- time: localtime(), gmtime() and strptime() now return a
4365 pseudo-sequence similar to the os.stat() return value, with
4366 attributes like tm_year etc.
4367
4368- Decompression objects in the zlib module now accept an optional
4369 second parameter to decompress() that specifies the maximum amount
4370 of memory to use for the uncompressed data.
4371
4372- optional SSL support in the socket module now exports OpenSSL
4373 functions RAND_add(), RAND_egd(), and RAND_status(). These calls
4374 are useful on platforms like Solaris where OpenSSL does not
4375 automatically seed its PRNG. Also, the keyfile and certfile
4376 arguments to socket.ssl() are now optional.
4377
4378- posixmodule (and by extension, the os module on POSIX platforms) now
4379 exports O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW.
4380
4381Library
4382-------
4383
4384- doctest now excludes functions and classes not defined by the module
4385 being tested, thanks to Tim Hochberg.
4386
4387- HotShot, a new profiler implemented using a C-based callback, has
4388 been added. This substantially reduces the overhead of profiling,
4389 but it is still quite preliminary. Support modules and
4390 documentation will be added in upcoming releases (before 2.2 final).
4391
4392- profile now produces correct output in situations where an exception
4393 raised in Python is cleared by C code (e.g. hasattr()). This used
4394 to cause wrong output, including spurious claims of recursive
4395 functions and attribution of time spent to the wrong function.
4396
4397 The code and documentation for the derived OldProfile and HotProfile
4398 profiling classes was removed. The code hasn't worked for years (if
4399 you tried to use them, they raised exceptions). OldProfile
4400 intended to reproduce the behavior of the profiler Python used more
4401 than 7 years ago, and isn't interesting anymore. HotProfile intended
4402 to provide a faster profiler (but producing less information), and
4403 that's a worthy goal we intend to meet via a different approach (but
4404 without losing information).
4405
4406- Profile.calibrate() has a new implementation that should deliver
4407 a much better system-specific calibration constant. The constant can
4408 now be specified in an instance constructor, or as a Profile class or
4409 instance variable, instead of by editing profile.py's source code.
4410 Calibration must still be done manually (see the docs for the profile
4411 module).
4412
4413 Note that Profile.calibrate() must be overridden by subclasses.
4414 Improving the accuracy required exploiting detailed knowledge of
4415 profiler internals; the earlier method abstracted away the details
4416 and measured a simplified model instead, but consequently computed
4417 a constant too small by a factor of 2 on some modern machines.
4418
4419- quopri's encode and decode methods take an optional header parameter,
4420 which indicates whether output is intended for the header 'Q'
4421 encoding.
4422
4423- The SocketServer.ThreadingMixIn class now closes the request after
4424 finish_request() returns. (Not when it errors out though.)
4425
4426- The nntplib module's NNTP.body() method has grown a 'file' argument
4427 to allow saving the message body to a file.
4428
4429- The email package has added a class email.Parser.HeaderParser which
4430 only parses headers and does not recurse into the message's body.
4431 Also, the module/class MIMEAudio has been added for representing
4432 audio data (contributed by Anthony Baxter).
4433
4434- ftplib should be able to handle files > 2GB.
4435
4436- ConfigParser.getboolean() now also interprets TRUE, FALSE, YES, NO,
4437 ON, and OFF.
4438
4439- xml.dom.minidom NodeList objects now support the length attribute
4440 and item() method as required by the DOM specifications.
4441
4442Tools/Demos
4443-----------
4444
4445- Demo/dns was removed. It no longer serves any purpose; a package
4446 derived from it is now maintained by Anthony Baxter, see
4447 http://PyDNS.SourceForge.net.
4448
4449- The freeze tool has been made more robust, and two new options have
4450 been added: -X and -E.
4451
4452Build
4453-----
4454
4455- configure will use CXX in LINKCC if CXX is used to build main() and
4456 the system requires to link a C++ main using the C++ compiler.
4457
4458C API
4459-----
4460
4461- The documentation for the tp_compare slot is updated to require that
4462 the return value must be -1, 0, 1; an arbitrary number <0 or >0 is
4463 not correct. This is not yet enforced but will be enforced in
4464 Python 2.3; even later, we may use -2 to indicate errors and +2 for
4465 "NotImplemented". Right now, -1 should be used for an error return.
4466
4467- PyLong_AsLongLong() now accepts int (as well as long) arguments.
4468 Consequently, PyArg_ParseTuple's 'L' code also accepts int (as well
4469 as long) arguments.
4470
4471- PyThread_start_new_thread() now returns a long int giving the thread
4472 ID, if one can be calculated; it returns -1 for error, 0 if no
4473 thread ID is calculated (this is an incompatible change, but only
4474 the thread module used this API). This code has only really been
4475 tested on Linux and Windows; other platforms please beware (and
4476 report any bugs or strange behavior).
4477
4478- PyUnicode_FromEncodedObject() no longer accepts Unicode objects as
4479 input.
4480
4481New platforms
4482-------------
4483
4484Tests
4485-----
4486
4487Windows
4488-------
4489
4490- Installer: If you install IDLE, and don't disable file-extension
4491 registration, a new "Edit with IDLE" context (right-click) menu entry
4492 is created for .py and .pyw files.
4493
4494- The signal module now supports SIGBREAK on Windows, thanks to Steven
4495 Scott. Note that SIGBREAK is unique to Windows. The default SIGBREAK
4496 action remains to call Win32 ExitProcess(). This can be changed via
4497 signal.signal(). For example::
4498
4499 # Make Ctrl+Break raise KeyboardInterrupt, like Python's default Ctrl+C
4500 # (SIGINT) behavior.
4501 import signal
4502 signal.signal(signal.SIGBREAK, signal.default_int_handler)
4503
4504 try:
4505 while 1:
4506 pass
4507 except KeyboardInterrupt:
4508 # We get here on Ctrl+C or Ctrl+Break now; if we had not changed
4509 # SIGBREAK, only on Ctrl+C (and Ctrl+Break would terminate the
4510 # program without the possibility for any Python-level cleanup).
4511 print "Clean exit"
4512
4513
4514What's New in Python 2.2a4?
4515===========================
4516
4517*Release date: 28-Sep-2001*
4518
4519Type/class unification and new-style classes
4520--------------------------------------------
4521
4522- pydoc and inspect are now aware of new-style classes;
4523 e.g. help(list) at the interactive prompt now shows proper
4524 documentation for all operations on list objects.
4525
4526- Applications using Jim Fulton's ExtensionClass module can now safely
4527 be used with Python 2.2. In particular, Zope 2.4.1 now works with
4528 Python 2.2 (as well as with Python 2.1.1). The Demo/metaclass
4529 examples also work again. It is hoped that Gtk and Boost also work
4530 with 2.2a4 and beyond. (If you can confirm this, please write
4531 webmaster@python.org; if there are still problems, please open a bug
4532 report on SourceForge.)
4533
4534- property() now takes 4 keyword arguments: fget, fset, fdel and doc.
4535 These map to read-only attributes 'fget', 'fset', 'fdel', and '__doc__'
4536 in the constructed property object. fget, fset and fdel weren't
4537 discoverable from Python in 2.2a3. __doc__ is new, and allows to
4538 associate a docstring with a property.
4539
4540- Comparison overloading is now more completely implemented. For
4541 example, a str subclass instance can properly be compared to a str
4542 instance, and it can properly overload comparison. Ditto for most
4543 other built-in object types.
4544
4545- The repr() of new-style classes has changed; instead of <type
4546 'M.Foo'> a new-style class is now rendered as <class 'M.Foo'>,
4547 *except* for built-in types, which are still rendered as <type
4548 'Foo'> (to avoid upsetting existing code that might parse or
4549 otherwise rely on repr() of certain type objects).
4550
4551- The repr() of new-style objects is now always <Foo object at XXX>;
4552 previously, it was sometimes <Foo instance at XXX>.
4553
4554- For new-style classes, what was previously called __getattr__ is now
4555 called __getattribute__. This method, if defined, is called for
4556 *every* attribute access. A new __getattr__ hook more similar to the
4557 one in classic classes is defined which is called only if regular
4558 attribute access raises AttributeError; to catch *all* attribute
4559 access, you can use __getattribute__ (for new-style classes). If
4560 both are defined, __getattribute__ is called first, and if it raises
4561 AttributeError, __getattr__ is called.
4562
4563- The __class__ attribute of new-style objects can be assigned to.
4564 The new class must have the same C-level object layout as the old
4565 class.
4566
4567- The builtin file type can be subclassed now. In the usual pattern,
4568 "file" is the name of the builtin type, and file() is a new builtin
4569 constructor, with the same signature as the builtin open() function.
4570 file() is now the preferred way to open a file.
4571
4572- Previously, __new__ would only see sequential arguments passed to
4573 the type in a constructor call; __init__ would see both sequential
4574 and keyword arguments. This made no sense whatsoever any more, so
4575 now both __new__ and __init__ see all arguments.
4576
4577- Previously, hash() applied to an instance of a subclass of str or
4578 unicode always returned 0. This has been repaired.
4579
4580- Previously, an operation on an instance of a subclass of an
4581 immutable type (int, long, float, complex, tuple, str, unicode),
4582 where the subtype didn't override the operation (and so the
4583 operation was handled by the builtin type), could return that
4584 instance instead a value of the base type. For example, if s was of
4585 a str subclass type, s[:] returned s as-is. Now it returns a str
4586 with the same value as s.
4587
4588- Provisional support for pickling new-style objects has been added.
4589
4590Core
4591----
4592
4593- file.writelines() now accepts any iterable object producing strings.
4594
4595- PyUnicode_FromEncodedObject() now works very much like
4596 PyObject_Str(obj) in that it tries to use __str__/tp_str
4597 on the object if the object is not a string or buffer. This
4598 makes unicode() behave like str() when applied to non-string/buffer
4599 objects.
4600
4601- PyFile_WriteObject now passes Unicode objects to the file's write
4602 method. As a result, all file-like objects which may be the target
4603 of a print statement must support Unicode objects, i.e. they must
4604 at least convert them into ASCII strings.
4605
4606- Thread scheduling on Solaris should be improved; it is no longer
4607 necessary to insert a small sleep at the start of a thread in order
4608 to let other runnable threads be scheduled.
4609
4610Library
4611-------
4612
4613- StringIO.StringIO instances and cStringIO.StringIO instances support
4614 read character buffer compatible objects for their .write() methods.
4615 These objects are converted to strings and then handled as such
4616 by the instances.
4617
4618- The "email" package has been added. This is basically a port of the
4619 mimelib package <http://sf.net/projects/mimelib> with API changes
4620 and some implementations updated to use iterators and generators.
4621
4622- difflib.ndiff() and difflib.Differ.compare() are generators now. This
4623 restores the ability of Tools/scripts/ndiff.py to start producing output
4624 before the entire comparison is complete.
4625
4626- StringIO.StringIO instances and cStringIO.StringIO instances support
4627 iteration just like file objects (i.e. their .readline() method is
4628 called for each iteration until it returns an empty string).
4629
4630- The codecs module has grown four new helper APIs to access
4631 builtin codecs: getencoder(), getdecoder(), getreader(),
4632 getwriter().
4633
4634- SimpleXMLRPCServer: a new module (based upon SimpleHTMLServer)
4635 simplifies writing XML RPC servers.
4636
4637- os.path.realpath(): a new function that returns the absolute pathname
4638 after interpretation of symbolic links. On non-Unix systems, this
4639 is an alias for os.path.abspath().
4640
4641- operator.indexOf() (PySequence_Index() in the C API) now works with any
4642 iterable object.
4643
4644- smtplib now supports various authentication and security features of
4645 the SMTP protocol through the new login() and starttls() methods.
4646
4647- hmac: a new module implementing keyed hashing for message
4648 authentication.
4649
4650- mimetypes now recognizes more extensions and file types. At the
4651 same time, some mappings not sanctioned by IANA were removed.
4652
4653- The "compiler" package has been brought up to date to the state of
4654 Python 2.2 bytecode generation. It has also been promoted from a
4655 Tool to a standard library package. (Tools/compiler still exists as
4656 a sample driver.)
4657
4658Build
4659-----
4660
4661- Large file support (LFS) is now automatic when the platform supports
4662 it; no more manual configuration tweaks are needed. On Linux, at
4663 least, it's possible to have a system whose C library supports large
4664 files but whose kernel doesn't; in this case, large file support is
4665 still enabled but doesn't do you any good unless you upgrade your
4666 kernel or share your Python executable with another system whose
4667 kernel has large file support.
4668
4669- The configure script now supplies plausible defaults in a
4670 cross-compilation environment. This doesn't mean that the supplied
4671 values are always correct, or that cross-compilation now works
4672 flawlessly -- but it's a first step (and it shuts up most of
4673 autoconf's warnings about AC_TRY_RUN).
4674
4675- The Unix build is now a bit less chatty, courtesy of the parser
4676 generator. The build is completely silent (except for errors) when
4677 using "make -s", thanks to a -q option to setup.py.
4678
4679C API
4680-----
4681
4682- The "structmember" API now supports some new flag bits to deny read
4683 and/or write access to attributes in restricted execution mode.
4684
4685New platforms
4686-------------
4687
4688- Compaq's iPAQ handheld, running the "familiar" Linux distribution
4689 (http://familiar.handhelds.org).
4690
4691Tests
4692-----
4693
4694- The "classic" standard tests, which work by comparing stdout to
4695 an expected-output file under Lib/test/output/, no longer stop at
4696 the first mismatch. Instead the test is run to completion, and a
4697 variant of ndiff-style comparison is used to report all differences.
4698 This is much easier to understand than the previous style of reporting.
4699
4700- The unittest-based standard tests now use regrtest's test_main()
4701 convention, instead of running as a side-effect of merely being
4702 imported. This allows these tests to be run in more natural and
4703 flexible ways as unittests, outside the regrtest framework.
4704
4705- regrtest.py is much better integrated with unittest and doctest now,
4706 especially in regard to reporting errors.
4707
4708Windows
4709-------
4710
4711- Large file support now also works for files > 4GB, on filesystems
4712 that support it (NTFS under Windows 2000). See "What's New in
4713 Python 2.2a3" for more detail.
4714
4715
4716What's New in Python 2.2a3?
4717===========================
4718
4719*Release Date: 07-Sep-2001*
4720
4721Core
4722----
4723
4724- Conversion of long to float now raises OverflowError if the long is too
4725 big to represent as a C double.
4726
4727- The 3-argument builtin pow() no longer allows a third non-None argument
4728 if either of the first two arguments is a float, or if both are of
4729 integer types and the second argument is negative (in which latter case
4730 the arguments are converted to float, so this is really the same
4731 restriction).
4732
4733- The builtin dir() now returns more information, and sometimes much
4734 more, generally naming all attributes of an object, and all attributes
4735 reachable from the object via its class, and from its class's base
4736 classes, and so on from them too. Example: in 2.2a2, dir([]) returned
4737 an empty list. In 2.2a3,
4738
4739 >>> dir([])
4740 ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
4741 '__eq__', '__ge__', '__getattr__', '__getitem__', '__getslice__',
4742 '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__le__',
4743 '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__repr__',
4744 '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__',
4745 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
4746 'reverse', 'sort']
4747
4748 dir(module) continues to return only the module's attributes, though.
4749
4750- Overflowing operations on plain ints now return a long int rather
4751 than raising OverflowError. This is a partial implementation of PEP
4752 237. You can use -Wdefault::OverflowWarning to enable a warning for
4753 this situation, and -Werror::OverflowWarning to revert to the old
4754 OverflowError exception.
4755
4756- A new command line option, -Q<arg>, is added to control run-time
4757 warnings for the use of classic division. (See PEP 238.) Possible
4758 values are -Qold, -Qwarn, -Qwarnall, and -Qnew. The default is
4759 -Qold, meaning the / operator has its classic meaning and no
4760 warnings are issued. Using -Qwarn issues a run-time warning about
4761 all uses of classic division for int and long arguments; -Qwarnall
4762 also warns about classic division for float and complex arguments
4763 (for use with fixdiv.py).
4764 [Note: the remainder of this item (preserved below) became
4765 obsolete in 2.2c1 -- -Qnew has global effect in 2.2] ::
4766
4767 Using -Qnew is questionable; it turns on new division by default, but
4768 only in the __main__ module. You can usefully combine -Qwarn or
4769 -Qwarnall and -Qnew: this gives the __main__ module new division, and
4770 warns about classic division everywhere else.
4771
4772- Many built-in types can now be subclassed. This applies to int,
4773 long, float, str, unicode, and tuple. (The types complex, list and
4774 dictionary can also be subclassed; this was introduced earlier.)
4775 Note that restrictions apply when subclassing immutable built-in
4776 types: you can only affect the value of the instance by overloading
4777 __new__. You can add mutable attributes, and the subclass instances
4778 will have a __dict__ attribute, but you cannot change the "value"
4779 (as implemented by the base class) of an immutable subclass instance
4780 once it is created.
4781
4782- The dictionary constructor now takes an optional argument, a
4783 mapping-like object, and initializes the dictionary from its
4784 (key, value) pairs.
4785
4786- A new built-in type, super, has been added. This facilitates making
4787 "cooperative super calls" in a multiple inheritance setting. For an
4788 explanation, see http://www.python.org/2.2/descrintro.html#cooperation
4789
4790- A new built-in type, property, has been added. This enables the
4791 creation of "properties". These are attributes implemented by
4792 getter and setter functions (or only one of these for read-only or
4793 write-only attributes), without the need to override __getattr__.
4794 See http://www.python.org/2.2/descrintro.html#property
4795
4796- The syntax of floating-point and imaginary literals has been
4797 liberalized, to allow leading zeroes. Examples of literals now
4798 legal that were SyntaxErrors before:
4799
4800 00.0 0e3 0100j 07.5 00000000000000000008.
4801
4802- An old tokenizer bug allowed floating point literals with an incomplete
4803 exponent, such as 1e and 3.1e-. Such literals now raise SyntaxError.
4804
4805Library
4806-------
4807
4808- telnetlib includes symbolic names for the options, and support for
4809 setting an option negotiation callback. It also supports processing
4810 of suboptions.
4811
4812- The new C standard no longer requires that math libraries set errno to
4813 ERANGE on overflow. For platform libraries that exploit this new
4814 freedom, Python's overflow-checking was wholly broken. A new overflow-
4815 checking scheme attempts to repair that, but may not be reliable on all
4816 platforms (C doesn't seem to provide anything both useful and portable
4817 in this area anymore).
4818
4819- Asynchronous timeout actions are available through the new class
4820 threading.Timer.
4821
4822- math.log and math.log10 now return sensible results for even huge
4823 long arguments. For example, math.log10(10 ** 10000) ~= 10000.0.
4824
4825- A new function, imp.lock_held(), returns 1 when the import lock is
4826 currently held. See the docs for the imp module.
4827
4828- pickle, cPickle and marshal on 32-bit platforms can now correctly read
4829 dumps containing ints written on platforms where Python ints are 8 bytes.
4830 When read on a box where Python ints are 4 bytes, such values are
4831 converted to Python longs.
4832
4833- In restricted execution mode (using the rexec module), unmarshalling
4834 code objects is no longer allowed. This plugs a security hole.
4835
4836- unittest.TestResult instances no longer store references to tracebacks
4837 generated by test failures. This prevents unexpected dangling references
4838 to objects that should be garbage collected between tests.
4839
4840Tools
4841-----
4842
4843- Tools/scripts/fixdiv.py has been added which can be used to fix
4844 division operators as per PEP 238.
4845
4846Build
4847-----
4848
4849- If you are an adventurous person using Mac OS X you may want to look at
4850 Mac/OSX. There is a Makefile there that will build Python as a real Mac
4851 application, which can be used for experimenting with Carbon or Cocoa.
4852 Discussion of this on pythonmac-sig, please.
4853
4854C API
4855-----
4856
4857- New function PyObject_Dir(obj), like Python __builtin__.dir(obj).
4858
4859- Note that PyLong_AsDouble can fail! This has always been true, but no
4860 callers checked for it. It's more likely to fail now, because overflow
4861 errors are properly detected now. The proper way to check::
4862
4863 double x = PyLong_AsDouble(some_long_object);
4864 if (x == -1.0 && PyErr_Occurred()) {
4865 /* The conversion failed. */
4866 }
4867
4868- The GC API has been changed. Extensions that use the old API will still
4869 compile but will not participate in GC. To upgrade an extension
4870 module:
4871
4872 - rename Py_TPFLAGS_GC to PyTPFLAGS_HAVE_GC
4873
4874 - use PyObject_GC_New or PyObject_GC_NewVar to allocate objects and
4875 PyObject_GC_Del to deallocate them
4876
4877 - rename PyObject_GC_Init to PyObject_GC_Track and PyObject_GC_Fini
4878 to PyObject_GC_UnTrack
4879
4880 - remove PyGC_HEAD_SIZE from object size calculations
4881
4882 - remove calls to PyObject_AS_GC and PyObject_FROM_GC
4883
4884- Two new functions: PyString_FromFormat() and PyString_FromFormatV().
4885 These can be used safely to construct string objects from a
4886 sprintf-style format string (similar to the format string supported
4887 by PyErr_Format()).
4888
4889New platforms
4890-------------
4891
4892- Stephen Hansen contributed patches sufficient to get a clean compile
4893 under Borland C (Windows), but he reports problems running it and ran
4894 out of time to complete the port. Volunteers? Expect a MemoryError
4895 when importing the types module; this is probably shallow, and
4896 causing later failures too.
4897
4898Tests
4899-----
4900
4901Windows
4902-------
4903
4904- Large file support is now enabled on Win32 platforms as well as on
4905 Win64. This means that, for example, you can use f.tell() and f.seek()
4906 to manipulate files larger than 2 gigabytes (provided you have enough
4907 disk space, and are using a Windows filesystem that supports large
4908 partitions). Windows filesystem limits: FAT has a 2GB (gigabyte)
4909 filesize limit, and large file support makes no difference there.
4910 FAT32's limit is 4GB, and files >= 2GB are easier to use from Python now.
4911 NTFS has no practical limit on file size, and files of any size can be
4912 used from Python now.
4913
4914- The w9xpopen hack is now used on Windows NT and 2000 too when COMPSPEC
4915 points to command.com (patch from Brian Quinlan).
4916
4917
4918What's New in Python 2.2a2?
4919===========================
4920
4921*Release Date: 22-Aug-2001*
4922
4923Build
4924-----
4925
4926- Tim Peters developed a brand new Windows installer using Wise 8.1,
4927 generously donated to us by Wise Solutions.
4928
4929- configure supports a new option --enable-unicode, with the values
4930 ucs2 and ucs4 (new in 2.2a1). With --disable-unicode, the Unicode
4931 type and supporting code is completely removed from the interpreter.
4932
4933- A new configure option --enable-framework builds a Mac OS X framework,
4934 which "make frameworkinstall" will install. This provides a starting
4935 point for more mac-like functionality, join pythonmac-sig@python.org
4936 if you are interested in helping.
4937
4938- The NeXT platform is no longer supported.
4939
4940- The 'new' module is now statically linked.
4941
4942Tools
4943-----
4944
4945- The new Tools/scripts/cleanfuture.py can be used to automatically
4946 edit out obsolete future statements from Python source code. See
4947 the module docstring for details.
4948
4949Tests
4950-----
4951
4952- regrtest.py now knows which tests are expected to be skipped on some
4953 platforms, allowing to give clearer test result output. regrtest
4954 also has optional --use/-u switch to run normally disabled tests
4955 which require network access or consume significant disk resources.
4956
4957- Several new tests in the standard test suite, with special thanks to
4958 Nick Mathewson.
4959
4960Core
4961----
4962
4963- The floor division operator // has been added as outlined in PEP
4964 238. The / operator still provides classic division (and will until
4965 Python 3.0) unless "from __future__ import division" is included, in
4966 which case the / operator will provide true division. The operator
4967 module provides truediv() and floordiv() functions. Augmented
4968 assignment variants are included, as are the equivalent overloadable
4969 methods and C API methods. See the PEP for a full discussion:
4970 <http://python.sf.net/peps/pep-0238.html>
4971
4972- Future statements are now effective in simulated interactive shells
4973 (like IDLE). This should "just work" by magic, but read Michael
4974 Hudson's "Future statements in simulated shells" PEP 264 for full
4975 details: <http://python.sf.net/peps/pep-0264.html>.
4976
4977- The type/class unification (PEP 252-253) was integrated into the
4978 trunk and is not so tentative any more (the exact specification of
4979 some features is still tentative). A lot of work has done on fixing
4980 bugs and adding robustness and features (performance still has to
4981 come a long way).
4982
4983- Warnings about a mismatch in the Python API during extension import
4984 now use the Python warning framework (which makes it possible to
4985 write filters for these warnings).
4986
4987- A function's __dict__ (aka func_dict) will now always be a
4988 dictionary. It used to be possible to delete it or set it to None,
4989 but now both actions raise TypeErrors. It is still legal to set it
4990 to a dictionary object. Getting func.__dict__ before any attributes
4991 have been assigned now returns an empty dictionary instead of None.
4992
4993- A new command line option, -E, was added which disables the use of
4994 all environment variables, or at least those that are specifically
4995 significant to Python. Usually those have a name starting with
4996 "PYTHON". This was used to fix a problem where the tests fail if
4997 the user happens to have PYTHONHOME or PYTHONPATH pointing to an
4998 older distribution.
4999
5000Library
5001-------
5002
5003- New class Differ and new functions ndiff() and restore() in difflib.py.
5004 These package the algorithms used by the popular Tools/scripts/ndiff.py,
5005 for programmatic reuse.
5006
5007- New function xml.sax.saxutils.quoteattr(): Quote an XML attribute
5008 value using the minimal quoting required for the value; more
5009 reliable than using xml.sax.saxutils.escape() for attribute values.
5010
5011- Readline completion support for cmd.Cmd was added.
5012
5013- Calling os.tempnam() or os.tmpnam() generate RuntimeWarnings.
5014
5015- Added function threading.BoundedSemaphore()
5016
5017- Added Ka-Ping Yee's cgitb.py module.
5018
5019- The 'new' module now exposes the CO_xxx flags.
5020
5021- The gc module offers the get_referents function.
5022
5023New platforms
5024-------------
5025
5026C API
5027-----
5028
5029- Two new APIs PyOS_snprintf() and PyOS_vsnprintf() were added
5030 which provide a cross-platform implementations for the
5031 relatively new snprintf()/vsnprintf() C lib APIs. In contrast to
5032 the standard sprintf() and vsprintf() C lib APIs, these versions
5033 apply bounds checking on the used buffer which enhances protection
5034 against buffer overruns.
5035
5036- Unicode APIs now use name mangling to assure that mixing interpreters
5037 and extensions using different Unicode widths is rendered next to
5038 impossible. Trying to import an incompatible Unicode-aware extension
5039 will result in an ImportError. Unicode extensions writers must make
5040 sure to check the Unicode width compatibility in their extensions by
5041 using at least one of the mangled Unicode APIs in the extension.
5042
5043- Two new flags METH_NOARGS and METH_O are available in method definition
5044 tables to simplify implementation of methods with no arguments and a
5045 single untyped argument. Calling such methods is more efficient than
5046 calling corresponding METH_VARARGS methods. METH_OLDARGS is now
5047 deprecated.
5048
5049Windows
5050-------
5051
5052- "import module" now compiles module.pyw if it exists and nothing else
5053 relevant is found.
5054
5055
5056What's New in Python 2.2a1?
5057===========================
5058
5059*Release date: 18-Jul-2001*
5060
5061Core
5062----
5063
5064- TENTATIVELY, a large amount of code implementing much of what's
5065 described in PEP 252 (Making Types Look More Like Classes) and PEP
5066 253 (Subtyping Built-in Types) was added. This will be released
5067 with Python 2.2a1. Documentation will be provided separately
5068 through http://www.python.org/2.2/. The purpose of releasing this
5069 with Python 2.2a1 is to test backwards compatibility. It is
5070 possible, though not likely, that a decision is made not to release
5071 this code as part of 2.2 final, if any serious backwards
5072 incompatibilities are found during alpha testing that cannot be
5073 repaired.
5074
5075- Generators were added; this is a new way to create an iterator (see
5076 below) using what looks like a simple function containing one or
5077 more 'yield' statements. See PEP 255. Since this adds a new
5078 keyword to the language, this feature must be enabled by including a
5079 future statement: "from __future__ import generators" (see PEP 236).
5080 Generators will become a standard feature in a future release
5081 (probably 2.3). Without this future statement, 'yield' remains an
5082 ordinary identifier, but a warning is issued each time it is used.
5083 (These warnings currently don't conform to the warnings framework of
5084 PEP 230; we intend to fix this in 2.2a2.)
5085
5086- The UTF-16 codec was modified to be more RFC compliant. It will now
5087 only remove BOM characters at the start of the string and then
5088 only if running in native mode (UTF-16-LE and -BE won't remove a
5089 leading BMO character).
5090
5091- Strings now have a new method .decode() to complement the already
5092 existing .encode() method. These two methods provide direct access
5093 to the corresponding decoders and encoders of the registered codecs.
5094
5095 To enhance the usability of the .encode() method, the special
5096 casing of Unicode object return values was dropped (Unicode objects
5097 were auto-magically converted to string using the default encoding).
5098
5099 Both methods will now return whatever the codec in charge of the
5100 requested encoding returns as object, e.g. Unicode codecs will
5101 return Unicode objects when decoding is requested ("äöü".decode("latin-1")
5102 will return u"äöü"). This enables codec writer to create codecs
5103 for various simple to use conversions.
5104
5105 New codecs were added to demonstrate these new features (the .encode()
5106 and .decode() columns indicate the type of the returned objects):
5107
5108 +---------+-----------+-----------+-----------------------------+
5109 |Name | .encode() | .decode() | Description |
5110 +=========+===========+===========+=============================+
5111 |uu | string | string | UU codec (e.g. for email) |
5112 +---------+-----------+-----------+-----------------------------+
5113 |base64 | string | string | base64 codec |
5114 +---------+-----------+-----------+-----------------------------+
5115 |quopri | string | string | quoted-printable codec |
5116 +---------+-----------+-----------+-----------------------------+
5117 |zlib | string | string | zlib compression |
5118 +---------+-----------+-----------+-----------------------------+
5119 |hex | string | string | 2-byte hex codec |
5120 +---------+-----------+-----------+-----------------------------+
5121 |rot-13 | string | Unicode | ROT-13 Unicode charmap codec|
5122 +---------+-----------+-----------+-----------------------------+
5123
5124- Some operating systems now support the concept of a default Unicode
5125 encoding for file system operations. Notably, Windows supports 'mbcs'
5126 as the default. The Macintosh will also adopt this concept in the medium
5127 term, although the default encoding for that platform will be other than
5128 'mbcs'.
5129
5130 On operating system that support non-ASCII filenames, it is common for
5131 functions that return filenames (such as os.listdir()) to return Python
5132 string objects pre-encoded using the default file system encoding for
5133 the platform. As this encoding is likely to be different from Python's
5134 default encoding, converting this name to a Unicode object before passing
5135 it back to the Operating System would result in a Unicode error, as Python
5136 would attempt to use its default encoding (generally ASCII) rather than
5137 the default encoding for the file system.
5138
5139 In general, this change simply removes surprises when working with
5140 Unicode and the file system, making these operations work as you expect,
5141 increasing the transparency of Unicode objects in this context.
5142 See [????] for more details, including examples.
5143
5144- Float (and complex) literals in source code were evaluated to full
5145 precision only when running from a .py file; the same code loaded from a
5146 .pyc (or .pyo) file could suffer numeric differences starting at about the
5147 12th significant decimal digit. For example, on a machine with IEEE-754
5148 floating arithmetic,
5149
5150 x = 9007199254740992.0
5151 print long(x)
5152
5153 printed 9007199254740992 if run directly from .py, but 9007199254740000
5154 if from a compiled (.pyc or .pyo) file. This was due to marshal using
5155 str(float) instead of repr(float) when building code objects. marshal
5156 now uses repr(float) instead, which should reproduce floats to full
5157 machine precision (assuming the platform C float<->string I/O conversion
5158 functions are of good quality).
5159
5160 This may cause floating-point results to change in some cases, and
5161 usually for the better, but may also cause numerically unstable
5162 algorithms to break.
5163
5164- The implementation of dicts suffers fewer collisions, which has speed
5165 benefits. However, the order in which dict entries appear in dict.keys(),
5166 dict.values() and dict.items() may differ from previous releases for a
5167 given dict. Nothing is defined about this order, so no program should
5168 rely on it. Nevertheless, it's easy to write test cases that rely on the
5169 order by accident, typically because of printing the str() or repr() of a
5170 dict to an "expected results" file. See Lib/test/test_support.py's new
5171 sortdict(dict) function for a simple way to display a dict in sorted
5172 order.
5173
5174- Many other small changes to dicts were made, resulting in faster
5175 operation along the most common code paths.
5176
5177- Dictionary objects now support the "in" operator: "x in dict" means
5178 the same as dict.has_key(x).
5179
5180- The update() method of dictionaries now accepts generic mapping
5181 objects. Specifically the argument object must support the .keys()
5182 and __getitem__() methods. This allows you to say, for example,
5183 {}.update(UserDict())
5184
5185- Iterators were added; this is a generalized way of providing values
5186 to a for loop. See PEP 234. There's a new built-in function iter()
5187 to return an iterator. There's a new protocol to get the next value
5188 from an iterator using the next() method (in Python) or the
5189 tp_iternext slot (in C). There's a new protocol to get iterators
5190 using the __iter__() method (in Python) or the tp_iter slot (in C).
5191 Iterating (i.e. a for loop) over a dictionary generates its keys.
5192 Iterating over a file generates its lines.
5193
5194- The following functions were generalized to work nicely with iterator
5195 arguments::
5196
5197 map(), filter(), reduce(), zip()
5198 list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API)
5199 max(), min()
5200 join() method of strings
5201 extend() method of lists
5202 'x in y' and 'x not in y' (PySequence_Contains() in C API)
5203 operator.countOf() (PySequence_Count() in C API)
5204 right-hand side of assignment statements with multiple targets, such as ::
5205 x, y, z = some_iterable_object_returning_exactly_3_values
5206
5207- Accessing module attributes is significantly faster (for example,
5208 random.random or os.path or yourPythonModule.yourAttribute).
5209
5210- Comparing dictionary objects via == and != is faster, and now works even
5211 if the keys and values don't support comparisons other than ==.
5212
5213- Comparing dictionaries in ways other than == and != is slower: there were
5214 insecurities in the dict comparison implementation that could cause Python
5215 to crash if the element comparison routines for the dict keys and/or
5216 values mutated the dicts. Making the code bulletproof slowed it down.
5217
5218- Collisions in dicts are resolved via a new approach, which can help
5219 dramatically in bad cases. For example, looking up every key in a dict
5220 d with d.keys() == [i << 16 for i in range(20000)] is approximately 500x
5221 faster now. Thanks to Christian Tismer for pointing out the cause and
5222 the nature of an effective cure (last December! better late than never).
5223
5224- repr() is much faster for large containers (dict, list, tuple).
5225
5226
5227Library
5228-------
5229
5230- The constants ascii_letters, ascii_lowercase. and ascii_uppercase
5231 were added to the string module. These a locale-independent
5232 constants, unlike letters, lowercase, and uppercase. These are now
5233 use in appropriate locations in the standard library.
5234
5235- The flags used in dlopen calls can now be configured using
5236 sys.setdlopenflags and queried using sys.getdlopenflags.
5237
5238- Fredrik Lundh's xmlrpclib is now a standard library module. This
5239 provides full client-side XML-RPC support. In addition,
5240 Demo/xmlrpc/ contains two server frameworks (one SocketServer-based,
5241 one asyncore-based). Thanks to Eric Raymond for the documentation.
5242
5243- The xrange() object is simplified: it no longer supports slicing,
5244 repetition, comparisons, efficient 'in' checking, the tolist()
5245 method, or the start, stop and step attributes. See PEP 260.
5246
5247- A new function fnmatch.filter to filter lists of file names was added.
5248
5249- calendar.py uses month and day names based on the current locale.
5250
5251- strop is now *really* obsolete (this was announced before with 1.6),
5252 and issues DeprecationWarning when used (except for the four items
5253 that are still imported into string.py).
5254
5255- Cookie.py now sorts key+value pairs by key in output strings.
5256
5257- pprint.isrecursive(object) didn't correctly identify recursive objects.
5258 Now it does.
5259
5260- pprint functions now much faster for large containers (tuple, list, dict).
5261
5262- New 'q' and 'Q' format codes in the struct module, corresponding to C
5263 types "long long" and "unsigned long long" (on Windows, __int64). In
5264 native mode, these can be used only when the platform C compiler supports
5265 these types (when HAVE_LONG_LONG is #define'd by the Python config
5266 process), and then they inherit the sizes and alignments of the C types.
5267 In standard mode, 'q' and 'Q' are supported on all platforms, and are
5268 8-byte integral types.
5269
5270- The site module installs a new built-in function 'help' that invokes
5271 pydoc.help. It must be invoked as 'help()'; when invoked as 'help',
5272 it displays a message reminding the user to use 'help()' or
5273 'help(object)'.
5274
5275Tests
5276-----
5277
5278- New test_mutants.py runs dict comparisons where the key and value
5279 comparison operators mutate the dicts randomly during comparison. This
5280 rapidly causes Python to crash under earlier releases (not for the faint
5281 of heart: it can also cause Win9x to freeze or reboot!).
5282
5283- New test_pprint.py verifies that pprint.isrecursive() and
5284 pprint.isreadable() return sensible results. Also verifies that simple
5285 cases produce correct output.
5286
5287C API
5288-----
5289
5290- Removed the unused last_is_sticky argument from the internal
5291 _PyTuple_Resize(). If this affects you, you were cheating.
5292
Skip Montanaro4cb22042002-09-17 20:55:31 +00005293What's New in Python 2.1 (final)?
5294=================================
5295
5296We only changed a few things since the last release candidate, all in
5297Python library code:
5298
5299- A bug in the locale module was fixed that affected locales which
5300 define no grouping for numeric formatting.
5301
5302- A few bugs in the weakref module's implementations of weak
5303 dictionaries (WeakValueDictionary and WeakKeyDictionary) were fixed,
5304 and the test suite was updated to check for these bugs.
5305
5306- An old bug in the os.path.walk() function (introduced in Python
5307 2.0!) was fixed: a non-existent file would cause an exception
5308 instead of being ignored.
5309
5310- Fixed a few bugs in the new symtable module found by Neil Norwitz's
5311 PyChecker.
5312
5313
5314What's New in Python 2.1c2?
5315===========================
5316
5317A flurry of small changes, and one showstopper fixed in the nick of
5318time made it necessary to release another release candidate. The list
5319here is the *complete* list of patches (except version updates):
5320
5321Core
5322
5323- Tim discovered a nasty bug in the dictionary code, caused by
5324 PyDict_Next() calling dict_resize(), and the GC code's use of
5325 PyDict_Next() violating an assumption in dict_items(). This was
5326 fixed with considerable amounts of band-aid, but the net effect is a
5327 saner and more robust implementation.
5328
5329- Made a bunch of symbols static that were accidentally global.
5330
5331Build and Ports
5332
5333- The setup.py script didn't check for a new enough version of zlib
5334 (1.1.3 is needed). Now it does.
5335
5336- Changed "make clean" target to also remove shared libraries.
5337
5338- Added a more general warning about the SGI Irix optimizer to README.
5339
5340Library
5341
5342- Fix a bug in urllib.basejoin("http://host", "../file.html") which
5343 omitted the slash between host and file.html.
5344
5345- The mailbox module's _Mailbox class contained a completely broken
5346 and undocumented seek() method. Ripped it out.
5347
5348- Fixed a bunch of typos in various library modules (urllib2, smtpd,
5349 sgmllib, netrc, chunk) found by Neil Norwitz's PyChecker.
5350
5351- Fixed a few last-minute bugs in unittest.
5352
5353Extensions
5354
5355- Reverted the patch to the OpenSSL code in socketmodule.c to support
5356 RAND_status() and the EGD, and the subsequent patch that tried to
5357 fix it for pre-0.9.5 versions; the problem with the patch is that on
5358 some systems it issues a warning whenever socket is imported, and
5359 that's unacceptable.
5360
5361Tests
5362
5363- Fixed the pickle tests to work with "import test.test_pickle".
5364
5365- Tweaked test_locale.py to actually run the test Windows.
5366
5367- In distutils/archive_util.py, call zipfile.ZipFile() with mode "w",
5368 not "wb" (which is not a valid mode at all).
5369
5370- Fix pstats browser crashes. Import readline if it exists to make
5371 the user interface nicer.
5372
5373- Add "import thread" to the top of test modules that import the
5374 threading module (test_asynchat and test_threadedtempfile). This
5375 prevents test failures caused by a broken threading module resulting
5376 from a previously caught failed import.
5377
5378- Changed test_asynchat.py to set the SO_REUSEADDR option; this was
5379 needed on some platforms (e.g. Solaris 8) when the tests are run
5380 twice in succession.
5381
5382- Skip rather than fail test_sunaudiodev if no audio device is found.
5383
5384
5385What's New in Python 2.1c1?
5386===========================
5387
5388This list was significantly updated when 2.1c2 was released; the 2.1c1
5389release didn't mention most changes that were actually part of 2.1c1:
5390
5391Legal
5392
5393- Copyright was assigned to the Python Software Foundation (PSF) and a
5394 PSF license (very similar to the CNRI license) was added.
5395
5396- The CNRI copyright notice was updated to include 2001.
5397
5398Core
5399
5400- After a public outcry, assignment to __debug__ is no longer illegal;
5401 instead, a warning is issued. It will become illegal in 2.2.
5402
5403- Fixed a core dump with "%#x" % 0, and changed the semantics so that
5404 "%#x" now always prepends "0x", even if the value is zero.
5405
5406- Fixed some nits in the bytecode compiler.
5407
5408- Fixed core dumps when calling certain kinds of non-functions.
5409
5410- Fixed various core dumps caused by reference count bugs.
5411
5412Build and Ports
5413
5414- Use INSTALL_SCRIPT to install script files.
5415
5416- New port: SCO Unixware 7, by Billy G. Allie.
5417
5418- Updated RISCOS port.
5419
5420- Updated BeOS port and notes.
5421
5422- Various other porting problems resolved.
5423
5424Library
5425
5426- The TERMIOS and SOCKET modules are now truly obsolete and
5427 unnecessary. Their symbols are incorporated in the termios and
5428 socket modules.
5429
5430- Fixed some 64-bit bugs in pickle, cPickle, and struct, and added
5431 better tests for pickling.
5432
5433- threading: make Condition.wait() robust against KeyboardInterrupt.
5434
5435- zipfile: add support to zipfile to support opening an archive
5436 represented by an open file rather than a file name. Fix bug where
5437 the archive was not properly closed. Fixed a bug in this bugfix
5438 where flush() was called for a read-only file.
5439
5440- imputil: added an uninstall() method to the ImportManager.
5441
5442- Canvas: fixed bugs in lower() and tkraise() methods.
5443
5444- SocketServer: API change (added overridable close_request() method)
5445 so that the TCP server can explicitly close the request.
5446
5447- pstats: Eric Raymond added a simple interactive statistics browser,
5448 invoked when the module is run as a script.
5449
5450- locale: fixed a problem in format().
5451
5452- webbrowser: made it work when the BROWSER environment variable has a
5453 value like "/usr/bin/netscape". Made it auto-detect Konqueror for
5454 KDE 2. Fixed some other nits.
5455
5456- unittest: changes to allow using a different exception than
5457 AssertionError, and added a few more function aliases. Some other
5458 small changes.
5459
5460- urllib, urllib2: fixed redirect problems and a coupleof other nits.
5461
5462- asynchat: fixed a critical bug in asynchat that slipped through the
5463 2.1b2 release. Fixed another rare bug.
5464
5465- Fix some unqualified except: clauses (always a bad code example).
5466
5467XML
5468
5469- pyexpat: new API get_version_string().
5470
5471- Fixed some minidom bugs.
5472
5473Extensions
5474
5475- Fixed a core dump in _weakref. Removed the weakref.mapping()
5476 function (it adds nothing to the API).
5477
5478- Rationalized the use of header files in the readline module, to make
5479 it compile (albeit with some warnings) with the very recent readline
5480 4.2, without breaking for earlier versions.
5481
5482- Hopefully fixed a buffering problem in linuxaudiodev.
5483
5484- Attempted a fix to make the OpenSSL support in the socket module
5485 work again with pre-0.9.5 versions of OpenSSL.
5486
5487Tests
5488
5489- Added a test case for asynchat and asyncore.
5490
5491- Removed coupling between tests where one test failing could break
5492 another.
5493
5494Tools
5495
5496- Ping added an interactive help browser to pydoc, fixed some nits
5497 in the rest of the pydoc code, and added some features to his
5498 inspect module.
5499
5500- An updated python-mode.el version 4.1 which integrates Ken
5501 Manheimer's pdbtrack.el. This makes debugging Python code via pdb
5502 much nicer in XEmacs and Emacs. When stepping through your program
5503 with pdb, in either the shell window or the *Python* window, the
5504 source file and line will be tracked by an arrow. Very cool!
5505
5506- IDLE: syntax warnings in interactive mode are changed into errors.
5507
5508- Some improvements to Tools/webchecker (ignore some more URL types,
5509 follow some more links).
5510
5511- Brought the Tools/compiler package up to date.
5512
5513
5514What's New in Python 2.1 beta 2?
5515================================
5516
5517(Unlisted are many fixed bugs, more documentation, etc.)
5518
5519Core language, builtins, and interpreter
5520
5521- The nested scopes work (enabled by "from __future__ import
5522 nested_scopes") is completed; in particular, the future now extends
5523 into code executed through exec, eval() and execfile(), and into the
5524 interactive interpreter.
5525
5526- When calling a base class method (e.g. BaseClass.__init__(self)),
5527 this is now allowed even if self is not strictly spoken a class
5528 instance (e.g. when using metaclasses or the Don Beaudry hook).
5529
5530- Slice objects are now comparable but not hashable; this prevents
5531 dict[:] from being accepted but meaningless.
5532
5533- Complex division is now calculated using less braindead algorithms.
5534 This doesn't change semantics except it's more likely to give useful
5535 results in extreme cases. Complex repr() now uses full precision
5536 like float repr().
5537
5538- sgmllib.py now calls handle_decl() for simple <!...> declarations.
5539
5540- It is illegal to assign to the name __debug__, which is set when the
5541 interpreter starts. It is effectively a compile-time constant.
5542
5543- A warning will be issued if a global statement for a variable
5544 follows a use or assignment of that variable.
5545
5546Standard library
5547
5548- unittest.py, a unit testing framework by Steve Purcell (PyUNIT,
5549 inspired by JUnit), is now part of the standard library. You now
5550 have a choice of two testing frameworks: unittest requires you to
5551 write testcases as separate code, doctest gathers them from
5552 docstrings. Both approaches have their advantages and
5553 disadvantages.
5554
5555- A new module Tix was added, which wraps the Tix extension library
5556 for Tk. With that module, it is not necessary to statically link
5557 Tix with _tkinter, since Tix will be loaded with Tcl's "package
5558 require" command. See Demo/tix/.
5559
5560- tzparse.py is now obsolete.
5561
5562- In gzip.py, the seek() and tell() methods are removed -- they were
5563 non-functional anyway, and it's better if callers can test for their
5564 existence with hasattr().
5565
5566Python/C API
5567
5568- PyDict_Next(): it is now safe to call PyDict_SetItem() with a key
5569 that's already in the dictionary during a PyDict_Next() iteration.
5570 This used to fail occasionally when a dictionary resize operation
5571 could be triggered that would rehash all the keys. All other
5572 modifications to the dictionary are still off-limits during a
5573 PyDict_Next() iteration!
5574
5575- New extended APIs related to passing compiler variables around.
5576
5577- New abstract APIs PyObject_IsInstance(), PyObject_IsSubclass()
5578 implement isinstance() and issubclass().
5579
5580- Py_BuildValue() now has a "D" conversion to create a Python complex
5581 number from a Py_complex C value.
5582
5583- Extensions types which support weak references must now set the
5584 field allocated for the weak reference machinery to NULL themselves;
5585 this is done to avoid the cost of checking each object for having a
5586 weakly referencable type in PyObject_INIT(), since most types are
5587 not weakly referencable.
5588
5589- PyFrame_FastToLocals() and PyFrame_LocalsToFast() copy bindings for
5590 free variables and cell variables to and from the frame's f_locals.
5591
5592- Variants of several functions defined in pythonrun.h have been added
5593 to support the nested_scopes future statement. The variants all end
5594 in Flags and take an extra argument, a PyCompilerFlags *; examples:
5595 PyRun_AnyFileExFlags(), PyRun_InteractiveLoopFlags(). These
5596 variants may be removed in Python 2.2, when nested scopes are
5597 mandatory.
5598
5599Distutils
5600
5601- the sdist command now writes a PKG-INFO file, as described in PEP 241,
5602 into the release tree.
5603
5604- several enhancements to the bdist_wininst command from Thomas Heller
5605 (an uninstaller, more customization of the installer's display)
5606
5607- from Jack Jansen: added Mac-specific code to generate a dialog for
5608 users to specify the command-line (because providing a command-line with
5609 MacPython is awkward). Jack also made various fixes for the Mac
5610 and the Metrowerks compiler.
5611
5612- added 'platforms' and 'keywords' to the set of metadata that can be
5613 specified for a distribution.
5614
5615- applied patches from Jason Tishler to make the compiler class work with
5616 Cygwin.
5617
5618
5619What's New in Python 2.1 beta 1?
5620================================
5621
5622Core language, builtins, and interpreter
5623
5624- Following an outcry from the community about the amount of code
5625 broken by the nested scopes feature introduced in 2.1a2, we decided
5626 to make this feature optional, and to wait until Python 2.2 (or at
5627 least 6 months) to make it standard. The option can be enabled on a
5628 per-module basis by adding "from __future__ import nested_scopes" at
5629 the beginning of a module (before any other statements, but after
5630 comments and an optional docstring). See PEP 236 (Back to the
5631 __future__) for a description of the __future__ statement. PEP 227
5632 (Statically Nested Scopes) has been updated to reflect this change,
5633 and to clarify the semantics in a number of endcases.
5634
5635- The nested scopes code, when enabled, has been hardened, and most
5636 bugs and memory leaks in it have been fixed.
5637
5638- Compile-time warnings are now generated for a number of conditions
5639 that will break or change in meaning when nested scopes are enabled:
5640
5641 - Using "from...import *" or "exec" without in-clause in a function
5642 scope that also defines a lambda or nested function with one or
5643 more free (non-local) variables. The presence of the import* or
5644 bare exec makes it impossible for the compiler to determine the
5645 exact set of local variables in the outer scope, which makes it
5646 impossible to determine the bindings for free variables in the
5647 inner scope. To avoid the warning about import *, change it into
5648 an import of explicitly name object, or move the import* statement
5649 to the global scope; to avoid the warning about bare exec, use
5650 exec...in... (a good idea anyway -- there's a possibility that
5651 bare exec will be deprecated in the future).
5652
5653 - Use of a global variable in a nested scope with the same name as a
5654 local variable in a surrounding scope. This will change in
5655 meaning with nested scopes: the name in the inner scope will
5656 reference the variable in the outer scope rather than the global
5657 of the same name. To avoid the warning, either rename the outer
5658 variable, or use a global statement in the inner function.
5659
5660- An optional object allocator has been included. This allocator is
5661 optimized for Python objects and should be faster and use less memory
5662 than the standard system allocator. It is not enabled by default
5663 because of possible thread safety problems. The allocator is only
5664 protected by the Python interpreter lock and it is possible that some
5665 extension modules require a thread safe allocator. The object
5666 allocator can be enabled by providing the "--with-pymalloc" option to
5667 configure.
5668
5669Standard library
5670
5671- pyexpat now detects the expat version if expat.h defines it. A
5672 number of additional handlers are provided, which are only available
5673 since expat 1.95. In addition, the methods SetParamEntityParsing and
5674 GetInputContext of Parser objects are available with 1.95.x
5675 only. Parser objects now provide the ordered_attributes and
5676 specified_attributes attributes. A new module expat.model was added,
5677 which offers a number of additional constants if 1.95.x is used.
5678
5679- xml.dom offers the new functions registerDOMImplementation and
5680 getDOMImplementation.
5681
5682- xml.dom.minidom offers a toprettyxml method. A number of DOM
5683 conformance issues have been resolved. In particular, Element now
5684 has an hasAttributes method, and the handling of namespaces was
5685 improved.
5686
5687- Ka-Ping Yee contributed two new modules: inspect.py, a module for
5688 getting information about live Python code, and pydoc.py, a module
5689 for interactively converting docstrings to HTML or text.
5690 Tools/scripts/pydoc, which is now automatically installed into
5691 <prefix>/bin, uses pydoc.py to display documentation; try running
5692 "pydoc -h" for instructions. "pydoc -g" pops up a small GUI that
5693 lets you browse the module docstrings using a web browser.
5694
5695- New library module difflib.py, primarily packaging the SequenceMatcher
5696 class at the heart of the popular ndiff.py file-comparison tool.
5697
5698- doctest.py (a framework for verifying Python code examples in docstrings)
5699 is now part of the std library.
5700
5701Windows changes
5702
5703- A new entry in the Start menu, "Module Docs", runs "pydoc -g" -- a
5704 small GUI that lets you browse the module docstrings using your
5705 default web browser.
5706
5707- Import is now case-sensitive. PEP 235 (Import on Case-Insensitive
5708 Platforms) is implemented. See
5709
5710 http://python.sourceforge.net/peps/pep-0235.html
5711
5712 for full details, especially the "Current Lower-Left Semantics" section.
5713 The new Windows import rules are simpler than before:
5714
5715 A. If the PYTHONCASEOK environment variable exists, same as
5716 before: silently accept the first case-insensitive match of any
5717 kind; raise ImportError if none found.
5718
5719 B. Else search sys.path for the first case-sensitive match; raise
5720 ImportError if none found.
5721
5722 The same rules have been implemented on other platforms with case-
5723 insensitive but case-preserving filesystems too (including Cygwin, and
5724 several flavors of Macintosh operating systems).
5725
5726- winsound module: Under Win9x, winsound.Beep() now attempts to simulate
5727 what it's supposed to do (and does do under NT and 2000) via direct
5728 port manipulation. It's unknown whether this will work on all systems,
5729 but it does work on my Win98SE systems now and was known to be useless on
5730 all Win9x systems before.
5731
5732- Build: Subproject _test (effectively) renamed to _testcapi.
5733
5734New platforms
5735
5736- 2.1 should compile and run out of the box under MacOS X, even using HFS+.
5737 Thanks to Steven Majewski!
5738
5739- 2.1 should compile and run out of the box on Cygwin. Thanks to Jason
5740 Tishler!
5741
5742- 2.1 contains new files and patches for RISCOS, thanks to Dietmar
5743 Schwertberger! See RISCOS/README for more information -- it seems
5744 that because of the bizarre filename conventions on RISCOS, no port
5745 to that platform is easy.
5746
5747
5748What's New in Python 2.1 alpha 2?
5749=================================
5750
5751Core language, builtins, and interpreter
5752
5753- Scopes nest. If a name is used in a function or class, but is not
5754 local, the definition in the nearest enclosing function scope will
5755 be used. One consequence of this change is that lambda statements
5756 could reference variables in the namespaces where the lambda is
5757 defined. In some unusual cases, this change will break code.
5758
5759 In all previous version of Python, names were resolved in exactly
5760 three namespaces -- the local namespace, the global namespace, and
5761 the builtin namespace. According to this old definition, if a
5762 function A is defined within a function B, the names bound in B are
5763 not visible in A. The new rules make names bound in B visible in A,
5764 unless A contains a name binding that hides the binding in B.
5765
5766 Section 4.1 of the reference manual describes the new scoping rules
5767 in detail. The test script in Lib/test/test_scope.py demonstrates
5768 some of the effects of the change.
5769
5770 The new rules will cause existing code to break if it defines nested
5771 functions where an outer function has local variables with the same
5772 name as globals or builtins used by the inner function. Example:
5773
5774 def munge(str):
5775 def helper(x):
5776 return str(x)
5777 if type(str) != type(''):
5778 str = helper(str)
5779 return str.strip()
5780
5781 Under the old rules, the name str in helper() is bound to the
5782 builtin function str(). Under the new rules, it will be bound to
5783 the argument named str and an error will occur when helper() is
5784 called.
5785
5786- The compiler will report a SyntaxError if "from ... import *" occurs
5787 in a function or class scope. The language reference has documented
5788 that this case is illegal, but the compiler never checked for it.
5789 The recent introduction of nested scope makes the meaning of this
5790 form of name binding ambiguous. In a future release, the compiler
5791 may allow this form when there is no possibility of ambiguity.
5792
5793- repr(string) is easier to read, now using hex escapes instead of octal,
5794 and using \t, \n and \r instead of \011, \012 and \015 (respectively):
5795
5796 >>> "\texample \r\n" + chr(0) + chr(255)
5797 '\texample \r\n\x00\xff' # in 2.1
5798 '\011example \015\012\000\377' # in 2.0
5799
5800- Functions are now compared and hashed by identity, not by value, since
5801 the func_code attribute is writable.
5802
5803- Weak references (PEP 205) have been added. This involves a few
5804 changes in the core, an extension module (_weakref), and a Python
5805 module (weakref). The weakref module is the public interface. It
5806 includes support for "explicit" weak references, proxy objects, and
5807 mappings with weakly held values.
5808
5809- A 'continue' statement can now appear in a try block within the body
5810 of a loop. It is still not possible to use continue in a finally
5811 clause.
5812
5813Standard library
5814
5815- mailbox.py now has a new class, PortableUnixMailbox which is
5816 identical to UnixMailbox but uses a more portable scheme for
5817 determining From_ separators. Also, the constructors for all the
5818 classes in this module have a new optional `factory' argument, which
5819 is a callable used when new message classes must be instantiated by
5820 the next() method.
5821
5822- random.py is now self-contained, and offers all the functionality of
5823 the now-deprecated whrandom.py. See the docs for details. random.py
5824 also supports new functions getstate() and setstate(), for saving
5825 and restoring the internal state of the generator; and jumpahead(n),
5826 for quickly forcing the internal state to be the same as if n calls to
5827 random() had been made. The latter is particularly useful for multi-
5828 threaded programs, creating one instance of the random.Random() class for
5829 each thread, then using .jumpahead() to force each instance to use a
5830 non-overlapping segment of the full period.
5831
5832- random.py's seed() function is new. For bit-for-bit compatibility with
5833 prior releases, use the whseed function instead. The new seed function
5834 addresses two problems: (1) The old function couldn't produce more than
5835 about 2**24 distinct internal states; the new one about 2**45 (the best
5836 that can be done in the Wichmann-Hill generator). (2) The old function
5837 sometimes produced identical internal states when passed distinct
5838 integers, and there was no simple way to predict when that would happen;
5839 the new one guarantees to produce distinct internal states for all
5840 arguments in [0, 27814431486576L).
5841
5842- The socket module now supports raw packets on Linux. The socket
5843 family is AF_PACKET.
5844
5845- test_capi.py is a start at running tests of the Python C API. The tests
5846 are implemented by the new Modules/_testmodule.c.
5847
5848- A new extension module, _symtable, provides provisional access to the
5849 internal symbol table used by the Python compiler. A higher-level
5850 interface will be added on top of _symtable in a future release.
5851
5852- Removed the obsolete soundex module.
5853
5854- xml.dom.minidom now uses the standard DOM exceptions. Node supports
5855 the isSameNode method; NamedNodeMap the get method.
5856
5857- xml.sax.expatreader supports the lexical handler property; it
5858 generates comment, startCDATA, and endCDATA events.
5859
5860Windows changes
5861
5862- Build procedure: the zlib project is built in a different way that
5863 ensures the zlib header files used can no longer get out of synch with
5864 the zlib binary used. See PCbuild\readme.txt for details. Your old
5865 zlib-related directories can be deleted; you'll need to download fresh
5866 source for zlib and unpack it into a new directory.
5867
5868- Build: New subproject _test for the benefit of test_capi.py (see above).
5869
5870- Build: New subproject _symtable, for new DLL _symtable.pyd (a nascent
5871 interface to some Python compiler internals).
5872
5873- Build: Subproject ucnhash is gone, since the code was folded into the
5874 unicodedata subproject.
5875
5876What's New in Python 2.1 alpha 1?
5877=================================
5878
5879Core language, builtins, and interpreter
5880
5881- There is a new Unicode companion to the PyObject_Str() API
5882 called PyObject_Unicode(). It behaves in the same way as the
5883 former, but assures that the returned value is an Unicode object
5884 (applying the usual coercion if necessary).
5885
5886- The comparison operators support "rich comparison overloading" (PEP
5887 207). C extension types can provide a rich comparison function in
5888 the new tp_richcompare slot in the type object. The cmp() function
5889 and the C function PyObject_Compare() first try the new rich
5890 comparison operators before trying the old 3-way comparison. There
5891 is also a new C API PyObject_RichCompare() (which also falls back on
5892 the old 3-way comparison, but does not constrain the outcome of the
5893 rich comparison to a Boolean result).
5894
5895 The rich comparison function takes two objects (at least one of
5896 which is guaranteed to have the type that provided the function) and
5897 an integer indicating the opcode, which can be Py_LT, Py_LE, Py_EQ,
5898 Py_NE, Py_GT, Py_GE (for <, <=, ==, !=, >, >=), and returns a Python
5899 object, which may be NotImplemented (in which case the tp_compare
5900 slot function is used as a fallback, if defined).
5901
5902 Classes can overload individual comparison operators by defining one
5903 or more of the methods__lt__, __le__, __eq__, __ne__, __gt__,
5904 __ge__. There are no explicit "reflected argument" versions of
5905 these; instead, __lt__ and __gt__ are each other's reflection,
5906 likewise for__le__ and __ge__; __eq__ and __ne__ are their own
5907 reflection (similar at the C level). No other implications are
5908 made; in particular, Python does not assume that == is the Boolean
5909 inverse of !=, or that < is the Boolean inverse of >=. This makes
5910 it possible to define types with partial orderings.
5911
5912 Classes or types that want to implement (in)equality tests but not
5913 the ordering operators (i.e. unordered types) should implement ==
5914 and !=, and raise an error for the ordering operators.
5915
5916 It is possible to define types whose rich comparison results are not
5917 Boolean; e.g. a matrix type might want to return a matrix of bits
5918 for A < B, giving elementwise comparisons. Such types should ensure
5919 that any interpretation of their value in a Boolean context raises
5920 an exception, e.g. by defining __nonzero__ (or the tp_nonzero slot
5921 at the C level) to always raise an exception.
5922
5923- Complex numbers use rich comparisons to define == and != but raise
5924 an exception for <, <=, > and >=. Unfortunately, this also means
5925 that cmp() of two complex numbers raises an exception when the two
5926 numbers differ. Since it is not mathematically meaningful to compare
5927 complex numbers except for equality, I hope that this doesn't break
5928 too much code.
5929
5930- The outcome of comparing non-numeric objects of different types is
5931 not defined by the language, other than that it's arbitrary but
5932 consistent (see the Reference Manual). An implementation detail changed
5933 in 2.1a1 such that None now compares less than any other object. Code
5934 relying on this new behavior (like code that relied on the previous
5935 behavior) does so at its own risk.
5936
5937- Functions and methods now support getting and setting arbitrarily
5938 named attributes (PEP 232). Functions have a new __dict__
5939 (a.k.a. func_dict) which hold the function attributes. Methods get
5940 and set attributes on their underlying im_func. It is a TypeError
5941 to set an attribute on a bound method.
5942
5943- The xrange() object implementation has been improved so that
5944 xrange(sys.maxint) can be used on 64-bit platforms. There's still a
5945 limitation that in this case len(xrange(sys.maxint)) can't be
5946 calculated, but the common idiom "for i in xrange(sys.maxint)" will
5947 work fine as long as the index i doesn't actually reach 2**31.
5948 (Python uses regular ints for sequence and string indices; fixing
5949 that is much more work.)
5950
5951- Two changes to from...import:
5952
5953 1) "from M import X" now works even if (after loading module M)
5954 sys.modules['M'] is not a real module; it's basically a getattr()
5955 operation with AttributeError exceptions changed into ImportError.
5956
5957 2) "from M import *" now looks for M.__all__ to decide which names to
5958 import; if M.__all__ doesn't exist, it uses M.__dict__.keys() but
5959 filters out names starting with '_' as before. Whether or not
5960 __all__ exists, there's no restriction on the type of M.
5961
5962- File objects have a new method, xreadlines(). This is the fastest
5963 way to iterate over all lines in a file:
5964
5965 for line in file.xreadlines():
5966 ...do something to line...
5967
5968 See the xreadlines module (mentioned below) for how to do this for
5969 other file-like objects.
5970
5971- Even if you don't use file.xreadlines(), you may expect a speedup on
5972 line-by-line input. The file.readline() method has been optimized
5973 quite a bit in platform-specific ways: on systems (like Linux) that
5974 support flockfile(), getc_unlocked(), and funlockfile(), those are
5975 used by default. On systems (like Windows) without getc_unlocked(),
5976 a complicated (but still thread-safe) method using fgets() is used by
5977 default.
5978
5979 You can force use of the fgets() method by #define'ing
5980 USE_FGETS_IN_GETLINE at build time (it may be faster than
5981 getc_unlocked()).
5982
5983 You can force fgets() not to be used by #define'ing
5984 DONT_USE_FGETS_IN_GETLINE (this is the first thing to try if std test
5985 test_bufio.py fails -- and let us know if it does!).
5986
5987- In addition, the fileinput module, while still slower than the other
5988 methods on most platforms, has been sped up too, by using
5989 file.readlines(sizehint).
5990
5991- Support for run-time warnings has been added, including a new
5992 command line option (-W) to specify the disposition of warnings.
5993 See the description of the warnings module below.
5994
5995- Extensive changes have been made to the coercion code. This mostly
5996 affects extension modules (which can now implement mixed-type
5997 numerical operators without having to use coercion), but
5998 occasionally, in boundary cases the coercion semantics have changed
5999 subtly. Since this was a terrible gray area of the language, this
6000 is considered an improvement. Also note that __rcmp__ is no longer
6001 supported -- instead of calling __rcmp__, __cmp__ is called with
6002 reflected arguments.
6003
6004- In connection with the coercion changes, a new built-in singleton
6005 object, NotImplemented is defined. This can be returned for
6006 operations that wish to indicate they are not implemented for a
6007 particular combination of arguments. From C, this is
6008 Py_NotImplemented.
6009
6010- The interpreter accepts now bytecode files on the command line even
6011 if they do not have a .pyc or .pyo extension. On Linux, after executing
6012
6013import imp,sys,string
6014magic = string.join(["\\x%.2x" % ord(c) for c in imp.get_magic()],"")
6015reg = ':pyc:M::%s::%s:' % (magic, sys.executable)
6016open("/proc/sys/fs/binfmt_misc/register","wb").write(reg)
6017
6018 any byte code file can be used as an executable (i.e. as an argument
6019 to execve(2)).
6020
6021- %[xXo] formats of negative Python longs now produce a sign
6022 character. In 1.6 and earlier, they never produced a sign,
6023 and raised an error if the value of the long was too large
6024 to fit in a Python int. In 2.0, they produced a sign if and
6025 only if too large to fit in an int. This was inconsistent
6026 across platforms (because the size of an int varies across
6027 platforms), and inconsistent with hex() and oct(). Example:
6028
6029 >>> "%x" % -0x42L
6030 '-42' # in 2.1
6031 'ffffffbe' # in 2.0 and before, on 32-bit machines
6032 >>> hex(-0x42L)
6033 '-0x42L' # in all versions of Python
6034
6035 The behavior of %d formats for negative Python longs remains
6036 the same as in 2.0 (although in 1.6 and before, they raised
6037 an error if the long didn't fit in a Python int).
6038
6039 %u formats don't make sense for Python longs, but are allowed
6040 and treated the same as %d in 2.1. In 2.0, a negative long
6041 formatted via %u produced a sign if and only if too large to
6042 fit in an int. In 1.6 and earlier, a negative long formatted
6043 via %u raised an error if it was too big to fit in an int.
6044
6045- Dictionary objects have an odd new method, popitem(). This removes
6046 an arbitrary item from the dictionary and returns it (in the form of
6047 a (key, value) pair). This can be useful for algorithms that use a
6048 dictionary as a bag of "to do" items and repeatedly need to pick one
6049 item. Such algorithms normally end up running in quadratic time;
6050 using popitem() they can usually be made to run in linear time.
6051
6052Standard library
6053
6054- In the time module, the time argument to the functions strftime,
6055 localtime, gmtime, asctime and ctime is now optional, defaulting to
6056 the current time (in the local timezone).
6057
6058- The ftplib module now defaults to passive mode, which is deemed a
6059 more useful default given that clients are often inside firewalls
6060 these days. Note that this could break if ftplib is used to connect
6061 to a *server* that is inside a firewall, from outside; this is
6062 expected to be a very rare situation. To fix that, you can call
6063 ftp.set_pasv(0).
6064
6065- The module site now treats .pth files not only for path configuration,
6066 but also supports extensions to the initialization code: Lines starting
6067 with import are executed.
6068
6069- There's a new module, warnings, which implements a mechanism for
6070 issuing and filtering warnings. There are some new built-in
6071 exceptions that serve as warning categories, and a new command line
6072 option, -W, to control warnings (e.g. -Wi ignores all warnings, -We
6073 turns warnings into errors). warnings.warn(message[, category])
6074 issues a warning message; this can also be called from C as
6075 PyErr_Warn(category, message).
6076
6077- A new module xreadlines was added. This exports a single factory
6078 function, xreadlines(). The intention is that this code is the
6079 absolutely fastest way to iterate over all lines in an open
6080 file(-like) object:
6081
6082 import xreadlines
6083 for line in xreadlines.xreadlines(file):
6084 ...do something to line...
6085
6086 This is equivalent to the previous the speed record holder using
6087 file.readlines(sizehint). Note that if file is a real file object
6088 (as opposed to a file-like object), this is equivalent:
6089
6090 for line in file.xreadlines():
6091 ...do something to line...
6092
6093- The bisect module has new functions bisect_left, insort_left,
6094 bisect_right and insort_right. The old names bisect and insort
6095 are now aliases for bisect_right and insort_right. XXX_right
6096 and XXX_left methods differ in what happens when the new element
6097 compares equal to one or more elements already in the list: the
6098 XXX_left methods insert to the left, the XXX_right methods to the
6099 right. Code that doesn't care where equal elements end up should
6100 continue to use the old, short names ("bisect" and "insort").
6101
6102- The new curses.panel module wraps the panel library that forms part
6103 of SYSV curses and ncurses. Contributed by Thomas Gellekum.
6104
6105- The SocketServer module now sets the allow_reuse_address flag by
6106 default in the TCPServer class.
6107
6108- A new function, sys._getframe(), returns the stack frame pointer of
6109 the caller. This is intended only as a building block for
6110 higher-level mechanisms such as string interpolation.
6111
6112- The pyexpat module supports a number of new handlers, which are
6113 available only in expat 1.2. If invocation of a callback fails, it
6114 will report an additional frame in the traceback. Parser objects
6115 participate now in garbage collection. If expat reports an unknown
6116 encoding, pyexpat will try to use a Python codec; that works only
6117 for single-byte charsets. The parser type objects is exposed as
6118 XMLParserObject.
6119
6120- xml.dom now offers standard definitions for symbolic node type and
6121 exception code constants, and a hierarchy of DOM exceptions. minidom
6122 was adjusted to use them.
6123
6124- The conformance of xml.dom.minidom to the DOM specification was
6125 improved. It detects a number of additional error cases; the
6126 previous/next relationship works even when the tree is modified;
6127 Node supports the normalize() method; NamedNodeMap, DocumentType and
6128 DOMImplementation classes were added; Element supports the
6129 hasAttribute and hasAttributeNS methods; and Text supports the splitText
6130 method.
6131
6132Build issues
6133
6134- For Unix (and Unix-compatible) builds, configuration and building of
6135 extension modules is now greatly automated. Rather than having to
6136 edit the Modules/Setup file to indicate which modules should be
6137 built and where their include files and libraries are, a
6138 distutils-based setup.py script now takes care of building most
6139 extension modules. All extension modules built this way are built
6140 as shared libraries. Only a few modules that must be linked
6141 statically are still listed in the Setup file; you won't need to
6142 edit their configuration.
6143
6144- Python should now build out of the box on Cygwin. If it doesn't,
6145 mail to Jason Tishler (jlt63 at users.sourceforge.net).
6146
6147- Python now always uses its own (renamed) implementation of getopt()
6148 -- there's too much variation among C library getopt()
6149 implementations.
6150
6151- C++ compilers are better supported; the CXX macro is always set to a
6152 C++ compiler if one is found.
6153
6154Windows changes
6155
6156- select module: By default under Windows, a select() call
6157 can specify no more than 64 sockets. Python now boosts
6158 this Microsoft default to 512. If you need even more than
6159 that, see the MS docs (you'll need to #define FD_SETSIZE
6160 and recompile Python from source).
6161
6162- Support for Windows 3.1, DOS and OS/2 is gone. The Lib/dos-8x3
6163 subdirectory is no more!
6164
6165
6166What's New in Python 2.0?
6167=========================
6168
6169Below is a list of all relevant changes since release 1.6. Older
6170changes are in the file HISTORY. If you are making the jump directly
6171from Python 1.5.2 to 2.0, make sure to read the section for 1.6 in the
6172HISTORY file! Many important changes listed there.
6173
6174Alternatively, a good overview of the changes between 1.5.2 and 2.0 is
6175the document "What's New in Python 2.0" by Kuchling and Moshe Zadka:
Andrew M. Kuchlinge240d9b2004-03-21 18:48:22 +00006176http://www.amk.ca/python/2.0/.
Skip Montanaro4cb22042002-09-17 20:55:31 +00006177
6178--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)
6179
6180======================================================================
6181
6182What's new in 2.0 (since release candidate 1)?
6183==============================================
6184
6185Standard library
6186
6187- The copy_reg module was modified to clarify its intended use: to
6188 register pickle support for extension types, not for classes.
6189 pickle() will raise a TypeError if it is passed a class.
6190
6191- Fixed a bug in gettext's "normalize and expand" code that prevented
6192 it from finding an existing .mo file.
6193
6194- Restored support for HTTP/0.9 servers in httplib.
6195
6196- The math module was changed to stop raising OverflowError in case of
6197 underflow, and return 0 instead in underflow cases. Whether Python
6198 used to raise OverflowError in case of underflow was platform-
6199 dependent (it did when the platform math library set errno to ERANGE
6200 on underflow).
6201
6202- Fixed a bug in StringIO that occurred when the file position was not
6203 at the end of the file and write() was called with enough data to
6204 extend past the end of the file.
6205
6206- Fixed a bug that caused Tkinter error messages to get lost on
6207 Windows. The bug was fixed by replacing direct use of
6208 interp->result with Tcl_GetStringResult(interp).
6209
6210- Fixed bug in urllib2 that caused it to fail when it received an HTTP
6211 redirect response.
6212
6213- Several changes were made to distutils: Some debugging code was
6214 removed from util. Fixed the installer used when an external zip
6215 program (like WinZip) is not found; the source code for this
6216 installer is in Misc/distutils. check_lib() was modified to behave
6217 more like AC_CHECK_LIB by add other_libraries() as a parameter. The
6218 test for whether installed modules are on sys.path was changed to
6219 use both normcase() and normpath().
6220
6221- Several minor bugs were fixed in the xml package (the minidom,
6222 pulldom, expatreader, and saxutils modules).
6223
6224- The regression test driver (regrtest.py) behavior when invoked with
6225 -l changed: It now reports a count of objects that are recognized as
6226 garbage but not freed by the garbage collector.
6227
6228- The regression test for the math module was changed to test
6229 exceptional behavior when the test is run in verbose mode. Python
6230 cannot yet guarantee consistent exception behavior across platforms,
6231 so the exception part of test_math is run only in verbose mode, and
6232 may fail on your platform.
6233
6234Internals
6235
6236- PyOS_CheckStack() has been disabled on Win64, where it caused
6237 test_sre to fail.
6238
6239Build issues
6240
6241- Changed compiler flags, so that gcc is always invoked with -Wall and
6242 -Wstrict-prototypes. Users compiling Python with GCC should see
6243 exactly one warning, except if they have passed configure the
6244 --with-pydebug flag. The expected warning is for getopt() in
6245 Modules/main.c. This warning will be fixed for Python 2.1.
6246
6247- Fixed configure to add -threads argument during linking on OSF1.
6248
6249Tools and other miscellany
6250
6251- The compiler in Tools/compiler was updated to support the new
6252 language features introduced in 2.0: extended print statement, list
6253 comprehensions, and augmented assignments. The new compiler should
6254 also be backwards compatible with Python 1.5.2; the compiler will
6255 always generate code for the version of the interpreter it runs
6256 under.
6257
6258What's new in 2.0 release candidate 1 (since beta 2)?
6259=====================================================
6260
6261What is release candidate 1?
6262
6263We believe that release candidate 1 will fix all known bugs that we
6264intend to fix for the 2.0 final release. This release should be a bit
6265more stable than the previous betas. We would like to see even more
6266widespread testing before the final release, so we are producing this
6267release candidate. The final release will be exactly the same unless
6268any show-stopping (or brown bag) bugs are found by testers of the
6269release candidate.
6270
6271All the changes since the last beta release are bug fixes or changes
6272to support building Python for specific platforms.
6273
6274Core language, builtins, and interpreter
6275
6276- A bug that caused crashes when __coerce__ was used with augmented
6277 assignment, e.g. +=, was fixed.
6278
6279- Raise ZeroDivisionError when raising zero to a negative number,
6280 e.g. 0.0 ** -2.0. Note that math.pow is unrelated to the builtin
6281 power operator and the result of math.pow(0.0, -2.0) will vary by
6282 platform. On Linux, it raises a ValueError.
6283
6284- A bug in Unicode string interpolation was fixed that occasionally
6285 caused errors with formats including "%%". For example, the
6286 following expression "%% %s" % u"abc" no longer raises a TypeError.
6287
6288- Compilation of deeply nested expressions raises MemoryError instead
6289 of SyntaxError, e.g. eval("[" * 50 + "]" * 50).
6290
6291- In 2.0b2 on Windows, the interpreter wrote .pyc files in text mode,
6292 rendering them useless. They are now written in binary mode again.
6293
6294Standard library
6295
6296- Keyword arguments are now accepted for most pattern and match object
6297 methods in SRE, the standard regular expression engine.
6298
6299- In SRE, fixed error with negative lookahead and lookbehind that
6300 manifested itself as a runtime error in patterns like "(?<!abc)(def)".
6301
6302- Several bugs in the Unicode handling and error handling in _tkinter
6303 were fixed.
6304
6305- Fix memory management errors in Merge() and Tkapp_Call() routines.
6306
6307- Several changes were made to cStringIO to make it compatible with
6308 the file-like object interface and with StringIO. If operations are
6309 performed on a closed object, an exception is raised. The truncate
6310 method now accepts a position argument and readline accepts a size
6311 argument.
6312
6313- There were many changes made to the linuxaudiodev module and its
6314 test suite; as a result, a short, unexpected audio sample should now
6315 play when the regression test is run.
6316
6317 Note that this module is named poorly, because it should work
6318 correctly on any platform that supports the Open Sound System
6319 (OSS).
6320
6321 The module now raises exceptions when errors occur instead of
6322 crashing. It also defines the AFMT_A_LAW format (logarithmic A-law
6323 audio) and defines a getptr() method that calls the
6324 SNDCTL_DSP_GETxPTR ioctl defined in the OSS Programmer's Guide.
6325
6326- The library_version attribute, introduced in an earlier beta, was
6327 removed because it can not be supported with early versions of the C
6328 readline library, which provides no way to determine the version at
6329 compile-time.
6330
6331- The binascii module is now enabled on Win64.
6332
6333- tokenize.py no longer suffers "recursion depth" errors when parsing
6334 programs with very long string literals.
6335
6336Internals
6337
6338- Fixed several buffer overflow vulnerabilities in calculate_path(),
6339 which is called when the interpreter starts up to determine where
6340 the standard library is installed. These vulnerabilities affect all
6341 previous versions of Python and can be exploited by setting very
6342 long values for PYTHONHOME or argv[0]. The risk is greatest for a
6343 setuid Python script, although use of the wrapper in
6344 Misc/setuid-prog.c will eliminate the vulnerability.
6345
6346- Fixed garbage collection bugs in instance creation that were
6347 triggered when errors occurred during initialization. The solution,
6348 applied in cPickle and in PyInstance_New(), is to call
6349 PyObject_GC_Init() after the initialization of the object's
6350 container attributes is complete.
6351
6352- pyexpat adds definitions of PyModule_AddStringConstant and
6353 PyModule_AddObject if the Python version is less than 2.0, which
6354 provides compatibility with PyXML on Python 1.5.2.
6355
6356- If the platform has a bogus definition for LONG_BIT (the number of
6357 bits in a long), an error will be reported at compile time.
6358
6359- Fix bugs in _PyTuple_Resize() which caused hard-to-interpret garbage
6360 collection crashes and possibly other, unreported crashes.
6361
6362- Fixed a memory leak in _PyUnicode_Fini().
6363
6364Build issues
6365
6366- configure now accepts a --with-suffix option that specifies the
6367 executable suffix. This is useful for builds on Cygwin and Mac OS
6368 X, for example.
6369
6370- The mmap.PAGESIZE constant is now initialized using sysconf when
6371 possible, which eliminates a dependency on -lucb for Reliant UNIX.
6372
6373- The md5 file should now compile on all platforms.
6374
6375- The select module now compiles on platforms that do not define
6376 POLLRDNORM and related constants.
6377
6378- Darwin (Mac OS X): Initial support for static builds on this
6379 platform.
6380
6381- BeOS: A number of changes were made to the build and installation
6382 process. ar-fake now operates on a directory of object files.
6383 dl_export.h is gone, and its macros now appear on the mwcc command
6384 line during build on PPC BeOS.
6385
6386- Platform directory in lib/python2.0 is "plat-beos5" (or
6387 "plat-beos4", if building on BeOS 4.5), rather than "plat-beos".
6388
6389- Cygwin: Support for shared libraries, Tkinter, and sockets.
6390
6391- SunOS 4.1.4_JL: Fix test for directory existence in configure.
6392
6393Tools and other miscellany
6394
6395- Removed debugging prints from main used with freeze.
6396
6397- IDLE auto-indent no longer crashes when it encounters Unicode
6398 characters.
6399
6400What's new in 2.0 beta 2 (since beta 1)?
6401========================================
6402
6403Core language, builtins, and interpreter
6404
6405- Add support for unbounded ints in %d,i,u,x,X,o formats; for example
6406 "%d" % 2L**64 == "18446744073709551616".
6407
6408- Add -h and -V command line options to print the usage message and
6409 Python version number and exit immediately.
6410
6411- eval() and exec accept Unicode objects as code parameters.
6412
6413- getattr() and setattr() now also accept Unicode objects for the
6414 attribute name, which are converted to strings using the default
6415 encoding before lookup.
6416
6417- Multiplication on string and Unicode now does proper bounds
6418 checking; e.g. 'a' * 65536 * 65536 will raise ValueError, "repeated
6419 string is too long."
6420
6421- Better error message when continue is found in try statement in a
6422 loop.
6423
6424
6425Standard library and extensions
6426
6427- socket module: the OpenSSL code now adds support for RAND_status()
6428 and EGD (Entropy Gathering Device).
6429
6430- array: reverse() method of array now works. buffer_info() now does
6431 argument checking; it still takes no arguments.
6432
6433- asyncore/asynchat: Included most recent version from Sam Rushing.
6434
6435- cgi: Accept '&' or ';' as separator characters when parsing form data.
6436
6437- CGIHTTPServer: Now works on Windows (and perhaps even Mac).
6438
6439- ConfigParser: When reading the file, options spelled in upper case
6440 letters are now correctly converted to lowercase.
6441
6442- copy: Copy Unicode objects atomically.
6443
6444- cPickle: Fail gracefully when copy_reg can't be imported.
6445
6446- cStringIO: Implemented readlines() method.
6447
6448- dbm: Add get() and setdefault() methods to dbm object. Add constant
6449 `library' to module that names the library used. Added doc strings
6450 and method names to error messages. Uses configure to determine
6451 which ndbm.h file to include; Berkeley DB's nbdm and GDBM's ndbm is
6452 now available options.
6453
6454- distutils: Update to version 0.9.3.
6455
6456- dl: Add several dl.RTLD_ constants.
6457
6458- fpectl: Now supported on FreeBSD.
6459
6460- gc: Add DEBUG_SAVEALL option. When enabled all garbage objects
6461 found by the collector will be saved in gc.garbage. This is useful
6462 for debugging a program that creates reference cycles.
6463
6464- httplib: Three changes: Restore support for set_debuglevel feature
6465 of HTTP class. Do not close socket on zero-length response. Do not
6466 crash when server sends invalid content-length header.
6467
6468- mailbox: Mailbox class conforms better to qmail specifications.
6469
6470- marshal: When reading a short, sign-extend on platforms where shorts
6471 are bigger than 16 bits. When reading a long, repair the unportable
6472 sign extension that was being done for 64-bit machines. (It assumed
6473 that signed right shift sign-extends.)
6474
6475- operator: Add contains(), invert(), __invert__() as aliases for
6476 __contains__(), inv(), and __inv__() respectively.
6477
6478- os: Add support for popen2() and popen3() on all platforms where
6479 fork() exists. (popen4() is still in the works.)
6480
6481- os: (Windows only:) Add startfile() function that acts like double-
6482 clicking on a file in Explorer (or passing the file name to the
6483 DOS "start" command).
6484
6485- os.path: (Windows, DOS:) Treat trailing colon correctly in
6486 os.path.join. os.path.join("a:", "b") yields "a:b".
6487
6488- pickle: Now raises ValueError when an invalid pickle that contains
6489 a non-string repr where a string repr was expected. This behavior
6490 matches cPickle.
6491
6492- posixfile: Remove broken __del__() method.
6493
6494- py_compile: support CR+LF line terminators in source file.
6495
6496- readline: Does not immediately exit when ^C is hit when readline and
6497 threads are configured. Adds definition of rl_library_version. (The
6498 latter addition requires GNU readline 2.2 or later.)
6499
6500- rfc822: Domain literals returned by AddrlistClass method
6501 getdomainliteral() are now properly wrapped in brackets.
6502
6503- site: sys.setdefaultencoding() should only be called in case the
6504 standard default encoding ("ascii") is changed. This saves quite a
6505 few cycles during startup since the first call to
6506 setdefaultencoding() will initialize the codec registry and the
6507 encodings package.
6508
6509- socket: Support for size hint in readlines() method of object returned
6510 by makefile().
6511
6512- sre: Added experimental expand() method to match objects. Does not
6513 use buffer interface on Unicode strings. Does not hang if group id
6514 is followed by whitespace.
6515
6516- StringIO: Size hint in readlines() is now supported as documented.
6517
6518- struct: Check ranges for bytes and shorts.
6519
6520- urllib: Improved handling of win32 proxy settings. Fixed quote and
6521 quote_plus functions so that the always encode a comma.
6522
6523- Tkinter: Image objects are now guaranteed to have unique ids. Set
6524 event.delta to zero if Tk version doesn't support mousewheel.
6525 Removed some debugging prints.
6526
6527- UserList: now implements __contains__().
6528
6529- webbrowser: On Windows, use os.startfile() instead of os.popen(),
6530 which works around a bug in Norton AntiVirus 2000 that leads directly
6531 to a Blue Screen freeze.
6532
6533- xml: New version detection code allows PyXML to override standard
6534 XML package if PyXML version is greater than 0.6.1.
6535
6536- xml.dom: DOM level 1 support for basic XML. Includes xml.dom.minidom
6537 (conventional DOM), and xml.dom.pulldom, which allows building the DOM
6538 tree only for nodes which are sufficiently interesting to a specific
6539 application. Does not provide the HTML-specific extensions. Still
6540 undocumented.
6541
6542- xml.sax: SAX 2 support for Python, including all the handler
6543 interfaces needed to process XML 1.0 compliant XML. Some
6544 documentation is already available.
6545
6546- pyexpat: Renamed to xml.parsers.expat since this is part of the new,
6547 packagized XML support.
6548
6549
6550C API
6551
6552- Add three new convenience functions for module initialization --
6553 PyModule_AddObject(), PyModule_AddIntConstant(), and
6554 PyModule_AddStringConstant().
6555
6556- Cleaned up definition of NULL in C source code; all definitions were
6557 removed and add #error to Python.h if NULL isn't defined after
6558 #include of stdio.h.
6559
6560- Py_PROTO() macros that were removed in 2.0b1 have been restored for
6561 backwards compatibility (at the source level) with old extensions.
6562
6563- A wrapper API was added for signal() and sigaction(). Instead of
6564 either function, always use PyOS_getsig() to get a signal handler
6565 and PyOS_setsig() to set one. A new convenience typedef
6566 PyOS_sighandler_t is defined for the type of signal handlers.
6567
6568- Add PyString_AsStringAndSize() function that provides access to the
6569 internal data buffer and size of a string object -- or the default
6570 encoded version of a Unicode object.
6571
6572- PyString_Size() and PyString_AsString() accept Unicode objects.
6573
6574- The standard header <limits.h> is now included by Python.h (if it
6575 exists). INT_MAX and LONG_MAX will always be defined, even if
6576 <limits.h> is not available.
6577
6578- PyFloat_FromString takes a second argument, pend, that was
6579 effectively useless. It is now officially useless but preserved for
6580 backwards compatibility. If the pend argument is not NULL, *pend is
6581 set to NULL.
6582
6583- PyObject_GetAttr() and PyObject_SetAttr() now accept Unicode objects
6584 for the attribute name. See note on getattr() above.
6585
6586- A few bug fixes to argument processing for Unicode.
6587 PyArg_ParseTupleAndKeywords() now accepts "es#" and "es".
6588 PyArg_Parse() special cases "s#" for Unicode objects; it returns a
6589 pointer to the default encoded string data instead of to the raw
6590 UTF-16.
6591
6592- Py_BuildValue accepts B format (for bgen-generated code).
6593
6594
6595Internals
6596
6597- On Unix, fix code for finding Python installation directory so that
6598 it works when argv[0] is a relative path.
6599
6600- Added a true unicode_internal_encode() function and fixed the
6601 unicode_internal_decode function() to support Unicode objects directly
6602 rather than by generating a copy of the object.
6603
6604- Several of the internal Unicode tables are much smaller now, and
6605 the source code should be much friendlier to weaker compilers.
6606
6607- In the garbage collector: Fixed bug in collection of tuples. Fixed
6608 bug that caused some instances to be removed from the container set
6609 while they were still live. Fixed parsing in gc.set_debug() for
6610 platforms where sizeof(long) > sizeof(int).
6611
6612- Fixed refcount problem in instance deallocation that only occurred
6613 when Py_REF_DEBUG was defined and Py_TRACE_REFS was not.
6614
6615- On Windows, getpythonregpath is now protected against null data in
6616 registry key.
6617
6618- On Unix, create .pyc/.pyo files with O_EXCL flag to avoid a race
6619 condition.
6620
6621
6622Build and platform-specific issues
6623
6624- Better support of GNU Pth via --with-pth configure option.
6625
6626- Python/C API now properly exposed to dynamically-loaded extension
6627 modules on Reliant UNIX.
6628
6629- Changes for the benefit of SunOS 4.1.4 (really!). mmapmodule.c:
6630 Don't define MS_SYNC to be zero when it is undefined. Added missing
6631 prototypes in posixmodule.c.
6632
6633- Improved support for HP-UX build. Threads should now be correctly
6634 configured (on HP-UX 10.20 and 11.00).
6635
6636- Fix largefile support on older NetBSD systems and OpenBSD by adding
6637 define for TELL64.
6638
6639
6640Tools and other miscellany
6641
6642- ftpmirror: Call to main() is wrapped in if __name__ == "__main__".
6643
6644- freeze: The modulefinder now works with 2.0 opcodes.
6645
6646- IDLE:
6647 Move hackery of sys.argv until after the Tk instance has been
6648 created, which allows the application-specific Tkinter
6649 initialization to be executed if present; also pass an explicit
6650 className parameter to the Tk() constructor.
6651
6652
6653What's new in 2.0 beta 1?
6654=========================
6655
6656Source Incompatibilities
6657------------------------
6658
6659None. Note that 1.6 introduced several incompatibilities with 1.5.2,
6660such as single-argument append(), connect() and bind(), and changes to
6661str(long) and repr(float).
6662
6663
6664Binary Incompatibilities
6665------------------------
6666
6667- Third party extensions built for Python 1.5.x or 1.6 cannot be used
6668with Python 2.0; these extensions will have to be rebuilt for Python
66692.0.
6670
6671- On Windows, attempting to import a third party extension built for
6672Python 1.5.x or 1.6 results in an immediate crash; there's not much we
6673can do about this. Check your PYTHONPATH environment variable!
6674
6675- Python bytecode files (*.pyc and *.pyo) are not compatible between
6676releases.
6677
6678
6679Overview of Changes Since 1.6
6680-----------------------------
6681
6682There are many new modules (including brand new XML support through
6683the xml package, and i18n support through the gettext module); a list
6684of all new modules is included below. Lots of bugs have been fixed.
6685
6686The process for making major new changes to the language has changed
6687since Python 1.6. Enhancements must now be documented by a Python
6688Enhancement Proposal (PEP) before they can be accepted.
6689
6690There are several important syntax enhancements, described in more
6691detail below:
6692
6693 - Augmented assignment, e.g. x += 1
6694
6695 - List comprehensions, e.g. [x**2 for x in range(10)]
6696
6697 - Extended import statement, e.g. import Module as Name
6698
6699 - Extended print statement, e.g. print >> file, "Hello"
6700
6701Other important changes:
6702
6703 - Optional collection of cyclical garbage
6704
6705Python Enhancement Proposal (PEP)
6706---------------------------------
6707
6708PEP stands for Python Enhancement Proposal. A PEP is a design
6709document providing information to the Python community, or describing
6710a new feature for Python. The PEP should provide a concise technical
6711specification of the feature and a rationale for the feature.
6712
6713We intend PEPs to be the primary mechanisms for proposing new
6714features, for collecting community input on an issue, and for
6715documenting the design decisions that have gone into Python. The PEP
6716author is responsible for building consensus within the community and
6717documenting dissenting opinions.
6718
6719The PEPs are available at http://python.sourceforge.net/peps/.
6720
6721Augmented Assignment
6722--------------------
6723
6724This must have been the most-requested feature of the past years!
6725Eleven new assignment operators were added:
6726
6727 += -= *= /= %= **= <<= >>= &= ^= |=
6728
6729For example,
6730
6731 A += B
6732
6733is similar to
6734
6735 A = A + B
6736
6737except that A is evaluated only once (relevant when A is something
6738like dict[index].attr).
6739
6740However, if A is a mutable object, A may be modified in place. Thus,
6741if A is a number or a string, A += B has the same effect as A = A+B
6742(except A is only evaluated once); but if a is a list, A += B has the
6743same effect as A.extend(B)!
6744
6745Classes and built-in object types can override the new operators in
6746order to implement the in-place behavior; the not-in-place behavior is
6747used automatically as a fallback when an object doesn't implement the
6748in-place behavior. For classes, the method name is derived from the
6749method name for the corresponding not-in-place operator by inserting
6750an 'i' in front of the name, e.g. __iadd__ implements in-place
6751__add__.
6752
6753Augmented assignment was implemented by Thomas Wouters.
6754
6755
6756List Comprehensions
6757-------------------
6758
6759This is a flexible new notation for lists whose elements are computed
6760from another list (or lists). The simplest form is:
6761
6762 [<expression> for <variable> in <sequence>]
6763
6764For example, [i**2 for i in range(4)] yields the list [0, 1, 4, 9].
6765This is more efficient than a for loop with a list.append() call.
6766
6767You can also add a condition:
6768
6769 [<expression> for <variable> in <sequence> if <condition>]
6770
6771For example, [w for w in words if w == w.lower()] would yield the list
6772of words that contain no uppercase characters. This is more efficient
6773than a for loop with an if statement and a list.append() call.
6774
6775You can also have nested for loops and more than one 'if' clause. For
6776example, here's a function that flattens a sequence of sequences::
6777
6778 def flatten(seq):
6779 return [x for subseq in seq for x in subseq]
6780
6781 flatten([[0], [1,2,3], [4,5], [6,7,8,9], []])
6782
6783This prints
6784
6785 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
6786
6787List comprehensions originated as a patch set from Greg Ewing; Skip
6788Montanaro and Thomas Wouters also contributed. Described by PEP 202.
6789
6790
6791Extended Import Statement
6792-------------------------
6793
6794Many people have asked for a way to import a module under a different
6795name. This can be accomplished like this:
6796
6797 import foo
6798 bar = foo
6799 del foo
6800
6801but this common idiom gets old quickly. A simple extension of the
6802import statement now allows this to be written as follows:
6803
6804 import foo as bar
6805
6806There's also a variant for 'from ... import':
6807
6808 from foo import bar as spam
6809
6810This also works with packages; e.g. you can write this:
6811
6812 import test.regrtest as regrtest
6813
6814Note that 'as' is not a new keyword -- it is recognized only in this
6815context (this is only possible because the syntax for the import
6816statement doesn't involve expressions).
6817
6818Implemented by Thomas Wouters. Described by PEP 221.
6819
6820
6821Extended Print Statement
6822------------------------
6823
6824Easily the most controversial new feature, this extension to the print
6825statement adds an option to make the output go to a different file
6826than the default sys.stdout.
6827
6828For example, to write an error message to sys.stderr, you can now
6829write:
6830
6831 print >> sys.stderr, "Error: bad dog!"
6832
6833As a special feature, if the expression used to indicate the file
6834evaluates to None, the current value of sys.stdout is used. Thus:
6835
6836 print >> None, "Hello world"
6837
6838is equivalent to
6839
6840 print "Hello world"
6841
6842Design and implementation by Barry Warsaw. Described by PEP 214.
6843
6844
6845Optional Collection of Cyclical Garbage
6846---------------------------------------
6847
6848Python is now equipped with a garbage collector that can hunt down
6849cyclical references between Python objects. It's no replacement for
6850reference counting; in fact, it depends on the reference counts being
6851correct, and decides that a set of objects belong to a cycle if all
6852their reference counts can be accounted for from their references to
6853each other. This devious scheme was first proposed by Eric Tiedemann,
6854and brought to implementation by Neil Schemenauer.
6855
6856There's a module "gc" that lets you control some parameters of the
6857garbage collection. There's also an option to the configure script
6858that lets you enable or disable the garbage collection. In 2.0b1,
6859it's on by default, so that we (hopefully) can collect decent user
6860experience with this new feature. There are some questions about its
6861performance. If it proves to be too much of a problem, we'll turn it
6862off by default in the final 2.0 release.
6863
6864
6865Smaller Changes
6866---------------
6867
6868A new function zip() was added. zip(seq1, seq2, ...) is equivalent to
6869map(None, seq1, seq2, ...) when the sequences have the same length;
6870i.e. zip([1,2,3], [10,20,30]) returns [(1,10), (2,20), (3,30)]. When
6871the lists are not all the same length, the shortest list wins:
6872zip([1,2,3], [10,20]) returns [(1,10), (2,20)]. See PEP 201.
6873
6874sys.version_info is a tuple (major, minor, micro, level, serial).
6875
6876Dictionaries have an odd new method, setdefault(key, default).
6877dict.setdefault(key, default) returns dict[key] if it exists; if not,
6878it sets dict[key] to default and returns that value. Thus:
6879
6880 dict.setdefault(key, []).append(item)
6881
6882does the same work as this common idiom:
6883
6884 if not dict.has_key(key):
6885 dict[key] = []
6886 dict[key].append(item)
6887
6888There are two new variants of SyntaxError that are raised for
6889indentation-related errors: IndentationError and TabError.
6890
6891Changed \x to consume exactly two hex digits; see PEP 223. Added \U
6892escape that consumes exactly eight hex digits.
6893
6894The limits on the size of expressions and file in Python source code
6895have been raised from 2**16 to 2**32. Previous versions of Python
6896were limited because the maximum argument size the Python VM accepted
6897was 2**16. This limited the size of object constructor expressions,
6898e.g. [1,2,3] or {'a':1, 'b':2}, and the size of source files. This
6899limit was raised thanks to a patch by Charles Waldman that effectively
6900fixes the problem. It is now much more likely that you will be
6901limited by available memory than by an arbitrary limit in Python.
6902
6903The interpreter's maximum recursion depth can be modified by Python
6904programs using sys.getrecursionlimit and sys.setrecursionlimit. This
6905limit is the maximum number of recursive calls that can be made by
6906Python code. The limit exists to prevent infinite recursion from
6907overflowing the C stack and causing a core dump. The default value is
69081000. The maximum safe value for a particular platform can be found
6909by running Misc/find_recursionlimit.py.
6910
6911New Modules and Packages
6912------------------------
6913
6914atexit - for registering functions to be called when Python exits.
6915
6916imputil - Greg Stein's alternative API for writing custom import
6917hooks.
6918
6919pyexpat - an interface to the Expat XML parser, contributed by Paul
6920Prescod.
6921
6922xml - a new package with XML support code organized (so far) in three
6923subpackages: xml.dom, xml.sax, and xml.parsers. Describing these
6924would fill a volume. There's a special feature whereby a
6925user-installed package named _xmlplus overrides the standard
6926xmlpackage; this is intended to give the XML SIG a hook to distribute
6927backwards-compatible updates to the standard xml package.
6928
6929webbrowser - a platform-independent API to launch a web browser.
6930
6931
6932Changed Modules
6933---------------
6934
6935array -- new methods for array objects: count, extend, index, pop, and
6936remove
6937
6938binascii -- new functions b2a_hex and a2b_hex that convert between
6939binary data and its hex representation
6940
6941calendar -- Many new functions that support features including control
6942over which day of the week is the first day, returning strings instead
6943of printing them. Also new symbolic constants for days of week,
6944e.g. MONDAY, ..., SUNDAY.
6945
6946cgi -- FieldStorage objects have a getvalue method that works like a
6947dictionary's get method and returns the value attribute of the object.
6948
6949ConfigParser -- The parser object has new methods has_option,
6950remove_section, remove_option, set, and write. They allow the module
6951to be used for writing config files as well as reading them.
6952
6953ftplib -- ntransfercmd(), transfercmd(), and retrbinary() all now
6954optionally support the RFC 959 REST command.
6955
6956gzip -- readline and readlines now accept optional size arguments
6957
6958httplib -- New interfaces and support for HTTP/1.1 by Greg Stein. See
6959the module doc strings for details.
6960
6961locale -- implement getdefaultlocale for Win32 and Macintosh
6962
6963marshal -- no longer dumps core when marshaling deeply nested or
6964recursive data structures
6965
6966os -- new functions isatty, seteuid, setegid, setreuid, setregid
6967
6968os/popen2 -- popen2/popen3/popen4 support under Windows. popen2/popen3
6969support under Unix.
6970
6971os/pty -- support for openpty and forkpty
6972
6973os.path -- fix semantics of os.path.commonprefix
6974
6975smtplib -- support for sending very long messages
6976
6977socket -- new function getfqdn()
6978
6979readline -- new functions to read, write and truncate history files.
6980The readline section of the library reference manual contains an
6981example.
6982
6983select -- add interface to poll system call
6984
6985shutil -- new copyfileobj function
6986
6987SimpleHTTPServer, CGIHTTPServer -- Fix problems with buffering in the
6988HTTP server.
6989
6990Tkinter -- optimization of function flatten
6991
6992urllib -- scans environment variables for proxy configuration,
6993e.g. http_proxy.
6994
6995whichdb -- recognizes dumbdbm format
6996
6997
6998Obsolete Modules
6999----------------
7000
7001None. However note that 1.6 made a whole slew of modules obsolete:
7002stdwin, soundex, cml, cmpcache, dircache, dump, find, grep, packmail,
7003poly, zmod, strop, util, whatsound.
7004
7005
7006Changed, New, Obsolete Tools
7007----------------------------
7008
7009None.
7010
7011
7012C-level Changes
7013---------------
7014
7015Several cleanup jobs were carried out throughout the source code.
7016
7017All C code was converted to ANSI C; we got rid of all uses of the
7018Py_PROTO() macro, which makes the header files a lot more readable.
7019
7020Most of the portability hacks were moved to a new header file,
7021pyport.h; several other new header files were added and some old
7022header files were removed, in an attempt to create a more rational set
7023of header files. (Few of these ever need to be included explicitly;
7024they are all included by Python.h.)
7025
7026Trent Mick ensured portability to 64-bit platforms, under both Linux
7027and Win64, especially for the new Intel Itanium processor. Mick also
7028added large file support for Linux64 and Win64.
7029
7030The C APIs to return an object's size have been update to consistently
7031use the form PyXXX_Size, e.g. PySequence_Size and PyDict_Size. In
7032previous versions, the abstract interfaces used PyXXX_Length and the
7033concrete interfaces used PyXXX_Size. The old names,
7034e.g. PyObject_Length, are still available for backwards compatibility
7035at the API level, but are deprecated.
7036
7037The PyOS_CheckStack function has been implemented on Windows by
7038Fredrik Lundh. It prevents Python from failing with a stack overflow
7039on Windows.
7040
7041The GC changes resulted in creation of two new slots on object,
7042tp_traverse and tp_clear. The augmented assignment changes result in
7043the creation of a new slot for each in-place operator.
7044
7045The GC API creates new requirements for container types implemented in
7046C extension modules. See Include/objimpl.h for details.
7047
7048PyErr_Format has been updated to automatically calculate the size of
7049the buffer needed to hold the formatted result string. This change
7050prevents crashes caused by programmer error.
7051
7052New C API calls: PyObject_AsFileDescriptor, PyErr_WriteUnraisable.
7053
7054PyRun_AnyFileEx, PyRun_SimpleFileEx, PyRun_FileEx -- New functions
7055that are the same as their non-Ex counterparts except they take an
7056extra flag argument that tells them to close the file when done.
7057
7058XXX There were other API changes that should be fleshed out here.
7059
7060
7061Windows Changes
7062---------------
7063
7064New popen2/popen3/peopen4 in os module (see Changed Modules above).
7065
7066os.popen is much more usable on Windows 95 and 98. See Microsoft
7067Knowledge Base article Q150956. The Win9x workaround described there
7068is implemented by the new w9xpopen.exe helper in the root of your
7069Python installation. Note that Python uses this internally; it is not
7070a standalone program.
7071
7072Administrator privileges are no longer required to install Python
7073on Windows NT or Windows 2000. If you have administrator privileges,
7074Python's registry info will be written under HKEY_LOCAL_MACHINE.
7075Otherwise the installer backs off to writing Python's registry info
7076under HKEY_CURRENT_USER. The latter is sufficient for all "normal"
7077uses of Python, but will prevent some advanced uses from working
7078(for example, running a Python script as an NT service, or possibly
7079from CGI).
7080
7081[This was new in 1.6] The installer no longer runs a separate Tcl/Tk
7082installer; instead, it installs the needed Tcl/Tk files directly in the
7083Python directory. If you already have a Tcl/Tk installation, this
7084wastes some disk space (about 4 Megs) but avoids problems with
7085conflicting Tcl/Tk installations, and makes it much easier for Python
7086to ensure that Tcl/Tk can find all its files.
7087
7088[This was new in 1.6] The Windows installer now installs by default in
7089\Python20\ on the default volume, instead of \Program Files\Python-2.0\.
7090
7091
7092Updates to the changes between 1.5.2 and 1.6
7093--------------------------------------------
7094
7095The 1.6 NEWS file can't be changed after the release is done, so here
7096is some late-breaking news:
7097
7098New APIs in locale.py: normalize(), getdefaultlocale(), resetlocale(),
7099and changes to getlocale() and setlocale().
7100
7101The new module is now enabled per default.
7102
7103It is not true that the encodings codecs cannot be used for normal
7104strings: the string.encode() (which is also present on 8-bit strings
7105!) allows using them for 8-bit strings too, e.g. to convert files from
7106cp1252 (Windows) to latin-1 or vice-versa.
7107
7108Japanese codecs are available from Tamito KAJIYAMA:
7109http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/python/
7110
7111
7112======================================================================
7113
7114
Guido van Rossumf2eac992000-09-04 17:24:24 +00007115=======================================
7116==> Release 1.6 (September 5, 2000) <==
7117=======================================
7118
Guido van Rossuma598c932000-09-04 16:26:03 +00007119What's new in release 1.6?
7120==========================
7121
7122Below is a list of all relevant changes since release 1.5.2.
7123
7124
7125Source Incompatibilities
7126------------------------
7127
7128Several small incompatible library changes may trip you up:
7129
7130 - The append() method for lists can no longer be invoked with more
7131 than one argument. This used to append a single tuple made out of
7132 all arguments, but was undocumented. To append a tuple, use
7133 e.g. l.append((a, b, c)).
7134
7135 - The connect(), connect_ex() and bind() methods for sockets require
7136 exactly one argument. Previously, you could call s.connect(host,
7137 port), but this was undocumented. You must now write
7138 s.connect((host, port)).
7139
7140 - The str() and repr() functions are now different more often. For
7141 long integers, str() no longer appends a 'L'. Thus, str(1L) == '1',
7142 which used to be '1L'; repr(1L) is unchanged and still returns '1L'.
7143 For floats, repr() now gives 17 digits of precision, to ensure no
7144 precision is lost (on all current hardware).
7145
7146 - The -X option is gone. Built-in exceptions are now always
7147 classes. Many more library modules also have been converted to
7148 class-based exceptions.
7149
7150
7151Binary Incompatibilities
7152------------------------
7153
7154- Third party extensions built for Python 1.5.x cannot be used with
7155Python 1.6; these extensions will have to be rebuilt for Python 1.6.
7156
7157- On Windows, attempting to import a third party extension built for
7158Python 1.5.x results in an immediate crash; there's not much we can do
7159about this. Check your PYTHONPATH environment variable!
7160
7161
7162Overview of Changes since 1.5.2
7163-------------------------------
7164
7165For this overview, I have borrowed from the document "What's New in
7166Python 2.0" by Andrew Kuchling and Moshe Zadka:
Andrew M. Kuchlinge240d9b2004-03-21 18:48:22 +00007167http://www.amk.ca/python/2.0/ .
Guido van Rossuma598c932000-09-04 16:26:03 +00007168
7169There are lots of new modules and lots of bugs have been fixed. A
7170list of all new modules is included below.
7171
7172Probably the most pervasive change is the addition of Unicode support.
7173We've added a new fundamental datatype, the Unicode string, a new
7174build-in function unicode(), an numerous C APIs to deal with Unicode
7175and encodings. See the file Misc/unicode.txt for details, or
7176http://starship.python.net/crew/lemburg/unicode-proposal.txt.
7177
7178Two other big changes, related to the Unicode support, are the
7179addition of string methods and (yet another) new regular expression
7180engine.
7181
7182 - String methods mean that you can now say s.lower() etc. instead of
7183 importing the string module and saying string.lower(s) etc. One
7184 peculiarity is that the equivalent of string.join(sequence,
7185 delimiter) is delimiter.join(sequence). Use " ".join(sequence) for
7186 the effect of string.join(sequence); to make this more readable, try
7187 space=" " first. Note that the maxsplit argument defaults in
7188 split() and replace() have changed from 0 to -1.
7189
7190 - The new regular expression engine, SRE by Fredrik Lundh, is fully
7191 backwards compatible with the old engine, and is in fact invoked
7192 using the same interface (the "re" module). You can explicitly
7193 invoke the old engine by import pre, or the SRE engine by importing
7194 sre. SRE is faster than pre, and supports Unicode (which was the
7195 main reason to put effort in yet another new regular expression
7196 engine -- this is at least the fourth!).
7197
7198
7199Other Changes
7200-------------
7201
7202Other changes that won't break code but are nice to know about:
7203
7204Deleting objects is now safe even for deeply nested data structures.
7205
7206Long/int unifications: long integers can be used in seek() calls, as
7207slice indexes.
7208
7209String formatting (s % args) has a new formatting option, '%r', which
7210acts like '%s' but inserts repr(arg) instead of str(arg). (Not yet in
7211alpha 1.)
7212
7213Greg Ward's "distutils" package is included: this will make
7214installing, building and distributing third party packages much
7215simpler.
7216
7217There's now special syntax that you can use instead of the apply()
7218function. f(*args, **kwds) is equivalent to apply(f, args, kwds).
7219You can also use variations f(a1, a2, *args, **kwds) and you can leave
7220one or the other out: f(*args), f(**kwds).
7221
7222The built-ins int() and long() take an optional second argument to
7223indicate the conversion base -- of course only if the first argument
7224is a string. This makes string.atoi() and string.atol() obsolete.
7225(string.atof() was already obsolete).
7226
7227When a local variable is known to the compiler but undefined when
7228used, a new exception UnboundLocalError is raised. This is a class
7229derived from NameError so code catching NameError should still work.
7230The purpose is to provide better diagnostics in the following example:
7231 x = 1
7232 def f():
7233 print x
7234 x = x+1
7235This used to raise a NameError on the print statement, which confused
7236even experienced Python programmers (especially if there are several
7237hundreds of lines of code between the reference and the assignment to
7238x :-).
7239
7240You can now override the 'in' operator by defining a __contains__
7241method. Note that it has its arguments backwards: x in a causes
7242a.__contains__(x) to be called. That's why the name isn't __in__.
7243
7244The exception AttributeError will have a more friendly error message,
7245e.g.: <code>'Spam' instance has no attribute 'eggs'</code>. This may
7246<b>break code</b> that expects the message to be exactly the attribute
7247name.
7248
7249
7250New Modules in 1.6
7251------------------
7252
7253UserString - base class for deriving from the string type.
7254
7255distutils - tools for distributing Python modules.
7256
7257robotparser - parse a robots.txt file, for writing web spiders.
7258(Moved from Tools/webchecker/.)
7259
7260linuxaudiodev - audio for Linux.
7261
7262mmap - treat a file as a memory buffer. (Windows and Unix.)
7263
7264sre - regular expressions (fast, supports unicode). Currently, this
7265code is very rough. Eventually, the re module will be reimplemented
7266using sre (without changes to the re API).
7267
7268filecmp - supersedes the old cmp.py and dircmp.py modules.
7269
7270tabnanny - check Python sources for tab-width dependance. (Moved from
7271Tools/scripts/.)
7272
7273urllib2 - new and improved but incompatible version of urllib (still
7274experimental).
7275
7276zipfile - read and write zip archives.
7277
7278codecs - support for Unicode encoders/decoders.
7279
7280unicodedata - provides access to the Unicode 3.0 database.
7281
7282_winreg - Windows registry access.
7283
7284encodings - package which provides a large set of standard codecs --
7285currently only for the new Unicode support. It has a drop-in extension
7286mechanism which allows you to add new codecs by simply copying them
7287into the encodings package directory. Asian codec support will
7288probably be made available as separate distribution package built upon
7289this technique and the new distutils package.
7290
7291
7292Changed Modules
7293---------------
7294
7295readline, ConfigParser, cgi, calendar, posix, readline, xmllib, aifc,
7296chunk, wave, random, shelve, nntplib - minor enhancements.
7297
7298socket, httplib, urllib - optional OpenSSL support (Unix only).
7299
7300_tkinter - support for 8.0 up to 8.3. Support for versions older than
73018.0 has been dropped.
7302
7303string - most of this module is deprecated now that strings have
7304methods. This no longer uses the built-in strop module, but takes
7305advantage of the new string methods to provide transparent support for
7306both Unicode and ordinary strings.
7307
7308
7309Changes on Windows
7310------------------
7311
7312The installer no longer runs a separate Tcl/Tk installer; instead, it
7313installs the needed Tcl/Tk files directly in the Python directory. If
7314you already have a Tcl/Tk installation, this wastes some disk space
7315(about 4 Megs) but avoids problems with conflincting Tcl/Tk
7316installations, and makes it much easier for Python to ensure that
7317Tcl/Tk can find all its files. Note: the alpha installers don't
7318include the documentation.
7319
7320The Windows installer now installs by default in \Python16\ on the
7321default volume, instead of \Program Files\Python-1.6\.
7322
7323
7324Changed Tools
7325-------------
7326
7327IDLE - complete overhaul. See the <a href="../idle/">IDLE home
7328page</a> for more information. (Python 1.6 alpha 1 will come with
7329IDLE 0.6.)
7330
7331Tools/i18n/pygettext.py - Python equivalent of xgettext(1). A message
7332text extraction tool used for internationalizing applications written
7333in Python.
7334
7335
7336Obsolete Modules
7337----------------
7338
7339stdwin and everything that uses it. (Get Python 1.5.2 if you need
7340it. :-)
7341
7342soundex. (Skip Montanaro has a version in Python but it won't be
7343included in the Python release.)
7344
7345cmp, cmpcache, dircmp. (Replaced by filecmp.)
7346
7347dump. (Use pickle.)
7348
7349find. (Easily coded using os.walk().)
7350
7351grep. (Not very useful as a library module.)
7352
7353packmail. (No longer has any use.)
7354
7355poly, zmod. (These were poor examples at best.)
7356
7357strop. (No longer needed by the string module.)
7358
7359util. (This functionality was long ago built in elsewhere).
7360
7361whatsound. (Use sndhdr.)
7362
7363
7364Detailed Changes from 1.6b1 to 1.6
7365----------------------------------
7366
7367- Slight changes to the CNRI license. A copyright notice has been
7368added; the requirement to indicate the nature of modifications now
7369applies when making a derivative work available "to others" instead of
7370just "to the public"; the version and date are updated. The new
7371license has a new handle.
7372
7373- Added the Tools/compiler package. This is a project led by Jeremy
7374Hylton to write the Python bytecode generator in Python.
7375
7376- The function math.rint() is removed.
7377
7378- In Python.h, "#define _GNU_SOURCE 1" was added.
7379
7380- Version 0.9.1 of Greg Ward's distutils is included (instead of
7381version 0.9).
7382
7383- A new version of SRE is included. It is more stable, and more
7384compatible with the old RE module. Non-matching ranges are indicated
7385by -1, not None. (The documentation said None, but the PRE
7386implementation used -1; changing to None would break existing code.)
7387
7388- The winreg module has been renamed to _winreg. (There are plans for
7389a higher-level API called winreg, but this has not yet materialized in
7390a form that is acceptable to the experts.)
7391
7392- The _locale module is enabled by default.
7393
7394- Fixed the configuration line for the _curses module.
7395
7396- A few crashes have been fixed, notably <file>.writelines() with a
7397list containing non-string objects would crash, and there were
7398situations where a lost SyntaxError could dump core.
7399
7400- The <list>.extend() method now accepts an arbitrary sequence
7401argument.
7402
7403- If __str__() or __repr__() returns a Unicode object, this is
7404converted to an 8-bit string.
7405
7406- Unicode string comparisons is no longer aware of UTF-16
7407encoding peculiarities; it's a straight 16-bit compare.
7408
7409- The Windows installer now installs the LICENSE file and no longer
7410registers the Python DLL version in the registry (this is no longer
7411needed). It now uses Tcl/Tk 8.3.2.
7412
7413- A few portability problems have been fixed, in particular a
7414compilation error involving socklen_t.
7415
7416- The PC configuration is slightly friendlier to non-Microsoft
7417compilers.
7418
7419
7420======================================================================
7421
7422
Guido van Rossumf2eac992000-09-04 17:24:24 +00007423======================================
7424==> Release 1.5.2 (April 13, 1999) <==
7425======================================
7426
Guido van Rossum2001da42000-09-01 22:26:44 +00007427From 1.5.2c1 to 1.5.2 (final)
7428=============================
7429
7430Tue Apr 13 15:44:49 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7431
7432 * PCbuild/python15.wse: Bump version to 1.5.2 (final)
7433
7434 * PCbuild/python15.dsp: Added shamodule.c
7435
7436 * PC/config.c: Added sha module!
7437
7438 * README, Include/patchlevel.h: Prepare for final release.
7439
7440 * Misc/ACKS:
7441 More (Cameron Laird is honorary; the others are 1.5.2c1 testers).
7442
7443 * Python/thread_solaris.h:
7444 While I can't really test this thoroughly, Pat Knight and the Solaris
7445 man pages suggest that the proper thing to do is to add THR_NEW_LWP to
7446 the flags on thr_create(), and that there really isn't a downside, so
7447 I'll do that.
7448
7449 * Misc/ACKS:
7450 Bunch of new names who helped iron out the last wrinkles of 1.5.2.
7451
7452 * PC/python_nt.rc:
7453 Bump the myusterious M$ version number from 1,5,2,1 to 1,5,2,3.
7454 (I can't even display this on NT, maybe Win/98 can?)
7455
7456 * Lib/pstats.py:
7457 Fix mysterious references to jprofile that were in the source since
7458 its creation. I'm assuming these were once valid references to "Jim
7459 Roskind's profile"...
7460
7461 * Lib/Attic/threading_api.py:
7462 Removed; since long subsumed in Doc/lib/libthreading.tex
7463
7464 * Modules/socketmodule.c:
7465 Put back __osf__ support for gethostbyname_r(); the real bug was that
7466 it was being used even without threads. This of course might be an
7467 all-platform problem so now we only use the _r variant when we are
7468 using threads.
7469
7470Mon Apr 12 22:51:20 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7471
7472 * Modules/cPickle.c:
7473 Fix accidentally reversed NULL test in load_mark(). Suggested by
7474 Tamito Kajiyama. (This caused a bug only on platforms where malloc(0)
7475 returns NULL.)
7476
7477 * README:
7478 Add note about popen2 problem on Linux noticed by Pablo Bleyer.
7479
7480 * README: Add note about -D_REENTRANT for HP-UX 10.20.
7481
7482 * Modules/Makefile.pre.in: 'clean' target should remove hassignal.
7483
7484 * PC/Attic/vc40.mak, PC/readme.txt:
7485 Remove all VC++ info (except VC 1.5) from readme.txt;
7486 remove the VC++ 4.0 project file; remove the unused _tkinter extern defs.
7487
7488 * README: Clarify PC build instructions (point to PCbuild).
7489
7490 * Modules/zlibmodule.c: Cast added by Jack Jansen (for Mac port).
7491
7492 * Lib/plat-sunos5/CDIO.py, Lib/plat-linux2/CDROM.py:
7493 Forgot to add this file. CDROM device parameters.
7494
7495 * Lib/gzip.py: Two different changes.
7496
7497 1. Jack Jansen reports that on the Mac, the time may be negative, and
7498 solves this by adding a write32u() function that writes an unsigned
7499 long.
7500
7501 2. On 64-bit platforms the CRC comparison fails; I've fixed this by
7502 casting both values to be compared to "unsigned long" i.e. modulo
7503 0x100000000L.
7504
7505Sat Apr 10 18:42:02 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7506
7507 * PC/Attic/_tkinter.def: No longer needed.
7508
7509 * Misc/ACKS: Correct missed character in Andrew Dalke's name.
7510
7511 * README: Add DEC Ultrix notes (from Donn Cave's email).
7512
7513 * configure: The usual
7514
7515 * configure.in:
7516 Quote a bunch of shell variables used in test, related to long-long.
7517
7518 * Objects/fileobject.c, Modules/shamodule.c, Modules/regexpr.c:
7519 casts for picky compilers.
7520
7521 * Modules/socketmodule.c:
7522 3-arg gethostbyname_r doesn't really work on OSF/1.
7523
7524 * PC/vc15_w31/_.c, PC/vc15_lib/_.c, Tools/pynche/__init__.py:
7525 Avoid totally empty files.
7526
7527Fri Apr 9 14:56:35 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7528
7529 * Tools/scripts/fixps.py: Use re instead of regex.
7530 Don't rewrite the file in place.
7531 (Reported by Andy Dustman.)
7532
7533 * Lib/netrc.py, Lib/shlex.py: Get rid of #! line
7534
7535Thu Apr 8 23:13:37 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7536
7537 * PCbuild/python15.wse: Use the Tcl 8.0.5 installer.
7538 Add a variable %_TCL_% that makes it easier to switch to a different version.
7539
7540
7541======================================================================
7542
7543
7544From 1.5.2b2 to 1.5.2c1
7545=======================
7546
7547Thu Apr 8 23:13:37 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7548
7549 * PCbuild/python15.wse:
7550 Release 1.5.2c1. Add IDLE and Uninstall to program group.
7551 Don't distribute zlib.dll. Tweak some comments.
7552
7553 * PCbuild/zlib.dsp: Now using static zlib 1.1.3
7554
7555 * 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:
7556 The usual
7557
7558 * Include/patchlevel.h: Release 1.5.2c1
7559
7560 * README: Release 1.5.2c1.
7561
7562 * Misc/NEWS: News for the 1.5.2c1 release.
7563
7564 * Lib/test/test_strftime.py:
7565 On Windows, we suddenly find, strftime() may return "" for an
7566 unsupported format string. (I guess this is because the logic for
7567 deciding whether to reallocate the buffer or not has been improved.)
7568 This caused the test code to crash on result[0]. Fix this by assuming
7569 an empty result also means the format is not supported.
7570
7571 * Demo/tkinter/matt/window-creation-w-location.py:
7572 This demo imported some private code from Matt. Make it cripple along.
7573
7574 * Lib/lib-tk/Tkinter.py:
7575 Delete an accidentally checked-in feature that actually broke more
7576 than was worth it: when deleting a canvas item, it would try to
7577 automatically delete the bindings for that item. Since there's
7578 nothing that says you can't reuse the tag and still have the bindings,
7579 this is not correct. Also, it broke at least one demo
7580 (Demo/tkinter/matt/rubber-band-box-demo-1.py).
7581
7582 * Python/thread_wince.h: Win/CE thread support by Mark Hammond.
7583
7584Wed Apr 7 20:23:17 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7585
7586 * Modules/zlibmodule.c:
7587 Patch by Andrew Kuchling to unflush() (flush() for deflating).
7588 Without this, if inflate() returned Z_BUF_ERROR asking for more output
7589 space, we would report the error; now, we increase the buffer size and
7590 try again, just as for Z_OK.
7591
7592 * Lib/test/test_gzip.py: Use binary mode for all gzip files we open.
7593
7594 * Tools/idle/ChangeLog: New change log.
7595
7596 * Tools/idle/README.txt, Tools/idle/NEWS.txt: New version.
7597
7598 * Python/pythonrun.c:
7599 Alas, get rid of the Win specific hack to ask the user to press Return
7600 before exiting when an error happened. This didn't work right when
7601 Python is invoked from a daemon.
7602
7603 * Tools/idle/idlever.py: Version bump awaiting impending new release.
7604 (Not much has changed :-( )
7605
7606 * Lib/lib-tk/Tkinter.py:
7607 lower, tkraise/lift hide Misc.lower, Misc.tkraise/lift,
7608 so the preferred name for them is tag_lower, tag_raise
7609 (similar to tag_bind, and similar to the Text widget);
7610 unfortunately can't delete the old ones yet (maybe in 1.6)
7611
7612 * Python/thread.c, Python/strtod.c, Python/mystrtoul.c, Python/import.c, Python/ceval.c:
7613 Changes by Mark Hammond for Windows CE. Mostly of the form
7614 #ifdef DONT_HAVE_header_H ... #endif around #include <header.h>.
7615
7616 * Python/bltinmodule.c:
7617 Remove unused variable from complex_from_string() code.
7618
7619 * Include/patchlevel.h:
7620 Add the possibility of a gamma release (release candidate).
7621 Add '+' to string version number to indicate we're beyond b2 now.
7622
7623 * Modules/posixmodule.c: Add extern decl for fsync() for SunOS 4.x.
7624
7625 * Lib/smtplib.py: Changes by Per Cederquist and The Dragon.
7626
7627 Per writes:
7628
7629 """
7630 The application where Signum Support uses smtplib needs to be able to
7631 report good error messages to the user when sending email fails. To
7632 help in diagnosing problems it is useful to be able to report the
7633 entire message sent by the server, not only the SMTP error code of the
7634 offending command.
7635
7636 A lot of the functions in sendmail.py unfortunately discards the
7637 message, leaving only the code. The enclosed patch fixes that
7638 problem.
7639
7640 The enclosed patch also introduces a base class for exceptions that
7641 include an SMTP error code and error message, and make the code and
7642 message available on separate attributes, so that surrounding code can
7643 deal with them in whatever way it sees fit. I've also added some
7644 documentation to the exception classes.
7645
7646 The constructor will now raise an exception if it cannot connect to
7647 the SMTP server.
7648
7649 The data() method will raise an SMTPDataError if it doesn't receive
7650 the expected 354 code in the middle of the exchange.
7651
7652 According to section 5.2.10 of RFC 1123 a smtp client must accept "any
7653 text, including no text at all" after the error code. If the response
7654 of a HELO command contains no text self.helo_resp will be set to the
7655 empty string (""). The patch fixes the test in the sendmail() method
7656 so that helo_resp is tested against None; if it has the empty string
7657 as value the sendmail() method would invoke the helo() method again.
7658
7659 The code no longer accepts a -1 reply from the ehlo() method in
7660 sendmail().
7661
7662 [Text about removing SMTPRecipientsRefused deleted --GvR]
7663 """
7664
7665 and also:
7666
7667 """
7668 smtplib.py appends an extra blank line to the outgoing mail if the
7669 `msg' argument to the sendmail method already contains a trailing
7670 newline. This patch should fix the problem.
7671 """
7672
7673 The Dragon writes:
7674
7675 """
7676 Mostly I just re-added the SMTPRecipientsRefused exception
7677 (the exeption object now has the appropriate info in it ) [Per had
7678 removed this in his patch --GvR] and tweaked the behavior of the
7679 sendmail method whence it throws the newly added SMTPHeloException (it
7680 was closing the connection, which it shouldn't. whatever catches the
7681 exception should do that. )
7682
7683 I pondered the change of the return values to tuples all around,
7684 and after some thinking I decided that regularizing the return values was
7685 too much of the Right Thing (tm) to not do.
7686
7687 My one concern is that code expecting an integer & getting a tuple
7688 may fail silently.
7689
7690 (i.e. if it's doing :
7691
7692 x.somemethod() >= 400:
7693 expecting an integer, the expression will always be true if it gets a
7694 tuple instead. )
7695
7696 However, most smtplib code I've seen only really uses the
7697 sendmail() method, so this wouldn't bother it. Usually code I've seen
7698 that calls the other methods usually only calls helo() and ehlo() for
7699 doing ESMTP, a feature which was not in the smtplib included with 1.5.1,
7700 and thus I would think not much code uses it yet.
7701 """
7702
7703Tue Apr 6 19:38:18 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7704
7705 * Lib/test/test_ntpath.py:
7706 Fix the tests now that splitdrive() no longer treats UNC paths special.
7707 (Some tests converted to splitunc() tests.)
7708
7709 * Lib/ntpath.py:
7710 Withdraw the UNC support from splitdrive(). Instead, a new function
7711 splitunc() parses UNC paths. The contributor of the UNC parsing in
7712 splitdrive() doesn't like it, but I haven't heard a good reason to
7713 keep it, and it causes some problems. (I think there's a
7714 philosophical problem -- to me, the split*() functions are purely
7715 syntactical, and the fact that \\foo is not a valid path doesn't mean
7716 that it shouldn't be considered an absolute path.)
7717
7718 Also (quite separately, but strangely related to the philosophical
7719 issue above) fix abspath() so that if win32api exists, it doesn't fail
7720 when the path doesn't actually exist -- if GetFullPathName() fails,
7721 fall back on the old strategy (join with getcwd() if neccessary, and
7722 then use normpath()).
7723
7724 * configure.in, configure, config.h.in, acconfig.h:
7725 For BeOS PowerPC. Chris Herborth.
7726
7727Mon Apr 5 21:54:14 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7728
7729 * Modules/timemodule.c:
7730 Jonathan Giddy notes, and Chris Lawrence agrees, that some comments on
7731 #else/#endif are wrong, and that #if HAVE_TM_ZONE should be #ifdef.
7732
7733 * Misc/ACKS:
7734 Bunch of new contributors, including 9 who contributed to the Docs,
7735 reported by Fred.
7736
7737Mon Apr 5 18:37:59 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
7738
7739 * Lib/gzip.py:
7740 Oops, missed mode parameter to open().
7741
7742 * Lib/gzip.py:
7743 Made the default mode 'rb' instead of 'r', for better cross-platform
7744 support. (Based on comment on the documentation by Bernhard Reiter
7745 <bernhard@csd.uwm.edu>).
7746
7747Fri Apr 2 22:18:25 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7748
7749 * Tools/scripts/dutree.py:
7750 For reasons I dare not explain, this script should always execute
7751 main() when imported (in other words, it is not usable as a module).
7752
7753Thu Apr 1 15:32:30 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7754
7755 * Lib/test/test_cpickle.py: Jonathan Giddy write:
7756
7757 In test_cpickle.py, the module os got imported, but the line to remove
7758 the temp file has gone missing.
7759
7760Tue Mar 30 20:17:31 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7761
7762 * Lib/BaseHTTPServer.py: Per Cederqvist writes:
7763
7764 If you send something like "PUT / HTTP/1.0" to something derived from
7765 BaseHTTPServer that doesn't define do_PUT, you will get a response
7766 that begins like this:
7767
7768 HTTP/1.0 501 Unsupported method ('do_PUT')
7769 Server: SimpleHTTP/0.3 Python/1.5
7770 Date: Tue, 30 Mar 1999 18:53:53 GMT
7771
7772 The server should complain about 'PUT' instead of 'do_PUT'. This
7773 patch should fix the problem.
7774
7775Mon Mar 29 20:33:21 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7776
7777 * Lib/smtplib.py: Patch by Per Cederqvist, who writes:
7778
7779 """
7780 - It needlessly used the makefile() method for each response that is
7781 read from the SMTP server.
7782
7783 - If the remote SMTP server closes the connection unexpectedly the
7784 code raised an IndexError. It now raises an SMTPServerDisconnected
7785 exception instead.
7786
7787 - The code now checks that all lines in a multiline response actually
7788 contains an error code.
7789 """
7790
7791 The Dragon approves.
7792
7793Mon Mar 29 20:25:40 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
7794
7795 * Lib/compileall.py:
7796 When run as a script, report failures in the exit code as well.
7797 Patch largely based on changes by Andrew Dalke, as discussed in the
7798 distutils-sig.
7799
7800Mon Mar 29 20:23:41 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7801
7802 * Lib/urllib.py:
7803 Hack so that if a 302 or 301 redirect contains a relative URL, the
7804 right thing "just happens" (basejoin() with old URL).
7805
7806 * Modules/cPickle.c:
7807 Protection against picling to/from closed (real) file.
7808 The problem was reported by Moshe Zadka.
7809
7810 * Lib/test/test_cpickle.py:
7811 Test protection against picling to/from closed (real) file.
7812
7813 * Modules/timemodule.c: Chris Lawrence writes:
7814
7815 """
7816 The GNU folks, in their infinite wisdom, have decided not to implement
7817 altzone in libc6; this would not be horrible, except that timezone
7818 (which is implemented) includes the current DST setting (i.e. timezone
7819 for Central is 18000 in summer and 21600 in winter). So Python's
7820 timezone and altzone variables aren't set correctly during DST.
7821
7822 Here's a patch relative to 1.5.2b2 that (a) makes timezone and altzone
7823 show the "right" thing on Linux (by using the tm_gmtoff stuff
7824 available in BSD, which is how the GLIBC manual claims things should
7825 be done) and (b) should cope with the southern hemisphere. In pursuit
7826 of (b), I also took the liberty of renaming the "summer" and "winter"
7827 variables to "july" and "jan". This patch should also make certain
7828 time calculations on Linux actually work right (like the tz-aware
7829 functions in the rfc822 module).
7830
7831 (It's hard to find DST that's currently being used in the southern
7832 hemisphere; I tested using Africa/Windhoek.)
7833 """
7834
7835 * Lib/test/output/test_gzip:
7836 Jonathan Giddy discovered this file was missing.
7837
7838 * Modules/shamodule.c:
7839 Avoid warnings from AIX compiler. Reported by Vladimir (AIX is my
7840 middlename) Marangozov, patch coded by Greg Stein.
7841
7842 * Tools/idle/ScriptBinding.py, Tools/idle/PyShell.py:
7843 At Tim Peters' recommendation, add a dummy flush() method to PseudoFile.
7844
7845Sun Mar 28 17:55:32 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7846
7847 * Tools/scripts/ndiff.py: Tim Peters writes:
7848
7849 I should have waited overnight <wink/sigh>. Nothing wrong with the one I
7850 sent, but I couldn't resist going on to add new -r1 / -r2 cmdline options
7851 for recreating the original files from ndiff's output. That's attached, if
7852 you're game! Us Windows guys don't usually have a sed sitting around
7853 <wink>.
7854
7855Sat Mar 27 13:34:01 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7856
7857 * Tools/scripts/ndiff.py: Tim Peters writes:
7858
7859 Attached is a cleaned-up version of ndiff (added useful module
7860 docstring, now echo'ed in case of cmd line mistake); added -q option
7861 to suppress initial file identification lines; + other minor cleanups,
7862 & a slightly faster match engine.
7863
7864Fri Mar 26 22:36:00 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
7865
7866 * Tools/scripts/dutree.py:
7867 During display, if EPIPE is raised, it's probably because a pager was
7868 killed. Discard the error in that case, but propogate it otherwise.
7869
7870Fri Mar 26 16:20:45 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7871
7872 * Lib/test/output/test_userlist, Lib/test/test_userlist.py:
7873 Test suite for UserList.
7874
7875 * Lib/UserList.py: Use isinstance() where appropriate.
7876 Reformatted with 4-space indent.
7877
7878Fri Mar 26 16:11:40 1999 Barry Warsaw <bwarsaw@eric.cnri.reston.va.us>
7879
7880 * Tools/pynche/PyncheWidget.py:
7881 Helpwin.__init__(): The text widget should get focus.
7882
7883 * Tools/pynche/pyColorChooser.py:
7884 Removed unnecessary import `from PyncheWidget import PyncheWidget'
7885
7886Fri Mar 26 15:32:05 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7887
7888 * Lib/test/output/test_userdict, Lib/test/test_userdict.py:
7889 Test suite for UserDict
7890
7891 * Lib/UserDict.py: Improved a bunch of things.
7892 The constructor now takes an optional dictionary.
7893 Use isinstance() where appropriate.
7894
7895Thu Mar 25 22:38:49 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7896
7897 * Lib/test/output/test_pickle, Lib/test/output/test_cpickle, Lib/test/test_pickle.py, Lib/test/test_cpickle.py:
7898 Basic regr tests for pickle/cPickle
7899
7900 * Lib/pickle.py:
7901 Don't use "exec" in find_class(). It's slow, unnecessary, and (as AMK
7902 points out) it doesn't work in JPython Applets.
7903
7904Thu Mar 25 21:50:27 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us>
7905
7906 * Lib/test/test_gzip.py:
7907 Added a simple test suite for gzip. It simply opens a temp file,
7908 writes a chunk of compressed data, closes it, writes another chunk, and
7909 reads the contents back to verify that they are the same.
7910
7911 * Lib/gzip.py:
7912 Based on a suggestion from bruce@hams.com, make a trivial change to
7913 allow using the 'a' flag as a mode for opening a GzipFile. gzip
7914 files, surprisingly enough, can be concatenated and then decompressed;
7915 the effect is to concatenate the two chunks of data.
7916
7917 If we support it on writing, it should also be supported on reading.
7918 This *wasn't* trivial, and required rearranging the code in the
7919 reading path, particularly the _read() method.
7920
7921 Raise IOError instead of RuntimeError in two cases, 'Not a gzipped file'
7922 and 'Unknown compression method'
7923
7924Thu Mar 25 21:25:01 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7925
7926 * Lib/test/test_b1.py:
7927 Add tests for float() and complex() with string args (Nick/Stephanie
7928 Lockwood).
7929
7930Thu Mar 25 21:21:08 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us>
7931
7932 * Modules/zlibmodule.c:
7933 Add an .unused_data attribute to decompressor objects. If .unused_data
7934 is not an empty string, this means that you have arrived at the
7935 end of the stream of compressed data, and the contents of .unused_data are
7936 whatever follows the compressed stream.
7937
7938Thu Mar 25 21:16:07 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7939
7940 * Python/bltinmodule.c:
7941 Patch by Nick and Stephanie Lockwood to implement complex() with a string
7942 argument. This closes TODO item 2.19.
7943
7944Wed Mar 24 19:09:00 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7945
7946 * Tools/webchecker/wcnew.py: Added Samuel Bayer's new webchecker.
7947 Unfortunately his code breaks wcgui.py in a way that's not easy
7948 to fix. I expect that this is a temporary situation --
7949 eventually Sam's changes will be merged back in.
7950 (The changes add a -t option to specify exceptions to the -x
7951 option, and explicit checking for #foo style fragment ids.)
7952
7953 * Objects/dictobject.c:
7954 Vladimir Marangozov contributed updated comments.
7955
7956 * Objects/bufferobject.c: Folded long lines.
7957
7958 * Lib/test/output/test_sha, Lib/test/test_sha.py:
7959 Added Jeremy's test code for the sha module.
7960
7961 * Modules/shamodule.c, Modules/Setup.in:
7962 Added Greg Stein and Andrew Kuchling's sha module.
7963 Fix comments about zlib version and URL.
7964
7965 * Lib/test/test_bsddb.py: Remove the temp file when we're done.
7966
7967 * Include/pythread.h: Conform to standard boilerplate.
7968
7969 * configure.in, configure, BeOS/linkmodule, BeOS/ar-fake:
7970 Chris Herborth: the new compiler in R4.1 needs some new options to work...
7971
7972 * Modules/socketmodule.c:
7973 Implement two suggestions by Jonathan Giddy: (1) in AIX, clear the
7974 data struct before calling gethostby{name,addr}_r(); (2) ignore the
7975 3/5/6 args determinations made by the configure script and switch on
7976 platform identifiers instead:
7977
7978 AIX, OSF have 3 args
7979 Sun, SGI have 5 args
7980 Linux has 6 args
7981
7982 On all other platforms, undef HAVE_GETHOSTBYNAME_R altogether.
7983
7984 * Modules/socketmodule.c:
7985 Vladimir Marangozov implements the AIX 3-arg gethostbyname_r code.
7986
7987 * Lib/mailbox.py:
7988 Add readlines() to _Subfile class. Not clear who would need it, but
7989 Chris Lawrence sent me a broken version; this one is a tad simpler and
7990 more conforming to the standard.
7991
7992Tue Mar 23 23:05:34 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us>
7993
7994 * Lib/gzip.py: use struct instead of bit-manipulate in Python
7995
7996Tue Mar 23 19:00:55 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
7997
7998 * Modules/Makefile.pre.in:
7999 Add $(EXE) to various occurrences of python so it will work on Cygwin
8000 with egcs (after setting EXE=.exe). Patch by Norman Vine.
8001
8002 * configure, configure.in:
8003 Ack! It never defined HAVE_GETHOSTBYNAME_R so that code was never tested!
8004
8005Mon Mar 22 22:25:39 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8006
8007 * Include/thread.h:
8008 Adding thread.h -- unused but for b/w compatibility.
8009 As requested by Bill Janssen.
8010
8011 * configure.in, configure:
8012 Add code to test for all sorts of gethostbyname_r variants,
8013 donated by David Arnold.
8014
8015 * config.h.in, acconfig.h:
8016 Add symbols for gethostbyname_r variants (sigh).
8017
8018 * Modules/socketmodule.c: Clean up pass for the previous patches.
8019
8020 - Use HAVE_GETHOSTBYNAME_R_6_ARG instead of testing for Linux and
8021 glibc2.
8022
8023 - If gethostbyname takes 3 args, undefine HAVE_GETHOSTBYNAME_R --
8024 don't know what code should be used.
8025
8026 - New symbol USE_GETHOSTBYNAME_LOCK defined iff the lock should be used.
8027
8028 - Modify the gethostbyaddr() code to also hold on to the lock until
8029 after it is safe to release, overlapping with the Python lock.
8030
8031 (Note: I think that it could in theory be possible that Python code
8032 executed while gethostbyname_lock is held could attempt to reacquire
8033 the lock -- e.g. in a signal handler or destructor. I will simply say
8034 "don't do that then.")
8035
8036 * Modules/socketmodule.c: Jonathan Giddy writes:
8037
8038 Here's a patch to fix the race condition, which wasn't fixed by Rob's
8039 patch. It holds the gethostbyname lock until the results are copied out,
8040 which means that this lock and the Python global lock are held at the same
8041 time. This shouldn't be a problem as long as the gethostbyname lock is
8042 always acquired when the global lock is not held.
8043
8044Mon Mar 22 19:25:30 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us>
8045
8046 * Modules/zlibmodule.c:
8047 Fixed the flush() method of compression objects; the test for
8048 the end of loop was incorrect, and failed when the flushmode != Z_FINISH.
8049 Logic cleaned up and commented.
8050
8051 * Lib/test/test_zlib.py:
8052 Added simple test for the flush() method of compression objects, trying the
8053 different flush values Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH.
8054
8055Mon Mar 22 15:28:08 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8056
8057 * Lib/shlex.py:
8058 Bug reported by Tobias Thelen: missing "self." in assignment target.
8059
8060Fri Mar 19 21:50:11 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8061
8062 * Modules/arraymodule.c:
8063 Use an unsigned cast to avoid a warning in VC++.
8064
8065 * Lib/dospath.py, Lib/ntpath.py:
8066 New code for split() by Tim Peters, behaves more like posixpath.split().
8067
8068 * Objects/floatobject.c:
8069 Fix a problem with Vladimir's PyFloat_Fini code: clear the free list; if
8070 a block cannot be freed, add its free items back to the free list.
8071 This is necessary to avoid leaking when Python is reinitialized later.
8072
8073 * Objects/intobject.c:
8074 Fix a problem with Vladimir's PyInt_Fini code: clear the free list; if
8075 a block cannot be freed, add its free items back to the free list, and
8076 add its valid ints back to the small_ints array if they are in range.
8077 This is necessary to avoid leaking when Python is reinitialized later.
8078
8079 * Lib/types.py:
8080 Added BufferType, the type returned by the new builtin buffer(). Greg Stein.
8081
8082 * Python/bltinmodule.c:
8083 New builtin buffer() creates a derived read-only buffer from any
8084 object that supports the buffer interface (e.g. strings, arrays).
8085
8086 * Objects/bufferobject.c:
8087 Added check for negative offset for PyBuffer_FromObject and check for
8088 negative size for PyBuffer_FromMemory. Greg Stein.
8089
8090Thu Mar 18 15:10:44 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8091
8092 * Lib/urlparse.py: Sjoerd Mullender writes:
8093
8094 If a filename on Windows starts with \\, it is converted to a URL
8095 which starts with ////. If this URL is passed to urlparse.urlparse
8096 you get a path that starts with // (and an empty netloc). If you pass
8097 the result back to urlparse.urlunparse, you get a URL that starts with
8098 //, which is parsed differently by urlparse.urlparse. The fix is to
8099 add the (empty) netloc with accompanying slashes if the path in
8100 urlunparse starts with //. Do this for all schemes that use a netloc.
8101
8102 * Lib/nturl2path.py: Sjoerd Mullender writes:
8103
8104 Pathnames of files on other hosts in the same domain
8105 (\\host\path\to\file) are not translated correctly to URLs and back.
8106 The URL should be something like file:////host/path/to/file.
8107 Note that a combination of drive letter and remote host is not
8108 possible.
8109
8110Wed Mar 17 22:30:10 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8111
8112 * Lib/urlparse.py:
8113 Delete non-standard-conforming code in urljoin() that would use the
8114 netloc from the base url as the default netloc for the resulting url
8115 even if the schemes differ.
8116
8117 Once upon a time, when the web was wild, this was a valuable hack
8118 because some people had a URL referencing an ftp server colocated with
8119 an http server without having the host in the ftp URL (so they could
8120 replicate it or change the hostname easily).
8121
8122 More recently, after the file: scheme got added back to the list of
8123 schemes that accept a netloc, it turns out that this caused weirdness
8124 when joining an http: URL with a file: URL -- the resulting file: URL
8125 would always inherit the host from the http: URL because the file:
8126 scheme supports a netloc but in practice never has one.
8127
8128 There are two reasons to get rid of the old, once-valuable hack,
8129 instead of removing the file: scheme from the uses_netloc list. One,
8130 the RFC says that file: uses the netloc syntax, and does not endorse
8131 the old hack. Two, neither netscape 4.5 nor IE 4.0 support the old
8132 hack.
8133
8134 * Include/ceval.h, Include/abstract.h:
8135 Add DLL level b/w compat for PySequence_In and PyEval_CallObject
8136
8137Tue Mar 16 21:54:50 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8138
8139 * Lib/lib-tk/Tkinter.py: Bug reported by Jim Robinson:
8140
8141 An attempt to execute grid_slaves with arguments (0,0) results in
8142 *all* of the slaves being returned, not just the slave associated with
8143 row 0, column 0. This is because the test for arguments in the method
8144 does not test to see if row (and column) does not equal None, but
8145 rather just whether is evaluates to non-false. A value of 0 fails
8146 this test.
8147
8148Tue Mar 16 14:17:48 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8149
8150 * Modules/cmathmodule.c:
8151 Docstring fix: acosh() returns the hyperbolic arccosine, not the
8152 hyperbolic cosine. Problem report via David Ascher by one of his
8153 students.
8154
8155Mon Mar 15 21:40:59 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8156
8157 * configure.in:
8158 Should test for gethost*by*name_r, not for gethostname_r (which
8159 doesn't exist and doesn't make sense).
8160
8161 * Modules/socketmodule.c:
8162 Patch by Rob Riggs for Linux -- glibc2 has a different argument
8163 converntion for gethostbyname_r() etc. than Solaris!
8164
8165 * Python/thread_pthread.h: Rob Riggs wrote:
8166
8167 """
8168 Spec says that on success pthread_create returns 0. It does not say
8169 that an error code will be < 0. Linux glibc2 pthread_create() returns
8170 ENOMEM (12) when one exceed process limits. (It looks like it should
8171 return EAGAIN, but that's another story.)
8172
8173 For reference, see:
8174 http://www.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html
8175 """
8176
8177 [I have a feeling that similar bugs were fixed before; perhaps someone
8178 could check that all error checks no check for != 0?]
8179
8180 * Tools/bgen/bgen/bgenObjectDefinition.py:
8181 New mixin class that defines cmp and hash that use
8182 the ob_itself pointer. This allows (when using the mixin)
8183 different Python objects pointing to the same C object and
8184 behaving well as dictionary keys.
8185
8186 Or so sez Jack Jansen...
8187
8188 * Lib/urllib.py: Yet another patch by Sjoerd Mullender:
8189
8190 Don't convert URLs to URLs using pathname2url.
8191
8192Fri Mar 12 22:15:43 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8193
8194 * Lib/cmd.py: Patch by Michael Scharf. He writes:
8195
8196 The module cmd requires for each do_xxx command a help_xxx
8197 function. I think this is a little old fashioned.
8198
8199 Here is a patch: use the docstring as help if no help_xxx
8200 function can be found.
8201
8202 [I'm tempted to rip out all the help_* functions from pdb, but I'll
8203 resist it. Any takers? --Guido]
8204
8205 * Tools/freeze/freeze.py: Bug submitted by Wayne Knowles, who writes:
8206
8207 Under Windows, python freeze.py -o hello hello.py
8208 creates all the correct files in the hello subdirectory, but the
8209 Makefile has the directory prefix in it for frozen_extensions.c
8210 nmake fails because it tries to locate hello/frozen_extensions.c
8211
8212 (His fix adds a call to os.path.basename() in the appropriate place.)
8213
8214 * Objects/floatobject.c, Objects/intobject.c:
8215 Vladimir has restructured his code somewhat so that the blocks are now
8216 represented by an explicit structure. (There are still too many casts
8217 in the code, but that may be unavoidable.)
8218
8219 Also added code so that with -vv it is very chatty about what it does.
8220
8221 * Demo/zlib/zlibdemo.py, Demo/zlib/minigzip.py:
8222 Change #! line to modern usage; also chmod +x
8223
8224 * Demo/pdist/rrcs, Demo/pdist/rcvs, Demo/pdist/rcsbump:
8225 Change #! line to modern usage
8226
8227 * Lib/nturl2path.py, Lib/urllib.py: From: Sjoerd Mullender
8228
8229 The filename to URL conversion didn't properly quote special
8230 characters.
8231 The URL to filename didn't properly unquote special chatacters.
8232
8233 * Objects/floatobject.c:
8234 OK, try again. Vladimir gave me a fix for the alignment bus error,
8235 so here's his patch again. This time it works (at least on Solaris,
8236 Linux and Irix).
8237
8238Thu Mar 11 23:21:23 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8239
8240 * Tools/idle/PathBrowser.py:
8241 Don't crash when sys.path contains an empty string.
8242
8243 * Tools/idle/PathBrowser.py:
8244 - Don't crash in the case where a superclass is a string instead of a
8245 pyclbr.Class object; this can happen when the superclass is
8246 unrecognizable (to pyclbr), e.g. when module renaming is used.
8247
8248 - Show a watch cursor when calling pyclbr (since it may take a while
8249 recursively parsing imported modules!).
8250
8251Thu Mar 11 16:04:04 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8252
8253 * Lib/mimetypes.py:
8254 Added .rdf and .xsl as application/xml types. (.rdf is for the
8255 Resource Description Framework, a metadata encoding, and .xsl is for
8256 the Extensible Stylesheet Language.)
8257
8258Thu Mar 11 13:26:23 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8259
8260 * Lib/test/output/test_popen2, Lib/test/test_popen2.py:
8261 Test for popen2 module, by Chris Tismer.
8262
8263 * Objects/floatobject.c:
8264 Alas, Vladimir's patch caused a bus error (probably double
8265 alignment?), and I didn't test it. Withdrawing it for now.
8266
8267Wed Mar 10 22:55:47 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8268
8269 * Objects/floatobject.c:
8270 Patch by Vladimir Marangoz to allow freeing of the allocated blocks of
8271 floats on finalization.
8272
8273 * Objects/intobject.c:
8274 Patch by Vladimir Marangoz to allow freeing of the allocated blocks of
8275 integers on finalization.
8276
8277 * Tools/idle/EditorWindow.py, Tools/idle/Bindings.py:
8278 Add PathBrowser to File module
8279
8280 * Tools/idle/PathBrowser.py:
8281 "Path browser" - 4 scrolled lists displaying:
8282 directories on sys.path
8283 modules in selected directory
8284 classes in selected module
8285 methods of selected class
8286
8287 Sinlge clicking in a directory, module or class item updates the next
8288 column with info about the selected item. Double clicking in a
8289 module, class or method item opens the file (and selects the clicked
8290 item if it is a class or method).
8291
8292 I guess eventually I should be using a tree widget for this, but the
8293 ones I've seen don't work well enough, so for now I use the old
8294 Smalltalk or NeXT style multi-column hierarchical browser.
8295
8296 * Tools/idle/MultiScrolledLists.py:
8297 New utility: multiple scrolled lists in parallel
8298
8299 * Tools/idle/ScrolledList.py: - White background.
8300 - Display "(None)" (or text of your choosing) when empty.
8301 - Don't set the focus.
8302
8303Tue Mar 9 19:31:21 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8304
8305 * Lib/urllib.py:
8306 open_http also had the 'data is None' test backwards. don't call with the
8307 extra argument if data is None.
8308
8309 * Demo/embed/demo.c:
8310 Call Py_SetProgramName() instead of redefining getprogramname(),
8311 reflecting changes in the runtime around 1.5 or earlier.
8312
8313 * Python/ceval.c:
8314 Always test for an error return (usually NULL or -1) without setting
8315 an exception.
8316
8317 * Modules/timemodule.c: Patch by Chris Herborth for BeOS code.
8318 He writes:
8319
8320 I had an off-by-1000 error in floatsleep(),
8321 and the problem with time.clock() is that it's not implemented properly
8322 on QNX... ANSI says it's supposed to return _CPU_ time used by the
8323 process, but on QNX it returns the amount of real time used... so I was
8324 confused.
8325
8326 * Tools/bgen/bgen/macsupport.py: Small change by Jack Jansen.
8327 Test for self.returntype behaving like OSErr rather than being it.
8328
8329Thu Feb 25 16:14:58 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us>
8330
8331 * Lib/urllib.py:
8332 http_error had the 'data is None' test backwards. don't call with the
8333 extra argument if data is None.
8334
8335 * Lib/urllib.py: change indentation from 8 spaces to 4 spaces
8336
8337 * Lib/urllib.py: pleasing the tabnanny
8338
8339Thu Feb 25 14:26:02 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8340
8341 * Lib/colorsys.py:
8342 Oops, one more "x, y, z" to convert...
8343
8344 * Lib/colorsys.py:
8345 Adjusted comment at the top to be less confusing, following Fredrik
8346 Lundh's example.
8347
8348 Converted comment to docstring.
8349
8350Wed Feb 24 18:49:15 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8351
8352 * Lib/toaiff.py:
8353 Use sndhdr instead of the obsolete whatsound module.
8354
8355Wed Feb 24 18:42:38 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us>
8356
8357 * Lib/urllib.py:
8358 When performing a POST request, i.e. when the second argument to
8359 urlopen is used to specify form data, make sure the second argument is
8360 threaded through all of the http_error_NNN calls. This allows error
8361 handlers like the redirect and authorization handlers to properly
8362 re-start the connection.
8363
8364Wed Feb 24 16:25:17 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8365
8366 * Lib/mhlib.py: Patch by Lars Wirzenius:
8367
8368 o the initial comment is wrong: creating messages is already
8369 implemented
8370
8371 o Message.getbodytext: if the mail or it's part contains an
8372 empty content-transfer-encoding header, the code used to
8373 break; the change below treats an empty encoding value the same
8374 as the other types that do not need decoding
8375
8376 o SubMessage.getbodytext was missing the decode argument; the
8377 change below adds it; I also made it unconditionally return
8378 the raw text if decoding was not desired, because my own
8379 routines needed that (and it was easier than rewriting my
8380 own routines ;-)
8381
8382Wed Feb 24 00:35:43 1999 Barry Warsaw <bwarsaw@eric.cnri.reston.va.us>
8383
8384 * Python/bltinmodule.c (initerrors):
8385 Make sure that the exception tuples ("base-classes" when
8386 string-based exceptions are used) reflect the real class hierarchy,
8387 i.e. that SystemExit derives from Exception not StandardError.
8388
8389 * Lib/exceptions.py:
8390 Document the correct class hierarchy for SystemExit. It is not an
8391 error and so it derives from Exception and not SystemError. The
8392 docstring was incorrect but the implementation was fine.
8393
8394Tue Feb 23 23:07:51 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8395
8396 * Lib/shutil.py:
8397 Add import sys, needed by reference to sys.exc_info() in rmtree().
8398 Discovered by Mitch Chapman.
8399
8400 * config.h.in:
8401 Now that we don't have AC_CHECK_LIB(m, pow), the HAVE_LIBM symbol
8402 disappears. It wasn't used anywhere anyway...
8403
8404 * Modules/arraymodule.c:
8405 Carefully check for overflow when allocating the memory for fromfile
8406 -- someone tried to pass in sys.maxint and got bitten by the bogus
8407 calculations.
8408
8409 * configure.in:
8410 Get rid of AC_CHECK_LIB(m, pow) since this is taken care of later with
8411 LIBM (from --with-libm=...); this actually broke the customizability
8412 offered by the latter option. Thanks go to Clay Spence for reporting
8413 this.
8414
8415 * Lib/test/test_dl.py:
8416 1. Print the error message (carefully) when a dl.open() fails in verbose mode.
8417 2. When no test case worked, raise ImportError instead of failing.
8418
8419 * Python/bltinmodule.c:
8420 Patch by Tim Peters to improve the range checks for range() and
8421 xrange(), especially for platforms where int and long are different
8422 sizes (so sys.maxint isn't actually the theoretical limit for the
8423 length of a list, but the largest C int is -- sys.maxint is the
8424 largest Python int, which is actually a C long).
8425
8426 * Makefile.in:
8427 1. Augment the DG/UX rule so it doesn't break the BeOS build.
8428 2. Add $(EXE) to various occurrences of python so it will work on
8429 Cygwin with egcs (after setting EXE=.exe). These patches by
8430 Norman Vine.
8431
8432 * Lib/posixfile.py:
8433 According to Jeffrey Honig, bsd/os 2.0 - 4.0 should be added to the
8434 list (of bsd variants that have a different lock structure).
8435
8436 * Lib/test/test_fcntl.py:
8437 According to Jeffrey Honig, bsd/os 4.0 should be added to the list.
8438
8439 * Modules/timemodule.c:
8440 Patch by Tadayoshi Funaba (with some changes) to be smarter about
8441 guessing what happened when strftime() returns 0. Is it buffer
8442 overflow or was the result simply 0 bytes long? (This happens for an
8443 empty format string, or when the format string is a single %Z and the
8444 timezone is unknown.) if the buffer is at least 256 times as long as
8445 the format, assume the latter.
8446
8447Mon Feb 22 19:01:42 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8448
8449 * Lib/urllib.py:
8450 As Des Barry points out, we need to call pathname2url(file) in two
8451 calls to addinfourl() in open_file().
8452
8453 * Modules/Setup.in: Document *static* -- in two places!
8454
8455 * Modules/timemodule.c:
8456 We don't support leap seconds, so the seconds field of a time 9-tuple
8457 should be in the range [0-59]. Noted by Tadayoshi Funaba.
8458
8459 * Modules/stropmodule.c:
8460 In atoi(), don't use isxdigit() to test whether the last character
8461 converted was a "digit" -- use isalnum(). This test is there only to
8462 guard against "+" or "-" being interpreted as a valid int literal.
8463 Reported by Takahiro Nakayama.
8464
8465 * Lib/os.py:
8466 As Finn Bock points out, _P_WAIT etc. don't have a leading underscore
8467 so they don't need to be treated specially here.
8468
8469Mon Feb 22 15:38:58 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8470
8471 * Misc/NEWS:
8472 Typo: "apparentlt" --> "apparently"
8473
8474Mon Feb 22 15:38:46 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
8475
8476 * Lib/urlparse.py: Steve Clift pointed out that 'file' allows a netloc.
8477
8478 * Modules/posixmodule.c:
8479 The docstring for ttyname(..) claims a second "mode" argument. The
8480 actual code does not allow such an argument. (Finn Bock.)
8481
8482 * Lib/lib-old/poly.py:
8483 Dang. Even though this is obsolete code, somebody found a bug, and I
8484 fix it. Oh well.
8485
8486Thu Feb 18 20:51:50 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
8487
8488 * Lib/pyclbr.py:
8489 Bow to font-lock at the end of the docstring, since it throws stuff
8490 off.
8491
8492 Make sure the path paramter to readmodule() is a list before adding it
8493 with sys.path, or the addition could fail.
8494
8495
8496======================================================================
8497
8498
8499From 1.5.2b1 to 1.5.2b2
8500=======================
8501
8502General
8503-------
8504
8505- Many memory leaks fixed.
8506
8507- Many small bugs fixed.
8508
8509- Command line option -OO (or -O -O) suppresses inclusion of doc
8510strings in resulting bytecode.
8511
8512Windows-specific changes
8513------------------------
8514
8515- New built-in module winsound provides an interface to the Win32
8516PlaySound() call.
8517
8518- Re-enable the audioop module in the config.c file.
8519
8520- On Windows, support spawnv() and associated P_* symbols.
8521
8522- Fixed the conversion of times() return values on Windows.
8523
8524- Removed freeze from the installer -- it doesn't work without the
8525source tree. (See FAQ 8.11.)
8526
8527- On Windows 95/98, the Tkinter module now is smart enough to find
8528Tcl/Tk even when the PATH environment variable hasn't been set -- when
8529the import of _tkinter fails, it searches in a standard locations,
8530patches os.environ["PATH"], and tries again. When it still fails, a
8531clearer error message is produced. This should avoid most
8532installation problems with Tkinter use (e.g. in IDLE).
8533
8534- The -i option doesn't make any calls to set[v]buf() for stdin --
8535this apparently screwed up _kbhit() and the _tkinter main loop.
8536
8537- The ntpath module (and hence, os.path on Windows) now parses out UNC
8538paths (e.g. \\host\mountpoint\dir\file) as "drive letters", so that
8539splitdrive() will \\host\mountpoint as the drive and \dir\file as the
8540path. ** EXPERIMENTAL **
8541
8542- Added a hack to the exit code so that if (1) the exit status is
8543nonzero and (2) we think we have our own DOS box (i.e. we're not
8544started from a command line shell), we print a message and wait for
8545the user to hit a key before the DOS box is closed.
8546
8547- Updated the installer to WISE 5.0g. Added a dialog warning about
8548the imminent Tcl installation. Added a dialog to specify the program
8549group name in the start menu. Upgraded the Tcl installer to Tcl
85508.0.4.
8551
8552Changes to intrinsics
8553---------------------
8554
8555- The repr() or str() of a module object now shows the __file__
8556attribute (i.e., the file which it was loaded), or the string
8557"(built-in)" if there is no __file__ attribute.
8558
8559- The range() function now avoids overflow during its calculations (if
8560at all possible).
8561
8562- New info string sys.hexversion, which is an integer encoding the
8563version in hexadecimal. In other words, hex(sys.hexversion) ==
85640x010502b2 for Python 1.5.2b2.
8565
8566New or improved ports
8567---------------------
8568
8569- Support for Nextstep descendants (future Mac systems).
8570
8571- Improved BeOS support.
8572
8573- Support dynamic loading of shared libraries on NetBSD platforms that
8574use ELF (i.e., MIPS and Alpha systems).
8575
8576Configuration/build changes
8577---------------------------
8578
8579- The Lib/test directory is no longer included in the default module
8580search path (sys.path) -- "test" has been a package ever since 1.5.
8581
8582- Now using autoconf 2.13.
8583
8584New library modules
8585-------------------
8586
8587- New library modules asyncore and asynchat: these form Sam Rushing's
8588famous asynchronous socket library. Sam has gracefully allowed me to
8589incorporate these in the standard Python library.
8590
8591- New module statvfs contains indexing constants for [f]statvfs()
8592return tuple.
8593
8594Changes to the library
8595----------------------
8596
8597- The wave module (platform-independent support for Windows sound
8598files) has been fixed to actually make it work.
8599
8600- The sunau module (platform-independent support for Sun/NeXT sound
8601files) has been fixed to work across platforms. Also, a weird
8602encoding bug in the header of the audio test data file has been
8603corrected.
8604
8605- Fix a bug in the urllib module that occasionally tripped up
8606webchecker and other ftp retrieves.
8607
8608- ConfigParser's get() method now accepts an optional keyword argument
8609(vars) that is substituted on top of the defaults that were setup in
8610__init__. You can now also have recusive references in your
8611configuration file.
8612
8613- Some improvements to the Queue module, including a put_nowait()
8614module and an optional "block" second argument, to get() and put(),
8615defaulting to 1.
8616
8617- The updated xmllib module is once again compatible with the version
8618present in Python 1.5.1 (this was accidentally broken in 1.5.2b1).
8619
8620- The bdb module (base class for the debugger) now supports
8621canonicalizing pathnames used in breakpoints. The derived class must
8622override the new canonical() method for this to work. Also changed
8623clear_break() to the backwards compatible old signature, and added
8624clear_bpbynumber() for the new functionality.
8625
8626- In sgmllib (and hence htmllib), recognize attributes even if they
8627don't have space in front of them. I.e. '<a
8628name="foo"href="bar.html">' will now have two attributes recognized.
8629
8630- In the debugger (pdb), change clear syntax to support three
8631alternatives: clear; clear file:line; clear bpno bpno ...
8632
8633- The os.path module now pretends to be a submodule within the os
8634"package", so you can do things like "from os.path import exists".
8635
8636- The standard exceptions now have doc strings.
8637
8638- In the smtplib module, exceptions are now classes. Also avoid
8639inserting a non-standard space after "TO" in rcpt() command.
8640
8641- The rfc822 module's getaddrlist() method now uses all occurrences of
8642the specified header instead of just the first. Some other bugfixes
8643too (to handle more weird addresses found in a very large test set,
8644and to avoid crashes on certain invalid dates), and a small test
8645module has been added.
8646
8647- Fixed bug in urlparse in the common-case code for HTTP URLs; it
8648would lose the query, fragment, and/or parameter information.
8649
8650- The sndhdr module no longer supports whatraw() -- it depended on a
8651rare extenral program.
8652
8653- The UserList module/class now supports the extend() method, like
8654real list objects.
8655
8656- The uu module now deals better with trailing garbage generated by
8657some broke uuencoders.
8658
8659- The telnet module now has an my_interact() method which uses threads
8660instead of select. The interact() method uses this by default on
8661Windows (where the single-threaded version doesn't work).
8662
8663- Add a class to mailbox.py for dealing with qmail directory
8664mailboxes. The test code was extended to notice these being used as
8665well.
8666
8667Changes to extension modules
8668----------------------------
8669
8670- Support for the [f]statvfs() system call, where it exists.
8671
8672- Fixed some bugs in cPickle where bad input could cause it to dump
8673core.
8674
8675- Fixed cStringIO to make the writelines() function actually work.
8676
8677- Added strop.expandtabs() so string.expandtabs() is now much faster.
8678
8679- Added fsync() and fdatasync(), if they appear to exist.
8680
8681- Support for "long files" (64-bit seek pointers).
8682
8683- Fixed a bug in the zlib module's flush() function.
8684
8685- Added access() system call. It returns 1 if access granted, 0 if
8686not.
8687
8688- The curses module implements an optional nlines argument to
8689w.scroll(). (It then calls wscrl(win, nlines) instead of scoll(win).)
8690
8691Changes to tools
8692----------------
8693
8694- Some changes to IDLE; see Tools/idle/NEWS.txt.
8695
8696- Latest version of Misc/python-mode.el included.
8697
8698Changes to Tkinter
8699------------------
8700
8701- Avoid tracebacks when an image is deleted after its root has been
8702destroyed.
8703
8704Changes to the Python/C API
8705---------------------------
8706
8707- When parentheses are used in a PyArg_Parse[Tuple]() call, any
8708sequence is now accepted, instead of requiring a tuple. This is in
8709line with the general trend towards accepting arbitrary sequences.
8710
8711- Added PyModule_GetFilename().
8712
8713- In PyNumber_Power(), remove unneeded and even harmful test for float
8714to the negative power (which is already and better done in
8715floatobject.c).
8716
8717- New version identification symbols; read patchlevel.h for info. The
8718version numbers are now exported by Python.h.
8719
8720- Rolled back the API version change -- it's back to 1007!
8721
8722- The frozenmain.c function calls PyInitFrozenExtensions().
8723
8724- Added 'N' format character to Py_BuildValue -- like 'O' but doesn't
8725INCREF.
8726
8727
8728======================================================================
8729
8730
8731From 1.5.2a2 to 1.5.2b1
8732=======================
8733
8734Changes to intrinsics
8735---------------------
8736
8737- New extension NotImplementedError, derived from RuntimeError. Not
8738used, but recommended use is for "abstract" methods to raise this.
8739
8740- The parser will now spit out a warning or error when -t or -tt is
8741used for parser input coming from a string, too.
8742
8743- The code generator now inserts extra SET_LINENO opcodes when
8744compiling multi-line argument lists.
8745
8746- When comparing bound methods, use identity test on the objects, not
8747equality test.
8748
8749New or improved ports
8750---------------------
8751
8752- Chris Herborth has redone his BeOS port; it now works on PowerPC
8753(R3/R4) and x86 (R4 only). Threads work too in this port.
8754
8755Renaming
8756--------
8757
8758- Thanks to Chris Herborth, the thread primitives now have proper Py*
8759names in the source code (they already had those for the linker,
8760through some smart macros; but the source still had the old, un-Py
8761names).
8762
8763Configuration/build changes
8764---------------------------
8765
8766- Improved support for FreeBSD/3.
8767
8768- Check for pthread_detach instead of pthread_create in libc.
8769
8770- The makesetup script now searches EXECINCLUDEPY before INCLUDEPY.
8771
8772- Misc/Makefile.pre.in now also looks at Setup.thread and Setup.local.
8773Otherwise modules such as thread didn't get incorporated in extensions.
8774
8775New library modules
8776-------------------
8777
8778- shlex.py by Eric Raymond provides a lexical analyzer class for
8779simple shell-like syntaxes.
8780
8781- netrc.py by Eric Raymond provides a parser for .netrc files. (The
8782undocumented Netrc class in ftplib.py is now obsolete.)
8783
8784- codeop.py is a new module that contains the compile_command()
8785function that was previously in code.py. This is so that JPython can
8786provide its own version of this function, while still sharing the
8787higher-level classes in code.py.
8788
8789- turtle.py is a new module for simple turtle graphics. I'm still
8790working on it; let me know if you use this to teach Python to children
8791or other novices without prior programming experience.
8792
8793Obsoleted library modules
8794-------------------------
8795
8796- poly.py and zmod.py have been moved to Lib/lib-old to emphasize
8797their status of obsoleteness. They don't do a particularly good job
8798and don't seem particularly relevant to the Python core.
8799
8800New tools
8801---------
8802
8803- I've added IDLE: my Integrated DeveLopment Environment for Python.
8804Requires Tcl/Tk (and Tkinter). Works on Windows and Unix (and should
8805work on Macintosh, but I haven't been able to test it there; it does
8806depend on new features in 1.5.2 and perhaps even new features in
88071.5.2b1, especially the new code module). This is very much a work in
8808progress. I'd like to hear how people like it compared to PTUI (or
8809any other IDE they are familiar with).
8810
8811- New tools by Barry Warsaw:
8812
8813 = audiopy: controls the Solaris Audio device
8814 = pynche: The PYthonically Natural Color and Hue Editor
8815 = world: Print mappings between country names and DNS country codes
8816
8817New demos
8818---------
8819
8820- Demo/scripts/beer.py prints the lyrics to an arithmetic drinking
8821song.
8822
8823- Demo/tkinter/guido/optionmenu.py shows how to do an option menu in
8824Tkinter. (By Fredrik Lundh -- not by me!)
8825
8826Changes to the library
8827----------------------
8828
8829- compileall.py now avoids recompiling .py files that haven't changed;
8830it adds a -f option to force recompilation.
8831
8832- New version of xmllib.py by Sjoerd Mullender (0.2 with latest
8833patches).
8834
8835- nntplib.py: statparse() no longer lowercases the message-id.
8836
8837- types.py: use type(__stdin__) for FileType.
8838
8839- urllib.py: fix translations for filenames with "funny" characters.
8840Patch by Sjoerd Mullender. Note that if you subclass one of the
8841URLopener classes, and you have copied code from the old urllib.py,
8842your subclass may stop working. A long-term solution is to provide
8843more methods so that you don't have to copy code.
8844
8845- cgi.py: In read_multi, allow a subclass to override the class we
8846instantiate when we create a recursive instance, by setting the class
8847variable 'FieldStorageClass' to the desired class. By default, this
8848is set to None, in which case we use self.__class__ (as before).
8849Also, a patch by Jim Fulton to pass additional arguments to recursive
8850calls to the FieldStorage constructor from its read_multi method.
8851
8852- UserList.py: In __getslice__, use self.__class__ instead of
8853UserList.
8854
8855- In SimpleHTTPServer.py, the server specified in test() should be
8856BaseHTTPServer.HTTPServer, in case the request handler should want to
8857reference the two attributes added by BaseHTTPServer.server_bind. (By
8858Jeff Rush, for Bobo). Also open the file in binary mode, so serving
8859images from a Windows box might actually work.
8860
8861- In CGIHTTPServer.py, the list of acceptable formats is -split-
8862on spaces but -joined- on commas, resulting in double commas
8863in the joined text. (By Jeff Rush.)
8864
8865- SocketServer.py, patch by Jeff Bauer: a minor change to declare two
8866new threaded versions of Unix Server classes, using the ThreadingMixIn
8867class: ThreadingUnixStreamServer, ThreadingUnixDatagramServer.
8868
8869- bdb.py: fix bomb on deleting a temporary breakpoint: there's no
8870method do_delete(); do_clear() was meant. By Greg Ward.
8871
8872- getopt.py: accept a non-list sequence for the long options (request
8873by Jack Jansen). Because it might be a common mistake to pass a
8874single string, this situation is treated separately. Also added
8875docstrings (copied from the library manual) and removed the (now
8876redundant) module comments.
8877
8878- tempfile.py: improvements to avoid security leaks.
8879
8880- code.py: moved compile_command() to new module codeop.py.
8881
8882- pickle.py: support pickle format 1.3 (binary float added). By Jim
8883Fulton. Also get rid of the undocumented obsolete Pickler dump_special
8884method.
8885
8886- uu.py: Move 'import sys' to top of module, as noted by Tim Peters.
8887
8888- imaplib.py: fix problem with some versions of IMAP4 servers that
8889choose to mix the case in their CAPABILITIES response.
8890
8891- cmp.py: use (f1, f2) as cache key instead of f1 + ' ' + f2. Noted
8892by Fredrik Lundh.
8893
8894Changes to extension modules
8895----------------------------
8896
8897- More doc strings for several modules were contributed by Chris
8898Petrilli: math, cmath, fcntl.
8899
8900- Fixed a bug in zlibmodule.c that could cause core dumps on
8901decompression of rarely occurring input.
8902
8903- cPickle.c: new version from Jim Fulton, with Open Source copyright
8904notice. Also, initialize self->safe_constructors early on to prevent
8905crash in early dealloc.
8906
8907- cStringIO.c: new version from Jim Fulton, with Open Source copyright
8908notice. Also fixed a core dump in cStringIO.c when doing seeks.
8909
8910- mpzmodule.c: fix signed character usage in mpz.mpz(stringobjecty).
8911
8912- readline.c: Bernard Herzog pointed out that rl_parse_and_bind
8913modifies its argument string (bad function!), so we make a temporary
8914copy.
8915
8916- sunaudiodev.c: Barry Warsaw added more smarts to get the device and
8917control pseudo-device, per audio(7I).
8918
8919Changes to tools
8920----------------
8921
8922- New, improved version of Barry Warsaw's Misc/python-mode.el (editing
8923support for Emacs).
8924
8925- tabnanny.py: added a -q ('quiet') option to tabnanny, which causes
8926only the names of offending files to be printed.
8927
8928- freeze: when printing missing modules, also print the module they
8929were imported from.
8930
8931- untabify.py: patch by Detlef Lannert to implement -t option
8932(set tab size).
8933
8934Changes to Tkinter
8935------------------
8936
8937- grid_bbox(): support new Tk API: grid bbox ?column row? ?column2
8938row2?
8939
8940- _tkinter.c: RajGopal Srinivasan noted that the latest code (1.5.2a2)
8941doesn't work when running in a non-threaded environment. He added
8942some #ifdefs that fix this.
8943
8944Changes to the Python/C API
8945---------------------------
8946
8947- Bumped API version number to 1008 -- enough things have changed!
8948
8949- There's a new macro, PyThreadState_GET(), which does the same work
8950as PyThreadState_Get() without the overhead of a function call (it
8951also avoids the error check). The two top calling locations of
8952PyThreadState_Get() have been changed to use this macro.
8953
8954- All symbols intended for export from a DLL or shared library are now
8955marked as such (with the DL_IMPORT() macro) in the header file that
8956declares them. This was needed for the BeOS port, and should also
8957make some other ports easier. The PC port no longer needs the file
8958with exported symbols (PC/python_nt.def). There's also a DL_EXPORT
8959macro which is only used for init methods in extension modules, and
8960for Py_Main().
8961
8962Invisible changes to internals
8963------------------------------
8964
8965- Fixed a bug in new_buffersize() in fileobject.c which could
8966return a buffer size that was way too large.
8967
8968- Use PySys_WriteStderr instead of fprintf in most places.
8969
8970- dictobject.c: remove dead code discovered by Vladimir Marangozov.
8971
8972- tupleobject.c: make tuples less hungry -- an extra item was
8973allocated but never used. Tip by Vladimir Marangozov.
8974
8975- mymath.h: Metrowerks PRO4 finally fixes the hypot snafu. (Jack
8976Jansen)
8977
8978- import.c: Jim Fulton fixes a reference count bug in
8979PyEval_GetGlobals.
8980
8981- glmodule.c: check in the changed version after running the stubber
8982again -- this solves the conflict with curses over the 'clear' entry
8983point much nicer. (Jack Jansen had checked in the changes to cstubs
8984eons ago, but I never regenrated glmodule.c :-( )
8985
8986- frameobject.c: fix reference count bug in PyFrame_New. Vladimir
8987Marangozov.
8988
8989- stropmodule.c: add a missing DECREF in an error exit. Submitted by
8990Jonathan Giddy.
8991
8992
8993======================================================================
8994
8995
8996From 1.5.2a1 to 1.5.2a2
8997=======================
8998
8999General
9000-------
9001
9002- It is now a syntax error to have a function argument without a
9003default following one with a default.
9004
9005- __file__ is now set to the .py file if it was parsed (it used to
9006always be the .pyc/.pyo file).
9007
9008- Don't exit with a fatal error during initialization when there's a
9009problem with the exceptions.py module.
9010
9011- New environment variable PYTHONOPTIMIZE can be used to set -O.
9012
9013- New version of python-mode.el for Emacs.
9014
9015Miscellaneous fixed bugs
9016------------------------
9017
9018- No longer print the (confusing) error message about stack underflow
9019while compiling.
9020
9021- Some threading and locking bugs fixed.
9022
9023- When errno is zero, report "Error", not "Success".
9024
9025Documentation
9026-------------
9027
9028- Documentation will be released separately.
9029
9030- Doc strings added to array and md5 modules by Chris Petrilli.
9031
9032Ports and build procedure
9033-------------------------
9034
9035- Stop installing when a move or copy fails.
9036
9037- New version of the OS/2 port code by Jeff Rush.
9038
9039- The makesetup script handles absolute filenames better.
9040
9041- The 'new' module is now enabled by default in the Setup file.
9042
9043- I *think* I've solved the problem with the Linux build blowing up
9044sometimes due to a conflict between sigcheck/intrcheck and
9045signalmodule.
9046
9047Built-in functions
9048------------------
9049
9050- The second argument to apply() can now be any sequence, not just a
9051tuple.
9052
9053Built-in types
9054--------------
9055
9056- Lists have a new method: L1.extend(L2) is equivalent to the common
9057idiom L1[len(L1):] = L2.
9058
9059- Better error messages when a sequence is indexed with a non-integer.
9060
9061- Bettter error message when calling a non-callable object (include
9062the type in the message).
9063
9064Python services
9065---------------
9066
9067- New version of cPickle.c fixes some bugs.
9068
9069- pickle.py: improved instantiation error handling.
9070
9071- code.py: reworked quite a bit. New base class
9072InteractiveInterpreter and derived class InteractiveConsole. Fixed
9073several problems in compile_command().
9074
9075- py_compile.py: print error message and continue on syntax errors.
9076Also fixed an old bug with the fstat code (it was never used).
9077
9078- pyclbr.py: support submodules of packages.
9079
9080String Services
9081---------------
9082
9083- StringIO.py: raise the right exception (ValueError) for attempted
9084I/O on closed StringIO objects.
9085
9086- re.py: fixed a bug in subn(), which caused .groups() to fail inside
9087the replacement function called by sub().
9088
9089- The struct module has a new format 'P': void * in native mode.
9090
9091Generic OS Services
9092-------------------
9093
9094- Module time: Y2K robustness. 2-digit year acceptance depends on
9095value of time.accept2dyear, initialized from env var PYTHONY2K,
9096default 0. Years 00-68 mean 2000-2068, while 69-99 mean 1969-1999
9097(POSIX or X/Open recommendation).
9098
9099- os.path: normpath(".//x") should return "x", not "/x".
9100
9101- getpass.py: fall back on default_getpass() when sys.stdin.fileno()
9102doesn't work.
9103
9104- tempfile.py: regenerate the template after a fork() call.
9105
9106Optional OS Services
9107--------------------
9108
9109- In the signal module, disable restarting interrupted system calls
9110when we have siginterrupt().
9111
9112Debugger
9113--------
9114
9115- No longer set __args__; this feature is no longer supported and can
9116affect the debugged code.
9117
9118- cmd.py, pdb.py and bdb.py have been overhauled by Richard Wolff, who
9119added aliases and some other useful new features, e.g. much better
9120breakpoint support: temporary breakpoint, disabled breakpoints,
9121breakpoints with ignore counts, and conditions; breakpoints can be set
9122on a file before it is loaded.
9123
9124Profiler
9125--------
9126
9127- Changes so that JPython can use it. Also fix the calibration code
9128so it actually works again
9129.
9130Internet Protocols and Support
9131------------------------------
9132
9133- imaplib.py: new version from Piers Lauder.
9134
9135- smtplib.py: change sendmail() method to accept a single string or a
9136list or strings as the destination (commom newbie mistake).
9137
9138- poplib.py: LIST with a msg argument fixed.
9139
9140- urlparse.py: some optimizations for common case (http).
9141
9142- urllib.py: support content-length in info() for ftp protocol;
9143support for a progress meter through a third argument to
9144urlretrieve(); commented out gopher test (the test site is dead).
9145
9146Internet Data handling
9147----------------------
9148
9149- sgmllib.py: support tags with - or . in their name.
9150
9151- mimetypes.py: guess_type() understands 'data' URLs.
9152
9153Restricted Execution
9154--------------------
9155
9156- The classes rexec.RModuleLoader and rexec.RModuleImporter no
9157longer exist.
9158
9159Tkinter
9160-------
9161
9162- When reporting an exception, store its info in sys.last_*. Also,
9163write all of it to stderr.
9164
9165- Added NS, EW, and NSEW constants, for grid's sticky option.
9166
9167- Fixed last-minute bug in 1.5.2a1 release: need to include "mytime.h".
9168
9169- Make bind variants without a sequence return a tuple of sequences
9170(formerly it returned a string, which wasn't very convenient).
9171
9172- Add image commands to the Text widget (these are new in Tk 8.0).
9173
9174- Added new listbox and canvas methods: {xview,yview}_{scroll,moveto}.)
9175
9176- Improved the thread code (but you still can't call update() from
9177another thread on Windows).
9178
9179- Fixed unnecessary references to _default_root in the new dialog
9180modules.
9181
9182- Miscellaneous problems fixed.
9183
9184
9185Windows General
9186---------------
9187
9188- Call LoadLibraryEx(..., ..., LOAD_WITH_ALTERED_SEARCH_PATH) to
9189search for dependent dlls in the directory containing the .pyd.
9190
9191- In debugging mode, call DebugBreak() in Py_FatalError().
9192
9193Windows Installer
9194-----------------
9195
9196- Install zlib.dll in the DLLs directory instead of in the win32
9197system directory, to avoid conflicts with other applications that have
9198their own zlib.dll.
9199
9200Test Suite
9201----------
9202
9203- test_long.py: new test for long integers, by Tim Peters.
9204
9205- regrtest.py: improved so it can be used for other test suites as
9206well.
9207
9208- test_strftime.py: use re to compare test results, to support legal
9209variants (e.g. on Linux).
9210
9211Tools and Demos
9212---------------
9213
9214- Four new scripts in Tools/scripts: crlf.py and lfcr.py (to
9215remove/add Windows style '\r\n' line endings), untabify.py (to remove
9216tabs), and rgrep.yp (reverse grep).
9217
9218- Improvements to Tools/freeze/. Each Python module is now written to
9219its own C file. This prevents some compilers or assemblers from
9220blowing up on large frozen programs, and saves recompilation time if
9221only a few modules are changed. Other changes too, e.g. new command
9222line options -x and -i.
9223
9224- Much improved (and smaller!) version of Tools/scripts/mailerdaemon.py.
9225
9226Python/C API
9227------------
9228
9229- New mechanism to support extensions of the type object while
9230remaining backward compatible with extensions compiled for previous
9231versions of Python 1.5. A flags field indicates presence of certain
9232fields.
9233
9234- Addition to the buffer API to differentiate access to bytes and
92358-bit characters (in anticipation of Unicode characters).
9236
9237- New argument parsing format t# ("text") to indicate 8-bit
9238characters; s# simply means 8-bit bytes, for backwards compatibility.
9239
9240- New object type, bufferobject.c is an example and can be used to
9241create buffers from memory.
9242
9243- Some support for 64-bit longs, including some MS platforms.
9244
9245- Many calls to fprintf(stderr, ...) have been replaced with calls to
9246PySys_WriteStderr(...).
9247
9248- The calling context for PyOS_Readline() has changed: it must now be
9249called with the interpreter lock held! It releases the lock around
9250the call to the function pointed to by PyOS_ReadlineFunctionPointer
9251(default PyOS_StdioReadline()).
9252
9253- New APIs PyLong_FromVoidPtr() and PyLong_AsVoidPtr().
9254
9255- Renamed header file "thread.h" to "pythread.h".
9256
9257- The code string of code objects may now be anything that supports the
9258buffer API.
9259
9260
9261======================================================================
9262
9263
9264From 1.5.1 to 1.5.2a1
9265=====================
9266
9267General
9268-------
9269
9270- When searching for the library, a landmark that is a compiled module
9271(string.pyc or string.pyo) is also accepted.
9272
9273- When following symbolic links to the python executable, use a loop
9274so that a symlink to a symlink can work.
9275
9276- Added a hack so that when you type 'quit' or 'exit' at the
9277interpreter, you get a friendly explanation of how to press Ctrl-D (or
9278Ctrl-Z) to exit.
9279
9280- New and improved Misc/python-mode.el (Python mode for Emacs).
9281
9282- Revert a new feature in Unix dynamic loading: for one or two
9283revisions, modules were loaded using the RTLD_GLOBAL flag. It turned
9284out to be a bad idea.
9285
9286Miscellaneous fixed bugs
9287------------------------
9288
9289- All patches on the patch page have been integrated. (But much more
9290has been done!)
9291
9292- Several memory leaks plugged (e.g. the one for classes with a
9293__getattr__ method).
9294
9295- Removed the only use of calloc(). This triggered an obscure bug on
9296multiprocessor Sparc Solaris 2.6.
9297
9298- Fix a peculiar bug that would allow "import sys.time" to succeed
9299(believing the built-in time module to be a part of the sys package).
9300
9301- Fix a bug in the overflow checking when converting a Python long to
9302a C long (failed to convert -2147483648L, and some other cases).
9303
9304Documentation
9305-------------
9306
9307- Doc strings have been added to many extension modules: __builtin__,
9308errno, select, signal, socket, sys, thread, time. Also to methods of
9309list objects (try [].append.__doc__). A doc string on a type will now
9310automatically be propagated to an instance if the instance has methods
9311that are accessed in the usual way.
9312
9313- The documentation has been expanded and the formatting improved.
9314(Remember that the documentation is now unbundled and has its own
9315release cycle though; see http://www.python.org/doc/.)
9316
9317- Added Misc/Porting -- a mini-FAQ on porting to a new platform.
9318
9319Ports and build procedure
9320-------------------------
9321
9322- The BeOS port is now integrated. Courtesy Chris Herborth.
9323
9324- Symbol files for FreeBSD 2.x and 3.x have been contributed
9325(Lib/plat-freebsd[23]/*).
9326
9327- Support HPUX 10.20 DCE threads.
9328
9329- Finally fixed the configure script so that (on SGI) if -OPT:Olimit=0
9330works, it won't also use -Olimit 1500 (which gives a warning for every
9331file). Also support the SGI_ABI environment variable better.
9332
9333- The makesetup script now understands absolute pathnames ending in .o
9334in the module -- it assumes it's a file for which we have no source.
9335
9336- Other miscellaneous improvements to the configure script and
9337Makefiles.
9338
9339- The test suite now uses a different sound sample.
9340
9341Built-in functions
9342------------------
9343
9344- Better checks for invalid input to int(), long(), string.atoi(),
9345string.atol(). (Formerly, a sign without digits would be accepted as
9346a legal ways to spell zero.)
9347
9348- Changes to map() and filter() to use the length of a sequence only
9349as a hint -- if an IndexError happens earlier, take that. (Formerly,
9350this was considered an error.)
9351
9352- Experimental feature in getattr(): a third argument can specify a
9353default (instead of raising AttributeError).
9354
9355- Implement round() slightly different, so that for negative ndigits
9356no additional errors happen in the last step.
9357
9358- The open() function now adds the filename to the exception when it
9359fails.
9360
9361Built-in exceptions
9362-------------------
9363
9364- New standard exceptions EnvironmentError and PosixError.
9365EnvironmentError is the base class for IOError and PosixError;
9366PosixError is the same as os.error. All this so that either exception
9367class can be instantiated with a third argument indicating a filename.
9368The built-in function open() and most os/posix functions that take a
9369filename argument now use this.
9370
9371Built-in types
9372--------------
9373
9374- List objects now have an experimental pop() method; l.pop() returns
9375and removes the last item; l.pop(i) returns and removes the item at
9376i. Also, the sort() method is faster again. Sorting is now also
9377safer: it is impossible for the sorting function to modify the list
9378while the sort is going on (which could cause core dumps).
9379
9380- Changes to comparisons: numbers are now smaller than any other type.
9381This is done to prevent the circularity where [] < 0L < 1 < [] is
9382true. As a side effect, cmp(None, 0) is now positive instead of
9383negative. This *shouldn't* affect any working code, but I've found
9384that the change caused several "sleeping" bugs to become active, so
9385beware!
9386
9387- Instance methods may now have other callable objects than just
9388Python functions as their im_func. Use new.instancemethod() or write
9389your own C code to create them; new.instancemethod() may be called
9390with None for the instance to create an unbound method.
9391
9392- Assignment to __name__, __dict__ or __bases__ of a class object is
9393now allowed (with stringent type checks); also allow assignment to
9394__getattr__ etc. The cached values for __getattr__ etc. are
9395recomputed after such assignments (but not for derived classes :-( ).
9396
9397- Allow assignment to some attributes of function objects: func_code,
9398func_defaults and func_doc / __doc__. (With type checks except for
9399__doc__ / func_doc .)
9400
9401Python services
9402---------------
9403
9404- New tests (in Lib/test): reperf.py (regular expression benchmark),
9405sortperf.py (list sorting benchmark), test_MimeWriter.py (test case
9406for the MimeWriter module).
9407
9408- Generalized test/regrtest.py so that it is useful for testing other
9409packages.
9410
9411- The ihooks.py module now understands package imports.
9412
9413- In code.py, add a class that subsumes Fredrik Lundh's
9414PythonInterpreter class. The interact() function now uses this.
9415
9416- In rlcompleter.py, in completer(), return None instead of raising an
9417IndexError when there are no more completions left.
9418
9419- Fixed the marshal module to test for certain common kinds of invalid
9420input. (It's still not foolproof!)
9421
9422- In the operator module, add an alias (now the preferred name)
9423"contains" for "sequenceincludes".
9424
9425String Services
9426---------------
9427
9428- In the string and strop modules, in the replace() function, treat an
9429empty pattern as an error (since it's not clear what was meant!).
9430
9431- Some speedups to re.py, especially the string substitution and split
9432functions. Also added new function/method findall(), to find all
9433occurrences of a given substring.
9434
9435- In cStringIO, add better argument type checking and support the
9436readonly 'closed' attribute (like regular files).
9437
9438- In the struct module, unsigned 1-2 byte sized formats no longer
9439result in long integer values.
9440
9441Miscellaneous services
9442----------------------
9443
9444- In whrandom.py, added new method and function randrange(), same as
9445choice(range(start, stop, step)) but faster. This addresses the
9446problem that randint() was accidentally defined as taking an inclusive
9447range. Also, randint(a, b) is now redefined as randrange(a, b+1),
9448adding extra range and type checking to its arguments!
9449
9450- Add some semi-thread-safety to random.gauss() (it used to be able to
9451crash when invoked from separate threads; now the worst it can do is
9452give a duplicate result occasionally).
9453
9454- Some restructuring and generalization done to cmd.py.
9455
9456- Major upgrade to ConfigParser.py; converted to using 're', added new
9457exceptions, support underscore in section header and option name. No
9458longer add 'name' option to every section; instead, add '__name__'.
9459
9460- In getpass.py, don't use raw_input() to ask for the password -- we
9461don't want it to show up in the readline history! Also don't catch
9462interrupts (the try-finally already does all necessary cleanup).
9463
9464Generic OS Services
9465-------------------
9466
9467- New functions in os.py: makedirs(), removedirs(), renames(). New
9468variable: linesep (the line separator as found in binary files,
9469i.e. '\n' on Unix, '\r\n' on DOS/Windows, '\r' on Mac. Do *not* use
9470this with files opened in (default) text mode; the line separator used
9471will always be '\n'!
9472
9473- Changes to the 'os.path' submodule of os.py: added getsize(),
9474getmtime(), getatime() -- these fetch the most popular items from the
9475stat return tuple.
9476
9477- In the time module, add strptime(), if it exists. (This parses a
9478time according to a format -- the inverse of strftime().) Also,
9479remove the call to mktime() from strftime() -- it messed up the
9480formatting of some non-local times.
9481
9482- In the socket module, added a new function gethostbyname_ex().
9483Also, don't use #ifdef to test for some symbols that are enums on some
9484platforms (and should exist everywhere).
9485
9486Optional OS Services
9487--------------------
9488
9489- Some fixes to gzip.py. In particular, the readlines() method now
9490returns the lines *with* trailing newline characters, like readlines()
9491of regular file objects. Also, it didn't work together with cPickle;
9492fixed that.
9493
9494- In whichdb.py, support byte-swapped dbhash (bsddb) files.
9495
9496- In anydbm.py, look at the type of an existing database to determine
9497which module to use to open it. (The anydbm.error exception is now a
9498tuple.)
9499
9500Unix Services
9501-------------
9502
9503- In the termios module, in tcsetattr(), initialize the structure vy
9504calling tcgetattr().
9505
9506- Added some of the "wait status inspection" macros as functions to
9507the posix module (and thus to the os module): WEXITSTATUS(),
9508WIFEXITED(), WIFSIGNALED(), WIFSTOPPED(), WSTOPSIG(), WTERMSIG().
9509
9510- In the syslog module, make the default facility more intuitive
9511(matching the docs).
9512
9513Debugger
9514--------
9515
9516- In pdb.py, support for setting breaks on files/modules that haven't
9517been loaded yet.
9518
9519Internet Protocols and Support
9520------------------------------
9521
9522- Changes in urllib.py; sped up unquote() and quote(). Fixed an
9523obscure bug in quote_plus(). Added urlencode(dict) -- convenience
9524function for sending a POST request with urlopen(). Use the getpass
9525module to ask for a password. Rewrote the (test) main program so that
9526when used as a script, it can retrieve one or more URLs to stdout.
9527Use -t to run the self-test. Made the proxy code work again.
9528
9529- In cgi.py, treat "HEAD" the same as "GET", so that CGI scripts don't
9530fail when someone asks for their HEAD. Also, for POST, set the
9531default content-type to application/x-www-form-urlencoded. Also, in
9532FieldStorage.__init__(), when method='GET', always get the query
9533string from environ['QUERY_STRING'] or sys.argv[1] -- ignore an
9534explicitly passed in fp.
9535
9536- The smtplib.py module now supports ESMTP and has improved standard
9537compliance, for picky servers.
9538
9539- Improved imaplib.py.
9540
9541- Fixed UDP support in SocketServer.py (it never worked).
9542
9543- Fixed a small bug in CGIHTTPServer.py.
9544
9545Internet Data handling
9546----------------------
9547
9548- In rfc822.py, add a new class AddressList. Also support a new
9549overridable method, isheader(). Also add a get() method similar to
9550dictionaries (and make getheader() an alias for it). Also, be smarter
9551about seekable (test whether fp.tell() works) and test for presence of
9552unread() method before trying seeks.
9553
9554- In sgmllib.py, restore the call to report_unbalanced() that was lost
9555long ago. Also some other improvements: handle <? processing
9556instructions >, allow . and - in entity names, and allow \r\n as line
9557separator.
9558
9559- Some restructuring and generalization done to multifile.py; support
9560a 'seekable' flag.
9561
9562Restricted Execution
9563--------------------
9564
9565- Improvements to rexec.py: package support; support a (minimal)
9566sys.exc_info(). Also made the (test) main program a bit fancier (you
9567can now use it to run arbitrary Python scripts in restricted mode).
9568
9569Tkinter
9570-------
9571
9572- On Unix, Tkinter can now safely be used from a multi-threaded
9573application. (Formerly, no threads would make progress while
9574Tkinter's mainloop() was active, because it didn't release the Python
9575interpreter lock.) Unfortunately, on Windows, threads other than the
9576main thread should not call update() or update_idletasks() because
9577this will deadlock the application.
9578
9579- An interactive interpreter that uses readline and Tkinter no longer
9580uses up all available CPU time.
9581
9582- Even if readline is not used, Tk windows created in an interactive
9583interpreter now get continuously updated. (This even works in Windows
9584as long as you don't hit a key.)
9585
9586- New demos in Demo/tkinter/guido/: brownian.py, redemo.py, switch.py.
9587
9588- No longer register Tcl_finalize() as a low-level exit handler. It
9589may call back into Python, and that's a bad idea.
9590
9591- Allow binding of Tcl commands (given as a string).
9592
9593- Some minor speedups; replace explicitly coded getint() with int() in
9594most places.
9595
9596- In FileDialog.py, remember the directory of the selected file, if
9597given.
9598
9599- Change the names of all methods in the Wm class: they are now
9600wm_title(), etc. The old names (title() etc.) are still defined as
9601aliases.
9602
9603- Add a new method of interpreter objects, interpaddr(). This returns
9604the address of the Tcl interpreter object, as an integer. Not very
9605useful for the Python programmer, but this can be called by another C
9606extension that needs to make calls into the Tcl/Tk C API and needs to
9607get the address of the Tcl interpreter object. A simple cast of the
9608return value to (Tcl_Interp *) will do the trick.
9609
9610Windows General
9611---------------
9612
9613- Don't insist on proper case for module source files if the filename
9614is all uppercase (e.g. FOO.PY now matches foo; but FOO.py still
9615doesn't). This should address problems with this feature on
9616oldfashioned filesystems (Novell servers?).
9617
9618Windows Library
9619---------------
9620
9621- os.environ is now all uppercase, but accesses are case insensitive,
9622and the putenv() calls made as a side effect of changing os.environ
9623are case preserving.
9624
9625- Removed samefile(), sameopenfile(), samestat() from os.path (aka
9626ntpath.py) -- these cannot be made to work reliably (at least I
9627wouldn't know how).
9628
9629- Fixed os.pipe() so that it returns file descriptors acceptable to
9630os.read() and os.write() (like it does on Unix), rather than Windows
9631file handles.
9632
9633- Added a table of WSA error codes to socket.py.
9634
9635- In the select module, put the (huge) file descriptor arrays on the
9636heap.
9637
9638- The getpass module now raises KeyboardInterrupt when it sees ^C.
9639
9640- In mailbox.py, fix tell/seek when using files opened in text mode.
9641
9642- In rfc822.py, fix tell/seek when using files opened in text mode.
9643
9644- In the msvcrt extension module, release the interpreter lock for
9645calls that may block: _locking(), _getch(), _getche(). Also fix a
9646bogus error return when open_osfhandle() doesn't have the right
9647argument list.
9648
9649Windows Installer
9650-----------------
9651
9652- The registry key used is now "1.5" instead of "1.5.x" -- so future
9653versions of 1.5 and Mark Hammond's win32all installer don't need to be
9654resynchronized.
9655
9656Windows Tools
9657-------------
9658
9659- Several improvements to freeze specifically for Windows.
9660
9661Windows Build Procedure
9662-----------------------
9663
9664- The VC++ project files and the WISE installer have been moved to the
9665PCbuild subdirectory, so they are distributed in the same subdirectory
9666where they must be used. This avoids confusion.
9667
9668- New project files for Windows 3.1 port by Jim Ahlstrom.
9669
9670- Got rid of the obsolete subdirectory PC/setup_nt/.
9671
9672- The projects now use distinct filenames for the .exe, .dll, .lib and
9673.pyd files built in debug mode (by appending "_d" to the base name,
9674before the extension). This makes it easier to switch between the two
9675and get the right versions. There's a pragma in config.h that directs
9676the linker to include the appropriate .lib file (so python15.lib no
9677longer needs to be explicit in your project).
9678
9679- The installer now installs more files (e.g. config.h). The idea is
9680that you shouldn't need the source distribution if you want build your
9681own extensions in C or C++.
9682
9683Tools and Demos
9684---------------
9685
9686- New script nm2def.py by Marc-Andre Lemburg, to construct
9687PC/python_nt.def automatically (some hand editing still required).
9688
9689- New tool ndiff.py: Tim Peters' text diffing tool.
9690
9691- Various and sundry improvements to the freeze script.
9692
9693- The script texi2html.py (which was part of the Doc tree but is no
9694longer used there) has been moved to the Tools/scripts subdirectory.
9695
9696- Some generalizations in the webchecker code. There's now a
9697primnitive gui for websucker.py: wsgui.py. (In Tools/webchecker/.)
9698
9699- The ftpmirror.py script now handles symbolic links properly, and
9700also files with multiple spaces in their names.
9701
9702- The 1.5.1 tabnanny.py suffers an assert error if fed a script whose
9703last line is both indented and lacks a newline. This is now fixed.
9704
9705Python/C API
9706------------
9707
9708- Added missing prototypes for PyEval_CallFunction() and
9709PyEval_CallMethod().
9710
9711- New macro PyList_SET_ITEM().
9712
9713- New macros to access object members for PyFunction, PyCFunction
9714objects.
9715
9716- New APIs PyImport_AppendInittab() an PyImport_ExtendInittab() to
9717dynamically add one or many entries to the table of built-in modules.
9718
9719- New macro Py_InitModule3(name, methods, doc) which calls
9720Py_InitModule4() with appropriate arguments. (The -4 variant requires
9721you to pass an obscure version number constant which is always the same.)
9722
9723- New APIs PySys_WriteStdout() and PySys_WriteStderr() to write to
9724sys.stdout or sys.stderr using a printf-like interface. (Used in
9725_tkinter.c, for example.)
9726
9727- New APIs for conversion between Python longs and C 'long long' if
9728your compiler supports it.
9729
9730- PySequence_In() is now called PySequence_Contains().
9731(PySequence_In() is still supported for b/w compatibility; it is
9732declared obsolete because its argument order is confusing.)
9733
9734- PyDict_GetItem() and PyDict_GetItemString() are changed so that they
9735*never* raise an exception -- (even if the hash() fails, simply clear
9736the error). This was necessary because there is lots of code out
9737there that already assumes this.
9738
9739- Changes to PySequence_Tuple() and PySequence_List() to use the
9740length of a sequence only as a hint -- if an IndexError happens
9741earlier, take that. (Formerly, this was considered an error.)
9742
9743- Reformatted abstract.c to give it a more familiar "look" and fixed
9744many error checking bugs.
9745
9746- Add NULL pointer checks to all calls of a C function through a type
9747object and extensions (e.g. nb_add).
9748
9749- The code that initializes sys.path now calls Py_GetPythonHome()
9750instead of getenv("PYTHONHOME"). This, together with the new API
9751Py_SetPythonHome(), makes it easier for embedding applications to
9752change the notion of Python's "home" directory (where the libraries
9753etc. are sought).
9754
9755- Fixed a very old bug in the parsing of "O?" format specifiers.
9756
9757
9758======================================================================
9759
9760
Guido van Rossumf2eac992000-09-04 17:24:24 +00009761========================================
9762==> Release 1.5.1 (October 31, 1998) <==
9763========================================
9764
Guido van Rossum439d1fa1998-12-21 21:41:14 +00009765From 1.5 to 1.5.1
9766=================
9767
9768General
9769-------
9770
9771- The documentation is now unbundled. It has also been extensively
9772modified (mostly to implement a new and more uniform formatting
9773style). We figure that most people will prefer to download one of the
9774preformatted documentation sets (HTML, PostScript or PDF) and that
9775only a minority have a need for the LaTeX or FrameMaker sources. Of
9776course, the unbundled documentation sources still released -- just not
9777in the same archive file, and perhaps not on the same date.
9778
9779- All bugs noted on the errors page (and many unnoted) are fixed. All
9780new bugs take their places.
9781
9782- No longer a core dump when attempting to print (or repr(), or str())
9783a list or dictionary that contains an instance of itself; instead, the
9784recursive entry is printed as [...] or {...}. See Py_ReprEnter() and
9785Py_ReprLeave() below. Comparisons of such objects still go beserk,
9786since this requires a different kind of fix; fortunately, this is a
9787less common scenario in practice.
9788
9789Syntax change
9790-------------
9791
9792- The raise statement can now be used without arguments, to re-raise
9793a previously set exception. This should be used after catching an
9794exception with an except clause only, either in the except clause or
9795later in the same function.
9796
9797Import and module handling
9798--------------------------
9799
9800- The implementation of import has changed to use a mutex (when
9801threading is supported). This means that when two threads
9802simultaneously import the same module, the import statements are
9803serialized. Recursive imports are not affected.
9804
9805- Rewrote the finalization code almost completely, to be much more
9806careful with the order in which modules are destroyed. Destructors
9807will now generally be able to reference built-in names such as None
9808without trouble.
9809
9810- Case-insensitive platforms such as Mac and Windows require the case
9811of a module's filename to match the case of the module name as
9812specified in the import statement (see below).
9813
9814- The code for figuring out the default path now distinguishes between
9815files, modules, executable files, and directories. When expecting a
9816module, we also look for the .pyc or .pyo file.
9817
9818Parser/tokenizer changes
9819------------------------
9820
9821- The tokenizer can now warn you when your source code mixes tabs and
9822spaces for indentation in a manner that depends on how much a tab is
9823worth in spaces. Use "python -t" or "python -v" to enable this
9824option. Use "python -tt" to turn the warnings into errors. (See also
9825tabnanny.py and tabpolice.py below.)
9826
9827- Return unsigned characters from tok_nextc(), so '\377' isn't
9828mistaken for an EOF character.
9829
9830- Fixed two pernicious bugs in the tokenizer that only affected AIX.
9831One was actually a general bug that was triggered by AIX's smaller I/O
9832buffer size. The other was a bug in the AIX optimizer's loop
9833unrolling code; swapping two statements made the problem go away.
9834
9835Tools, demos and miscellaneous files
9836------------------------------------
9837
9838- There's a new version of Misc/python-mode.el (the Emacs mode for
9839Python) which is much smarter about guessing the indentation style
9840used in a particular file. Lots of other cool features too!
9841
9842- There are two new tools in Tools/scripts: tabnanny.py and
9843tabpolice.py, implementing two different ways of checking whether a
9844file uses indentation in a way that is sensitive to the interpretation
9845of a tab. The preferred module is tabnanny.py (by Tim Peters).
9846
9847- Some new demo programs:
9848
9849 Demo/tkinter/guido/paint.py -- Dave Mitchell
9850 Demo/sockets/unixserver.py -- Piet van Oostrum
9851
9852
9853- Much better freeze support. The freeze script can now freeze
9854hierarchical module names (with a corresponding change to import.c),
9855and has a few extra options (e.g. to suppress freezing specific
9856modules). It also does much more on Windows NT.
9857
9858- Version 1.0 of the faq wizard is included (only very small changes
9859since version 0.9.0).
9860
9861- New feature for the ftpmirror script: when removing local files
9862(i.e., only when -r is used), do a recursive delete.
9863
9864Configuring and building Python
9865-------------------------------
9866
9867- Get rid of the check for -linet -- recent Sequent Dynix systems don't
9868need this any more and apparently it screws up their configuration.
9869
9870- Some changes because gcc on SGI doesn't support '-all'.
9871
9872- Changed the build rules to use $(LIBRARY) instead of
9873 -L.. -lpython$(VERSION)
9874since the latter trips up the SunOS 4.1.x linker (sigh).
9875
9876- Fix the bug where the '# dgux is broken' comment in the Makefile
9877tripped over Make on some platforms.
9878
9879- Changes for AIX: install the python.exp file; properly use
9880$(srcdir); the makexp_aix script now removes C++ entries of the form
9881Class::method.
9882
9883- Deleted some Makefile targets only used by the (long obsolete)
9884gMakefile hacks.
9885
9886Extension modules
9887-----------------
9888
9889- Performance and threading improvements to the socket and bsddb
9890modules, by Christopher Lindblad of Infoseek.
9891
9892- Added operator.__not__ and operator.not_.
9893
9894- In the thread module, when a thread exits due to an unhandled
9895exception, don't store the exception information in sys.last_*; it
9896prevents proper calling of destructors of local variables.
9897
9898- Fixed a number of small bugs in the cPickle module.
9899
9900- Changed find() and rfind() in the strop module so that
9901find("x","",2) returns -1, matching the implementation in string.py.
9902
9903- In the time module, be more careful with the result of ctime(), and
9904test for HAVE_MKTIME before usinmg mktime().
9905
9906- Doc strings contributed by Mitch Chapman to the termios, pwd, gdbm
9907modules.
9908
9909- Added the LOG_SYSLOG constant to the syslog module, if defined.
9910
9911Standard library modules
9912------------------------
9913
9914- All standard library modules have been converted to an indentation
9915style using either only tabs or only spaces -- never a mixture -- if
9916they weren't already consistent according to tabnanny. This means
9917that the new -t option (see above) won't complain about standard
9918library modules.
9919
9920- New standard library modules:
9921
9922 threading -- GvR and the thread-sig
9923 Java style thread objects -- USE THIS!!!
9924
9925 getpass -- Piers Lauder
9926 simple utilities to prompt for a password and to
9927 retrieve the current username
9928
9929 imaplib -- Piers Lauder
9930 interface for the IMAP4 protocol
9931
9932 poplib -- David Ascher, Piers Lauder
9933 interface for the POP3 protocol
9934
9935 smtplib -- Dragon De Monsyne
9936 interface for the SMTP protocol
9937
9938- Some obsolete modules moved to a separate directory (Lib/lib-old)
9939which is *not* in the default module search path:
9940
9941 Para
9942 addpack
9943 codehack
9944 fmt
9945 lockfile
9946 newdir
9947 ni
9948 rand
9949 tb
9950
9951- New version of the PCRE code (Perl Compatible Regular Expressions --
9952the re module and the supporting pcre extension) by Andrew Kuchling.
9953Incompatible new feature in re.sub(): the handling of escapes in the
9954replacement string has changed.
9955
9956- Interface change in the copy module: a __deepcopy__ method is now
9957called with the memo dictionary as an argument.
9958
9959- Feature change in the tokenize module: differentiate between NEWLINE
9960token (an official newline) and NL token (a newline that the grammar
9961ignores).
9962
9963- Several bugfixes to the urllib module. It is now truly thread-safe,
9964and several bugs and a portability problem have been fixed. New
9965features, all due to Sjoerd Mullender: When creating a temporary file,
9966it gives it an appropriate suffix. Support the "data:" URL scheme.
9967The open() method uses the tempcache.
9968
9969- New version of the xmllib module (this time with a test suite!) by
9970Sjoerd Mullender.
9971
9972- Added debugging code to the telnetlib module, to be able to trace
9973the actual traffic.
9974
9975- In the rfc822 module, added support for deleting a header (still no
9976support for adding headers, though). Also fixed a bug where an
9977illegal address would cause a crash in getrouteaddr(), fixed a
9978sign reversal in mktime_tz(), and use the local timezone by default
9979(the latter two due to Bill van Melle).
9980
9981- The normpath() function in the dospath and ntpath modules no longer
9982does case normalization -- for that, use the separate function
9983normcase() (which always existed); normcase() has been sped up and
9984fixed (it was the cause of a crash in Mark Hammond's installer in
9985certain locales).
9986
9987- New command supported by the ftplib module: rmd(); also fixed some
9988minor bugs.
9989
9990- The profile module now uses a different timer function by default --
9991time.clock() is generally better than os.times(). This makes it work
9992better on Windows NT, too.
9993
9994- The tempfile module now recovers when os.getcwd() raises an
9995exception.
9996
9997- Fixed some bugs in the random module; gauss() was subtly wrong, and
9998vonmisesvariate() should return a full circle. Courtesy Mike Miller,
9999Lambert Meertens (gauss()), and Magnus Kessler (vonmisesvariate()).
10000
10001- Better default seed in the whrandom module, courtesy Andrew Kuchling.
10002
10003- Fix slow close() in shelve module.
10004
10005- The Unix mailbox class in the mailbox module is now more robust when
10006a line begins with the string "From " but is definitely not the start
10007of a new message. The pattern used can be changed by overriding a
10008method or class variable.
10009
10010- Added a rmtree() function to the copy module.
10011
10012- Fixed several typos in the pickle module. Also fixed problems when
10013unpickling in restricted execution environments.
10014
10015- Added docstrings and fixed a typo in the py_compile and compileall
10016modules. At Mark Hammond's repeated request, py_compile now append a
10017newline to the source if it needs one. Both modules support an extra
10018parameter to specify the purported source filename (to be used in
10019error messages).
10020
10021- Some performance tweaks by Jeremy Hylton to the gzip module.
10022
10023- Fixed a bug in the merge order of dictionaries in the ConfigParser
10024module. Courtesy Barry Warsaw.
10025
10026- In the multifile module, support the optional second parameter to
10027seek() when possible.
10028
10029- Several fixes to the gopherlib module by Lars Marius Garshol. Also,
10030urlparse now correctly handles Gopher URLs with query strings.
10031
10032- Fixed a tiny bug in format_exception() in the traceback module.
10033Also rewrite tb_lineno() to be compatible with JPython (and not
10034disturb the current exception!); by Jim Hugunin.
10035
10036- The httplib module is more robust when servers send a short response
10037-- courtesy Tim O'Malley.
10038
10039Tkinter and friends
10040-------------------
10041
10042- Various typos and bugs fixed.
10043
10044- New module Tkdnd implements a drag-and-drop protocol (within one
10045application only).
10046
10047- The event_*() widget methods have been restructured slightly -- they
10048no longer use the default root.
10049
10050- The interfaces for the bind*() and unbind() widget methods have been
10051redesigned; the bind*() methods now return the name of the Tcl command
10052created for the callback, and this can be passed as a optional
10053argument to unbind() in order to delete the command (normally, such
10054commands are automatically unbound when the widget is destroyed, but
10055for some applications this isn't enough).
10056
10057- Variable objects now have trace methods to interface to Tcl's
10058variable tracing facilities.
10059
10060- Image objects now have an optional keyword argument, 'master', to
10061specify a widget (tree) to which they belong. The image_names() and
10062image_types() calls are now also widget methods.
10063
10064- There's a new global call, Tkinter.NoDefaultRoot(), which disables
10065all use of the default root by the Tkinter library. This is useful to
10066debug applications that are in the process of being converted from
10067relying on the default root to explicit specification of the root
10068widget.
10069
10070- The 'exit' command is deleted from the Tcl interpreter, since it
10071provided a loophole by which one could (accidentally) exit the Python
10072interpreter without invoking any cleanup code.
10073
10074- Tcl_Finalize() is now registered as a Python low-level exit handle,
10075so Tcl will be finalized when Python exits.
10076
10077The Python/C API
10078----------------
10079
10080- New function PyThreadState_GetDict() returns a per-thread dictionary
10081intended for storing thread-local global variables.
10082
10083- New functions Py_ReprEnter() and Py_ReprLeave() use the per-thread
10084dictionary to allow recursive container types to detect recursion in
10085their repr(), str() and print implementations.
10086
10087- New function PyObject_Not(x) calculates (not x) according to Python's
10088standard rules (basically, it negates the outcome PyObject_IsTrue(x).
10089
10090- New function _PyModule_Clear(), which clears a module's dictionary
10091carefully without removing the __builtins__ entry. This is implied
10092when a module object is deallocated (this used to clear the dictionary
10093completely).
10094
10095- New function PyImport_ExecCodeModuleEx(), which extends
10096PyImport_ExecCodeModule() by adding an extra parameter to pass it the
10097true file.
10098
10099- New functions Py_GetPythonHome() and Py_SetPythonHome(), intended to
10100allow embedded applications to force a different value for PYTHONHOME.
10101
10102- New global flag Py_FrozenFlag is set when this is a "frozen" Python
10103binary; it suppresses warnings about not being able to find the
10104standard library directories.
10105
10106- New global flag Py_TabcheckFlag is incremented by the -t option and
10107causes the tokenizer to issue warnings or errors about inconsistent
10108mixing of tabs and spaces for indentation.
10109
10110Miscellaneous minor changes and bug fixes
10111-----------------------------------------
10112
10113- Improved the error message when an attribute of an attribute-less
10114object is requested -- include the name of the attribute and the type
10115of the object in the message.
10116
10117- Sped up int(), long(), float() a bit.
10118
10119- Fixed a bug in list.sort() that would occasionally dump core.
10120
10121- Fixed a bug in PyNumber_Power() that caused numeric arrays to fail
10122when taken tothe real power.
10123
10124- Fixed a number of bugs in the file reading code, at least one of
10125which could cause a core dump on NT, and one of which would
10126occasionally cause file.read() to return less than the full contents
10127of the file.
10128
10129- Performance hack by Vladimir Marangozov for stack frame creation.
10130
10131- Make sure setvbuf() isn't used unless HAVE_SETVBUF is defined.
10132
10133Windows 95/NT
10134-------------
10135
10136- The .lib files are now part of the distribution; they are collected
10137in the subdirectory "libs" of the installation directory.
10138
10139- The extension modules (.pyd files) are now collected in a separate
10140subdirectory of the installation directory named "DLLs".
10141
10142- The case of a module's filename must now match the case of the
10143module name as specified in the import statement. This is an
10144experimental feature -- if it turns out to break in too many
10145situations, it will be removed (or disabled by default) in the future.
10146It can be disabled on a per-case basis by setting the environment
10147variable PYTHONCASEOK (to any value).
10148
10149
10150======================================================================
10151
10152
Guido van Rossumf2eac992000-09-04 17:24:24 +000010153=====================================
10154==> Release 1.5 (January 3, 1998) <==
10155=====================================
10156
10157
Guido van Rossum439d1fa1998-12-21 21:41:14 +000010158From 1.5b2 to 1.5
10159=================
10160
10161- Newly documentated module: BaseHTTPServer.py, thanks to Greg Stein.
10162
10163- Added doc strings to string.py, stropmodule.c, structmodule.c,
10164thanks to Charles Waldman.
10165
10166- Many nits fixed in the manuals, thanks to Fred Drake and many others
10167(especially Rob Hooft and Andrew Kuchling). The HTML version now uses
10168HTML markup instead of inline GIF images for tables; only two images
10169are left (for obsure bits of math). The index of the HTML version has
10170also been much improved. Finally, it is once again possible to
10171generate an Emacs info file from the library manual (but I don't
10172commit to supporting this in future versions).
10173
10174- New module: telnetlib.py (a simple telnet client library).
10175
10176- New tool: Tools/versioncheck/, by Jack Jansen.
10177
10178- Ported zlibmodule.c and bsddbmodule.c to NT; The project file for MS
10179DevStudio 5.0 now includes new subprojects to build the zlib and bsddb
10180extension modules.
10181
10182- Many small changes again to Tkinter.py -- mostly bugfixes and adding
10183missing routines. Thanks to Greg McFarlane for reporting a bunch of
10184problems and proofreading my fixes.
10185
10186- The re module and its documentation are up to date with the latest
10187version released to the string-sig (Dec. 22).
10188
10189- Stop test_grp.py from failing when the /etc/group file is empty
10190(yes, this happens!).
10191
10192- Fix bug in integer conversion (mystrtoul.c) that caused
101934294967296==0 to be true!
10194
10195- The VC++ 4.2 project file should be complete again.
10196
10197- In tempfile.py, use a better template on NT, and add a new optional
10198argument "suffix" with default "" to specify a specific extension for
10199the temporary filename (needed sometimes on NT but perhaps also handy
10200elsewhere).
10201
10202- Fixed some bugs in the FAQ wizard, and converted it to use re
10203instead of regex.
10204
10205- Fixed a mysteriously undetected error in dlmodule.c (it was using a
10206totally bogus routine name to raise an exception).
10207
10208- Fixed bug in import.c which wasn't using the new "dos-8x3" name yet.
10209
10210- Hopefully harmless changes to the build process to support shared
10211libraries on DG/UX. This adds a target to create
10212libpython$(VERSION).so; however this target is *only* for DG/UX.
10213
10214- Fixed a bug in the new format string error checking in getargs.c.
10215
10216- A simple fix for infinite recursion when printing __builtins__:
10217reset '_' to None before printing and set it to the printed variable
10218*after* printing (and only when printing is successful).
10219
10220- Fixed lib-tk/SimpleDialog.py to keep the dialog visible even if the
10221parent window is not (Skip Montanaro).
10222
10223- Fixed the two most annoying problems with ftp URLs in
10224urllib.urlopen(); an empty file now correctly raises an error, and it
10225is no longer required to explicitly close the returned "file" object
10226before opening another ftp URL to the same host and directory.
10227
10228
10229======================================================================
10230
10231
10232From 1.5b1 to 1.5b2
10233===================
10234
10235- Fixed a bug in cPickle.c that caused it to crash right away because
10236the version string had a different format.
10237
10238- Changes in pickle.py and cPickle.c: when unpickling an instance of a
10239class that doesn't define the __getinitargs__() method, the __init__()
10240constructor is no longer called. This makes a much larger group of
10241classes picklable by default, but may occasionally change semantics.
10242To force calling __init__() on unpickling, define a __getinitargs__()
10243method. Other changes too, in particular cPickle now handles classes
10244defined in packages correctly. The same change applies to copying
10245instances with copy.py. The cPickle.c changes and some pickle.py
10246changes are courtesy Jim Fulton.
10247
10248- Locale support in he "re" (Perl regular expressions) module. Use
10249the flag re.L (or re.LOCALE) to enable locale-specific matching
10250rules for \w and \b. The in-line syntax for this flag is (?L).
10251
10252- The built-in function isinstance(x, y) now also succeeds when y is
10253a type object and type(x) is y.
10254
10255- repr() and str() of class and instance objects now reflect the
10256package/module in which the class is defined.
10257
10258- Module "ni" has been removed. (If you really need it, it's been
10259renamed to "ni1". Let me know if this causes any problems for you.
10260Package authors are encouraged to write __init__.py files that
10261support both ni and 1.5 package support, so the same version can be
10262used with Python 1.4 as well as 1.5.)
10263
10264- The thread module is now automatically included when threads are
10265configured. (You must remove it from your existing Setup file,
10266since it is now in its own Setup.thread file.)
10267
10268- New command line option "-x" to skip the first line of the script;
10269handy to make executable scripts on non-Unix platforms.
10270
10271- In importdl.c, add the RTLD_GLOBAL to the dlopen() flags. I
10272haven't checked how this affects things, but it should make symbols
10273in one shared library available to the next one.
10274
10275- The Windows installer now installs in the "Program Files" folder on
10276the proper volume by default.
10277
10278- The Windows configuration adds a new main program, "pythonw", and
10279registers a new extension, ".pyw" that invokes this. This is a
10280pstandard Python interpreter that does not pop up a console window;
10281handy for pure Tkinter applications. All output to the original
10282stdout and stderr is lost; reading from the original stdin yields
10283EOF. Also, both python.exe and pythonw.exe now have a pretty icon
10284(a green snake in a box, courtesy Mark Hammond).
10285
10286- Lots of improvements to emacs-mode.el again. See Barry's web page:
10287http://www.python.org/ftp/emacs/pmdetails.html.
10288
10289- Lots of improvements and additions to the library reference manual;
10290many by Fred Drake.
10291
10292- Doc strings for the following modules: rfc822.py, posixpath.py,
10293ntpath.py, httplib.py. Thanks to Mitch Chapman and Charles Waldman.
10294
10295- Some more regression testing.
10296
10297- An optional 4th (maxsplit) argument to strop.replace().
10298
10299- Fixed handling of maxsplit in string.splitfields().
10300
10301- Tweaked os.environ so it can be pickled and copied.
10302
10303- The portability problems caused by indented preprocessor commands
10304and C++ style comments should be gone now.
10305
10306- In random.py, added Pareto and Weibull distributions.
10307
10308- The crypt module is now disabled in Modules/Setup.in by default; it
10309is rarely needed and causes errors on some systems where users often
10310don't know how to deal with those.
10311
10312- Some improvements to the _tkinter build line suggested by Case Roole.
10313
10314- A full suite of platform specific files for NetBSD 1.x, submitted by
10315Anders Andersen.
10316
10317- New Solaris specific header STROPTS.py.
10318
10319- Moved a confusing occurrence of *shared* from the comments in
10320Modules/Setup.in (people would enable this one instead of the real
10321one, and get disappointing results).
10322
10323- Changed the default mode for directories to be group-writable when
10324the installation process creates them.
10325
10326- Check for pthread support in "-l_r" for FreeBSD/NetBSD, and support
10327shared libraries for both.
10328
10329- Support FreeBSD and NetBSD in posixfile.py.
10330
10331- Support for the "event" command, new in Tk 4.2. By Case Roole.
10332
10333- Add Tix_SafeInit() support to tkappinit.c.
10334
10335- Various bugs fixed in "re.py" and "pcre.c".
10336
10337- Fixed a bug (broken use of the syntax table) in the old "regexpr.c".
10338
10339- In frozenmain.c, stdin is made unbuffered too when PYTHONUNBUFFERED
10340is set.
10341
10342- Provide default blocksize for retrbinary in ftplib.py (Skip
10343Montanaro).
10344
10345- In NT, pick the username up from different places in user.py (Jeff
10346Bauer).
10347
10348- Patch to urlparse.urljoin() for ".." and "..#1", Marc Lemburg.
10349
10350- Many small improvements to Jeff Rush' OS/2 support.
10351
10352- ospath.py is gone; it's been obsolete for so many years now...
10353
10354- The reference manual is now set up to prepare better HTML (still
10355using webmaker, alas).
10356
10357- Add special handling to /Tools/freeze for Python modules that are
10358imported implicitly by the Python runtime: 'site' and 'exceptions'.
10359
10360- Tools/faqwiz 0.8.3 -- add an option to suppress URL processing
10361inside <PRE>, by "Scott".
10362
10363- Added ConfigParser.py, a generic parser for sectioned configuration
10364files.
10365
10366- In _localemodule.c, LC_MESSAGES is not always defined; put it
10367between #ifdefs.
10368
10369- Typo in resource.c: RUSAGE_CHILDERN -> RUSAGE_CHILDREN.
10370
10371- Demo/scripts/newslist.py: Fix the way the version number is gotten
10372out of the RCS revision.
10373
10374- PyArg_Parse[Tuple] now explicitly check for bad characters at the
10375end of the format string.
10376
10377- Revamped PC/example_nt to support VC++ 5.x.
10378
10379- <listobject>.sort() now uses a modified quicksort by Raymund Galvin,
10380after studying the GNU libg++ quicksort. This should be much faster
10381if there are lots of duplicates, and otherwise at least as good.
10382
10383- Added "uue" as an alias for "uuencode" to mimetools.py. (Hm, the
10384uudecode bug where it complaints about trailing garbage is still there
10385:-( ).
10386
10387- pickle.py requires integers in text mode to be in decimal notation
10388(it used to accept octal and hex, even though it would only generate
10389decimal numbers).
10390
10391- In string.atof(), don't fail when the "re" module is unavailable.
10392Plug the ensueing security leak by supplying an empty __builtins__
10393directory to eval().
10394
10395- A bunch of small fixes and improvements to Tkinter.py.
10396
10397- Fixed a buffer overrun in PC/getpathp.c.
10398
10399
10400======================================================================
10401
10402
10403From 1.5a4 to 1.5b1
10404===================
10405
10406- The Windows NT/95 installer now includes full HTML of all manuals.
10407It also has a checkbox that lets you decide whether to install the
10408interpreter and library. The WISE installer script for the installer
10409is included in the source tree as PC/python15.wse, and so are the
10410icons used for Python files. The config.c file for the Windows build
10411is now complete with the pcre module.
10412
10413- sys.ps1 and sys.ps2 can now arbitrary objects; their str() is
10414evaluated for the prompt.
10415
10416- The reference manual is brought up to date (more or less -- it still
10417needs work, e.g. in the area of package import).
10418
10419- The icons used by latex2html are now included in the Doc
10420subdirectory (mostly so that tarring up the HTML files can be fully
10421automated). A simple index.html is also added to Doc (it only works
10422after you have successfully run latex2html).
10423
10424- For all you would-be proselytizers out there: a new version of
10425Misc/BLURB describes Python more concisely, and Misc/comparisons
10426compares Python to several other languages. Misc/BLURB.WINDOWS
10427contains a blurb specifically aimed at Windows programmers (by Mark
10428Hammond).
10429
10430- A new version of the Python mode for Emacs is included as
10431Misc/python-mode.el. There are too many new features to list here.
10432See http://www.python.org/ftp/emacs/pmdetails.html for more info.
10433
10434- New module fileinput makes iterating over the lines of a list of
10435files easier. (This still needs some more thinking to make it more
10436extensible.)
10437
10438- There's full OS/2 support, courtesy Jeff Rush. To build the OS/2
10439version, see PC/readme.txt and PC/os2vacpp. This is for IBM's Visual
10440Age C++ compiler. I expect that Jeff will also provide a binary
10441release for this platform.
10442
10443- On Linux, the configure script now uses '-Xlinker -export-dynamic'
10444instead of '-rdynamic' to link the main program so that it exports its
10445symbols to shared libraries it loads dynamically. I hope this doesn't
10446break on older Linux versions; it is needed for mklinux and appears to
10447work on Linux 2.0.30.
10448
10449- Some Tkinter resstructuring: the geometry methods that apply to a
10450master are now properly usable on toplevel master widgets. There's a
10451new (internal) widget class, BaseWidget. New, longer "official" names
10452for the geometry manager methods have been added,
10453e.g. "grid_columnconfigure()" instead of "columnconfigure()". The old
10454shorter names still work, and where there's ambiguity, pack wins over
10455place wins over grid. Also, the bind_class method now returns its
10456value.
10457
10458- New, RFC-822 conformant parsing of email addresses and address lists
10459in the rfc822 module, courtesy Ben Escoto.
10460
10461- New, revamped tkappinit.c with support for popular packages (PIL,
10462TIX, BLT, TOGL). For the last three, you need to execute the Tcl
10463command "load {} Tix" (or Blt, or Togl) to gain access to them.
10464The Modules/Setup line for the _tkinter module has been rewritten
10465using the cool line-breaking feature of most Bourne shells.
10466
10467- New socket method connect_ex() returns the error code from connect()
10468instead of raising an exception on errors; this makes the logic
10469required for asynchronous connects simpler and more efficient.
10470
10471- New "locale" module with (still experimental) interface to the
10472standard C library locale interface, courtesy Martin von Loewis. This
10473does not repeat my mistake in 1.5a4 of always calling
10474setlocale(LC_ALL, ""). In fact, we've pretty much decided that
10475Python's standard numerical formatting operations should always use
10476the conventions for the C locale; the locale module contains utility
10477functions to format numbers according to the user specified locale.
10478(All this is accomplished by an explicit call to setlocale(LC_NUMERIC,
10479"C") after locale-changing calls.) See the library manual. (Alas, the
10480promised changes to the "re" module for locale support have not been
10481materialized yet. If you care, volunteer!)
10482
10483- Memory leak plugged in Py_BuildValue when building a dictionary.
10484
10485- Shared modules can now live inside packages (hierarchical module
10486namespaces). No changes to the shared module itself are needed.
10487
10488- Improved policy for __builtins__: this is a module in __main__ and a
10489dictionary everywhere else.
10490
10491- Python no longer catches SIGHUP and SIGTERM by default. This was
10492impossible to get right in the light of thread contexts. If you want
10493your program to clean up when a signal happens, use the signal module
10494to set up your own signal handler.
10495
10496- New Python/C API PyNumber_CoerceEx() does not return an exception
10497when no coercion is possible. This is used to fix a problem where
10498comparing incompatible numbers for equality would raise an exception
10499rather than return false as in Python 1.4 -- it once again will return
10500false.
10501
10502- The errno module is changed again -- the table of error messages
10503(errorstr) is removed. Instead, you can use os.strerror(). This
10504removes redundance and a potential locale dependency.
10505
10506- New module xmllib, to parse XML files. By Sjoerd Mullender.
10507
10508- New C API PyOS_AfterFork() is called after fork() in posixmodule.c.
10509It resets the signal module's notion of what the current process ID
10510and thread are, so that signal handlers will work after (and across)
10511calls to os.fork().
10512
10513- Fixed most occurrences of fatal errors due to missing thread state.
10514
10515- For vgrind (a flexible source pretty printer) fans, there's a simple
10516Python definition in Misc/vgrindefs, courtesy Neale Pickett.
10517
10518- Fixed memory leak in exec statement.
10519
10520- The test.pystone module has a new function, pystones(loops=LOOPS),
10521which returns a (benchtime, stones) tuple. The main() function now
10522calls this and prints the report.
10523
10524- Package directories now *require* the presence of an __init__.py (or
10525__init__.pyc) file before they are considered as packages. This is
10526done to prevent accidental subdirectories with common names from
10527overriding modules with the same name.
10528
10529- Fixed some strange exceptions in __del__ methods in library modules
10530(e.g. urllib). This happens because the builtin names are already
10531deleted by the time __del__ is called. The solution (a hack, but it
10532works) is to set some instance variables to 0 instead of None.
10533
10534- The table of built-in module initializers is replaced by a pointer
10535variable. This makes it possible to switch to a different table at
10536run time, e.g. when a collection of modules is loaded from a shared
10537library. (No example code of how to do this is given, but it is
10538possible.) The table is still there of course, its name prefixed with
10539an underscore and used to initialize the pointer.
10540
10541- The warning about a thread still having a frame now only happens in
10542verbose mode.
10543
10544- Change the signal finialization so that it also resets the signal
10545handlers. After this has been called, our signal handlers are no
10546longer active!
10547
10548- New version of tokenize.py (by Ka-Ping Yee) recognizes raw string
10549literals. There's now also a test fort this module.
10550
10551- The copy module now also uses __dict__.update(state) instead of
10552going through individual attribute assignments, for class instances
10553without a __setstate__ method.
10554
10555- New module reconvert translates old-style (regex module) regular
10556expressions to new-style (re module, Perl-style) regular expressions.
10557
10558- Most modules that used to use the regex module now use the re
10559module. The grep module has a new pgrep() function which uses
10560Perl-style regular expressions.
10561
10562- The (very old, backwards compatibility) regexp.py module has been
10563deleted.
10564
10565- Restricted execution (rexec): added the pcre module (support for the
10566re module) to the list of trusted extension modules.
10567
10568- New version of Jim Fulton's CObject object type, adds
10569PyCObject_FromVoidPtrAndDesc() and PyCObject_GetDesc() APIs.
10570
10571- Some patches to Lee Busby's fpectl mods that accidentally didn't
10572make it into 1.5a4.
10573
10574- In the string module, add an optional 4th argument to count(),
10575matching find() etc.
10576
10577- Patch for the nntplib module by Charles Waldman to add optional user
10578and password arguments to NNTP.__init__(), for nntp servers that need
10579them.
10580
10581- The str() function for class objects now returns
10582"modulename.classname" instead of returning the same as repr().
10583
10584- The parsing of \xXX escapes no longer relies on sscanf().
10585
10586- The "sharedmodules" subdirectory of the installation is renamed to
10587"lib-dynload". (You may have to edit your Modules/Setup file to fix
10588this in an existing installation!)
10589
10590- Fixed Don Beaudry's mess-up with the OPT test in the configure
10591script. Certain SGI platforms will still issue a warning for each
10592compile; there's not much I can do about this since the compiler's
10593exit status doesn't indicate that I was using an obsolete option.
10594
10595- Fixed Barry's mess-up with {}.get(), and added test cases for it.
10596
10597- Shared libraries didn't quite work under AIX because of the change
10598in status of the GNU readline interface. Fix due to by Vladimir
10599Marangozov.
10600
10601
10602======================================================================
10603
10604
10605From 1.5a3 to 1.5a4
10606===================
10607
10608- faqwiz.py: version 0.8; Recognize https:// as URL; <html>...</html>
10609feature; better install instructions; removed faqmain.py (which was an
10610older version).
10611
10612- nntplib.py: Fixed some bugs reported by Lars Wirzenius (to Debian)
10613about the treatment of lines starting with '.'. Added a minimal test
10614function.
10615
10616- struct module: ignore most whitespace in format strings.
10617
10618- urllib.py: close the socket and temp file in URLopener.retrieve() so
10619that multiple retrievals using the same connection work.
10620
10621- All standard exceptions are now classes by default; use -X to make
10622them strings (for backward compatibility only).
10623
10624- There's a new standard exception hierarchy, defined in the standard
10625library module exceptions.py (which you never need to import
10626explicitly). See
10627http://grail.cnri.reston.va.us/python/essays/stdexceptions.html for
10628more info.
10629
10630- Three new C API functions:
10631
10632 - int PyErr_GivenExceptionMatches(obj1, obj2)
10633
10634 Returns 1 if obj1 and obj2 are the same object, or if obj1 is an
10635 instance of type obj2, or of a class derived from obj2
10636
10637 - int PyErr_ExceptionMatches(obj)
10638
10639 Higher level wrapper around PyErr_GivenExceptionMatches() which uses
10640 PyErr_Occurred() as obj1. This will be the more commonly called
10641 function.
10642
10643 - void PyErr_NormalizeException(typeptr, valptr, tbptr)
10644
10645 Normalizes exceptions, and places the normalized values in the
10646 arguments. If type is not a class, this does nothing. If type is a
10647 class, then it makes sure that value is an instance of the class by:
10648
10649 1. if instance is of the type, or a class derived from type, it does
10650 nothing.
10651
10652 2. otherwise it instantiates the class, using the value as an
10653 argument. If value is None, it uses an empty arg tuple, and if
10654 the value is a tuple, it uses just that.
10655
10656- Another new C API function: PyErr_NewException() creates a new
10657exception class derived from Exception; when -X is given, it creates a
10658new string exception.
10659
10660- core interpreter: remove the distinction between tuple and list
10661unpacking; allow an arbitrary sequence on the right hand side of any
10662unpack instruction. (UNPACK_LIST and UNPACK_TUPLE now do the same
10663thing, which should really be called UNPACK_SEQUENCE.)
10664
10665- classes: Allow assignments to an instance's __dict__ or __class__,
10666so you can change ivars (including shared ivars -- shock horror) and
10667change classes dynamically. Also make the check on read-only
10668attributes of classes less draconic -- only the specials names
10669__dict__, __bases__, __name__ and __{get,set,del}attr__ can't be
10670assigned.
10671
10672- Two new built-in functions: issubclass() and isinstance(). Both
10673take classes as their second arguments. The former takes a class as
10674the first argument and returns true iff first is second, or is a
10675subclass of second. The latter takes any object as the first argument
10676and returns true iff first is an instance of the second, or any
10677subclass of second.
10678
10679- configure: Added configuration tests for presence of alarm(),
10680pause(), and getpwent().
10681
10682- Doc/Makefile: changed latex2html targets.
10683
10684- classes: Reverse the search order for the Don Beaudry hook so that
10685the first class with an applicable hook wins. Makes more sense.
10686
10687- Changed the checks made in Py_Initialize() and Py_Finalize(). It is
10688now legal to call these more than once. The first call to
10689Py_Initialize() initializes, the first call to Py_Finalize()
10690finalizes. There's also a new API, Py_IsInitalized() which checks
10691whether we are already initialized (in case you want to leave things
10692as they were).
10693
10694- Completely disable the declarations for malloc(), realloc() and
10695free(). Any 90's C compiler has these in header files, and the tests
10696to decide whether to suppress the declarations kept failing on some
10697platforms.
10698
10699- *Before* (instead of after) signalmodule.o is added, remove both
10700intrcheck.o and sigcheck.o. This should get rid of warnings in ar or
10701ld on various systems.
10702
10703- Added reop to PC/config.c
10704
10705- configure: Decided to use -Aa -D_HPUX_SOURCE on HP-UX platforms.
10706Removed outdated HP-UX comments from README. Added Cray T3E comments.
10707
10708- Various renames of statically defined functions that had name
10709conflicts on some systems, e.g. strndup (GNU libc), join (Cray),
10710roundup (sys/types.h).
10711
10712- urllib.py: Interpret three slashes in file: URL as local file (for
10713Netscape on Windows/Mac).
10714
10715- copy.py: Make sure the objects returned by __getinitargs__() are
10716kept alive (in the memo) to avoid a certain kind of nasty crash. (Not
10717easily reproducable because it requires a later call to
10718__getinitargs__() to return a tuple that happens to be allocated at
10719the same address.)
10720
10721- Added definition of AR to toplevel Makefile. Renamed @buildno temp
10722file to buildno1.
10723
10724- Moved Include/assert.h to Parser/assert.h, which seems to be the
10725only place where it's needed.
10726
10727- Tweaked the dictionary lookup code again for some more speed
10728(Vladimir Marangozov).
10729
10730- NT build: Changed the way python15.lib is included in the other
10731projects. Per Mark Hammond's suggestion, add it to the extra libs in
10732Settings instead of to the project's source files.
10733
10734- regrtest.py: Change default verbosity so that there are only three
10735levels left: -q, default and -v. In default mode, the name of each
10736test is now printed. -v is the same as the old -vv. -q is more quiet
10737than the old default mode.
10738
10739- Removed the old FAQ from the distribution. You now have to get it
10740from the web!
10741
10742- Removed the PC/make_nt.in file from the distribution; it is no
10743longer needed.
10744
10745- Changed the build sequence so that shared modules are built last.
10746This fixes things for AIX and doesn't hurt elsewhere.
10747
10748- Improved test for GNU MP v1 in mpzmodule.c
10749
10750- fileobject.c: ftell() on Linux discards all buffered data; changed
10751read() code to use lseek() instead to get the same effect
10752
10753- configure.in, configure, importdl.c: NeXT sharedlib fixes
10754
10755- tupleobject.c: PyTuple_SetItem asserts refcnt==1
10756
10757- resource.c: Different strategy regarding whether to declare
10758getrusage() and getpagesize() -- #ifdef doesn't work, Linux has
10759conflicting decls in its headers. Choice: only declare the return
10760type, not the argument prototype, and not on Linux.
10761
10762- importdl.c, configure*: set sharedlib extensions properly for NeXT
10763
10764- configure*, Makefile.in, Modules/Makefile.pre.in: AIX shared libraries
10765fixed; moved addition of PURIFY to LINKCC to configure
10766
10767- reopmodule.c, regexmodule.c, regexpr.c, zlibmodule.c: needed casts
10768added to shup up various compilers.
10769
10770- _tkinter.c: removed buggy mac #ifndef
10771
10772- Doc: various Mac documentation changes, added docs for 'ic' module
10773
10774- PC/make_nt.in: deleted
10775
10776- test_time.py, test_strftime.py: tweaks to catch %Z (which may return
10777"")
10778
10779- test_rotor.py: print b -> print `b`
10780
10781- Tkinter.py: (tagOrId) -> (tagOrId,)
10782
10783- Tkinter.py: the Tk class now also has a configure() method and
10784friends (they have been moved to the Misc class to accomplish this).
10785
10786- dict.get(key[, default]) returns dict[key] if it exists, or default
10787if it doesn't. The default defaults to None. This is quicker for
10788some applications than using either has_key() or try:...except
10789KeyError:....
10790
10791- Tools/webchecker/: some small changes to webchecker.py; added
10792websucker.py (a simple web site mirroring script).
10793
10794- Dictionary objects now have a get() method (also in UserDict.py).
10795dict.get(key, default) returns dict[key] if it exists and default
10796otherwise; default defaults to None.
10797
10798- Tools/scripts/logmerge.py: print the author, too.
10799
10800- Changes to import: support for "import a.b.c" is now built in. See
10801http://grail.cnri.reston.va.us/python/essays/packages.html
10802for more info. Most important deviations from "ni.py": __init__.py is
10803executed in the package's namespace instead of as a submodule; and
10804there's no support for "__" or "__domain__". Note that "ni.py" is not
10805changed to match this -- it is simply declared obsolete (while at the
10806same time, it is documented...:-( ).
10807Unfortunately, "ihooks.py" has not been upgraded (but see "knee.py"
10808for an example implementation of hierarchical module import written in
10809Python).
10810
10811- More changes to import: the site.py module is now imported by
10812default when Python is initialized; use -S to disable it. The site.py
10813module extends the path with several more directories: site-packages
10814inside the lib/python1.5/ directory, site-python in the lib/
10815directory, and pathnames mentioned in *.pth files found in either of
10816those directories. See
10817http://grail.cnri.reston.va.us/python/essays/packages.html
10818for more info.
10819
10820- Changes to standard library subdirectory names: those subdirectories
10821that are not packages have been renamed with a hypen in their name,
10822e.g. lib-tk, lib-stdwin, plat-win, plat-linux2, plat-sunos5, dos-8x3.
10823The test suite is now a package -- to run a test, you must now use
10824"import test.test_foo".
10825
10826- A completely new re.py module is provided (thanks to Andrew
10827Kuchling, Tim Peters and Jeffrey Ollie) which uses Philip Hazel's
10828"pcre" re compiler and engine. For a while, the "old" re.py (which
10829was new in 1.5a3!) will be kept around as re1.py. The "old" regex
10830module and underlying parser and engine are still present -- while
10831regex is now officially obsolete, it will probably take several major
10832release cycles before it can be removed.
10833
10834- The posix module now has a strerror() function which translates an
10835error code to a string.
10836
10837- The emacs.py module (which was long obsolete) has been removed.
10838
10839- The universal makefile Misc/Makefile.pre.in now features an
10840"install" target. By default, installed shared libraries go into
10841$exec_prefix/lib/python$VERSION/site-packages/.
10842
10843- The install-sh script is installed with the other configuration
10844specific files (in the config/ subdirectory).
10845
10846- It turns out whatsound.py and sndhdr.py were identical modules.
10847Since there's also an imghdr.py file, I propose to make sndhdr.py the
10848official one. For compatibility, whatsound.py imports * from
10849sndhdr.py.
10850
10851- Class objects have a new attribute, __module__, giving the name of
10852the module in which they were declared. This is useful for pickle and
10853for printing the full name of a class exception.
10854
10855- Many extension modules no longer issue a fatal error when their
10856initialization fails; the importing code now checks whether an error
10857occurred during module initialization, and correctly propagates the
10858exception to the import statement.
10859
10860- Most extension modules now raise class-based exceptions (except when
10861-X is used).
10862
10863- Subtle changes to PyEval_{Save,Restore}Thread(): always swap the
10864thread state -- just don't manipulate the lock if it isn't there.
10865
10866- Fixed a bug in Python/getopt.c that made it do the wrong thing when
10867an option was a single '-'. Thanks to Andrew Kuchling.
10868
10869- New module mimetypes.py will guess a MIME type from a filename's
10870extension.
10871
10872- Windows: the DLL version is now settable via a resource rather than
10873being hardcoded. This can be used for "branding" a binary Python
10874distribution.
10875
10876- urllib.py is now threadsafe -- it now uses re instead of regex, and
10877sys.exc_info() instead of sys.exc_{type,value}.
10878
10879- Many other library modules that used to use
10880sys.exc_{type,value,traceback} are now more thread-safe by virtue of
10881using sys.exc_info().
10882
10883- The functions in popen2 have an optional buffer size parameter.
10884Also, the command argument can now be either a string (passed to the
10885shell) or a list of arguments (passed directly to execv).
10886
10887- Alas, the thread support for _tkinter released with 1.5a3 didn't
10888work. It's been rewritten. The bad news is that it now requires a
10889modified version of a file in the standard Tcl distribution, which you
10890must compile with a -I option pointing to the standard Tcl source
10891tree. For this reason, the thread support is disabled by default.
10892
10893- The errno extension module adds two tables: errorcode maps errno
10894numbers to errno names (e.g. EINTR), and errorstr maps them to
10895message strings. (The latter is redundant because the new call
10896posix.strerror() now does the same, but alla...) (Marc-Andre Lemburg)
10897
10898- The readline extension module now provides some interfaces to
10899internal readline routines that make it possible to write a completer
10900in Python. An example completer, rlcompleter.py, is provided.
10901
10902 When completing a simple identifier, it completes keywords,
10903 built-ins and globals in __main__; when completing
10904 NAME.NAME..., it evaluates (!) the expression up to the last
10905 dot and completes its attributes.
10906
10907 It's very cool to do "import string" type "string.", hit the
10908 completion key (twice), and see the list of names defined by
10909 the string module!
10910
10911 Tip: to use the tab key as the completion key, call
10912
10913 readline.parse_and_bind("tab: complete")
10914
10915- The traceback.py module has a new function tb_lineno() by Marc-Andre
10916Lemburg which extracts the line number from the linenumber table in
10917the code object. Apparently the traceback object doesn't contains the
10918right linenumber when -O is used. Rather than guessing whether -O is
10919on or off, the module itself uses tb_lineno() unconditionally.
10920
10921- Fixed Demo/tkinter/matt/canvas-moving-or-creating.py: change bind()
10922to tag_bind() so it works again.
10923
10924- The pystone script is now a standard library module. Example use:
10925"import test.pystone; test.pystone.main()".
10926
10927- The import of the readline module in interactive mode is now also
10928attempted when -i is specified. (Yes, I know, giving in to Marc-Andre
10929Lemburg, who asked for this. :-)
10930
10931- rfc822.py: Entirely rewritten parseaddr() function by Sjoerd
10932Mullender, to be closer to the standard. This fixes the getaddr()
10933method. Unfortunately, getaddrlist() is as broken as ever, since it
10934splits on commas without regard for RFC 822 quoting conventions.
10935
10936- pprint.py: correctly emit trailing "," in singleton tuples.
10937
10938- _tkinter.c: export names for its type objects, TkappType and
10939TkttType.
10940
10941- pickle.py: use __module__ when defined; fix a particularly hard to
10942reproduce bug that confuses the memo when temporary objects are
10943returned by custom pickling interfaces; and a semantic change: when
10944unpickling the instance variables of an instance, use
10945inst.__dict__.update(value) instead of a for loop with setattr() over
10946the value.keys(). This is more consistent (the pickling doesn't use
10947getattr() either but pickles inst.__dict__) and avoids problems with
10948instances that have a __setattr__ hook. But it *is* a semantic change
10949(because the setattr hook is no longer used). So beware!
10950
10951- config.h is now installed (at last) in
10952$exec_prefix/include/python1.5/. For most sites, this means that it
10953is actually in $prefix/include/python1.5/, with all the other Python
10954include files, since $prefix and $exec_prefix are the same by
10955default.
10956
10957- The imp module now supports parts of the functionality to implement
10958import of hierarchical module names. It now supports find_module()
10959and load_module() for all types of modules. Docstrings have been
10960added for those functions in the built-in imp module that are still
10961relevant (some old interfaces are obsolete). For a sample
10962implementation of hierarchical module import in Python, see the new
10963library module knee.py.
10964
10965- The % operator on string objects now allows arbitrary nested parens
10966in a %(...)X style format. (Brad Howes)
10967
10968- Reverse the order in which Setup and Setup.local are passed to the
10969makesetup script. This allows variable definitions in Setup.local to
10970override definitions in Setup. (But you'll still have to edit Setup
10971if you want to disable modules that are enabled by default, or if such
10972modules need non-standard options.)
10973
10974- Added PyImport_ImportModuleEx(name, globals, locals, fromlist); this
10975is like PyImport_ImporModule(name) but receives the globals and locals
10976dict and the fromlist arguments as well. (The name is a char*; the
10977others are PyObject*s).
10978
10979- The 'p' format in the struct extension module alloded to above is
10980new in 1.5a4.
10981
10982- The types.py module now uses try-except in a few places to make it
10983more likely that it can be imported in restricted mode. Some type
10984names are undefined in that case, e.g. CodeType (inaccessible),
10985FileType (not always accessible), and TracebackType and FrameType
10986(inaccessible).
10987
10988- In urllib.py: added separate administration of temporary files
10989created y URLopener.retrieve() so cleanup() can properly remove them.
10990The old code removed everything in tempcache which was a bad idea if
10991the user had passed a non-temp file into it. Also, in basejoin(),
10992interpret relative paths starting in "../". This is necessary if the
10993server uses symbolic links.
10994
10995- The Windows build procedure and project files are now based on
10996Microsoft Visual C++ 5.x. The build now takes place in the PCbuild
10997directory. It is much more robust, and properly builds separate Debug
10998and Release versions. (The installer will be added shortly.)
10999
11000- Added casts and changed some return types in regexpr.c to avoid
11001compiler warnings or errors on some platforms.
11002
11003- The AIX build tools for shared libraries now supports VPATH. (Donn
11004Cave)
11005
11006- By default, disable the "portable" multimedia modules audioop,
11007imageop, and rgbimg, since they don't work on 64-bit platforms.
11008
11009- Fixed a nasty bug in cStringIO.c when code was actually using the
11010close() method (the destructors would try to free certain fields a
11011second time).
11012
11013- For those who think they need it, there's a "user.py" module. This
11014is *not* imported by default, but can be imported to run user-specific
11015setup commands, ~/.pythonrc.py.
11016
11017- Various speedups suggested by Fredrik Lundh, Marc-Andre Lemburg,
11018Vladimir Marangozov, and others.
11019
11020- Added os.altsep; this is '/' on DOS/Windows, and None on systems
11021with a sane filename syntax.
11022
11023- os.py: Write out the dynamic OS choice, to avoid exec statements.
11024Adding support for a new OS is now a bit more work, but I bet that
11025'dos' or 'nt' will cover most situations...
11026
11027- The obsolete exception AccessError is now really gone.
11028
11029- Tools/faqwiz/: New installation instructions show how to maintain
11030multiple FAQs. Removed bootstrap script from end of faqwiz.py module.
11031Added instructions to bootstrap script, too. Version bumped to 0.8.1.
11032Added <html>...</html> feature suggested by Skip Montanaro. Added
11033leading text for Roulette, default to 'Hit Reload ...'. Fix typo in
11034default SRCDIR.
11035
11036- Documentation for the relatively new modules "keyword" and "symbol"
11037has been added (to the end of the section on the parser extension
11038module).
11039
11040- In module bisect.py, but functions have two optional argument 'lo'
11041and 'hi' which allow you to specify a subsequence of the array to
11042operate on.
11043
11044- In ftplib.py, changed most methods to return their status (even when
11045it is always "200 OK") rather than swallowing it.
11046
11047- main() now calls setlocale(LC_ALL, ""), if setlocale() and
11048<locale.h> are defined.
11049
11050- Changes to configure.in, the configure script, and both
11051Makefile.pre.in files, to support SGI's SGI_ABI platform selection
11052environment variable.
11053
11054
11055======================================================================
11056
11057
11058From 1.4 to 1.5a3
11059=================
11060
11061Security
11062--------
11063
11064- If you are using the setuid script C wrapper (Misc/setuid-prog.c),
11065please use the new version. The old version has a huge security leak.
11066
11067Miscellaneous
11068-------------
11069
11070- Because of various (small) incompatible changes in the Python
11071bytecode interpreter, the magic number for .pyc files has changed
11072again.
11073
11074- The default module search path is now much saner. Both on Unix and
11075Windows, it is essentially derived from the path to the executable
11076(which can be overridden by setting the environment variable
11077$PYTHONHOME). The value of $PYTHONPATH on Windows is now inserted in
11078front of the default path, like in Unix (instead of overriding the
11079default path). On Windows, the directory containing the executable is
11080added to the end of the path.
11081
11082- A new version of python-mode.el for Emacs has been included. Also,
11083a new file ccpy-style.el has been added to configure Emacs cc-mode for
11084the preferred style in Python C sources.
11085
11086- On Unix, when using sys.argv[0] to insert the script directory in
11087front of sys.path, expand a symbolic link. You can now install a
11088program in a private directory and have a symbolic link to it in a
11089public bin directory, and it will put the private directory in the
11090module search path. Note that the symlink is expanded in sys.path[0]
11091but not in sys.argv[0], so you can still tell the name by which you
11092were invoked.
11093
11094- It is now recommended to use ``#!/usr/bin/env python'' instead of
11095``#!/usr/local/bin/python'' at the start of executable scripts, except
11096for CGI scripts. It has been determined that the use of /usr/bin/env
11097is more portable than that of /usr/local/bin/python -- scripts almost
11098never have to be edited when the Python interpreter lives in a
11099non-standard place. Note that this doesn't work for CGI scripts since
11100the python executable often doesn't live in the HTTP server's default
11101search path.
11102
11103- The silly -s command line option and the corresponding
11104PYTHONSUPPRESS environment variable (and the Py_SuppressPrint global
11105flag in the Python/C API) are gone.
11106
11107- Most problems on 64-bit platforms should now be fixed. Andrew
11108Kuchling helped. Some uncommon extension modules are still not
11109clean (image and audio ops?).
11110
11111- Fixed a bug where multiple anonymous tuple arguments would be mixed up
11112when using the debugger or profiler (reported by Just van Rossum).
11113The simplest example is ``def f((a,b),(c,d)): print a,b,c,d''; this
11114would print the wrong value when run under the debugger or profiler.
11115
11116- The hacks that the dictionary implementation used to speed up
11117repeated lookups of the same C string were removed; these were a
11118source of subtle problems and don't seem to serve much of a purpose
11119any longer.
11120
11121- All traces of support for the long dead access statement have been
11122removed from the sources.
11123
11124- Plugged the two-byte memory leak in the tokenizer when reading an
11125interactive EOF.
11126
11127- There's a -O option to the interpreter that removes SET_LINENO
11128instructions and assert statements (see below); it uses and produces
11129.pyo files instead of .pyc files. The speedup is only a few percent
11130in most cases. The line numbers are still available in the .pyo file,
11131as a separate table (which is also available in .pyc files). However,
11132the removal of the SET_LINENO instructions means that the debugger
11133(pdb) can't set breakpoints on lines in -O mode. The traceback module
11134contains a function to extract a line number from the code object
11135referenced in a traceback object. In the future it should be possible
11136to write external bytecode optimizers that create better optimized
11137.pyo files, and there should be more control over optimization;
11138consider the -O option a "teaser". Without -O, the assert statement
11139actually generates code that first checks __debug__; if this variable
11140is false, the assertion is not checked. __debug__ is a built-in
11141variable whose value is initialized to track the -O flag (it's true
11142iff -O is not specified). With -O, no code is generated for assert
11143statements, nor for code of the form ``if __debug__: <something>''.
11144Sorry, no further constant folding happens.
11145
11146
11147Performance
11148-----------
11149
11150- It's much faster (almost twice for pystone.py -- see
11151Tools/scripts). See the entry on string interning below.
11152
11153- Some speedup by using separate free lists for method objects (both
11154the C and the Python variety) and for floating point numbers.
11155
11156- Big speedup by allocating frame objects with a single malloc() call.
11157The Python/C API for frames is changed (you shouldn't be using this
11158anyway).
11159
11160- Significant speedup by inlining some common opcodes for common operand
11161types (e.g. i+i, i-i, and list[i]). Fredrik Lundh.
11162
11163- Small speedup by reordering the method tables of some common
11164objects (e.g. list.append is now first).
11165
11166- Big optimization to the read() method of file objects. A read()
11167without arguments now attempts to use fstat to allocate a buffer of
11168the right size; for pipes and sockets, it will fall back to doubling
11169the buffer size. While that the improvement is real on all systems,
11170it is most dramatic on Windows.
11171
11172
11173Documentation
11174-------------
11175
11176- Many new pieces of library documentation were contributed, mostly by
11177Andrew Kuchling. Even cmath is now documented! There's also a
11178chapter of the library manual, "libundoc.tex", which provides a
11179listing of all undocumented modules, plus their status (e.g. internal,
11180obsolete, or in need of documentation). Also contributions by Sue
11181Williams, Skip Montanaro, and some module authors who succumbed to
11182pressure to document their own contributed modules :-). Note that
11183printing the documentation now kills fewer trees -- the margins have
11184been reduced.
11185
11186- I have started documenting the Python/C API. Unfortunately this project
11187hasn't been completed yet. It will be complete before the final release of
11188Python 1.5, though. At the moment, it's better to read the LaTeX source
11189than to attempt to run it through LaTeX and print the resulting dvi file.
11190
11191- The posix module (and hence os.py) now has doc strings! Thanks to Neil
11192Schemenauer. I received a few other contributions of doc strings. In most
11193other places, doc strings are still wishful thinking...
11194
11195
11196Language changes
11197----------------
11198
11199- Private variables with leading double underscore are now a permanent
11200feature of the language. (These were experimental in release 1.4. I have
11201favorable experience using them; I can't label them "experimental"
11202forever.)
11203
11204- There's new string literal syntax for "raw strings". Prefixing a string
11205literal with the letter r (or R) disables all escape processing in the
11206string; for example, r'\n' is a two-character string consisting of a
11207backslash followed by the letter n. This combines with all forms of string
11208quotes; it is actually useful for triple quoted doc strings which might
11209contain references to \n or \t. An embedded quote prefixed with a
11210backslash does not terminate the string, but the backslash is still
11211included in the string; for example, r'\'' is a two-character string
11212consisting of a backslash and a quote. (Raw strings are also
11213affectionately known as Robin strings, after their inventor, Robin
11214Friedrich.)
11215
11216- There's a simple assert statement, and a new exception
11217AssertionError. For example, ``assert foo > 0'' is equivalent to ``if
11218not foo > 0: raise AssertionError''. Sorry, the text of the asserted
11219condition is not available; it would be too complicated to generate
11220code for this (since the code is generated from a parse tree).
11221However, the text is displayed as part of the traceback!
11222
11223- The raise statement has a new feature: when using "raise SomeClass,
11224somevalue" where somevalue is not an instance of SomeClass, it
11225instantiates SomeClass(somevalue). In 1.5a4, if somevalue is an
11226instance of a *derived* class of SomeClass, the exception class raised
11227is set to somevalue.__class__, and SomeClass is ignored after that.
11228
11229- Duplicate keyword arguments are now detected at compile time;
11230f(a=1,a=2) is now a syntax error.
11231
11232
11233Changes to builtin features
11234---------------------------
11235
11236- There's a new exception FloatingPointError (used only by Lee Busby's
11237patches to catch floating point exceptions, at the moment).
11238
11239- The obsolete exception ConflictError (presumably used by the long
11240obsolete access statement) has been deleted.
11241
11242- There's a new function sys.exc_info() which returns the tuple
11243(sys.exc_type, sys.exc_value, sys.exc_traceback) in a thread-safe way.
11244
11245- There's a new variable sys.executable, pointing to the executable file
11246for the Python interpreter.
11247
11248- The sort() methods for lists no longer uses the C library qsort(); I
11249wrote my own quicksort implementation, with lots of help (in the form
11250of a kind of competition) from Tim Peters. This solves a bug in
11251dictionary comparisons on some Solaris versions when Python is built
11252with threads, and makes sorting lists even faster.
11253
11254- The semantics of comparing two dictionaries have changed, to make
11255comparison of unequal dictionaries faster. A shorter dictionary is
11256always considered smaller than a larger dictionary. For dictionaries
11257of the same size, the smallest differing element determines the
11258outcome (which yields the same results as before in this case, without
11259explicit sorting). Thanks to Aaron Watters for suggesting something
11260like this.
11261
11262- The semantics of try-except have changed subtly so that calling a
11263function in an exception handler that itself raises and catches an
11264exception no longer overwrites the sys.exc_* variables. This also
11265alleviates the problem that objects referenced in a stack frame that
11266caught an exception are kept alive until another exception is caught
11267-- the sys.exc_* variables are restored to their previous value when
11268returning from a function that caught an exception.
11269
11270- There's a new "buffer" interface. Certain objects (e.g. strings and
11271arrays) now support the "buffer" protocol. Buffer objects are acceptable
11272whenever formerly a string was required for a write operation; mutable
11273buffer objects can be the target of a read operation using the call
11274f.readinto(buffer). A cool feature is that regular expression matching now
11275also work on array objects. Contribution by Jack Jansen. (Needs
11276documentation.)
11277
11278- String interning: dictionary lookups are faster when the lookup
11279string object is the same object as the key in the dictionary, not
11280just a string with the same value. This is done by having a pool of
11281"interned" strings. Most names generated by the interpreter are now
11282automatically interned, and there's a new built-in function intern(s)
11283that returns the interned version of a string. Interned strings are
11284not a different object type, and interning is totally optional, but by
11285interning most keys a speedup of about 15% was obtained for the
11286pystone benchmark.
11287
11288- Dictionary objects have several new methods; clear() and copy() have
11289the obvious semantics, while update(d) merges the contents of another
11290dictionary d into this one, overriding existing keys. The dictionary
11291implementation file is now called dictobject.c rather than the
11292confusing mappingobject.c.
11293
11294- The intrinsic function dir() is much smarter; it looks in __dict__,
11295__members__ and __methods__.
11296
11297- The intrinsic functions int(), long() and float() can now take a
11298string argument and then do the same thing as string.atoi(),
11299string.atol(), and string.atof(). No second 'base' argument is
11300allowed, and complex() does not take a string (nobody cared enough).
11301
11302- When a module is deleted, its globals are now deleted in two phases.
11303In the first phase, all variables whose name begins with exactly one
11304underscore are replaced by None; in the second phase, all variables
11305are deleted. This makes it possible to have global objects whose
11306destructors depend on other globals. The deletion order within each
11307phase is still random.
11308
11309- It is no longer an error for a function to be called without a
11310global variable __builtins__ -- an empty directory will be provided
11311by default.
11312
11313- Guido's corollary to the "Don Beaudry hook": it is now possible to
11314do metaprogramming by using an instance as a base class. Not for the
11315faint of heart; and undocumented as yet, but basically if a base class
11316is an instance, its class will be instantiated to create the new
11317class. Jim Fulton will love it -- it also works with instances of his
11318"extension classes", since it is triggered by the presence of a
11319__class__ attribute on the purported base class. See
11320Demo/metaclasses/index.html for an explanation and see that directory
11321for examples.
11322
11323- Another change is that the Don Beaudry hook is now invoked when
11324*any* base class is special. (Up to 1.5a3, the *last* special base
11325class is used; in 1.5a4, the more rational choice of the *first*
11326special base class is used.)
11327
11328- New optional parameter to the readlines() method of file objects.
11329This indicates the number of bytes to read (the actual number of bytes
11330read will be somewhat larger due to buffering reading until the end of
11331the line). Some optimizations have also been made to speed it up (but
11332not as much as read()).
11333
11334- Complex numbers no longer have the ".conj" pseudo attribute; use
11335z.conjugate() instead, or complex(z.real, -z.imag). Complex numbers
11336now *do* support the __members__ and __methods__ special attributes.
11337
11338- The complex() function now looks for a __complex__() method on class
11339instances before giving up.
11340
11341- Long integers now support arbitrary shift counts, so you can now
11342write 1L<<1000000, memory permitting. (Python 1.4 reports "outrageous
11343shift count for this.)
11344
11345- The hex() and oct() functions have been changed so that for regular
11346integers, they never emit a minus sign. For example, on a 32-bit
11347machine, oct(-1) now returns '037777777777' and hex(-1) returns
11348'0xffffffff'. While this may seem inconsistent, it is much more
11349useful. (For long integers, a minus sign is used as before, to fit
11350the result in memory :-)
11351
11352- The hash() function computes better hashes for several data types,
11353including strings, floating point numbers, and complex numbers.
11354
11355
11356New extension modules
11357---------------------
11358
11359- New extension modules cStringIO.c and cPickle.c, written by Jim
11360Fulton and other folks at Digital Creations. These are much more
11361efficient than their Python counterparts StringIO.py and pickle.py,
11362but don't support subclassing. cPickle.c clocks up to 1000 times
11363faster than pickle.py; cStringIO.c's improvement is less dramatic but
11364still significant.
11365
11366- New extension module zlibmodule.c, interfacing to the free zlib
11367library (gzip compatible compression). There's also a module gzip.py
11368which provides a higher level interface. Written by Andrew Kuchling
11369and Jeremy Hylton.
11370
11371- New module readline; see the "miscellaneous" section above.
11372
11373- New Unix extension module resource.c, by Jeremy Hylton, provides
11374access to getrlimit(), getrusage(), setrusage(), getpagesize(), and
11375related symbolic constants.
11376
11377- New extension puremodule.c, by Barry Warsaw, which interfaces to the
11378Purify(TM) C API. See also the file Misc/PURIFY.README. It is also
11379possible to enable Purify by simply setting the PURIFY Makefile
11380variable in the Modules/Setup file.
11381
11382
11383Changes in extension modules
11384----------------------------
11385
11386- The struct extension module has several new features to control byte
11387order and word size. It supports reading and writing IEEE floats even
11388on platforms where this is not the native format. It uses uppercase
11389format codes for unsigned integers of various sizes (always using
11390Python long ints for 'I' and 'L'), 's' with a size prefix for strings,
11391and 'p' for "Pascal strings" (with a leading length byte, included in
11392the size; blame Hannu Krosing; new in 1.5a4). A prefix '>' forces
11393big-endian data and '<' forces little-endian data; these also select
11394standard data sizes and disable automatic alignment (use pad bytes as
11395needed).
11396
11397- The array module supports uppercase format codes for unsigned data
11398formats (like the struct module).
11399
11400- The fcntl extension module now exports the needed symbolic
11401constants. (Formerly these were in FCNTL.py which was not available
11402or correct for all platforms.)
11403
11404- The extension modules dbm, gdbm and bsddb now check that the
11405database is still open before making any new calls.
11406
11407- The dbhash module is no more. Use bsddb instead. (There's a third
11408party interface for the BSD 2.x code somewhere on the web; support for
11409bsddb will be deprecated.)
11410
11411- The gdbm module now supports a sync() method.
11412
11413- The socket module now has some new functions: getprotobyname(), and
11414the set {ntoh,hton}{s,l}().
11415
11416- Various modules now export their type object: socket.SocketType,
11417array.ArrayType.
11418
11419- The socket module's accept() method now returns unknown addresses as
11420a tuple rather than raising an exception. (This can happen in
11421promiscuous mode.) Theres' also a new function getprotobyname().
11422
11423- The pthread support for the thread module now works on most platforms.
11424
11425- STDWIN is now officially obsolete. Support for it will eventually
11426be removed from the distribution.
11427
11428- The binascii extension module is now hopefully fully debugged.
11429(XXX Oops -- Fredrik Lundh promised me a uuencode fix that I never
11430received.)
11431
11432- audioop.c: added a ratecv() function; better handling of overflow in
11433add().
11434
11435- posixmodule.c: now exports the O_* flags (O_APPEND etc.). On
11436Windows, also O_TEXT and O_BINARY. The 'error' variable (the
11437exception is raises) is renamed -- its string value is now "os.error",
11438so newbies don't believe they have to import posix (or nt) to catch
11439it when they see os.error reported as posix.error. The execve()
11440function now accepts any mapping object for the environment.
11441
11442- A new version of the al (audio library) module for SGI was
11443contributed by Sjoerd Mullender.
11444
11445- The regex module has a new function get_syntax() which retrieves the
11446syntax setting set by set_syntax(). The code was also sanitized,
11447removing worries about unclean error handling. See also below for its
11448successor, re.py.
11449
11450- The "new" module (which creates new objects of various types) once
11451again has a fully functioning new.function() method. Dangerous as
11452ever! Also, new.code() has several new arguments.
11453
11454- A problem has been fixed in the rotor module: on systems with signed
11455characters, rotor-encoded data was not portable when the key contained
114568-bit characters. Also, setkey() now requires its argument rather
11457than having broken code to default it.
11458
11459- The sys.builtin_module_names variable is now a tuple. Another new
11460variables in sys is sys.executable (the full path to the Python
11461binary, if known).
11462
11463- The specs for time.strftime() have undergone some revisions. It
11464appears that not all format characters are supported in the same way
11465on all platforms. Rather than reimplement it, we note these
11466differences in the documentation, and emphasize the shared set of
11467features. There's also a thorough test set (that occasionally finds
11468problems in the C library implementation, e.g. on some Linuxes),
11469thanks to Skip Montanaro.
11470
11471- The nis module seems broken when used with NIS+; unfortunately
11472nobody knows how to fix it. It should still work with old NIS.
11473
11474
11475New library modules
11476-------------------
11477
11478- New (still experimental) Perl-style regular expression module,
11479re.py, which uses a new interface for matching as well as a new
11480syntax; the new interface avoids the thread-unsafety of the regex
11481interface. This comes with a helper extension reopmodule.c and vastly
11482rewritten regexpr.c. Most work on this was done by Jeffrey Ollie, Tim
11483Peters, and Andrew Kuchling. See the documentation libre.tex. In
114841.5, the old regex module is still fully supported; in the future, it
11485will become obsolete.
11486
11487- New module gzip.py; see zlib above.
11488
11489- New module keyword.py exports knowledge about Python's built-in
11490keywords. (New version by Ka-Ping Yee.)
11491
11492- New module pprint.py (with documentation) which supports
11493pretty-printing of lists, tuples, & dictionaries recursively. By Fred
11494Drake.
11495
11496- New module code.py. The function code.compile_command() can
11497determine whether an interactively entered command is complete or not,
11498distinguishing incomplete from invalid input. (XXX Unfortunately,
11499this seems broken at this moment, and I don't have the time to fix
11500it. It's probably better to add an explicit interface to the parser
11501for this.)
11502
11503- There is now a library module xdrlib.py which can read and write the
11504XDR data format as used by Sun RPC, for example. It uses the struct
11505module.
11506
11507
11508Changes in library modules
11509--------------------------
11510
11511- Module codehack.py is now completely obsolete.
11512
11513- The pickle.py module has been updated to make it compatible with the
11514new binary format that cPickle.c produces. By default it produces the
11515old all-ASCII format compatible with the old pickle.py, still much
11516faster than pickle.py; it will read both formats automatically. A few
11517other updates have been made.
11518
11519- A new helper module, copy_reg.py, is provided to register extensions
11520to the pickling code.
11521
11522- Revamped module tokenize.py is much more accurate and has an
11523interface that makes it a breeze to write code to colorize Python
11524source code. Contributed by Ka-Ping Yee.
11525
11526- In ihooks.py, ModuleLoader.load_module() now closes the file under
11527all circumstances.
11528
11529- The tempfile.py module has a new class, TemporaryFile, which creates
11530an open temporary file that will be deleted automatically when
11531closed. This works on Windows and MacOS as well as on Unix. (Jim
11532Fulton.)
11533
11534- Changes to the cgi.py module: Most imports are now done at the
11535top of the module, which provides a speedup when using ni (Jim
11536Fulton). The problem with file upload to a Windows platform is solved
11537by using the new tempfile.TemporaryFile class; temporary files are now
11538always opened in binary mode (Jim Fulton). The cgi.escape() function
11539now takes an optional flag argument that quotes '"' to '&quot;'. It
11540is now possible to invoke cgi.py from a command line script, to test
11541cgi scripts more easily outside an http server. There's an optional
11542limit to the size of uploads to POST (Skip Montanaro). Added a
11543'strict_parsing' option to all parsing functions (Jim Fulton). The
11544function parse_qs() now uses urllib.unquote() on the name as well as
11545the value of fields (Clarence Gardner). The FieldStorage class now
11546has a __len__() method.
11547
11548- httplib.py: the socket object is no longer closed; all HTTP/1.*
11549responses are now accepted; and it is now thread-safe (by not using
11550the regex module).
11551
11552- BaseHTTPModule.py: treat all HTTP/1.* versions the same.
11553
11554- The popen2.py module is now rewritten using a class, which makes
11555access to the standard error stream and the process id of the
11556subprocess possible.
11557
11558- Added timezone support to the rfc822.py module, in the form of a
11559getdate_tz() method and a parsedate_tz() function; also a mktime_tz().
11560Also added recognition of some non-standard date formats, by Lars
11561Wirzenius, and RFC 850 dates (Chris Lawrence).
11562
11563- mhlib.py: various enhancements, including almost compatible parsing
11564of message sequence specifiers without invoking a subprocess. Also
11565added a createmessage() method by Lars Wirzenius.
11566
11567- The StringIO.StringIO class now supports readline(nbytes). (Lars
11568Wirzenius.) (Of course, you should be using cStringIO for performance.)
11569
11570- UserDict.py supports the new dictionary methods as well.
11571
11572- Improvements for whrandom.py by Tim Peters: use 32-bit arithmetic to
11573speed it up, and replace 0 seed values by 1 to avoid degeneration.
11574A bug was fixed in the test for invalid arguments.
11575
11576- Module ftplib.py: added support for parsing a .netrc file (Fred
11577Drake). Also added an ntransfercmd() method to the FTP class, which
11578allows access to the expected size of a transfer when available, and a
11579parse150() function to the module which parses the corresponding 150
11580response.
11581
11582- urllib.py: the ftp cache is now limited to 10 entries. Added
11583quote_plus() and unquote_plus() functions which are like quote() and
11584unquote() but also replace spaces with '+' or vice versa, for
11585encoding/decoding CGI form arguments. Catch all errors from the ftp
11586module. HTTP requests now add the Host: header line. The proxy
11587variable names are now mapped to lower case, for Windows. The
11588spliturl() function no longer erroneously throws away all data past
11589the first newline. The basejoin() function now intereprets "../"
11590correctly. I *believe* that the problems with "exception raised in
11591__del__" under certain circumstances have been fixed (mostly by
11592changes elsewher in the interpreter).
11593
11594- In urlparse.py, there is a cache for results in urlparse.urlparse();
11595its size limit is set to 20. Also, new URL schemes shttp, https, and
11596snews are "supported".
11597
11598- shelve.py: use cPickle and cStringIO when available. Also added
11599a sync() method, which calls the database's sync() method if there is
11600one.
11601
11602- The mimetools.py module now uses the available Python modules for
11603decoding quoted-printable, uuencode and base64 formats, rather than
11604creating a subprocess.
11605
11606- The python debugger (pdb.py, and its base class bdb.py) now support
11607conditional breakpoints. See the docs.
11608
11609- The modules base64.py, uu.py and quopri.py can now be used as simple
11610command line utilities.
11611
11612- Various small fixes to the nntplib.py module that I can't bother to
11613document in detail.
11614
11615- Sjoerd Mullender's mimify.py module now supports base64 encoding and
11616includes functions to handle the funny encoding you sometimes see in mail
11617headers. It is now documented.
11618
11619- mailbox.py: Added BabylMailbox. Improved the way the mailbox is
11620gotten from the environment.
11621
11622- Many more modules now correctly open files in binary mode when this
11623is necessary on non-Unix platforms.
11624
11625- The copying functions in the undocumented module shutil.py are
11626smarter.
11627
11628- The Writer classes in the formatter.py module now have a flush()
11629method.
11630
11631- The sgmllib.py module accepts hyphens and periods in the middle of
11632attribute names. While this is against the SGML standard, there is
11633some HTML out there that uses this...
11634
11635- The interface for the Python bytecode disassembler module, dis.py,
11636has been enhanced quite a bit. There's now one main function,
11637dis.dis(), which takes almost any kind of object (function, module,
11638class, instance, method, code object) and disassembles it; without
11639arguments it disassembles the last frame of the last traceback. The
11640other functions have changed slightly, too.
11641
11642- The imghdr.py module recognizes new image types: BMP, PNG.
11643
11644- The string.py module has a new function replace(str, old, new,
11645[maxsplit]) which does substring replacements. It is actually
11646implemented in C in the strop module. The functions [r]find() an
11647[r]index() have an optional 4th argument indicating the end of the
11648substring to search, alsoo implemented by their strop counterparts.
11649(Remember, never import strop -- import string uses strop when
11650available with zero overhead.)
11651
11652- The string.join() function now accepts any sequence argument, not
11653just lists and tuples.
11654
11655- The string.maketrans() requires its first two arguments to be
11656present. The old version didn't require them, but there's not much
11657point without them, and the documentation suggests that they are
11658required, so we fixed the code to match the documentation.
11659
11660- The regsub.py module has a function clear_cache(), which clears its
11661internal cache of compiled regular expressions. Also, the cache now
11662takes the current syntax setting into account. (However, this module
11663is now obsolete -- use the sub() or subn() functions or methods in the
11664re module.)
11665
11666- The undocumented module Complex.py has been removed, now that Python
11667has built-in complex numbers. A similar module remains as
11668Demo/classes/Complex.py, as an example.
11669
11670
11671Changes to the build process
11672----------------------------
11673
11674- The way GNU readline is configured is totally different. The
11675--with-readline configure option is gone. It is now an extension
11676module, which may be loaded dynamically. You must enable it (and
Thomas Wouters89f507f2006-12-13 04:49:30 +000011677specify the correct libraries to link with) in the Modules/Setup file.
Guido van Rossum439d1fa1998-12-21 21:41:14 +000011678Importing the module installs some hooks which enable command line
11679editing. When the interpreter shell is invoked interactively, it
11680attempts to import the readline module; when this fails, the default
11681input mechanism is used. The hook variables are PyOS_InputHook and
11682PyOS_ReadlineFunctionPointer. (Code contributed by Lee Busby, with
11683ideas from William Magro.)
11684
11685- New build procedure: a single library, libpython1.5.a, is now built,
11686which contains absolutely everything except for a one-line main()
11687program (which calls Py_Main(argc, argv) to start the interpreter
11688shell). This makes life much simpler for applications that need to
11689embed Python. The serial number of the build is now included in the
11690version string (sys.version).
11691
11692- As far as I can tell, neither gcc -Wall nor the Microsoft compiler
11693emits a single warning any more when compiling Python.
11694
11695- A number of new Makefile variables have been added for special
11696situations, e.g. LDLAST is appended to the link command. These are
11697used by editing the Makefile or passing them on the make command
11698line.
11699
11700- A set of patches from Lee Busby has been integrated that make it
11701possible to catch floating point exceptions. Use the configure option
11702--with-fpectl to enable the patches; the extension modules fpectl and
11703fpetest provide control to enable/disable and test the feature,
11704respectively.
11705
11706- The support for shared libraries under AIX is now simpler and more
11707robust. Thanks to Vladimir Marangozov for revamping his own patches!
11708
11709- The Modules/makesetup script now reads a file Setup.local as well as
11710a file Setup. Most changes to the Setup script can be done by editing
11711Setup.local instead, which makes it easier to carry a particular setup
11712over from one release to the next.
11713
11714- The Modules/makesetup script now copies any "include" lines it
11715encounters verbatim into the output Makefile. It also recognizes .cxx
11716and .cpp as C++ source files.
11717
11718- The configure script is smarter about C compiler options; e.g. with
11719gcc it uses -O2 and -g when possible, and on some other platforms it
11720uses -Olimit 1500 to avoid a warning from the optimizer about the main
11721loop in ceval.c (which has more than 1000 basic blocks).
11722
11723- The configure script now detects whether malloc(0) returns a NULL
11724pointer or a valid block (of length zero). This avoids the nonsense
11725of always adding one byte to all malloc() arguments on most platforms.
11726
11727- The configure script has a new option, --with-dec-threads, to enable
11728DEC threads on DEC Alpha platforms. Also, --with-threads is now an
11729alias for --with-thread (this was the Most Common Typo in configure
11730arguments).
11731
11732- Many changes in Doc/Makefile; amongst others, latex2html is now used
11733to generate HTML from all latex documents.
11734
11735
11736Change to the Python/C API
11737--------------------------
11738
11739- Because some interfaces have changed, the PYTHON_API macro has been
11740bumped. Most extensions built for the old API version will still run,
11741but I can't guarantee this. Python prints a warning message on
11742version mismatches; it dumps core when the version mismatch causes a
11743serious problem :-)
11744
11745- I've completed the Grand Renaming, with the help of Roger Masse and
11746Barry Warsaw. This makes reading or debugging the code much easier.
11747Many other unrelated code reorganizations have also been carried out.
11748The allobjects.h header file is gone; instead, you would have to
11749include Python.h followed by rename2.h. But you're better off running
11750Tools/scripts/fixcid.py -s Misc/RENAME on your source, so you can omit
11751the rename2.h; it will disappear in the next release.
11752
11753- Various and sundry small bugs in the "abstract" interfaces have been
11754fixed. Thanks to all the (involuntary) testers of the Python 1.4
11755version! Some new functions have been added, e.g. PySequence_List(o),
11756equivalent to list(o) in Python.
11757
11758- New API functions PyLong_FromUnsignedLong() and
11759PyLong_AsUnsignedLong().
11760
11761- The API functions in the file cgensupport.c are no longer
11762supported. This file has been moved to Modules and is only ever
11763compiled when the SGI specific 'gl' module is built.
11764
11765- PyObject_Compare() can now raise an exception. Check with
11766PyErr_Occurred(). The comparison function in an object type may also
11767raise an exception.
11768
11769- The slice interface uses an upper bound of INT_MAX when no explicit
11770upper bound is given (e.x. for a[1:]). It used to ask the object for
11771its length and do the calculations.
11772
11773- Support for multiple independent interpreters. See Doc/api.tex,
11774functions Py_NewInterpreter() and Py_EndInterpreter(). Since the
11775documentation is incomplete, also see the new Demo/pysvr example
11776(which shows how to use these in a threaded application) and the
11777source code.
11778
11779- There is now a Py_Finalize() function which "de-initializes"
11780Python. It is possible to completely restart the interpreter
11781repeatedly by calling Py_Finalize() followed by Py_Initialize(). A
11782change of functionality in Py_Initialize() means that it is now a
11783fatal error to call it while the interpreter is already initialized.
11784The old, half-hearted Py_Cleanup() routine is gone. Use of Py_Exit()
11785is deprecated (it is nothing more than Py_Finalize() followed by
11786exit()).
11787
11788- There are no known memory leaks left. While Py_Finalize() doesn't
11789free *all* allocated memory (some of it is hard to track down),
11790repeated calls to Py_Finalize() and Py_Initialize() do not create
11791unaccessible heap blocks.
11792
11793- There is now explicit per-thread state. (Inspired by, but not the
11794same as, Greg Stein's free threading patches.)
11795
11796- There is now better support for threading C applications. There are
11797now explicit APIs to manipulate the interpreter lock. Read the source
11798or the Demo/pysvr example; the new functions are
11799PyEval_{Acquire,Release}{Lock,Thread}().
11800
11801- The test macro DEBUG has changed to Py_DEBUG, to avoid interference
11802with other libraries' DEBUG macros. Likewise for any other test
11803macros that didn't yet start with Py_.
11804
11805- New wrappers around malloc() and friends: Py_Malloc() etc. call
11806malloc() and call PyErr_NoMemory() when it fails; PyMem_Malloc() call
11807just malloc(). Use of these wrappers could be essential if multiple
11808memory allocators exist (e.g. when using certain DLL setups under
11809Windows). (Idea by Jim Fulton.)
11810
11811- New C API PyImport_Import() which uses whatever __import__() hook
11812that is installed for the current execution environment. By Jim
11813Fulton.
11814
11815- It is now possible for an extension module's init function to fail
11816non-fatally, by calling one of the PyErr_* functions and returning.
11817
11818- The PyInt_AS_LONG() and PyFloat_AS_DOUBLE() macros now cast their
11819argument to the proper type, like the similar PyString macros already
11820did. (Suggestion by Marc-Andre Lemburg.) Similar for PyList_GET_SIZE
11821and PyList_GET_ITEM.
11822
11823- Some of the Py_Get* function, like Py_GetVersion() (but not yet
11824Py_GetPath()) are now declared as returning a const char *. (More
11825should follow.)
11826
11827- Changed the run-time library to check for exceptions after object
11828comparisons. PyObject_Compare() can now return an exception; use
11829PyErr_Occurred() to check (there is *no* special return value).
11830
11831- PyFile_WriteString() and Py_Flushline() now return error indicators
11832instead of clearing exceptions. This fixes an obscure bug where using
11833these would clear a pending exception, discovered by Just van Rossum.
11834
11835- There's a new function, PyArg_ParseTupleAndKeywords(), which parses
11836an argument list including keyword arguments. Contributed by Geoff
11837Philbrick.
11838
11839- PyArg_GetInt() is gone.
11840
11841- It's no longer necessary to include graminit.h when calling one of
11842the extended parser API functions. The three public grammar start
11843symbols are now in Python.h as Py_single_input, Py_file_input, and
11844Py_eval_input.
11845
11846- The CObject interface has a new function,
11847PyCObject_Import(module, name). It calls PyCObject_AsVoidPtr()
11848on the object referenced by "module.name".
11849
11850
11851Tkinter
11852-------
11853
11854- On popular demand, _tkinter once again installs a hook for readline
11855that processes certain Tk events while waiting for the user to type
11856(using PyOS_InputHook).
11857
11858- A patch by Craig McPheeters plugs the most obnoxious memory leaks,
11859caused by command definitions referencing widget objects beyond their
11860lifetime.
11861
11862- New standard dialog modules: tkColorChooser.py, tkCommonDialog.py,
11863tkMessageBox.py, tkFileDialog.py, tkSimpleDialog.py These interface
11864with the new Tk dialog scripts, and provide more "native platform"
11865style file selection dialog boxes on some platforms. Contributed by
11866Fredrik Lundh.
11867
11868- Tkinter.py: when the first Tk object is destroyed, it sets the
11869hiddel global _default_root to None, so that when another Tk object is
11870created it becomes the new default root. Other miscellaneous
11871changes and fixes.
11872
11873- The Image class now has a configure method.
11874
11875- Added a bunch of new winfo options to Tkinter.py; we should now be
11876up to date with Tk 4.2. The new winfo options supported are:
11877mananger, pointerx, pointerxy, pointery, server, viewable, visualid,
11878visualsavailable.
11879
11880- The broken bind() method on Canvas objects defined in the Canvas.py
11881module has been fixed. The CanvasItem and Group classes now also have
11882an unbind() method.
11883
11884- The problem with Tkinter.py falling back to trying to import
11885"tkinter" when "_tkinter" is not found has been fixed -- it no longer
11886tries "tkinter", ever. This makes diagnosing the problem "_tkinter
11887not configured" much easier and will hopefully reduce the newsgroup
11888traffic on this topic.
11889
11890- The ScrolledText module once again supports the 'cnf' parameter, to
11891be compatible with the examples in Mark Lutz' book (I know, I know,
11892too late...)
11893
11894- The _tkinter.c extension module has been revamped. It now support
11895Tk versions 4.1 through 8.0; support for 4.0 has been dropped. It
11896works well under Windows and Mac (with the latest Tk ports to those
11897platforms). It also supports threading -- it is safe for one
11898(Python-created) thread to be blocked in _tkinter.mainloop() while
11899other threads modify widgets. To make the changes visible, those
11900threads must use update_idletasks()method. (The patch for threading
11901in 1.5a3 was broken; in 1.5a4, it is back in a different version,
11902which requires access to the Tcl sources to get it to work -- hence it
11903is disabled by default.)
11904
11905- A bug in _tkinter.c has been fixed, where Split() with a string
11906containing an unmatched '"' could cause an exception or core dump.
11907
11908- Unfortunately, on Windows and Mac, Tk 8.0 no longer supports
11909CreateFileHandler, so _tkinter.createfilehandler is not available on
11910those platforms when using Tk 8.0 or later. I will have to rethink
11911how to interface with Tcl's lower-level event mechanism, or with its
11912channels (which are like Python's file-like objects). Jack Jansen has
11913provided a fix for the Mac, so createfilehandler *is* actually
11914supported there; maybe I can adapt his fix for Windows.
11915
11916
11917Tools and Demos
11918---------------
11919
11920- A new regression test suite is provided, which tests most of the
11921standard and built-in modules. The regression test is run by invoking
11922the script Lib/test/regrtest.py. Barry Warsaw wrote the test harnass;
11923he and Roger Masse contributed most of the new tests.
11924
11925- New tool: faqwiz -- the CGI script that is used to maintain the
11926Python FAQ (http://grail.cnri.reston.va.us/cgi-bin/faqw.py). In
11927Tools/faqwiz.
11928
11929- New tool: webchecker -- a simple extensible web robot that, when
11930aimed at a web server, checks that server for dead links. Available
11931are a command line utility as well as a Tkinter based GUI version. In
11932Tools/webchecker. A simplified version of this program is dissected
11933in my article in O'Reilly's WWW Journal, the issue on Scripting
11934Languages (Vol 2, No 2); Scripting the Web with Python (pp 97-120).
11935Includes a parser for robots.txt files by Skip Montanaro.
11936
11937- New small tools: cvsfiles.py (prints a list of all files under CVS
11938n a particular directory tree), treesync.py (a rather Guido-specific
11939script to synchronize two source trees, one on Windows NT, the other
11940one on Unix under CVS but accessible from the NT box), and logmerge.py
11941(sort a collection of RCS or CVS logs by date). In Tools/scripts.
11942
11943- The freeze script now also works under Windows (NT). Another
11944feature allows the -p option to be pointed at the Python source tree
11945instead of the installation prefix. This was loosely based on part of
11946xfreeze by Sam Rushing and Bill Tutt.
11947
11948- New examples (Demo/extend) that show how to use the generic
11949extension makefile (Misc/Makefile.pre.in).
11950
11951- Tools/scripts/h2py.py now supports C++ comments.
11952
11953- Tools/scripts/pystone.py script is upgraded to version 1.1; there
11954was a bug in version 1.0 (distributed with Python 1.4) that leaked
11955memory. Also, in 1.1, the LOOPS variable is incremented to 10000.
11956
11957- Demo/classes/Rat.py completely rewritten by Sjoerd Mullender.
11958
11959
11960Windows (NT and 95)
11961-------------------
11962
11963- New project files for Developer Studio (Visual C++) 5.0 for Windows
11964NT (the old VC++ 4.2 Makefile is also still supported, but will
11965eventually be withdrawn due to its bulkiness).
11966
11967- See the note on the new module search path in the "Miscellaneous" section
11968above.
11969
11970- Support for Win32s (the 32-bit Windows API under Windows 3.1) is
11971basically withdrawn. If it still works for you, you're lucky.
11972
11973- There's a new extension module, msvcrt.c, which provides various
11974low-level operations defined in the Microsoft Visual C++ Runtime Library.
11975These include locking(), setmode(), get_osfhandle(), set_osfhandle(), and
11976console I/O functions like kbhit(), getch() and putch().
11977
11978- The -u option not only sets the standard I/O streams to unbuffered
11979status, but also sets them in binary mode. (This can also be done
11980using msvcrt.setmode(), by the way.)
11981
11982- The, sys.prefix and sys.exec_prefix variables point to the directory
11983where Python is installed, or to the top of the source tree, if it was run
11984from there.
11985
11986- The various os.path modules (posixpath, ntpath, macpath) now support
11987passing more than two arguments to the join() function, so
11988os.path.join(a, b, c) is the same as os.path.join(a, os.path.join(b,
11989c)).
11990
11991- The ntpath module (normally used as os.path) supports ~ to $HOME
11992expansion in expanduser().
11993
11994- The freeze tool now works on Windows.
11995
11996- See also the Tkinter category for a sad note on
11997_tkinter.createfilehandler().
11998
11999- The truncate() method for file objects now works on Windows.
12000
12001- Py_Initialize() is no longer called when the DLL is loaded. You
12002must call it yourself.
12003
12004- The time module's clock() function now has good precision through
12005the use of the Win32 API QueryPerformanceCounter().
12006
12007- Mark Hammond will release Python 1.5 versions of PythonWin and his
12008other Windows specific code: the win32api extensions, COM/ActiveX
12009support, and the MFC interface.
12010
12011
12012Mac
12013---
12014
12015- As always, the Macintosh port will be done by Jack Jansen. He will
12016make a separate announcement for the Mac specific source code and the
12017binary distribution(s) when these are ready.
12018
12019
12020======================================================================
Guido van Rossuma7925f11994-01-26 10:20:16 +000012021
Guido van Rossumaa253861994-10-06 17:18:57 +000012022
Guido van Rossumc30e95f1996-07-30 18:53:51 +000012023=====================================
Guido van Rossum821a5581997-05-23 04:05:31 +000012024==> Release 1.4 (October 25 1996) <==
12025=====================================
12026
12027(Starting in reverse chronological order:)
12028
12029- Changed disclaimer notice.
12030
12031- Added SHELL=/bin/sh to Misc/Makefile.pre.in -- some Make versions
12032default to the user's login shell.
12033
12034- In Lib/tkinter/Tkinter.py, removed bogus binding of <Delete> in Text
12035widget, and bogus bspace() function.
12036
12037- In Lib/cgi.py, bumped __version__ to 2.0 and restored a truncated
12038paragraph.
12039
12040- Fixed the NT Makefile (PC/vc40.mak) for VC 4.0 to set /MD for all
12041subprojects, and to remove the (broken) experimental NumPy
12042subprojects.
12043
12044- In Lib/py_compile.py, cast mtime to long() so it will work on Mac
12045(where os.stat() returns mtimes as floats.)
12046- Set self.rfile unbuffered (like self.wfile) in SocketServer.py, to
12047fix POST in CGIHTTPServer.py.
12048
12049- Version 2.83 of Misc/python-mode.el for Emacs is included.
12050
12051- In Modules/regexmodule.c, fixed symcomp() to correctly handle a new
12052group starting immediately after a group tag.
12053
12054- In Lib/SocketServer.py, changed the mode for rfile to unbuffered.
12055
12056- In Objects/stringobject.c, fixed the compare function to do the
12057first char comparison in unsigned mode, for consistency with the way
12058other characters are compared by memcmp().
12059
12060- In Lib/tkinter/Tkinter.py, fixed Scale.get() to support floats.
12061
12062- In Lib/urllib.py, fix another case where openedurl wasn't set.
12063
12064(XXX Sorry, the rest is in totally random order. No time to fix it.)
12065
12066- SyntaxError exceptions detected during code generation
12067(e.g. assignment to an expression) now include a line number.
12068
12069- Don't leave trailing / or \ in script directory inserted in front of
12070sys.path.
12071
12072- Added a note to Tools/scripts/classfix.py abouts its historical
12073importance.
12074
12075- Added Misc/Makefile.pre.in, a universal Makefile for extensions
12076built outside the distribution.
12077
12078- Rewritten Misc/faq2html.py, by Ka-Ping Yee.
12079
12080- Install shared modules with mode 555 (needed for performance on some
12081platforms).
12082
12083- Some changes to standard library modules to avoid calling append()
12084with more than one argument -- while supported, this should be
12085outlawed, and I don't want to set a bad example.
12086
12087- bdb.py (and hence pdb.py) supports calling run() with a code object
12088instead of a code string.
12089
12090- Fixed an embarrassing bug cgi.py which prevented correct uploading
12091of binary files from Netscape (which doesn't distinguish between
12092binary and text files). Also added dormant logging support, which
12093makes it easier to debug the cgi module itself.
12094
12095- Added default writer to constructor of NullFormatter class.
12096
12097- Use binary mode for socket.makefile() calls in ftplib.py.
12098
12099- The ihooks module no longer "installs" itself upon import -- this
12100was an experimental feature that helped ironing out some bugs but that
12101slowed down code that imported it without the need to install it
12102(e.g. the rexec module). Also close the file in some cases and add
12103the __file__ attribute to loaded modules.
12104
12105- The test program for mailbox.py is now more useful.
12106
12107- Added getparamnames() to Message class in mimetools.py -- it returns
12108the names of parameters to the content-type header.
12109
12110- Fixed a typo in ni that broke the loop stripping "__." from names.
12111
12112- Fix sys.path[0] for scripts run via pdb.py's new main program.
12113
12114- profile.py can now also run a script, like pdb.
12115
12116- Fix a small bug in pyclbr -- don't add names starting with _ when
12117emulating from ... import *.
12118
12119- Fixed a series of embarrassing typos in rexec's handling of standard
12120I/O redirection. Added some more "safe" built-in modules: cmath,
12121errno, operator.
12122
12123- Fixed embarrassing typo in shelve.py.
12124
12125- Added SliceType and EllipsisType to types.py.
12126
12127- In urllib.py, added handling for error 301 (same as 302); added
12128geturl() method to get the URL after redirection.
12129
12130- Fixed embarrassing typo in xdrlib.py. Also fixed typo in Setup.in
12131for _xdrmodule.c and removed redundant #include from _xdrmodule.c.
12132
12133- Fixed bsddbmodule.c to add binary mode indicator on platforms that
12134have it. This should make it working on Windows NT.
12135
12136- Changed last uses of #ifdef NT to #ifdef MS_WINDOWS or MS_WIN32,
12137whatever applies. Also rationalized some other tests for various MS
12138platforms.
12139
12140- Added the sources for the NT installer script used for Python
121411.4beta3. Not tested with this release, but better than nothing.
12142
12143- A compromise in pickle's defenses against Trojan horses: a
12144user-defined function is now okay where a class is expected. A
12145built-in function is not okay, to prevent pickling something that
12146will execute os.system("rm -f *") when unpickling.
12147
12148- dis.py will print the name of local variables referenced by local
12149load/store/delete instructions.
12150
12151- Improved portability of SimpleHTTPServer module to non-Unix
12152platform.
12153
12154- The thread.h interface adds an extra argument to down_sema(). This
12155only affects other C code that uses thread.c; the Python thread module
12156doesn't use semaphores (which aren't provided on all platforms where
12157Python threads are supported). Note: on NT, this change is not
12158implemented.
12159
12160- Fixed some typos in abstract.h; corrected signature of
12161PyNumber_Coerce, added PyMapping_DelItem. Also fixed a bug in
12162abstract.c's PyObject_CallMethod().
12163
12164- apply(classname, (), {}) now works even if the class has no
12165__init__() method.
12166
12167- Implemented complex remainder and divmod() (these would dump core!).
12168Conversion of complex numbers to int, long int or float now raises an
12169exception, since there is no meaningful way to do it without losing
12170information.
12171
12172- Fixed bug in built-in complex() function which gave the wrong result
12173for two real arguments.
12174
12175- Change the hash algorithm for strings -- the multiplier is now
121761000003 instead of 3, which gives better spread for short strings.
12177
12178- New default path for Windows NT, the registry structure now supports
12179default paths for different install packages. (Mark Hammond -- the
12180next PythonWin release will use this.)
12181
12182- Added more symbols to the python_nt.def file.
12183
12184- When using GNU readline, set rl_readline_name to "python".
12185
12186- The Ellipses built-in name has been renamed to Ellipsis -- this is
12187the correct singular form. Thanks to Ka-Ping Yee, who saved us from
12188eternal embarrassment.
12189
12190- Bumped the PYTHON_API_VERSION to 1006, due to the Ellipses ->
12191Ellipsis name change.
12192
12193- Updated the library reference manual. Added documentation of
12194restricted mode (rexec, Bastion) and the formatter module (for use
12195with the htmllib module). Fixed the documentation of htmllib
12196(finally).
12197
12198- The reference manual is now maintained in FrameMaker.
12199
12200- Upgraded scripts Doc/partparse.py and Doc/texi2html.py.
12201
12202- Slight improvements to Doc/Makefile.
12203
12204- Added fcntl.lockf(). This should be used for Unix file locking
12205instead of the posixfile module; lockf() is more portable.
12206
12207- The getopt module now supports long option names, thanks to Lars
12208Wizenius.
12209
12210- Plenty of changes to Tkinter and Canvas, mostly due to Fred Drake
12211and Nils Fischbeck.
12212
12213- Use more bits of time.time() in whrandom's default seed().
12214
12215- Performance hack for regex module's regs attribute.
12216
12217- Don't close already closed socket in socket module.
12218
12219- Correctly handle separators containing embedded nulls in
12220strop.split, strop.find and strop.rfind. Also added more detail to
12221error message for strop.atoi and friends.
12222
12223- Moved fallback definition for hypot() to Python/hypot.c.
12224
12225- Added fallback definition for strdup, in Python/strdup.c.
12226
12227- Fixed some bugs where a function would return 0 to indicate an error
12228where it should return -1.
12229
12230- Test for error returned by time.localtime(), and rationalized its MS
12231tests.
12232
12233- Added Modules/Setup.local file, which is processed after Setup.
12234
12235- Corrected bug in toplevel Makefile.in -- execution of regen script
12236would not use the right PATH and PYTHONPATH.
12237
12238- Various and sundry NeXT configuration changes (sigh).
12239
12240- Support systems where libreadline needs neither termcap nor curses.
12241
12242- Improved ld_so_aix script and python.exp file (for AIX).
12243
12244- More stringent test for working <stdarg.h> in configure script.
12245
12246- Removed Demo/www subdirectory -- it was totally out of date.
12247
12248- Improved demos and docs for Fred Drake's parser module; fixed one
12249typo in the module itself.
12250
12251
12252=========================================
12253==> Release 1.4beta3 (August 26 1996) <==
12254=========================================
12255
12256
12257(XXX This is less readable that it should. I promise to restructure
12258it for the final 1.4 release.)
12259
12260
12261What's new in 1.4beta3 (since beta2)?
12262-------------------------------------
12263
12264- Name mangling to implement a simple form of class-private variables.
12265A name of the form "__spam" can't easily be used outside the class.
12266(This was added in 1.4beta3, but left out of the 1.4beta3 release
12267message.)
12268
12269- In urllib.urlopen(): HTTP URLs containing user:passwd@host are now
12270handled correctly when using a proxy server.
12271
12272- In ntpath.normpath(): don't truncate to 8+3 format.
12273
12274- In mimetools.choose_boundary(): don't die when getuid() or getpid()
12275aren't defined.
12276
12277- Module urllib: some optimizations to (un)quoting.
12278
12279- New module MimeWriter for writing MIME documents.
12280
12281- More changes to formatter module.
12282
12283- The freeze script works once again and is much more robust (using
12284sys.prefix etc.). It also supports a -o option to specify an
12285output directory.
12286
12287- New module whichdb recognizes dbm, gdbm and bsddb/dbhash files.
12288
12289- The Doc/Makefile targets have been reorganized somewhat to remove the
12290insistence on always generating PostScript.
12291
12292- The texinfo to html filter (Doc/texi2html.py) has been improved somewhat.
12293
12294- "errors.h" has been renamed to "pyerrors.h" to resolve a long-standing
12295name conflict on the Mac.
12296
12297- Linking a module compiled with a different setting for Py_TRACE_REFS now
12298generates a linker error rather than a core dump.
12299
12300- The cgi module has a new convenience function print_exception(), which
12301formats a python exception using HTML. It also fixes a bug in the
12302compatibility code and adds a dubious feature which makes it possible to
12303have two query strings, one in the URL and one in the POST data.
12304
12305- A subtle change in the unpickling of class instances makes it possible
12306to unpickle in restricted execution mode, where the __dict__ attribute is
12307not available (but setattr() is).
12308
12309- Documentation for os.path.splitext() (== posixpath.splitext()) has been
12310cleared up. It splits at the *last* dot.
12311
12312- posixfile locking is now also correctly supported on AIX.
12313
12314- The tempfile module once again honors an initial setting of tmpdir. It
12315now works on Windows, too.
12316
12317- The traceback module has some new functions to extract, format and print
12318the active stack.
12319
12320- Some translation functions in the urllib module have been made a little
12321less sluggish.
12322
12323- The addtag_* methods for Canvas widgets in Tkinter as well as in the
12324separate Canvas class have been fixed so they actually do something
12325meaningful.
12326
12327- A tiny _test() function has been added to Tkinter.py.
12328
12329- A generic Makefile for dynamically loaded modules is provided in the Misc
12330subdirectory (Misc/gMakefile).
12331
12332- A new version of python-mode.el for Emacs is provided. See
12333http://www.python.org/ftp/emacs/pmdetails.html for details. The
12334separate file pyimenu.el is no longer needed, imenu support is folded
12335into python-mode.el.
12336
12337- The configure script can finally correctly find the readline library in a
Walter Dörwaldf0dfc7a2003-10-20 14:01:56 +000012338non-standard location. The LDFLAGS variable is passed on the Makefiles
Guido van Rossum821a5581997-05-23 04:05:31 +000012339from the configure script.
12340
12341- Shared libraries are now installed as programs (i.e. with executable
12342permission). This is required on HP-UX and won't hurt on other systems.
12343
12344- The objc.c module is no longer part of the distribution. Objective-C
12345support may become available as contributed software on the ftp site.
12346
12347- The sybase module is no longer part of the distribution. A much
12348improved sybase module is available as contributed software from the
12349ftp site.
12350
12351- _tkinter is now compatible with Tcl 7.5 / Tk 4.1 patch1 on Windows and
12352Mac (don't use unpatched Tcl/Tk!). The default line in the Setup.in file
12353now links with Tcl 7.5 / Tk 4.1 rather than 7.4/4.0.
12354
12355- In Setup, you can now write "*shared*" instead of "*noconfig*", and you
12356can use *.so and *.sl as shared libraries.
12357
12358- Some more fidgeting for AIX shared libraries.
12359
12360- The mpz module is now compatible with GMP 2.x. (Not tested by me.)
12361(Note -- a complete replacement by Niels Mo"ller, called gpmodule, is
12362available from the contrib directory on the ftp site.)
12363
12364- A warning is written to sys.stderr when a __del__ method raises an
12365exception (formerly, such exceptions were completely ignored).
12366
12367- The configure script now defines HAVE_OLD_CPP if the C preprocessor is
12368incapable of ANSI style token concatenation and stringification.
12369
12370- All source files (except a few platform specific modules) are once again
12371compatible with K&R C compilers as well as ANSI compilers. In particular,
12372ANSI-isms have been removed or made conditional in complexobject.c,
12373getargs.c and operator.c.
12374
12375- The abstract object API has three new functions, PyObject_DelItem,
12376PySequence_DelItem, and PySequence_DelSlice.
12377
12378- The operator module has new functions delitem and delslice, and the
12379functions "or" and "and" are renamed to "or_" and "and_" (since "or" and
12380"and" are reserved words). ("__or__" and "__and__" are unchanged.)
12381
12382- The environment module is no longer supported; putenv() is now a function
12383in posixmodule (also under NT).
12384
12385- Error in filter(<function>, "") has been fixed.
12386
12387- Unrecognized keyword arguments raise TypeError, not KeyError.
12388
12389- Better portability, fewer bugs and memory leaks, fewer compiler warnings,
12390some more documentation.
12391
12392- Bug in float power boundary case (0.0 to the negative integer power)
12393fixed.
12394
12395- The test of negative number to the float power has been moved from the
12396built-in pow() functin to floatobject.c (so complex numbers can yield the
12397correct result).
12398
12399- The bug introduced in beta2 where shared libraries loaded (using
12400dlopen()) from the current directory would fail, has been fixed.
12401
12402- Modules imported as shared libraries now also have a __file__ attribute,
12403giving the filename from which they were loaded. The only modules without
12404a __file__ attribute now are built-in modules.
12405
12406- On the Mac, dynamically loaded modules can end in either ".slb" or
12407".<platform>.slb" where <platform> is either "CFM68K" or "ppc". The ".slb"
12408extension should only be used for "fat" binaries.
12409
12410- C API addition: marshal.c now supports
12411PyMarshal_WriteObjectToString(object).
12412
12413- C API addition: getargs.c now supports
12414PyArg_ParseTupleAndKeywords(args, kwdict, format, kwnames, ...)
12415to parse keyword arguments.
12416
12417- The PC versioning scheme (sys.winver) has changed once again. the
12418version number is now "<digit>.<digit>.<digit>.<apiversion>", where the
12419first three <digit>s are the Python version (e.g. "1.4.0" for Python 1.4,
12420"1.4.1" for Python 1.4.1 -- the beta level is not included) and
12421<apiversion> is the four-digit PYTHON_API_VERSION (currently 1005).
12422
12423- h2py.py accepts whitespace before the # in CPP directives
12424
12425- On Solaris 2.5, it should now be possible to use either Posix threads or
12426Solaris threads (XXX: how do you select which is used???). (Note: the
12427Python pthreads interface doesn't fully support semaphores yet -- anyone
12428care to fix this?)
12429
12430- Thread support should now work on AIX, using either DCE threads or
12431pthreads.
12432
12433- New file Demo/sockets/unicast.py
12434
12435- Working Mac port, with CFM68K support, with Tk 4.1 support (though not
12436both) (XXX)
12437
12438- New project setup for PC port, now compatible with PythonWin, with
12439_tkinter and NumPy support (XXX)
12440
12441- New module site.py (XXX)
12442
12443- New module xdrlib.py and optional support module _xdrmodule.c (XXX)
12444
12445- parser module adapted to new grammar, complete w/ Doc & Demo (XXX)
12446
12447- regen script fixed (XXX)
12448
12449- new machdep subdirectories Lib/{aix3,aix4,next3_3,freebsd2,linux2} (XXX)
12450
12451- testall now also tests math module (XXX)
12452
12453- string.atoi c.s. now raise an exception for an empty input string.
12454
12455- At last, it is no longer necessary to define HAVE_CONFIG_H in order to
12456have config.h included at various places.
12457
12458- Unrecognized keyword arguments now raise TypeError rather than KeyError.
12459
12460- The makesetup script recognizes files with extension .so or .sl as
12461(shared) libraries.
12462
12463- 'access' is no longer a reserved word, and all code related to its
12464implementation is gone (or at least #ifdef'ed out). This should make
12465Python a little speedier too!
12466
12467- Performance enhancements suggested by Sjoerd Mullender. This includes
12468the introduction of two new optional function pointers in type object,
12469getattro and setattro, which are like getattr and setattr but take a
12470string object instead of a C string pointer.
12471
12472- New operations in string module: lstrip(s) and rstrip(s) strip whitespace
12473only on the left or only on the right, A new optional third argument to
12474split() specifies the maximum number of separators honored (so
12475splitfields(s, sep, n) returns a list of at most n+1 elements). (Since
124761.3, splitfields(s, None) is totally equivalent to split(s).)
12477string.capwords() has an optional second argument specifying the
12478separator (which is passed to split()).
12479
12480- regsub.split() has the same addition as string.split(). regsub.splitx(s,
12481sep, maxsep) implements the functionality that was regsub.split(s, 1) in
124821.4beta2 (return a list containing the delimiters as well as the words).
12483
12484- Final touch for AIX loading, rewritten Misc/AIX-NOTES.
12485
12486- In Modules/_tkinter.c, when using Tk 4.1 or higher, use className
12487argument to _tkinter.create() to set Tcl's argv0 variable, so X
12488resources use the right resource class again.
12489
12490- Add #undef fabs to Modules/mathmodule.c for macintosh.
12491
12492- Added some macro renames for AIX in Modules/operator.c.
12493
12494- Removed spurious 'E' from Doc/liberrno.tex.
12495
12496- Got rid of some cruft in Misc/ (dlMakefile, pyimenu.el); added new
12497Misc/gMakefile and new version of Misc/python-mode.el.
12498
12499- Fixed typo in Lib/ntpath.py (islink has "return false" which gives a
12500NameError).
12501
12502- Added missing "from types import *" to Lib/tkinter/Canvas.py.
12503
12504- Added hint about using default args for __init__ to pickle docs.
12505
12506- Corrected typo in Inclide/abstract.h: PySequence_Lenth ->
12507PySequence_Length.
12508
12509- Some improvements to Doc/texi2html.py.
12510
12511- In Python/import.c, Cast unsigned char * in struct _frozen to char *
12512in calls to rds_object().
12513
12514- In doc/ref4.tex, added note about scope of lambda bodies.
12515
12516What's new in 1.4beta2 (since beta1)?
12517-------------------------------------
12518
12519- Portability bug in the md5.h header solved.
12520
12521- The PC build procedure now really works, and sets sys.platform to a
12522meaningful value (a few things were botched in beta 1). Lib/dos_8x3
12523is now a standard part of the distribution (alas).
12524
12525- More improvements to the installation procedure. Typing "make install"
12526now inserts the version number in the pathnames of almost everything
12527installed, and creates the machine dependent modules (FCNTL.py etc.) if not
12528supplied by the distribution. (XXX There's still a problem with the latter
12529because the "regen" script requires that Python is installed. Some manual
12530intervention may still be required.) (This has been fixed in 1.4beta3.)
12531
12532- New modules: errno, operator (XXX).
12533
12534- Changes for use with Numerical Python: builtin function slice() and
12535Ellipses object, and corresponding syntax:
12536
12537 x[lo:hi:stride] == x[slice(lo, hi, stride)]
12538 x[a, ..., z] == x[(a, Ellipses, z)]
12539
Raymond Hettinger565ea5a2004-10-02 11:02:59 +000012540- New documentation for errno and cgi modules.
Guido van Rossum821a5581997-05-23 04:05:31 +000012541
12542- The directory containing the script passed to the interpreter is
12543inserted in from of sys.path; "." is no longer a default path
12544component.
12545
12546- Optional third string argument to string.translate() specifies
12547characters to delete. New function string.maketrans() creates a
12548translation table for translate() or for regex.compile().
12549
12550- Module posix (and hence module os under Unix) now supports putenv().
12551Moreover, module os is enhanced so that if putenv() is supported,
12552assignments to os.environ entries make the appropriate putenv() call.
12553(XXX the putenv() implementation can leak a small amount of memory per
12554call.)
12555
12556- pdb.py can now be invoked from the command line to debug a script:
12557python pdb.py <script> <arg> ...
12558
12559- Much improved parseaddr() in rfc822.
12560
12561- In cgi.py, you can now pass an alternative value for environ to
12562nearly all functions.
12563
12564- You can now assign to instance variables whose name begins and ends
12565with '__'.
12566
12567- New version of Fred Drake's parser module and associates (token,
12568symbol, AST).
12569
12570- New PYTHON_API_VERSION value and .pyc file magic number (again!).
12571
12572- The "complex" internal structure type is now called "Py_complex" to
12573avoid name conflicts.
12574
12575- Numerous small bugs fixed.
12576
12577- Slight pickle speedups.
12578
12579- Some slight speedups suggested by Sjoerd (more coming in 1.4 final).
12580
12581- NeXT portability mods by Bill Bumgarner integrated.
12582
12583- Modules regexmodule.c, bsddbmodule.c and xxmodule.c have been
12584converted to new naming style.
12585
12586
12587What's new in 1.4beta1 (since 1.3)?
12588-----------------------------------
12589
12590- Added sys.platform and sys.exec_platform for Bill Janssen.
12591
12592- Installation has been completely overhauled. "make install" now installs
12593everything, not just the python binary. Installation uses the install-sh
12594script (borrowed from X11) to install each file.
12595
12596- New functions in the posix module: mkfifo, plock, remove (== unlink),
12597and ftruncate. More functions are also available under NT.
12598
12599- New function in the fcntl module: flock.
12600
12601- Shared library support for FreeBSD.
12602
12603- The --with-readline option can now be used without a DIRECTORY argument,
12604for systems where libreadline.* is in one of the standard places. It is
12605also possible for it to be a shared library.
12606
12607- The extension tkinter has been renamed to _tkinter, to avoid confusion
12608with Tkinter.py oncase insensitive file systems. It now supports Tk 4.1 as
12609well as 4.0.
12610
12611- Author's change of address from CWI in Amsterdam, The Netherlands, to
12612CNRI in Reston, VA, USA.
12613
12614- The math.hypot() function is now always available (if it isn't found in
12615the C math library, Python provides its own implementation).
12616
12617- The latex documentation is now compatible with latex2e, thanks to David
12618Ascher.
12619
12620- The expression x**y is now equivalent to pow(x, y).
12621
12622- The indexing expression x[a, b, c] is now equivalent to x[(a, b, c)].
12623
12624- Complex numbers are now supported. Imaginary constants are written with
12625a 'j' or 'J' prefix, general complex numbers can be formed by adding a real
12626part to an imaginary part, like 3+4j. Complex numbers are always stored in
12627floating point form, so this is equivalent to 3.0+4.0j. It is also
12628possible to create complex numbers with the new built-in function
12629complex(re, [im]). For the footprint-conscious, complex number support can
12630be disabled by defining the symbol WITHOUT_COMPLEX.
12631
12632- New built-in function list() is the long-awaited counterpart of tuple().
12633
12634- There's a new "cmath" module which provides the same functions as the
12635"math" library but with complex arguments and results. (There are very
12636good reasons why math.sqrt(-1) still raises an exception -- you have to use
12637cmath.sqrt(-1) to get 1j for an answer.)
12638
12639- The Python.h header file (which is really the same as allobjects.h except
12640it disables support for old style names) now includes several more files,
12641so you have to have fewer #include statements in the average extension.
12642
12643- The NDEBUG symbol is no longer used. Code that used to be dependent on
12644the presence of NDEBUG is now present on the absence of DEBUG. TRACE_REFS
12645and REF_DEBUG have been renamed to Py_TRACE_REFS and Py_REF_DEBUG,
12646respectively. At long last, the source actually compiles and links without
12647errors when this symbol is defined.
12648
12649- Several symbols that didn't follow the new naming scheme have been
12650renamed (usually by adding to rename2.h) to use a Py or _Py prefix. There
12651are no external symbols left without a Py or _Py prefix, not even those
12652defined by sources that were incorporated from elsewhere (regexpr.c,
12653md5c.c). (Macros are a different story...)
12654
12655- There are now typedefs for the structures defined in config.c and
12656frozen.c.
12657
12658- New PYTHON_API_VERSION value and .pyc file magic number.
12659
12660- New module Bastion. (XXX)
12661
12662- Improved performance of StringIO module.
12663
12664- UserList module now supports + and * operators.
12665
12666- The binhex and binascii modules now actually work.
12667
12668- The cgi module has been almost totally rewritten and documented.
12669It now supports file upload and a new data type to handle forms more
12670flexibly.
12671
12672- The formatter module (for use with htmllib) has been overhauled (again).
12673
12674- The ftplib module now supports passive mode and has doc strings.
12675
12676- In (ideally) all places where binary files are read or written, the file
12677is now correctly opened in binary mode ('rb' or 'wb') so the code will work
12678on Mac or PC.
12679
12680- Dummy versions of os.path.expandvars() and expanduser() are now provided
12681on non-Unix platforms.
12682
12683- Module urllib now has two new functions url2pathname and pathname2url
12684which turn local filenames into "file:..." URLs using the same rules as
12685Netscape (why be different). it also supports urlretrieve() with a
12686pathname parameter, and honors the proxy environment variables (http_proxy
12687etc.). The URL parsing has been improved somewhat, too.
12688
12689- Micro improvements to urlparse. Added urlparse.urldefrag() which
12690removes a trailing ``#fragment'' if any.
12691
12692- The mailbox module now supports MH style message delimiters as well.
12693
12694- The mhlib module contains some new functionality: setcontext() to set the
12695current folder and parsesequence() to parse a sequence as commonly passed
12696to MH commands (e.g. 1-10 or last:5).
12697
12698- New module mimify for conversion to and from MIME format of email
12699messages.
12700
12701- Module ni now automatically installs itself when first imported -- this
12702is against the normal rule that modules should define classes and functions
12703but not invoke them, but appears more useful in the case that two
12704different, independent modules want to use ni's features.
12705
12706- Some small performance enhancements in module pickle.
12707
12708- Small interface change to the profile.run*() family of functions -- more
12709sensible handling of return values.
12710
12711- The officially registered Mac creator for Python files is 'Pyth'. This
12712replaces 'PYTH' which was used before but never registered.
12713
12714- Added regsub.capwords(). (XXX)
12715
12716- Added string.capwords(), string.capitalize() and string.translate().
12717(XXX)
12718
12719- Fixed an interface bug in the rexec module: it was impossible to pass a
12720hooks instance to the RExec class. rexec now also supports the dynamic
12721loading of modules from shared libraries. Some other interfaces have been
12722added too.
12723
12724- Module rfc822 now caches the headers in a dictionary for more efficient
12725lookup.
12726
12727- The sgmllib module now understands a limited number of SGML "shorthands"
12728like <A/.../ for <A>...</A>. (It's not clear that this was a good idea...)
12729
12730- The tempfile module actually tries a number of different places to find a
12731usable temporary directory. (This was prompted by certain Linux
12732installations that appear to be missing a /usr/tmp directory.) [A bug in
12733the implementation that would ignore a pre-existing tmpdir global has been
12734fixed in beta3.]
12735
12736- Much improved and enhanved FileDialog module for Tkinter.
12737
12738- Many small changes to Tkinter, to bring it more in line with Tk 4.0 (as
12739well as Tk 4.1).
12740
12741- New socket interfaces include ntohs(), ntohl(), htons(), htonl(), and
12742s.dup(). Sockets now work correctly on Windows. On Windows, the built-in
12743extension is called _socket and a wrapper module win/socket.py provides
12744"makefile()" and "dup()" functionality. On Windows, the select module
12745works only with socket objects.
12746
12747- Bugs in bsddb module fixed (e.g. missing default argument values).
12748
12749- The curses extension now includes <ncurses.h> when available.
12750
12751- The gdbm module now supports opening databases in "fast" mode by
12752specifying 'f' as the second character or the mode string.
12753
12754- new variables sys.prefix and sys.exec_prefix pass corresponding
12755configuration options / Makefile variables to the Python programmer.
12756
12757- The ``new'' module now supports creating new user-defined classes as well
12758as instances thereof.
12759
12760- The soundex module now sports get_soundex() to get the soundex value for an
12761arbitrary string (formerly it would only do soundex-based string
12762comparison) as well as doc strings.
12763
12764- New object type "cobject" to safely wrap void pointers for passing them
12765between various extension modules.
12766
12767- More efficient computation of float**smallint.
12768
12769- The mysterious bug whereby "x.x" (two occurrences of the same
12770one-character name) typed from the commandline would sometimes fail
12771mysteriously.
12772
12773- The initialization of the readline function can now be invoked by a C
12774extension through PyOS_ReadlineInit().
12775
12776- There's now an externally visible pointer PyImport_FrozenModules which
12777can be changed by an embedding application.
12778
12779- The argument parsing functions now support a new format character 'D' to
12780specify complex numbers.
12781
12782- Various memory leaks plugged and bugs fixed.
12783
12784- Improved support for posix threads (now that real implementations are
12785beginning to apepar). Still no fully functioning semaphores.
12786
12787- Some various and sundry improvements and new entries in the Tools
12788directory.
12789
12790
12791=====================================
Guido van Rossumc30e95f1996-07-30 18:53:51 +000012792==> Release 1.3 (13 October 1995) <==
12793=====================================
12794
12795Major change
12796============
12797
12798Two words: Keyword Arguments. See the first section of Chapter 12 of
12799the Tutorial.
12800
12801(The rest of this file is textually the same as the remaining sections
12802of that chapter.)
12803
12804
12805Changes to the WWW and Internet tools
12806=====================================
12807
12808The "htmllib" module has been rewritten in an incompatible fashion.
12809The new version is considerably more complete (HTML 2.0 except forms,
12810but including all ISO-8859-1 entity definitions), and easy to use.
12811Small changes to "sgmllib" have also been made, to better match the
12812tokenization of HTML as recognized by other web tools.
12813
12814A new module "formatter" has been added, for use with the new
12815"htmllib" module.
12816
12817The "urllib"and "httplib" modules have been changed somewhat to allow
12818overriding unknown URL types and to support authentication. They now
12819use "mimetools.Message" instead of "rfc822.Message" to parse headers.
12820The "endrequest()" method has been removed from the HTTP class since
12821it breaks the interaction with some servers.
12822
12823The "rfc822.Message" class has been changed to allow a flag to be
12824passed in that says that the file is unseekable.
12825
12826The "ftplib" module has been fixed to be (hopefully) more robust on
12827Linux.
12828
12829Several new operations that are optionally supported by servers have
12830been added to "nntplib": "xover", "xgtitle", "xpath" and "date".
12831
12832Other Language Changes
12833======================
12834
12835The "raise" statement now takes an optional argument which specifies
12836the traceback to be used when printing the exception's stack trace.
12837This must be a traceback object, such as found in "sys.exc_traceback".
12838When omitted or given as "None", the old behavior (to generate a stack
12839trace entry for the current stack frame) is used.
12840
12841The tokenizer is now more tolerant of alien whitespace. Control-L in
12842the leading whitespace of a line resets the column number to zero,
12843while Control-R just before the end of the line is ignored.
12844
12845Changes to Built-in Operations
12846==============================
12847
12848For file objects, "f.read(0)" and "f.readline(0)" now return an empty
12849string rather than reading an unlimited number of bytes. For the
12850latter, omit the argument altogether or pass a negative value.
12851
12852A new system variable, "sys.platform", has been added. It specifies
12853the current platform, e.g. "sunos5" or "linux1".
12854
12855The built-in functions "input()" and "raw_input()" now use the GNU
12856readline library when it has been configured (formerly, only
12857interactive input to the interpreter itself was read using GNU
12858readline). The GNU readline library provides elaborate line editing
12859and history. The Python debugger ("pdb") is the first beneficiary of
12860this change.
12861
12862Two new built-in functions, "globals()" and "locals()", provide access
12863to dictionaries containming current global and local variables,
12864respectively. (These augment rather than replace "vars()", which
12865returns the current local variables when called without an argument,
12866and a module's global variables when called with an argument of type
12867module.)
12868
12869The built-in function "compile()" now takes a third possible value for
12870the kind of code to be compiled: specifying "'single'" generates code
12871for a single interactive statement, which prints the output of
12872expression statements that evaluate to something else than "None".
12873
12874Library Changes
12875===============
12876
12877There are new module "ni" and "ihooks" that support importing modules
12878with hierarchical names such as "A.B.C". This is enabled by writing
12879"import ni; ni.ni()" at the very top of the main program. These
12880modules are amply documented in the Python source.
12881
12882The module "rexec" has been rewritten (incompatibly) to define a class
12883and to use "ihooks".
12884
12885The "string.split()" and "string.splitfields()" functions are now the
12886same function (the presence or absence of the second argument
12887determines which operation is invoked); similar for "string.join()"
12888and "string.joinfields()".
12889
12890The "Tkinter" module and its helper "Dialog" have been revamped to use
12891keyword arguments. Tk 4.0 is now the standard. A new module
12892"FileDialog" has been added which implements standard file selection
12893dialogs.
12894
12895The optional built-in modules "dbm" and "gdbm" are more coordinated
12896--- their "open()" functions now take the same values for their "flag"
12897argument, and the "flag" and "mode" argument have default values (to
12898open the database for reading only, and to create the database with
12899mode "0666" minuse the umask, respectively). The memory leaks have
12900finally been fixed.
12901
12902A new dbm-like module, "bsddb", has been added, which uses the BSD DB
12903package's hash method.
12904
12905A portable (though slow) dbm-clone, implemented in Python, has been
12906added for systems where none of the above is provided. It is aptly
12907dubbed "dumbdbm".
12908
12909The module "anydbm" provides a unified interface to "bsddb", "gdbm",
12910"dbm", and "dumbdbm", choosing the first one available.
12911
12912A new extension module, "binascii", provides a variety of operations
12913for conversion of text-encoded binary data.
12914
12915There are three new or rewritten companion modules implemented in
12916Python that can encode and decode the most common such formats: "uu"
12917(uuencode), "base64" and "binhex".
12918
12919A module to handle the MIME encoding quoted-printable has also been
12920added: "quopri".
12921
12922The parser module (which provides an interface to the Python parser's
12923abstract syntax trees) has been rewritten (incompatibly) by Fred
12924Drake. It now lets you change the parse tree and compile the result!
12925
12926The \code{syslog} module has been upgraded and documented.
12927
12928Other Changes
12929=============
12930
12931The dynamic module loader recognizes the fact that different filenames
12932point to the same shared library and loads the library only once, so
12933you can have a single shared library that defines multiple modules.
12934(SunOS / SVR4 style shared libraries only.)
12935
12936Jim Fulton's ``abstract object interface'' has been incorporated into
12937the run-time API. For more detailes, read the files
12938"Include/abstract.h" and "Objects/abstract.c".
12939
12940The Macintosh version is much more robust now.
12941
12942Numerous things I have forgotten or that are so obscure no-one will
12943notice them anyway :-)
12944
12945
Guido van Rossumf456b6d1995-01-04 19:20:37 +000012946===================================
Guido van Rossumd462f3d1995-10-09 21:30:37 +000012947==> Release 1.2 (13 April 1995) <==
12948===================================
12949
12950- Changes to Misc/python-mode.el:
12951 - Wrapping and indentation within triple quote strings should work
12952 properly now.
12953 - `Standard' bug reporting mechanism (use C-c C-b)
12954 - py-mark-block was moved to C-c C-m
12955 - C-c C-v shows you the python-mode version
12956 - a basic python-font-lock-keywords has been added for Emacs 19
12957 font-lock colorizations.
12958 - proper interaction with pending-del and del-sel modes.
12959 - New py-electric-colon (:) command for improved outdenting. Also
12960 py-indent-line (TAB) should handle outdented lines better.
12961 - New commands py-outdent-left (C-c C-l) and py-indent-right (C-c C-r)
12962
12963- The Library Reference has been restructured, and many new and
12964existing modules are now documented, in particular the debugger and
12965the profiler, as well as the persistency and the WWW/Internet support
12966modules.
12967
12968- All known bugs have been fixed. For example the pow(2,2,3L) bug on
12969Linux has been fixed. Also the re-entrancy problems with __del__ have
12970been fixed.
12971
12972- All known memory leaks have been fixed.
12973
12974- Phase 2 of the Great Renaming has been executed. The header files
12975now use the new names (PyObject instead of object, etc.). The linker
12976also sees the new names. Most source files still use the old names,
12977by virtue of the rename2.h header file. If you include Python.h, you
12978only see the new names. Dynamically linked modules have to be
12979recompiled. (Phase 3, fixing the rest of the sources, will be
12980executed gradually with the release later versions.)
12981
12982- The hooks for implementing "safe-python" (better called "restricted
12983execution") are in place. Specifically, the import statement is
12984implemented by calling the built-in function __import__, and the
12985built-in names used in a particular scope are taken from the
12986dictionary __builtins__ in that scope's global dictionary. See also
12987the new (unsupported, undocumented) module rexec.py.
12988
12989- The import statement now supports the syntax "import a.b.c" and
12990"from a.b.c import name". No officially supported implementation
12991exists, but one can be prototyped by replacing the built-in __import__
12992function. A proposal by Ken Manheimer is provided as newimp.py.
12993
12994- All machinery used by the import statement (or the built-in
12995__import__ function) is now exposed through the new built-in module
12996"imp" (see the library reference manual). All dynamic loading
12997machinery is moved to the new file importdl.c.
12998
12999- Persistent storage is supported through the use of the modules
13000"pickle" and "shelve" (implemented in Python). There's also a "copy"
13001module implementing deepcopy and normal (shallow) copy operations.
13002See the library reference manual.
13003
13004- Documentation strings for many objects types are accessible through
13005the __doc__ attribute. Modules, classes and functions support special
13006syntax to initialize the __doc__ attribute: if the first statement
13007consists of just a string literal, that string literal becomes the
13008value of the __doc__ attribute. The default __doc__ attribute is
13009None. Documentation strings are also supported for built-in
13010functions, types and modules; however this feature hasn't been widely
13011used yet. See the 'new' module for an example. (Basically, the type
13012object's tp_doc field contains the doc string for the type, and the
130134th member of the methodlist structure contains the doc string for the
13014method.)
13015
13016- The __coerce__ and __cmp__ methods for user-defined classes once
13017again work as expected. As an example, there's a new standard class
13018Complex in the library.
13019
13020- The functions posix.popen() and posix.fdopen() now have an optional
13021third argument to specify the buffer size, and default their second
13022(mode) argument to 'r' -- in analogy to the builtin open() function.
13023The same applies to posixfile.open() and the socket method makefile().
13024
13025- The thread.exit_thread() function now raises SystemExit so that
13026'finally' clauses are honored and a memory leak is plugged.
13027
13028- Improved X11 and Motif support, by Sjoerd Mullender. This extension
13029is being maintained and distributed separately.
13030
13031- Improved support for the Apple Macintosh, in part by Jack Jansen,
13032e.g. interfaces to (a few) resource mananger functions, get/set file
13033type and creator, gestalt, sound manager, speech manager, MacTCP, comm
13034toolbox, and the think C console library. This is being maintained
13035and distributed separately.
13036
13037- Improved version for Windows NT, by Mark Hammond. This is being
13038maintained and distributed separately.
13039
13040- Used autoconf 2.0 to generate the configure script. Adapted
13041configure.in to use the new features in autoconf 2.0.
13042
13043- It now builds on the NeXT without intervention, even on the 3.3
13044Sparc pre-release.
13045
13046- Characters passed to isspace() and friends are masked to nonnegative
13047values.
13048
13049- Correctly compute pow(-3.0, 3).
13050
13051- Fix portability problems with getopt (configure now checks for a
13052non-GNU getopt).
13053
13054- Don't add frozenmain.o to libPython.a.
13055
13056- Exceptions can now be classes. ALl built-in exceptions are still
13057string objects, but this will change in the future.
13058
13059- The socket module exports a long list of socket related symbols.
13060(More built-in modules will export their symbolic constants instead of
13061relying on a separately generated Python module.)
13062
13063- When a module object is deleted, it clears out its own dictionary.
13064This fixes a circularity in the references between functions and
13065their global dictionary.
13066
13067- Changed the error handling by [new]getargs() e.g. for "O&".
13068
13069- Dynamic loading of modules using shared libraries is supported for
13070several new platforms.
13071
13072- Support "O&", "[...]" and "{...}" in mkvalue().
13073
13074- Extension to findmethod(): findmethodinchain() (where a chain is a
13075linked list of methodlist arrays). The calling interface for
13076findmethod() has changed: it now gets a pointer to the (static!)
13077methodlist structure rather than just to the function name -- this
13078saves copying flags etc. into the (short-lived) method object.
13079
13080- The callable() function is now public.
13081
13082- Object types can define a few new operations by setting function
13083pointers in the type object structure: tp_call defines how an object
13084is called, and tp_str defines how an object's str() is computed.
13085
13086
13087===================================
Guido van Rossumf456b6d1995-01-04 19:20:37 +000013088==> Release 1.1.1 (10 Nov 1994) <==
13089===================================
13090
13091This is a pure bugfix release again. See the ChangeLog file for details.
13092
13093One exception: a few new features were added to tkinter.
13094
13095
13096=================================
13097==> Release 1.1 (11 Oct 1994) <==
13098=================================
13099
13100This release adds several new features, improved configuration and
13101portability, and fixes more bugs than I can list here (including some
13102memory leaks).
13103
13104The source compiles and runs out of the box on more platforms than
13105ever -- including Windows NT. Makefiles or projects for a variety of
13106non-UNIX platforms are provided.
13107
13108APOLOGY: some new features are badly documented or not at all. I had
13109the choice -- postpone the new release indefinitely, or release it
13110now, with working code but some undocumented areas. The problem with
13111postponing the release is that people continue to suffer from existing
13112bugs, and send me patches based on the previous release -- which I
13113can't apply directly because my own source has changed. Also, some
13114new modules (like signal) have been ready for release for quite some
13115time, and people are anxiously waiting for them. In the case of
13116signal, the interface is simple enough to figure out without
13117documentation (if you're anxious enough :-). In this case it was not
13118simple to release the module on its own, since it relies on many small
13119patches elsewhere in the source.
13120
13121For most new Python modules, the source code contains comments that
13122explain how to use them. Documentation for the Tk interface, written
13123by Matt Conway, is available as tkinter-doc.tar.gz from the Python
13124home and mirror ftp sites (see Misc/FAQ for ftp addresses). For the
13125new operator overloading facilities, have a look at Demo/classes:
13126Complex.py and Rat.py show how to implement a numeric type without and
13127with __coerce__ method. Also have a look at the end of the Tutorial
13128document (Doc/tut.tex). If you're still confused: use the newsgroup
13129or mailing list.
13130
13131
13132New language features:
13133
13134 - More flexible operator overloading for user-defined classes
13135 (INCOMPATIBLE WITH PREVIOUS VERSIONS!) See end of tutorial.
13136
13137 - Classes can define methods named __getattr__, __setattr__ and
13138 __delattr__ to trap attribute accesses. See end of tutorial.
13139
13140 - Classes can define method __call__ so instances can be called
13141 directly. See end of tutorial.
13142
13143
13144New support facilities:
13145
13146 - The Makefiles (for the base interpreter as well as for extensions)
13147 now support creating dynamically loadable modules if the platform
13148 supports shared libraries.
13149
13150 - Passing the interpreter a .pyc file as script argument will execute
13151 the code in that file. (On the Mac such files can be double-clicked!)
13152
13153 - New Freeze script, to create independently distributable "binaries"
13154 of Python programs -- look in Demo/freeze
13155
13156 - Improved h2py script (in Demo/scripts) follows #includes and
13157 supports macros with one argument
13158
13159 - New module compileall generates .pyc files for all modules in a
13160 directory (tree) without also executing them
13161
13162 - Threads should work on more platforms
13163
13164
13165New built-in modules:
13166
13167 - tkinter (support for Tcl's Tk widget set) is now part of the base
13168 distribution
13169
13170 - signal allows catching or ignoring UNIX signals (unfortunately still
13171 undocumented -- any taker?)
13172
13173 - termios provides portable access to POSIX tty settings
13174
13175 - curses provides an interface to the System V curses library
13176
13177 - syslog provides an interface to the (BSD?) syslog daemon
13178
13179 - 'new' provides interfaces to create new built-in object types
13180 (e.g. modules and functions)
13181
13182 - sybase provides an interface to SYBASE database
13183
13184
13185New/obsolete built-in methods:
13186
13187 - callable(x) tests whether x can be called
13188
13189 - sockets now have a setblocking() method
13190
13191 - sockets no longer have an allowbroadcast() method
13192
13193 - socket methods send() and sendto() return byte count
13194
13195
13196New standard library modules:
13197
13198 - types.py defines standard names for built-in types, e.g. StringType
13199
13200 - urlparse.py parses URLs according to the latest Internet draft
13201
13202 - uu.py does uuencode/uudecode (not the fastest in the world, but
13203 quicker than installing uuencode on a non-UNIX machine :-)
13204
13205 - New, faster and more powerful profile module.py
13206
13207 - mhlib.py provides interface to MH folders and messages
13208
13209
13210New facilities for extension writers (unfortunately still
13211undocumented):
13212
13213 - newgetargs() supports optional arguments and improved error messages
13214
13215 - O!, O& O? formats for getargs allow more versatile type checking of
13216 non-standard types
13217
13218 - can register pending asynchronous callback, to be called the next
13219 time the Python VM begins a new instruction (Py_AddPendingCall)
13220
13221 - can register cleanup routines to be called when Python exits
13222 (Py_AtExit)
13223
13224 - makesetup script understands C++ files in Setup file (use file.C
13225 or file.cc)
13226
13227 - Make variable OPT is passed on to sub-Makefiles
13228
13229 - An init<module>() routine may signal an error by not entering
13230 the module in the module table and raising an exception instead
13231
13232 - For long module names, instead of foobarbletchmodule.c you can
13233 use foobarbletch.c
13234
13235 - getintvalue() and getfloatvalue() try to convert any object
13236 instead of requiring an "intobject" or "floatobject"
13237
13238 - All the [new]getargs() formats that retrieve an integer value
13239 will now also work if a float is passed
13240
13241 - C function listtuple() converts list to tuple, fast
13242
13243 - You should now call sigcheck() instead of intrcheck();
13244 sigcheck() also sets an exception when it returns nonzero
13245
13246
Guido van Rossumaa253861994-10-06 17:18:57 +000013247====================================
13248==> Release 1.0.3 (14 July 1994) <==
13249====================================
13250
13251This release consists entirely of bug fixes to the C sources; see the
13252head of ../ChangeLog for a complete list. Most important bugs fixed:
13253
13254- Sometimes the format operator (string%expr) would drop the last
13255character of the format string
13256
13257- Tokenizer looped when last line did not end in \n
13258
13259- Bug when triple-quoted string ended in quote plus newline
13260
13261- Typo in socketmodule (listen) (== instead of =)
13262
13263- typing vars() at the >>> prompt would cause recursive output
13264
13265
13266==================================
13267==> Release 1.0.2 (4 May 1994) <==
13268==================================
13269
13270Overview of the most visible changes. Bug fixes are not listed. See
13271also ChangeLog.
13272
13273Tokens
13274------
13275
13276* String literals follow Standard C rules: they may be continued on
13277the next line using a backslash; adjacent literals are concatenated
13278at compile time.
13279
13280* A new kind of string literals, surrounded by triple quotes (""" or
13281'''), can be continued on the next line without a backslash.
13282
13283Syntax
13284------
13285
13286* Function arguments may have a default value, e.g. def f(a, b=1);
13287defaults are evaluated at function definition time. This also applies
13288to lambda.
13289
13290* The try-except statement has an optional else clause, which is
13291executed when no exception occurs in the try clause.
13292
13293Interpreter
13294-----------
13295
13296* The result of a statement-level expression is no longer printed,
13297except_ for expressions entered interactively. Consequently, the -k
13298command line option is gone.
13299
13300* The result of the last printed interactive expression is assigned to
13301the variable '_'.
13302
13303* Access to implicit global variables has been speeded up by removing
13304an always-failing dictionary lookup in the dictionary of local
13305variables (mod suggested by Steve Makewski and Tim Peters).
13306
13307* There is a new command line option, -u, to force stdout and stderr
13308to be unbuffered.
13309
13310* Incorporated Steve Majewski's mods to import.c for dynamic loading
13311under AIX.
13312
13313* Fewer chances of dumping core when trying to reload or re-import
13314static built-in, dynamically loaded built-in, or frozen modules.
13315
13316* Loops over sequences now don't ask for the sequence's length when
13317they start, but try to access items 0, 1, 2, and so on until they hit
13318an IndexError. This makes it possible to create classes that generate
13319infinite or indefinite sequences a la Steve Majewski. This affects
13320for loops, the (not) in operator, and the built-in functions filter(),
13321map(), max(), min(), reduce().
13322
13323Changed Built-in operations
13324---------------------------
13325
13326* The '%' operator on strings (printf-style formatting) supports a new
13327feature (adapted from a patch by Donald Beaudry) to allow
13328'%(<key>)<format>' % {...} to take values from a dictionary by name
13329instead of from a tuple by position (see also the new function
13330vars()).
13331
13332* The '%s' formatting operator is changed to accept any type and
13333convert it to a string using str().
13334
13335* Dictionaries with more than 20,000 entries can now be created
13336(thanks to Steve Kirsch).
13337
13338New Built-in Functions
13339----------------------
13340
13341* vars() returns a dictionary containing the local variables; vars(m)
13342returns a dictionary containing the variables of module m. Note:
13343dir(x) is now equivalent to vars(x).keys().
13344
13345Changed Built-in Functions
13346--------------------------
13347
13348* open() has an optional third argument to specify the buffer size: 0
13349for unbuffered, 1 for line buffered, >1 for explicit buffer size, <0
13350for default.
13351
13352* open()'s second argument is now optional; it defaults to "r".
13353
13354* apply() now checks that its second argument is indeed a tuple.
13355
13356New Built-in Modules
13357--------------------
13358
13359Changed Built-in Modules
13360------------------------
13361
13362The thread module no longer supports exit_prog().
13363
13364New Python Modules
13365------------------
13366
13367* Module addpack contains a standard interface to modify sys.path to
13368find optional packages (groups of related modules).
13369
13370* Module urllib contains a number of functions to access
13371World-Wide-Web files specified by their URL.
13372
13373* Module httplib implements the client side of the HTTP protocol used
13374by World-Wide-Web servers.
13375
13376* Module gopherlib implements the client side of the Gopher protocol.
13377
13378* Module mailbox (by Jack Jansen) contains a parser for UNIX and MMDF
13379style mailbox files.
13380
13381* Module random contains various random distributions, e.g. gauss().
13382
13383* Module lockfile locks and unlocks open files using fcntl (inspired
13384by a similar module by Andy Bensky).
13385
13386* Module ntpath (by Jaap Vermeulen) implements path operations for
13387Windows/NT.
13388
13389* Module test_thread (in Lib/test) contains a small test set for the
13390thread module.
13391
13392Changed Python Modules
13393----------------------
13394
13395* The string module's expandvars() function is now documented and is
13396implemented in Python (using regular expressions) instead of forking
13397off a shell process.
13398
13399* Module rfc822 now supports accessing the header fields using the
13400mapping/dictionary interface, e.g. h['subject'].
13401
13402* Module pdb now makes it possible to set a break on a function
13403(syntax: break <expression>, where <expression> yields a function
13404object).
13405
13406Changed Demos
13407-------------
13408
13409* The Demo/scripts/freeze.py script is working again (thanks to Jaap
13410Vermeulen).
13411
13412New Demos
13413---------
13414
13415* Demo/threads/Generator.py is a proposed interface for restartable
13416functions a la Tim Peters.
13417
13418* Demo/scripts/newslist.py, by Quentin Stafford-Fraser, generates a
13419directory full of HTML pages which between them contain links to all
13420the newsgroups available on your server.
13421
13422* Demo/dns contains a DNS (Domain Name Server) client.
13423
13424* Demo/lutz contains miscellaneous demos by Mark Lutz (e.g. psh.py, a
13425nice enhanced Python shell!!!).
13426
13427* Demo/turing contains a Turing machine by Amrit Prem.
13428
13429Documentation
13430-------------
13431
13432* Documented new language features mentioned above (but not all new
13433modules).
13434
13435* Added a chapter to the Tutorial describing recent additions to
13436Python.
13437
13438* Clarified some sentences in the reference manual,
13439e.g. break/continue, local/global scope, slice assignment.
13440
13441Source Structure
13442----------------
13443
13444* Moved Include/tokenizer.h to Parser/tokenizer.h.
13445
13446* Added Python/getopt.c for systems that don't have it.
13447
13448Emacs mode
13449----------
13450
13451* Indentation of continuated lines is done more intelligently;
13452consequently the variable py-continuation-offset is gone.
13453
Guido van Rossumf2eac992000-09-04 17:24:24 +000013454
Guido van Rossumaa253861994-10-06 17:18:57 +000013455========================================
13456==> Release 1.0.1 (15 February 1994) <==
13457========================================
13458
13459* Many portability fixes should make it painless to build Python on
13460several new platforms, e.g. NeXT, SEQUENT, WATCOM, DOS, and Windows.
13461
13462* Fixed test for <stdarg.h> -- this broke on some platforms.
13463
13464* Fixed test for shared library dynalic loading -- this broke on SunOS
134654.x using the GNU loader.
13466
13467* Changed order and number of SVR4 networking libraries (it is now
13468-lsocket -linet -lnsl, if these libraries exist).
13469
13470* Installing the build intermediate stages with "make libainstall" now
13471also installs config.c.in, Setup and makesetup, which are used by the
13472new Extensions mechanism.
13473
13474* Improved README file contains more hints and new troubleshooting
13475section.
13476
13477* The built-in module strop now defines fast versions of three more
13478functions of the standard string module: atoi(), atol() and atof().
13479The strop versions of atoi() and atol() support an optional second
13480argument to specify the base (default 10). NOTE: you don't have to
13481explicitly import strop to use the faster versions -- the string
13482module contains code to let versions from stop override the default
13483versions.
13484
13485* There is now a working Lib/dospath.py for those who use Python under
13486DOS (or Windows). Thanks, Jaap!
13487
13488* There is now a working Modules/dosmodule.c for DOS (or Windows)
13489system calls.
13490
13491* Lib.os.py has been reorganized (making it ready for more operating
13492systems).
13493
13494* Lib/ospath.py is now obsolete (use os.path instead).
13495
13496* Many fixes to the tutorial to make it match Python 1.0. Thanks,
13497Tim!
13498
13499* Fixed Doc/Makefile, Doc/README and various scripts there.
13500
13501* Added missing description of fdopen to Doc/libposix.tex.
13502
13503* Made cleanup() global, for the benefit of embedded applications.
13504
13505* Added parsing of addresses and dates to Lib/rfc822.py.
13506
13507* Small fixes to Lib/aifc.py, Lib/sunau.py, Lib/tzparse.py to make
13508them usable at all.
13509
13510* New module Lib/wave.py reads RIFF (*.wav) audio files.
13511
13512* Module Lib/filewin.py moved to Lib/stdwin/filewin.py where it
13513belongs.
13514
13515* New options and comments for Modules/makesetup (used by new
13516Extension mechanism).
13517
13518* Misc/HYPE contains text of announcement of 1.0.0 in comp.lang.misc
13519and elsewhere.
13520
13521* Fixed coredump in filter(None, 'abcdefg').
13522
13523
13524=======================================
13525==> Release 1.0.0 (26 January 1994) <==
13526=======================================
13527
13528As is traditional, so many things have changed that I can't pretend to
13529be complete in these release notes, but I'll try anyway :-)
13530
13531Note that the very last section is labeled "remaining bugs".
13532
13533
13534Source organization and build process
13535-------------------------------------
13536
13537* The sources have finally been split: instead of a single src
13538subdirectory there are now separate directories Include, Parser,
13539Grammar, Objects, Python and Modules. Other directories also start
13540with a capital letter: Misc, Doc, Lib, Demo.
13541
13542* A few extensions (notably Amoeba and X support) have been moved to a
13543separate subtree Extensions, which is no longer in the core
13544distribution, but separately ftp'able as extensions.tar.Z. (The
13545distribution contains a placeholder Ext-dummy with a description of
13546the Extensions subtree as well as the most recent versions of the
13547scripts used there.)
13548
13549* A few large specialized demos (SGI video and www) have been
13550moved to a separate subdirectory Demo2, which is no longer in the core
13551distribution, but separately ftp'able as demo2.tar.Z.
13552
13553* Parts of the standard library have been moved to subdirectories:
13554there are now standard subdirectories stdwin, test, sgi and sun4.
13555
13556* The configuration process has radically changed: I now use GNU
13557autoconf. This makes it much easier to build on new Unix flavors, as
13558well as fully supporting VPATH (if your Make has it). The scripts
13559Configure.py and Addmodule.sh are no longer needed. Many source files
13560have been adapted in order to work with the symbols that the configure
13561script generated by autoconf defines (or not); the resulting source is
13562much more portable to different C compilers and operating systems,
13563even non Unix systems (a Mac port was done in an afternoon). See the
13564toplevel README file for a description of the new build process.
13565
13566* GNU readline (a slightly newer version) is now a subdirectory of the
13567Python toplevel. It is still not automatically configured (being
13568totally autoconf-unaware :-). One problem has been solved: typing
13569Control-C to a readline prompt will now work. The distribution no
13570longer contains a "super-level" directory (above the python toplevel
13571directory), and dl, dl-dld and GNU dld are no longer part of the
13572Python distribution (you can still ftp them from
13573ftp.cwi.nl:/pub/dynload).
13574
13575* The DOS functions have been taken out of posixmodule.c and moved
13576into a separate file dosmodule.c.
13577
13578* There's now a separate file version.c which contains nothing but
13579the version number.
13580
13581* The actual main program is now contained in config.c (unless NO_MAIN
13582is defined); pythonmain.c now contains a function realmain() which is
13583called from config.c's main().
13584
13585* All files needed to use the built-in module md5 are now contained in
13586the distribution. The module has been cleaned up considerably.
13587
13588
13589Documentation
13590-------------
13591
13592* The library manual has been split into many more small latex files,
13593so it is easier to edit Doc/lib.tex file to create a custom library
13594manual, describing only those modules supported on your system. (This
13595is not automated though.)
13596
13597* A fourth manual has been added, titled "Extending and Embedding the
13598Python Interpreter" (Doc/ext.tex), which collects information about
13599the interpreter which was previously spread over several files in the
13600misc subdirectory.
13601
13602* The entire documentation is now also available on-line for those who
13603have a WWW browser (e.g. NCSA Mosaic). Point your browser to the URL
13604"http://www.cwi.nl/~guido/Python.html".
13605
13606
13607Syntax
13608------
13609
13610* Strings may now be enclosed in double quotes as well as in single
13611quotes. There is no difference in interpretation. The repr() of
13612string objects will use double quotes if the string contains a single
13613quote and no double quotes. Thanks to Amrit Prem for these changes!
13614
13615* There is a new keyword 'exec'. This replaces the exec() built-in
13616function. If a function contains an exec statement, local variable
13617optimization is not performed for that particular function, thus
13618making assignment to local variables in exec statements less
13619confusing. (As a consequence, os.exec and python.exec have been
13620renamed to execv.)
13621
13622* There is a new keyword 'lambda'. An expression of the form
13623
13624 lambda <parameters> : <expression>
13625
13626yields an anonymous function. This is really only syntactic sugar;
13627you can just as well define a local function using
13628
13629 def some_temporary_name(<parameters>): return <expression>
13630
13631Lambda expressions are particularly useful in combination with map(),
13632filter() and reduce(), described below. Thanks to Amrit Prem for
13633submitting this code (as well as map(), filter(), reduce() and
13634xrange())!
13635
13636
13637Built-in functions
13638------------------
13639
13640* The built-in module containing the built-in functions is called
13641__builtin__ instead of builtin.
13642
13643* New built-in functions map(), filter() and reduce() perform standard
13644functional programming operations (though not lazily):
13645
13646- map(f, seq) returns a new sequence whose items are the items from
13647seq with f() applied to them.
13648
13649- filter(f, seq) returns a subsequence of seq consisting of those
13650items for which f() is true.
13651
13652- reduce(f, seq, initial) returns a value computed as follows:
13653 acc = initial
13654 for item in seq: acc = f(acc, item)
13655 return acc
13656
13657* New function xrange() creates a "range object". Its arguments are
13658the same as those of range(), and when used in a for loop a range
13659objects also behaves identical. The advantage of xrange() over
13660range() is that its representation (if the range contains many
13661elements) is much more compact than that of range(). The disadvantage
13662is that the result cannot be used to initialize a list object or for
13663the "Python idiom" [RED, GREEN, BLUE] = range(3). On some modern
13664architectures, benchmarks have shown that "for i in range(...): ..."
13665actually executes *faster* than "for i in xrange(...): ...", but on
13666memory starved machines like PCs running DOS range(100000) may be just
13667too big to be represented at all...
13668
13669* Built-in function exec() has been replaced by the exec statement --
13670see above.
13671
13672
13673The interpreter
13674---------------
13675
13676* Syntax errors are now not printed to stderr by the parser, but
13677rather the offending line and other relevant information are packed up
13678in the SyntaxError exception argument. When the main loop catches a
13679SyntaxError exception it will print the error in the same format as
13680previously, but at the proper position in the stack traceback.
13681
13682* You can now set a maximum to the number of traceback entries
13683printed by assigning to sys.tracebacklimit. The default is 1000.
13684
13685* The version number in .pyc files has changed yet again.
13686
13687* It is now possible to have a .pyc file without a corresponding .py
13688file. (Warning: this may break existing installations if you have an
13689old .pyc file lingering around somewhere on your module search path
13690without a corresponding .py file, when there is a .py file for a
13691module of the same name further down the path -- the new interpreter
13692will find the first .pyc file and complain about it, while the old
13693interpreter would ignore it and use the .py file further down.)
13694
13695* The list sys.builtin_module_names is now sorted and also contains
13696the names of a few hardwired built-in modules (sys, __main__ and
13697__builtin__).
13698
13699* A module can now find its own name by accessing the global variable
13700__name__. Assigning to this variable essentially renames the module
13701(it should also be stored under a different key in sys.modules).
13702A neat hack follows from this: a module that wants to execute a main
13703program when called as a script no longer needs to compare
13704sys.argv[0]; it can simply do "if __name__ == '__main__': main()".
13705
13706* When an object is printed by the print statement, its implementation
13707of str() is used. This means that classes can define __str__(self) to
13708direct how their instances are printed. This is different from
13709__repr__(self), which should define an unambigous string
13710representation of the instance. (If __str__() is not defined, it
13711defaults to __repr__().)
13712
13713* Functions and code objects can now be compared meaningfully.
13714
13715* On systems supporting SunOS or SVR4 style shared libraries, dynamic
13716loading of modules using shared libraries is automatically configured.
13717Thanks to Bill Jansen and Denis Severson for contributing this change!
13718
13719
13720Built-in objects
13721----------------
13722
13723* File objects have acquired a new method writelines() which is the
13724reverse of readlines(). (It does not actually write lines, just a
13725list of strings, but the symmetry makes the choice of name OK.)
13726
13727
13728Built-in modules
13729----------------
13730
13731* Socket objects no longer support the avail() method. Use the select
13732module instead, or use this function to replace it:
13733
13734 def avail(f):
13735 import select
13736 return f in select.select([f], [], [], 0)[0]
13737
13738* Initialization of stdwin is done differently. It actually modifies
13739sys.argv (taking out the options the X version of stdwin recognizes)
13740the first time it is imported.
13741
13742* A new built-in module parser provides a rudimentary interface to the
13743python parser. Corresponding standard library modules token and symbol
13744defines the numeric values of tokens and non-terminal symbols.
13745
13746* The posix module has aquired new functions setuid(), setgid(),
13747execve(), and exec() has been renamed to execv().
13748
13749* The array module is extended with 8-byte object swaps, the 'i'
13750format character, and a reverse() method. The read() and write()
13751methods are renamed to fromfile() and tofile().
13752
13753* The rotor module has freed of portability bugs. This introduces a
13754backward compatibility problem: strings encoded with the old rotor
13755module can't be decoded by the new version.
13756
13757* For select.select(), a timeout (4th) argument of None means the same
13758as leaving the timeout argument out.
13759
13760* Module strop (and hence standard library module string) has aquired
13761a new function: rindex(). Thanks to Amrit Prem!
13762
13763* Module regex defines a new function symcomp() which uses an extended
13764regular expression syntax: parenthesized subexpressions may be labeled
13765using the form "\(<labelname>...\)", and the group() method can return
13766sub-expressions by name. Thanks to Tracy Tims for these changes!
13767
13768* Multiple threads are now supported on Solaris 2. Thanks to Sjoerd
13769Mullender!
13770
13771
13772Standard library modules
13773------------------------
13774
13775* The library is now split in several subdirectories: all stuff using
13776stdwin is in Lib/stdwin, all SGI specific (or SGI Indigo or GL) stuff
13777is in Lib/sgi, all Sun Sparc specific stuff is in Lib/sun4, and all
13778test modules are in Lib/test. The default module search path will
13779include all relevant subdirectories by default.
13780
13781* Module os now knows about trying to import dos. It defines
13782functions execl(), execle(), execlp() and execvp().
13783
13784* New module dospath (should be attacked by a DOS hacker though).
13785
13786* All modules defining classes now define __init__() constructors
13787instead of init() methods. THIS IS AN INCOMPATIBLE CHANGE!
13788
13789* Some minor changes and bugfixes module ftplib (mostly Steve
13790Majewski's suggestions); the debug() method is renamed to
13791set_debuglevel().
13792
13793* Some new test modules (not run automatically by testall though):
13794test_audioop, test_md5, test_rgbimg, test_select.
13795
13796* Module string now defines rindex() and rfind() in analogy of index()
13797and find(). It also defines atof() and atol() (and corresponding
13798exceptions) in analogy to atoi().
13799
13800* Added help() functions to modules profile and pdb.
13801
13802* The wdb debugger (now in Lib/stdwin) now shows class or instance
13803variables on a double click. Thanks to Sjoerd Mullender!
13804
13805* The (undocumented) module lambda has gone -- you couldn't import it
13806any more, and it was basically more a demo than a library module...
13807
13808
13809Multimedia extensions
13810---------------------
13811
13812* The optional built-in modules audioop and imageop are now standard
13813parts of the interpreter. Thanks to Sjoerd Mullender and Jack Jansen
13814for contributing this code!
13815
13816* There's a new operation in audioop: minmax().
13817
13818* There's a new built-in module called rgbimg which supports portable
13819efficient reading of SGI RCG image files. Thanks also to Paul
13820Haeberli for the original code! (Who will contribute a GIF reader?)
13821
13822* The module aifc is gone -- you should now always use aifc, which has
13823received a facelift.
13824
13825* There's a new module sunau., for reading Sun (and NeXT) audio files.
13826
13827* There's a new module audiodev which provides a uniform interface to
13828(SGI Indigo and Sun Sparc) audio hardware.
13829
13830* There's a new module sndhdr which recognizes various sound files by
13831looking in their header and checking for various magic words.
13832
13833
13834Optimizations
13835-------------
13836
13837* Most optimizations below can be configured by compile-time flags.
13838Thanks to Sjoerd Mullender for submitting these optimizations!
13839
13840* Small integers (default -1..99) are shared -- i.e. if two different
13841functions compute the same value it is possible (but not
13842guaranteed!!!) that they return the same *object*. Python programs
13843can detect this but should *never* rely on it.
13844
13845* Empty tuples (which all compare equal) are shared in the same
13846manner.
13847
13848* Tuples of size up to 20 (default) are put in separate free lists
13849when deallocated.
13850
13851* There is a compile-time option to cache a string's hash function,
13852but this appeared to have a negligeable effect, and as it costs 4
13853bytes per string it is disabled by default.
13854
13855
13856Embedding Python
13857----------------
13858
13859* The initialization interface has been simplified somewhat. You now
13860only call "initall()" to initialize the interpreter.
13861
13862* The previously announced renaming of externally visible identifiers
13863has not been carried out. It will happen in a later release. Sorry.
13864
13865
13866Miscellaneous bugs that have been fixed
13867---------------------------------------
13868
13869* All known portability bugs.
13870
13871* Version 0.9.9 dumped core in <listobject>.sort() which has been
13872fixed. Thanks to Jaap Vermeulen for fixing this and posting the fix
13873on the mailing list while I was away!
13874
13875* Core dump on a format string ending in '%', e.g. in the expression
13876'%' % None.
13877
13878* The array module yielded a bogus result for concatenation (a+b would
13879yield a+a).
13880
13881* Some serious memory leaks in strop.split() and strop.splitfields().
13882
13883* Several problems with the nis module.
13884
13885* Subtle problem when copying a class method from another class
13886through assignment (the method could not be called).
13887
13888
13889Remaining bugs
13890--------------
13891
13892* One problem with 64-bit machines remains -- since .pyc files are
13893portable and use only 4 bytes to represent an integer object, 64-bit
13894integer literals are silently truncated when written into a .pyc file.
13895Work-around: use eval('123456789101112').
13896
13897* The freeze script doesn't work any more. A new and more portable
13898one can probably be cooked up using tricks from Extensions/mkext.py.
13899
13900* The dos support hasn't been tested yet. (Really Soon Now we should
13901have a PC with a working C compiler!)
13902
13903
Guido van Rossuma7925f11994-01-26 10:20:16 +000013904===================================
13905==> Release 0.9.9 (29 Jul 1993) <==
13906===================================
13907
13908I *believe* these are the main user-visible changes in this release,
13909but there may be others. SGI users may scan the {src,lib}/ChangeLog
13910files for improvements of some SGI specific modules, e.g. aifc and
13911cl. Developers of extension modules should also read src/ChangeLog.
13912
13913
13914Naming of C symbols used by the Python interpreter
13915--------------------------------------------------
13916
13917* This is the last release using the current naming conventions. New
13918naming conventions are explained in the file misc/NAMING.
13919Summarizing, all externally visible symbols get (at least) a "Py"
13920prefix, and most functions are renamed to the standard form
13921PyModule_FunctionName.
13922
13923* Writers of extensions are urged to start using the new naming
13924conventions. The next release will use the new naming conventions
13925throughout (it will also have a different source directory
13926structure).
13927
13928* As a result of the preliminary work for the great renaming, many
13929functions that were accidentally global have been made static.
13930
13931
13932BETA X11 support
13933----------------
13934
13935* There are now modules interfacing to the X11 Toolkit Intrinsics, the
13936Athena widgets, and the Motif 1.1 widget set. These are not yet
13937documented except through the examples and README file in the demo/x11
13938directory. It is expected that this interface will be replaced by a
13939more powerful and correct one in the future, which may or may not be
13940backward compatible. In other words, this part of the code is at most
13941BETA level software! (Note: the rest of Python is rock solid as ever!)
13942
13943* I understand that the above may be a bit of a disappointment,
13944however my current schedule does not allow me to change this situation
13945before putting the release out of the door. By releasing it
13946undocumented and buggy, at least some of the (working!) demo programs,
13947like itr (my Internet Talk Radio browser) become available to a larger
13948audience.
13949
13950* There are also modules interfacing to SGI's "Glx" widget (a GL
13951window wrapped in a widget) and to NCSA's "HTML" widget (which can
13952format HyperText Markup Language, the document format used by the
13953World Wide Web).
13954
13955* I've experienced some problems when building the X11 support. In
13956particular, the Xm and Xaw widget sets don't go together, and it
13957appears that using X11R5 is better than using X11R4. Also the threads
13958module and its link time options may spoil things. My own strategy is
13959to build two Python binaries: one for use with X11 and one without
13960it, which can contain a richer set of built-in modules. Don't even
13961*think* of loading the X11 modules dynamically...
13962
13963
13964Environmental changes
13965---------------------
13966
13967* Compiled files (*.pyc files) created by this Python version are
13968incompatible with those created by the previous version. Both
13969versions detect this and silently create a correct version, but it
13970means that it is not a good idea to use the same library directory for
13971an old and a new interpreter, since they will start to "fight" over
13972the *.pyc files...
13973
13974* When a stack trace is printed, the exception is printed last instead
13975of first. This means that if the beginning of the stack trace
13976scrolled out of your window you can still see what exception caused
13977it.
13978
13979* Sometimes interrupting a Python operation does not work because it
13980hangs in a blocking system call. You can now kill the interpreter by
13981interrupting it three times. The second time you interrupt it, a
13982message will be printed telling you that the third interrupt will kill
13983the interpreter. The "sys.exitfunc" feature still makes limited
13984clean-up possible in this case.
13985
13986
13987Changes to the command line interface
13988-------------------------------------
13989
13990* The python usage message is now much more informative.
13991
13992* New option -i enters interactive mode after executing a script --
13993useful for debugging.
13994
13995* New option -k raises an exception when an expression statement
13996yields a value other than None.
13997
13998* For each option there is now also a corresponding environment
13999variable.
14000
14001
14002Using Python as an embedded language
14003------------------------------------
14004
14005* The distribution now contains (some) documentation on the use of
14006Python as an "embedded language" in other applications, as well as a
14007simple example. See the file misc/EMBEDDING and the directory embed/.
14008
14009
14010Speed improvements
14011------------------
14012
14013* Function local variables are now generally stored in an array and
14014accessed using an integer indexing operation, instead of through a
14015dictionary lookup. (This compensates the somewhat slower dictionary
14016lookup caused by the generalization of the dictionary module.)
14017
14018
14019Changes to the syntax
14020---------------------
14021
14022* Continuation lines can now *sometimes* be written without a
14023backslash: if the continuation is contained within nesting (), [] or
14024{} brackets the \ may be omitted. There's a much improved
14025python-mode.el in the misc directory which knows about this as well.
14026
14027* You can no longer use an empty set of parentheses to define a class
14028without base classes. That is, you no longer write this:
14029
14030 class Foo(): # syntax error
14031 ...
14032
14033You must write this instead:
14034
14035 class Foo:
14036 ...
14037
14038This was already the preferred syntax in release 0.9.8 but many
14039people seemed not to have picked it up. There's a Python script that
14040fixes old code: demo/scripts/classfix.py.
14041
14042* There's a new reserved word: "access". The syntax and semantics are
14043still subject of of research and debate (as well as undocumented), but
14044the parser knows about the keyword so you must not use it as a
14045variable, function, or attribute name.
14046
14047
14048Changes to the semantics of the language proper
14049-----------------------------------------------
14050
14051* The following compatibility hack is removed: if a function was
14052defined with two or more arguments, and called with a single argument
14053that was a tuple with just as many arguments, the items of this tuple
14054would be used as the arguments. This is no longer supported.
14055
14056
14057Changes to the semantics of classes and instances
14058-------------------------------------------------
14059
14060* Class variables are now also accessible as instance variables for
14061reading (assignment creates an instance variable which overrides the
14062class variable of the same name though).
14063
14064* If a class attribute is a user-defined function, a new kind of
14065object is returned: an "unbound method". This contains a pointer to
14066the class and can only be called with a first argument which is a
14067member of that class (or a derived class).
14068
14069* If a class defines a method __init__(self, arg1, ...) then this
14070method is called when a class instance is created by the classname()
14071construct. Arguments passed to classname() are passed to the
14072__init__() method. The __init__() methods of base classes are not
14073automatically called; the derived __init__() method must call these if
14074necessary (this was done so the derived __init__() method can choose
14075the call order and arguments for the base __init__() methods).
14076
14077* If a class defines a method __del__(self) then this method is called
14078when an instance of the class is about to be destroyed. This makes it
14079possible to implement clean-up of external resources attached to the
14080instance. As with __init__(), the __del__() methods of base classes
14081are not automatically called. If __del__ manages to store a reference
14082to the object somewhere, its destruction is postponed; when the object
14083is again about to be destroyed its __del__() method will be called
14084again.
14085
14086* Classes may define a method __hash__(self) to allow their instances
14087to be used as dictionary keys. This must return a 32-bit integer.
14088
14089
14090Minor improvements
14091------------------
14092
14093* Function and class objects now know their name (the name given in
14094the 'def' or 'class' statement that created them).
14095
14096* Class instances now know their class name.
14097
14098
14099Additions to built-in operations
14100--------------------------------
14101
14102* The % operator with a string left argument implements formatting
14103similar to sprintf() in C. The right argument is either a single
14104value or a tuple of values. All features of Standard C sprintf() are
14105supported except %p.
14106
14107* Dictionaries now support almost any key type, instead of just
14108strings. (The key type must be an immutable type or must be a class
14109instance where the class defines a method __hash__(), in order to
14110avoid losing track of keys whose value may change.)
14111
14112* Built-in methods are now compared properly: when comparing x.meth1
14113and y.meth2, if x is equal to y and the methods are defined by the
14114same function, x.meth1 compares equal to y.meth2.
14115
14116
14117Additions to built-in functions
14118-------------------------------
14119
14120* str(x) returns a string version of its argument. If the argument is
14121a string it is returned unchanged, otherwise it returns `x`.
14122
14123* repr(x) returns the same as `x`. (Some users found it easier to
14124have this as a function.)
14125
14126* round(x) returns the floating point number x rounded to an whole
14127number, represented as a floating point number. round(x, n) returns x
14128rounded to n digits.
14129
14130* hasattr(x, name) returns true when x has an attribute with the given
14131name.
14132
14133* hash(x) returns a hash code (32-bit integer) of an arbitrary
14134immutable object's value.
14135
14136* id(x) returns a unique identifier (32-bit integer) of an arbitrary
14137object.
14138
14139* compile() compiles a string to a Python code object.
14140
14141* exec() and eval() now support execution of code objects.
14142
14143
14144Changes to the documented part of the library (standard modules)
14145----------------------------------------------------------------
14146
14147* os.path.normpath() (a.k.a. posixpath.normpath()) has been fixed so
14148the border case '/foo/..' returns '/' instead of ''.
14149
14150* A new function string.find() is added with similar semantics to
14151string.index(); however when it does not find the given substring it
14152returns -1 instead of raising string.index_error.
14153
14154
14155Changes to built-in modules
14156---------------------------
14157
14158* New optional module 'array' implements operations on sequences of
14159integers or floating point numbers of a particular size. This is
14160useful to manipulate large numerical arrays or to read and write
14161binary files consisting of numerical data.
14162
14163* Regular expression objects created by module regex now support a new
14164method named group(), which returns one or more \(...\) groups by number.
14165The number of groups is increased from 10 to 100.
14166
14167* Function compile() in module regex now supports an optional mapping
14168argument; a variable casefold is added to the module which can be used
14169as a standard uppercase to lowercase mapping.
14170
14171* Module time now supports many routines that are defined in the
14172Standard C time interface (<time.h>): gmtime(), localtime(),
14173asctime(), ctime(), mktime(), as well as these variables (taken from
14174System V): timezone, altzone, daylight and tzname. (The corresponding
14175functions in the undocumented module calendar have been removed; the
14176undocumented and unfinished module tzparse is now obsolete and will
14177disappear in a future release.)
14178
14179* Module strop (the fast built-in version of standard module string)
14180now uses C's definition of whitespace instead of fixing it to space,
14181tab and newline; in practice this usually means that vertical tab,
14182form feed and return are now also considered whitespace. It exports
14183the string of characters that are considered whitespace as well as the
14184characters that are considered lowercase or uppercase.
14185
14186* Module sys now defines the variable builtin_module_names, a list of
14187names of modules built into the current interpreter (including not
14188yet imported, but excluding two special modules that always have to be
14189defined -- sys and builtin).
14190
14191* Objects created by module sunaudiodev now also support flush() and
14192close() methods.
14193
14194* Socket objects created by module socket now support an optional
14195flags argument for their methods sendto() and recvfrom().
14196
14197* Module marshal now supports dumping to and loading from strings,
14198through the functions dumps() and loads().
14199
14200* Module stdwin now supports some new functionality. You may have to
14201ftp the latest version: ftp.cwi.nl:/pub/stdwin/stdwinforviews.tar.Z.)
14202
14203
14204Bugs fixed
14205----------
14206
14207* Fixed comparison of negative long integers.
14208
14209* The tokenizer no longer botches input lines longer than BUFSIZ.
14210
14211* Fixed several severe memory leaks in module select.
14212
14213* Fixed memory leaks in modules socket and sv.
14214
14215* Fixed memory leak in divmod() for long integers.
14216
14217* Problems with definition of floatsleep() on Suns fixed.
14218
14219* Many portability bugs fixed (and undoubtedly new ones added :-).
14220
14221
14222Changes to the build procedure
14223------------------------------
14224
14225* The Makefile supports some new targets: "make default" and "make
14226all". Both are by normally equivalent to "make python".
14227
14228* The Makefile no longer uses $> since it's not supported by all
14229versions of Make.
14230
14231* The header files now all contain #ifdef constructs designed to make
14232it safe to include the same header file twice, as well as support for
14233inclusion from C++ programs (automatic extern "C" { ... } added).
14234
14235
14236Freezing Python scripts
14237-----------------------
14238
14239* There is now some support for "freezing" a Python script as a
14240stand-alone executable binary file. See the script
14241demo/scripts/freeze.py. It will require some site-specific tailoring
14242of the script to get this working, but is quite worthwhile if you write
14243Python code for other who may not have built and installed Python.
14244
14245
14246MS-DOS
14247------
14248
14249* A new MS-DOS port has been done, using MSC 6.0 (I believe). Thanks,
14250Marcel van der Peijl! This requires fewer compatibility hacks in
14251posixmodule.c. The executable is not yet available but will be soon
14252(check the mailing list).
14253
14254* The default PYTHONPATH has changed.
14255
14256
14257Changes for developers of extension modules
14258-------------------------------------------
14259
14260* Read src/ChangeLog for full details.
14261
14262
14263SGI specific changes
14264--------------------
14265
14266* Read src/ChangeLog for full details.
14267
Guido van Rossumaa253861994-10-06 17:18:57 +000014268
Guido van Rossuma7925f11994-01-26 10:20:16 +000014269==================================
14270==> Release 0.9.8 (9 Jan 1993) <==
14271==================================
14272
14273I claim no completeness here, but I've tried my best to scan the log
14274files throughout my source tree for interesting bits of news. A more
14275complete account of the changes is to be found in the various
14276ChangeLog files. See also "News for release 0.9.7beta" below if you're
14277still using release 0.9.6, and the file HISTORY if you have an even
14278older release.
14279
14280 --Guido
14281
14282
14283Changes to the language proper
14284------------------------------
14285
14286There's only one big change: the conformance checking for function
14287argument lists (of user-defined functions only) is stricter. Earlier,
14288you could get away with the following:
14289
14290 (a) define a function of one argument and call it with any
14291 number of arguments; if the actual argument count wasn't
14292 one, the function would receive a tuple containing the
14293 arguments arguments (an empty tuple if there were none).
14294
14295 (b) define a function of two arguments, and call it with more
14296 than two arguments; if there were more than two arguments,
14297 the second argument would be passed as a tuple containing
14298 the second and further actual arguments.
14299
14300(Note that an argument (formal or actual) that is a tuple is counted as
14301one; these rules don't apply inside such tuples, only at the top level
14302of the argument list.)
14303
14304Case (a) was needed to accommodate variable-length argument lists;
14305there is now an explicit "varargs" feature (precede the last argument
14306with a '*'). Case (b) was needed for compatibility with old class
14307definitions: up to release 0.9.4 a method with more than one argument
14308had to be declared as "def meth(self, (arg1, arg2, ...)): ...".
14309Version 0.9.6 provide better ways to handle both casees, bot provided
14310backward compatibility; version 0.9.8 retracts the compatibility hacks
14311since they also cause confusing behavior if a function is called with
14312the wrong number of arguments.
14313
14314There's a script that helps converting classes that still rely on (b),
14315provided their methods' first argument is called "self":
14316demo/scripts/methfix.py.
14317
14318If this change breaks lots of code you have developed locally, try
14319#defining COMPAT_HACKS in ceval.c.
14320
14321(There's a third compatibility hack, which is the reverse of (a): if a
14322function is defined with two or more arguments, and called with a
14323single argument that is a tuple with just as many arguments, the items
14324of this tuple will be used as the arguments. Although this can (and
14325should!) be done using the built-in function apply() instead, it isn't
14326withdrawn yet.)
14327
14328
14329One minor change: comparing instance methods works like expected, so
14330that if x is an instance of a user-defined class and has a method m,
14331then (x.m==x.m) yields 1.
14332
14333
14334The following was already present in 0.9.7beta, but not explicitly
14335mentioned in the NEWS file: user-defined classes can now define types
14336that behave in almost allrespects like numbers. See
14337demo/classes/Rat.py for a simple example.
14338
14339
14340Changes to the build process
14341----------------------------
14342
14343The Configure.py script and the Makefile has been made somewhat more
14344bullet-proof, after reports of (minor) trouble on certain platforms.
14345
14346There is now a script to patch Makefile and config.c to add a new
14347optional built-in module: Addmodule.sh. Read the script before using!
14348
14349Useing Addmodule.sh, all optional modules can now be configured at
14350compile time using Configure.py, so there are no modules left that
14351require dynamic loading.
14352
14353The Makefile has been fixed to make it easier to use with the VPATH
14354feature of some Make versions (e.g. SunOS).
14355
14356
14357Changes affecting portability
14358-----------------------------
14359
14360Several minor portability problems have been solved, e.g. "malloc.h"
14361has been renamed to "mymalloc.h", "strdup.c" is no longer used, and
14362the system now tolerates malloc(0) returning 0.
14363
14364For dynamic loading on the SGI, Jack Jansen's dl 1.6 is now
14365distributed with Python. This solves several minor problems, in
14366particular scripts invoked using #! can now use dynamic loading.
14367
14368
14369Changes to the interpreter interface
14370------------------------------------
14371
14372On popular demand, there's finally a "profile" feature for interactive
14373use of the interpreter. If the environment variable $PYTHONSTARTUP is
14374set to the name of an existing file, Python statements in this file
14375are executed when the interpreter is started in interactive mode.
14376
14377There is a new clean-up mechanism, complementing try...finally: if you
14378assign a function object to sys.exitfunc, it will be called when
14379Python exits or receives a SIGTERM or SIGHUP signal.
14380
14381The interpreter is now generally assumed to live in
14382/usr/local/bin/python (as opposed to /usr/local/python). The script
14383demo/scripts/fixps.py will update old scripts in place (you can easily
14384modify it to do other similar changes).
14385
14386Most I/O that uses sys.stdin/stdout/stderr will now use any object
14387assigned to those names as long as the object supports readline() or
14388write() methods.
14389
14390The parser stack has been increased to 500 to accommodate more
14391complicated expressions (7 levels used to be the practical maximum,
14392it's now about 38).
14393
14394The limit on the size of the *run-time* stack has completely been
14395removed -- this means that tuple or list displays can contain any
14396number of elements (formerly more than 50 would crash the
14397interpreter).
14398
14399
14400Changes to existing built-in functions and methods
14401--------------------------------------------------
14402
14403The built-in functions int(), long(), float(), oct() and hex() now
14404also apply to class instalces that define corresponding methods
14405(__int__ etc.).
14406
14407
14408New built-in functions
14409----------------------
14410
14411The new functions str() and repr() convert any object to a string.
14412The function repr(x) is in all respects equivalent to `x` -- some
14413people prefer a function for this. The function str(x) does the same
14414except if x is already a string -- then it returns x unchanged
14415(repr(x) adds quotes and escapes "funny" characters as octal escapes).
14416
14417The new function cmp(x, y) returns -1 if x<y, 0 if x==y, 1 if x>y.
14418
14419
14420Changes to general built-in modules
14421-----------------------------------
14422
14423The time module's functions are more general: time() returns a
14424floating point number and sleep() accepts one. Their accuracies
14425depends on the precision of the system clock. Millisleep is no longer
14426needed (although it still exists for now), but millitimer is still
14427needed since on some systems wall clock time is only available with
14428seconds precision, while a source of more precise time exists that
14429isn't synchronized with the wall clock. (On UNIX systems that support
14430the BSD gettimeofday() function, time.time() is as time.millitimer().)
14431
14432The string representation of a file object now includes an address:
14433'<file 'filename', mode 'r' at #######>' where ###### is a hex number
14434(the object's address) to make it unique.
14435
14436New functions added to posix: nice(), setpgrp(), and if your system
14437supports them: setsid(), setpgid(), tcgetpgrp(), tcsetpgrp().
14438
14439Improvements to the socket module: socket objects have new methods
14440getpeername() and getsockname(), and the {get,set}sockopt methods can
14441now get/set any kind of option using strings built with the new struct
14442module. And there's a new function fromfd() which creates a socket
14443object given a file descriptor (useful for servers started by inetd,
14444which have a socket connected to stdin and stdout).
14445
14446
14447Changes to SGI-specific built-in modules
14448----------------------------------------
14449
14450The FORMS library interface (fl) now requires FORMS 2.1a. Some new
14451functions have been added and some bugs have been fixed.
14452
14453Additions to al (audio library interface): added getname(),
14454getdefault() and getminmax().
14455
14456The gl modules doesn't call "foreground()" when initialized (this
14457caused some problems) like it dit in 0.9.7beta (but not before).
14458There's a new gl function 'gversion() which returns a version string.
14459
14460The interface to sv (Indigo video interface) has totally changed.
14461(Sorry, still no documentation, but see the examples in
14462demo/sgi/{sv,video}.)
14463
14464
14465Changes to standard library modules
14466-----------------------------------
14467
14468Most functions in module string are now much faster: they're actually
14469implemented in C. The module containing the C versions is called
14470"strop" but you should still import "string" since strop doesn't
14471provide all the interfaces defined in string (and strop may be renamed
14472to string when it is complete in a future release).
14473
14474string.index() now accepts an optional third argument giving an index
14475where to start searching in the first argument, so you can find second
14476and further occurrences (this is similar to the regular expression
14477functions in regex).
14478
14479The definition of what string.splitfields(anything, '') should return
14480is changed for the last time: it returns a singleton list containing
14481its whole first argument unchanged. This is compatible with
14482regsub.split() which also ignores empty delimiter matches.
14483
14484posixpath, macpath: added dirname() and normpath() (and basename() to
14485macpath).
14486
14487The mainloop module (for use with stdwin) can now demultiplex input
14488from other sources, as long as they can be polled with select().
14489
14490
14491New built-in modules
14492--------------------
14493
14494Module struct defines functions to pack/unpack values to/from strings
14495representing binary values in native byte order.
14496
14497Module strop implements C versions of many functions from string (see
14498above).
14499
14500Optional module fcntl defines interfaces to fcntl() and ioctl() --
14501UNIX only. (Not yet properly documented -- see however src/fcntl.doc.)
14502
14503Optional module mpz defines an interface to an altaernative long
14504integer implementation, the GNU MPZ library.
14505
14506Optional module md5 uses the GNU MPZ library to calculate MD5
14507signatures of strings.
14508
14509There are also optional new modules specific to SGI machines: imageop
14510defines some simple operations to images represented as strings; sv
14511interfaces to the Indigo video board; cl interfaces to the (yet
14512unreleased) compression library.
14513
14514
14515New standard library modules
14516----------------------------
14517
14518(Unfortunately the following modules are not all documented; read the
14519sources to find out more about them!)
14520
14521autotest: run testall without showing any output unless it differs
14522from the expected output
14523
14524bisect: use bisection to insert or find an item in a sorted list
14525
14526colorsys: defines conversions between various color systems (e.g. RGB
14527<-> YUV)
14528
14529nntplib: a client interface to NNTP servers
14530
14531pipes: utility to construct pipeline from templates, e.g. for
14532conversion from one file format to another using several utilities.
14533
14534regsub: contains three functions that are more or less compatible with
14535awk functions of the same name: sub() and gsub() do string
14536substitution, split() splits a string using a regular expression to
14537define how separators are define.
14538
14539test_types: test operations on the built-in types of Python
14540
14541toaiff: convert various audio file formats to AIFF format
14542
14543tzparse: parse the TZ environment parameter (this may be less general
14544than it could be, let me know if you fix it).
14545
14546(Note that the obsolete module "path" no longer exists.)
14547
14548
14549New SGI-specific library modules
14550--------------------------------
14551
14552CL: constants for use with the built-in compression library interface (cl)
14553
14554Queue: a multi-producer, multi-consumer queue class implemented for
14555use with the built-in thread module
14556
14557SOCKET: constants for use with built-in module socket, e.g. to set/get
14558socket options. This is SGI-specific because the constants to be
14559passed are system-dependent. You can generate a version for your own
14560system by running the script demo/scripts/h2py.py with
14561/usr/include/sys/socket.h as input.
14562
Walter Dörwaldf0dfc7a2003-10-20 14:01:56 +000014563cddb: interface to the database used by the CD player
Guido van Rossuma7925f11994-01-26 10:20:16 +000014564
14565torgb: convert various image file types to rgb format (requires pbmplus)
14566
14567
14568New demos
14569---------
14570
14571There's an experimental interface to define Sun RPC clients and
14572servers in demo/rpc.
14573
14574There's a collection of interfaces to WWW, WAIS and Gopher (both
14575Python classes and program providing a user interface) in demo/www.
14576This includes a program texi2html.py which converts texinfo files to
14577HTML files (the format used hy WWW).
14578
14579The ibrowse demo has moved from demo/stdwin/ibrowse to demo/ibrowse.
14580
14581For SGI systems, there's a whole collection of programs and classes
14582that make use of the Indigo video board in demo/sgi/{sv,video}. This
14583represents a significant amount of work that we're giving away!
14584
14585There are demos "rsa" and "md5test" that exercise the mpz and md5
14586modules, respectively. The rsa demo is a complete implementation of
14587the RSA public-key cryptosystem!
14588
14589A bunch of games and examples submitted by Stoffel Erasmus have been
14590included in demo/stoffel.
14591
14592There are miscellaneous new files in some existing demo
14593subdirectories: classes/bitvec.py, scripts/{fixps,methfix}.py,
14594sgi/al/cmpaf.py, sockets/{mcast,gopher}.py.
14595
14596There are also many minor changes to existing files, but I'm too lazy
14597to run a diff and note the differences -- you can do this yourself if
14598you save the old distribution's demos. One highlight: the
14599stdwin/python.py demo is much improved!
14600
14601
14602Changes to the documentation
14603----------------------------
14604
14605The LaTeX source for the library uses different macros to enable it to
14606be converted to texinfo, and from there to INFO or HTML format so it
14607can be browsed as a hypertext. The net result is that you can now
14608read the Python library documentation in Emacs info mode!
14609
14610
14611Changes to the source code that affect C extension writers
14612----------------------------------------------------------
14613
14614The function strdup() no longer exists (it was used only in one places
14615and is somewhat of a a portability problem sice some systems have the
14616same function in their C library.
14617
14618The functions NEW() and RENEW() allocate one spare byte to guard
14619against a NULL return from malloc(0) being taken for an error, but
14620this should not be relied upon.
14621
14622
14623=========================
14624==> Release 0.9.7beta <==
14625=========================
14626
14627
14628Changes to the language proper
14629------------------------------
14630
14631User-defined classes can now implement operations invoked through
14632special syntax, such as x[i] or `x` by defining methods named
14633__getitem__(self, i) or __repr__(self), etc.
14634
14635
14636Changes to the build process
14637----------------------------
14638
14639Instead of extensive manual editing of the Makefile to select
14640compile-time options, you can now run a Configure.py script.
14641The Makefile as distributed builds a minimal interpreter sufficient to
14642run Configure.py. See also misc/BUILD
14643
14644The Makefile now includes more "utility" targets, e.g. install and
14645tags/TAGS
14646
14647Using the provided strtod.c and strtol.c are now separate options, as
14648on the Sun the provided strtod.c dumps core :-(
14649
14650The regex module is now an option chosen by the Makefile, since some
14651(old) C compilers choke on regexpr.c
14652
14653
14654Changes affecting portability
14655-----------------------------
14656
14657You need STDWIN version 0.9.7 (released 30 June 1992) for the stdwin
14658interface
14659
14660Dynamic loading is now supported for Sun (and other non-COFF systems)
14661throug dld-3.2.3, as well as for SGI (a new version of Jack Jansen's
14662DL is out, 1.4)
14663
14664The system-dependent code for the use of the select() system call is
14665moved to one file: myselect.h
14666
14667Thanks to Jaap Vermeulen, the code should now port cleanly to the
14668SEQUENT
14669
14670
14671Changes to the interpreter interface
14672------------------------------------
14673
14674The interpretation of $PYTHONPATH in the environment is different: it
14675is inserted in front of the default path instead of overriding it
14676
14677
14678Changes to existing built-in functions and methods
14679--------------------------------------------------
14680
14681List objects now support an optional argument to their sort() method,
14682which is a comparison function similar to qsort(3) in C
14683
14684File objects now have a method fileno(), used by the new select module
14685(see below)
14686
14687
14688New built-in function
14689---------------------
14690
14691coerce(x, y): take two numbers and return a tuple containing them
14692both converted to a common type
14693
14694
14695Changes to built-in modules
14696---------------------------
14697
14698sys: fixed core dumps in settrace() and setprofile()
14699
14700socket: added socket methods setsockopt() and getsockopt(); and
14701fileno(), used by the new select module (see below)
14702
14703stdwin: added fileno() == connectionnumber(), in support of new module
14704select (see below)
14705
14706posix: added get{eg,eu,g,u}id(); waitpid() is now a separate function.
14707
14708gl: added qgetfd()
14709
14710fl: added several new functions, fixed several obscure bugs, adapted
14711to FORMS 2.1
14712
14713
14714Changes to standard modules
14715---------------------------
14716
14717posixpath: changed implementation of ismount()
14718
14719string: atoi() no longer mistakes leading zero for octal number
14720
14721...
14722
14723
14724New built-in modules
14725--------------------
14726
14727Modules marked "dynamic only" are not configured at compile time but
14728can be loaded dynamically. You need to turn on the DL or DLD option in
14729the Makefile for support dynamic loading of modules (this requires
14730external code).
14731
14732select: interfaces to the BSD select() system call
14733
14734dbm: interfaces to the (new) dbm library (dynamic only)
14735
14736nis: interfaces to some NIS functions (aka yellow pages)
14737
14738thread: limited form of multiple threads (sgi only)
14739
14740audioop: operations useful for audio programs, e.g. u-LAW and ADPCM
14741coding (dynamic only)
14742
14743cd: interface to Indigo SCSI CDROM player audio library (sgi only)
14744
14745jpeg: read files in JPEG format (dynamic only, sgi only; needs
14746external code)
14747
14748imgfile: read SGI image files (dynamic only, sgi only)
14749
14750sunaudiodev: interface to sun's /dev/audio (dynamic only, sun only)
14751
14752sv: interface to Indigo video library (sgi only)
14753
14754pc: a minimal set of MS-DOS interfaces (MS-DOS only)
14755
14756rotor: encryption, by Lance Ellinghouse (dynamic only)
14757
14758
14759New standard modules
14760--------------------
14761
14762Not all these modules are documented. Read the source:
14763lib/<modulename>.py. Sometimes a file lib/<modulename>.doc contains
14764additional documentation.
14765
14766imghdr: recognizes image file headers
14767
14768sndhdr: recognizes sound file headers
14769
14770profile: print run-time statistics of Python code
14771
14772readcd, cdplayer: companion modules for built-in module cd (sgi only)
14773
14774emacs: interface to Emacs using py-connect.el (see below).
14775
14776SOCKET: symbolic constant definitions for socket options
14777
14778SUNAUDIODEV: symbolic constant definitions for sunaudiodef (sun only)
14779
14780SV: symbolic constat definitions for sv (sgi only)
14781
14782CD: symbolic constat definitions for cd (sgi only)
14783
14784
14785New demos
14786---------
14787
14788scripts/pp.py: execute Python as a filter with a Perl-like command
14789line interface
14790
14791classes/: examples using the new class features
14792
14793threads/: examples using the new thread module
14794
14795sgi/cd/: examples using the new cd module
14796
14797
14798Changes to the documentation
14799----------------------------
14800
14801The last-minute syntax changes of release 0.9.6 are now reflected
14802everywhere in the manuals
14803
14804The reference manual has a new section (3.2) on implementing new kinds
14805of numbers, sequences or mappings with user classes
14806
14807Classes are now treated extensively in the tutorial (chapter 9)
14808
14809Slightly restructured the system-dependent chapters of the library
14810manual
14811
14812The file misc/EXTENDING incorporates documentation for mkvalue() and
14813a new section on error handling
14814
14815The files misc/CLASSES and misc/ERRORS are no longer necessary
14816
14817The doc/Makefile now creates PostScript files automatically
14818
14819
14820Miscellaneous changes
14821---------------------
14822
14823Incorporated Tim Peters' changes to python-mode.el, it's now version
148241.06
14825
14826A python/Emacs bridge (provided by Terrence M. Brannon) lets a Python
14827program running in an Emacs buffer execute Emacs lisp code. The
14828necessary Python code is in lib/emacs.py. The Emacs code is
14829misc/py-connect.el (it needs some external Emacs lisp code)
14830
14831
14832Changes to the source code that affect C extension writers
14833----------------------------------------------------------
14834
14835New service function mkvalue() to construct a Python object from C
14836values according to a "format" string a la getargs()
14837
14838Most functions from pythonmain.c moved to new pythonrun.c which is
14839in libpython.a. This should make embedded versions of Python easier
14840
14841ceval.h is split in eval.h (which needs compile.h and only declares
14842eval_code) and ceval.h (which doesn't need compile.hand declares the
14843rest)
14844
14845ceval.h defines macros BGN_SAVE / END_SAVE for use with threads (to
14846improve the parallellism of multi-threaded programs by letting other
14847Python code run when a blocking system call or something similar is
14848made)
14849
14850In structmember.[ch], new member types BYTE, CHAR and unsigned
14851variants have been added
14852
14853New file xxmodule.c is a template for new extension modules.
14854
Guido van Rossumaa253861994-10-06 17:18:57 +000014855
Guido van Rossuma7925f11994-01-26 10:20:16 +000014856==================================
Guido van Rossumf2eac992000-09-04 17:24:24 +000014857==> Release 0.9.6 (6 Apr 1992) <==
Guido van Rossuma7925f11994-01-26 10:20:16 +000014858==================================
14859
14860Misc news in 0.9.6:
14861- Restructured the misc subdirectory
14862- Reference manual completed, library manual much extended (with indexes!)
14863- the GNU Readline library is now distributed standard with Python
14864- the script "../demo/scripts/classfix.py" fixes Python modules using old
14865 class syntax
14866- Emacs python-mode.el (was python.el) vastly improved (thanks, Tim!)
14867- Because of the GNU copyleft business I am not using the GNU regular
14868 expression implementation but a free re-implementation by Tatu Ylonen
14869 that recently appeared in comp.sources.misc (Bravo, Tatu!)
14870
14871New features in 0.9.6:
14872- stricter try stmt syntax: cannot mix except and finally clauses on 1 try
14873- New module 'os' supplants modules 'mac' and 'posix' for most cases;
14874 module 'path' is replaced by 'os.path'
14875- os.path.split() return value differs from that of old path.split()
14876- sys.exc_type, sys.exc_value, sys.exc_traceback are set to the exception
14877 currently being handled
14878- sys.last_type, sys.last_value, sys.last_traceback remember last unhandled
14879 exception
14880- New function string.expandtabs() expands tabs in a string
14881- Added times() interface to posix (user & sys time of process & children)
14882- Added uname() interface to posix (returns OS type, hostname, etc.)
14883- New built-in function execfile() is like exec() but from a file
14884- Functions exec() and eval() are less picky about whitespace/newlines
14885- New built-in functions getattr() and setattr() access arbitrary attributes
14886- More generic argument handling in built-in functions (see "./EXTENDING")
14887- Dynamic loading of modules written in C or C++ (see "./DYNLOAD")
14888- Division and modulo for long and plain integers with negative operands
14889 have changed; a/b is now floor(float(a)/float(b)) and a%b is defined
14890 as a-(a/b)*b. So now the outcome of divmod(a,b) is the same as
14891 (a/b, a%b) for integers. For floats, % is also changed, but of course
14892 / is unchanged, and divmod(x,y) does not yield (x/y, x%y)...
14893- A function with explicit variable-length argument list can be declared
14894 like this: def f(*args): ...; or even like this: def f(a, b, *rest): ...
14895- Code tracing and profiling features have been added, and two source
14896 code debuggers are provided in the library (pdb.py, tty-oriented,
14897 and wdb, window-oriented); you can now step through Python programs!
14898 See sys.settrace() and sys.setprofile(), and "../lib/pdb.doc"
14899- '==' is now the only equality operator; "../demo/scripts/eqfix.py" is
14900 a script that fixes old Python modules
14901- Plain integer right shift now uses sign extension
14902- Long integer shift/mask operations now simulate 2's complement
14903 to give more useful results for negative operands
14904- Changed/added range checks for long/plain integer shifts
14905- Options found after "-c command" are now passed to the command in sys.argv
14906 (note subtle incompatiblity with "python -c command -- -options"!)
14907- Module stdwin is better protected against touching objects after they've
14908 been closed; menus can now also be closed explicitly
14909- Stdwin now uses its own exception (stdwin.error)
14910
14911New features in 0.9.5 (released as Macintosh application only, 2 Jan 1992):
14912- dictionary objects can now be compared properly; e.g., {}=={} is true
14913- new exception SystemExit causes termination if not caught;
14914 it is raised by sys.exit() so that 'finally' clauses can clean up,
14915 and it may even be caught. It does work interactively!
14916- new module "regex" implements GNU Emacs style regular expressions;
14917 module "regexp" is rewritten in Python for backward compatibility
14918- formal parameter lists may contain trailing commas
14919
14920Bugs fixed in 0.9.6:
14921- assigning to or deleting a list item with a negative index dumped core
14922- divmod(-10L,5L) returned (-3L, 5L) instead of (-2L, 0L)
14923
14924Bugs fixed in 0.9.5:
14925- masking operations involving negative long integers gave wrong results
14926
14927
14928===================================
Guido van Rossumf2eac992000-09-04 17:24:24 +000014929==> Release 0.9.4 (24 Dec 1991) <==
Guido van Rossuma7925f11994-01-26 10:20:16 +000014930===================================
14931
14932- new function argument handling (see below)
14933- built-in apply(func, args) means func(args[0], args[1], ...)
14934- new, more refined exceptions
14935- new exception string values (NameError = 'NameError' etc.)
14936- better checking for math exceptions
14937- for sequences (string/tuple/list), x[-i] is now equivalent to x[len(x)-i]
14938- fixed list assignment bug: "a[1:1] = a" now works correctly
14939- new class syntax, without extraneous parentheses
14940- new 'global' statement to assign global variables from within a function
14941
14942
14943New class syntax
14944----------------
14945
14946You can now declare a base class as follows:
14947
14948 class B: # Was: class B():
14949 def some_method(self): ...
14950 ...
14951
14952and a derived class thusly:
14953
14954 class D(B): # Was: class D() = B():
14955 def another_method(self, arg): ...
14956
14957Multiple inheritance looks like this:
14958
14959 class M(B, D): # Was: class M() = B(), D():
14960 def this_or_that_method(self, arg): ...
14961
14962The old syntax is still accepted by Python 0.9.4, but will disappear
14963in Python 1.0 (to be posted to comp.sources).
14964
14965
14966New 'global' statement
14967----------------------
14968
14969Every now and then you have a global variable in a module that you
14970want to change from within a function in that module -- say, a count
14971of calls to a function, or an option flag, etc. Until now this was
14972not directly possible. While several kludges are known that
14973circumvent the problem, and often the need for a global variable can
14974be avoided by rewriting the module as a class, this does not always
14975lead to clearer code.
14976
14977The 'global' statement solves this dilemma. Its occurrence in a
14978function body means that, for the duration of that function, the
14979names listed there refer to global variables. For instance:
14980
14981 total = 0.0
14982 count = 0
14983
14984 def add_to_total(amount):
14985 global total, count
14986 total = total + amount
14987 count = count + 1
14988
14989'global' must be repeated in each function where it is needed. The
14990names listed in a 'global' statement must not be used in the function
14991before the statement is reached.
14992
14993Remember that you don't need to use 'global' if you only want to *use*
14994a global variable in a function; nor do you need ot for assignments to
14995parts of global variables (e.g., list or dictionary items or
14996attributes of class instances). This has not changed; in fact
14997assignment to part of a global variable was the standard workaround.
14998
14999
15000New exceptions
15001--------------
15002
15003Several new exceptions have been defined, to distinguish more clearly
15004between different types of errors.
15005
15006name meaning was
15007
15008AttributeError reference to non-existing attribute NameError
15009IOError unexpected I/O error RuntimeError
15010ImportError import of non-existing module or name NameError
15011IndexError invalid string, tuple or list index RuntimeError
15012KeyError key not in dictionary RuntimeError
15013OverflowError numeric overflow RuntimeError
15014SyntaxError invalid syntax RuntimeError
15015ValueError invalid argument value RuntimeError
15016ZeroDivisionError division by zero RuntimeError
15017
15018The string value of each exception is now its name -- this makes it
15019easier to experimentally find out which operations raise which
15020exceptions; e.g.:
15021
15022 >>> KeyboardInterrupt
15023 'KeyboardInterrupt'
15024 >>>
15025
15026
15027New argument passing semantics
15028------------------------------
15029
15030Off-line discussions with Steve Majewski and Daniel LaLiberte have
15031convinced me that Python's parameter mechanism could be changed in a
15032way that made both of them happy (I hope), kept me happy, fixed a
15033number of outstanding problems, and, given some backward compatibility
15034provisions, would only break a very small amount of existing code --
15035probably all mine anyway. In fact I suspect that most Python users
15036will hardly notice the difference. And yet it has cost me at least
15037one sleepless night to decide to make the change...
15038
15039Philosophically, the change is quite radical (to me, anyway): a
15040function is no longer called with either zero or one argument, which
15041is a tuple if there appear to be more arguments. Every function now
15042has an argument list containing 0, 1 or more arguments. This list is
15043always implemented as a tuple, and it is a (run-time) error if a
15044function is called with a different number of arguments than expected.
15045
15046What's the difference? you may ask. The answer is, very little unless
15047you want to write variadic functions -- functions that may be called
15048with a variable number of arguments. Formerly, you could write a
15049function that accepted one or more arguments with little trouble, but
15050writing a function that could be called with either 0 or 1 argument
15051(or more) was next to impossible. This is now a piece of cake: you
15052can simply declare an argument that receives the entire argument
15053tuple, and check its length -- it will be of size 0 if there are no
15054arguments.
15055
15056Another anomaly of the old system was the way multi-argument methods
15057(in classes) had to be declared, e.g.:
15058
15059 class Point():
15060 def init(self, (x, y, color)): ...
15061 def setcolor(self, color): ...
15062 dev moveto(self, (x, y)): ...
15063 def draw(self): ...
15064
15065Using the new scheme there is no need to enclose the method arguments
15066in an extra set of parentheses, so the above class could become:
15067
15068 class Point:
15069 def init(self, x, y, color): ...
15070 def setcolor(self, color): ...
15071 dev moveto(self, x, y): ...
15072 def draw(self): ...
15073
15074That is, the equivalence rule between methods and functions has
15075changed so that now p.moveto(x,y) is equivalent to Point.moveto(p,x,y)
15076while formerly it was equivalent to Point.moveto(p,(x,y)).
15077
15078A special backward compatibility rule makes that the old version also
15079still works: whenever a function with exactly two arguments (at the top
15080level) is called with more than two arguments, the second and further
15081arguments are packed into a tuple and passed as the second argument.
15082This rule is invoked independently of whether the function is actually a
15083method, so there is a slight chance that some erroneous calls of
15084functions expecting two arguments with more than that number of
15085arguments go undetected at first -- when the function tries to use the
15086second argument it may find it is a tuple instead of what was expected.
15087Note that this rule will be removed from future versions of the
15088language; it is a backward compatibility provision *only*.
15089
15090Two other rules and a new built-in function handle conversion between
15091tuples and argument lists:
15092
15093Rule (a): when a function with more than one argument is called with a
15094single argument that is a tuple of the right size, the tuple's items
15095are used as arguments.
15096
15097Rule (b): when a function with exactly one argument receives no
15098arguments or more than one, that one argument will receive a tuple
15099containing the arguments (the tuple will be empty if there were no
15100arguments).
15101
15102
15103A new built-in function, apply(), was added to support functions that
15104need to call other functions with a constructed argument list. The call
15105
15106 apply(function, tuple)
15107
15108is equivalent to
15109
15110 function(tuple[0], tuple[1], ..., tuple[len(tuple)-1])
15111
15112
15113While no new argument syntax was added in this phase, it would now be
15114quite sensible to add explicit syntax to Python for default argument
15115values (as in C++ or Modula-3), or a "rest" argument to receive the
15116remaining arguments of a variable-length argument list.
15117
15118
15119========================================================
15120==> Release 0.9.3 (never made available outside CWI) <==
15121========================================================
15122
15123- string sys.version shows current version (also printed on interactive entry)
15124- more detailed exceptions, e.g., IOError, ZeroDivisionError, etc.
15125- 'global' statement to declare module-global variables assigned in functions.
15126- new class declaration syntax: class C(Base1, Base2, ...): suite
15127 (the old syntax is still accepted -- be sure to convert your classes now!)
15128- C shifting and masking operators: << >> ~ & ^ | (for ints and longs).
15129- C comparison operators: == != (the old = and <> remain valid).
15130- floating point numbers may now start with a period (e.g., .14).
15131- definition of integer division tightened (always truncates towards zero).
15132- new builtins hex(x), oct(x) return hex/octal string from (long) integer.
15133- new list method l.count(x) returns the number of occurrences of x in l.
15134- new SGI module: al (Indigo and 4D/35 audio library).
15135- the FORMS interface (modules fl and FL) now uses FORMS 2.0
15136- module gl: added lrect{read,write}, rectzoom and pixmode;
15137 added (non-GL) functions (un)packrect.
15138- new socket method: s.allowbroadcast(flag).
15139- many objects support __dict__, __methods__ or __members__.
15140- dir() lists anything that has __dict__.
15141- class attributes are no longer read-only.
15142- classes support __bases__, instances support __class__ (and __dict__).
15143- divmod() now also works for floats.
15144- fixed obscure bug in eval('1 ').
15145
15146
15147===================================
15148==> Release 0.9.2 (Autumn 1991) <==
15149===================================
15150
15151Highlights
15152----------
15153
15154- tutorial now (almost) complete; library reference reorganized
15155- new syntax: continue statement; semicolons; dictionary constructors;
15156 restrictions on blank lines in source files removed
15157- dramatically improved module load time through precompiled modules
15158- arbitrary precision integers: compute 2 to the power 1000 and more...
15159- arithmetic operators now accept mixed type operands, e.g., 3.14/4
15160- more operations on list: remove, index, reverse; repetition
15161- improved/new file operations: readlines, seek, tell, flush, ...
15162- process management added to the posix module: fork/exec/wait/kill etc.
15163- BSD socket operations (with example servers and clients!)
15164- many new STDWIN features (color, fonts, polygons, ...)
15165- new SGI modules: font manager and FORMS library interface
15166
15167
15168Extended list of changes in 0.9.2
15169---------------------------------
15170
15171Here is a summary of the most important user-visible changes in 0.9.2,
15172in somewhat arbitrary order. Changes in later versions are listed in
15173the "highlights" section above.
15174
15175
151761. Changes to the interpreter proper
15177
15178- Simple statements can now be separated by semicolons.
15179 If you write "if t: s1; s2", both s1 and s2 are executed
15180 conditionally.
15181- The 'continue' statement was added, with semantics as in C.
15182- Dictionary displays are now allowed on input: {key: value, ...}.
15183- Blank lines and lines bearing only a comment no longer need to
15184 be indented properly. (A completely empty line still ends a multi-
15185 line statement interactively.)
15186- Mixed arithmetic is supported, 1 compares equal to 1.0, etc.
15187- Option "-c command" to execute statements from the command line
15188- Compiled versions of modules are cached in ".pyc" files, giving a
15189 dramatic improvement of start-up time
15190- Other, smaller speed improvements, e.g., extracting characters from
15191 strings, looking up single-character keys, and looking up global
15192 variables
15193- Interrupting a print operation raises KeyboardInterrupt instead of
15194 only cancelling the print operation
15195- Fixed various portability problems (it now passes gcc with only
15196 warnings -- more Standard C compatibility will be provided in later
15197 versions)
15198- Source is prepared for porting to MS-DOS
15199- Numeric constants are now checked for overflow (this requires
15200 standard-conforming strtol() and strtod() functions; a correct
15201 strtol() implementation is provided, but the strtod() provided
15202 relies on atof() for everything, including error checking
15203
15204
152052. Changes to the built-in types, functions and modules
15206
15207- New module socket: interface to BSD socket primitives
15208- New modules pwd and grp: access the UNIX password and group databases
15209- (SGI only:) New module "fm" interfaces to the SGI IRIX Font Manager
15210- (SGI only:) New module "fl" interfaces to Mark Overmars' FORMS library
15211- New numeric type: long integer, for unlimited precision
15212 - integer constants suffixed with 'L' or 'l' are long integers
15213 - new built-in function long(x) converts int or float to long
15214 - int() and float() now also convert from long integers
15215- New built-in function:
15216 - pow(x, y) returns x to the power y
15217- New operation and methods for lists:
15218 - l*n returns a new list consisting of n concatenated copies of l
15219 - l.remove(x) removes the first occurrence of the value x from l
15220 - l.index(x) returns the index of the first occurrence of x in l
15221 - l.reverse() reverses l in place
15222- New operation for tuples:
15223 - t*n returns a tuple consisting of n concatenated copies of t
15224- Improved file handling:
15225 - f.readline() no longer restricts the line length, is faster,
15226 and isn't confused by null bytes; same for raw_input()
15227 - f.read() without arguments reads the entire (rest of the) file
15228 - mixing of print and sys.stdout.write() has different effect
15229- New methods for files:
15230 - f.readlines() returns a list containing the lines of the file,
15231 as read with f.readline()
15232 - f.flush(), f.tell(), f.seek() call their stdio counterparts
15233 - f.isatty() tests for "tty-ness"
15234- New posix functions:
15235 - _exit(), exec(), fork(), getpid(), getppid(), kill(), wait()
15236 - popen() returns a file object connected to a pipe
15237 - utime() replaces utimes() (the latter is not a POSIX name)
15238- New stdwin features, including:
15239 - font handling
15240 - color drawing
15241 - scroll bars made optional
15242 - polygons
15243 - filled and xor shapes
15244 - text editing objects now have a 'settext' method
15245
15246
152473. Changes to the standard library
15248
15249- Name change: the functions path.cat and macpath.cat are now called
15250 path.join and macpath.join
15251- Added new modules: formatter, mutex, persist, sched, mainloop
15252- Added some modules and functionality to the "widget set" (which is
15253 still under development, so please bear with me):
15254 DirList, FormSplit, TextEdit, WindowSched
15255- Fixed module testall to work non-interactively
15256- Module string:
15257 - added functions join() and joinfields()
15258 - fixed center() to work correct and make it "transitive"
15259- Obsolete modules were removed: util, minmax
15260- Some modules were moved to the demo directory
15261
15262
152634. Changes to the demonstration programs
15264
15265- Added new useful scipts: byteyears, eptags, fact, from, lfact,
15266 objgraph, pdeps, pi, primes, ptags, which
15267- Added a bunch of socket demos
15268- Doubled the speed of ptags
15269- Added new stdwin demos: microedit, miniedit
15270- Added a windowing interface to the Python interpreter: python (most
15271 useful on the Mac)
15272- Added a browser for Emacs info files: demo/stdwin/ibrowse
15273 (yes, I plan to put all STDWIN and Python documentation in texinfo
15274 form in the future)
15275
15276
152775. Other changes to the distribution
15278
15279- An Emacs Lisp file "python.el" is provided to facilitate editing
15280 Python programs in GNU Emacs (slightly improved since posted to
15281 gnu.emacs.sources)
15282- Some info on writing an extension in C is provided
15283- Some info on building Python on non-UNIX platforms is provided
15284
15285
15286=====================================
15287==> Release 0.9.1 (February 1991) <==
15288=====================================
15289
15290- Micro changes only
15291- Added file "patchlevel.h"
15292
15293
15294=====================================
15295==> Release 0.9.0 (February 1991) <==
15296=====================================
15297
15298Original posting to alt.sources.