blob: e5d962e8b1078a1501b5e4bbd1684c8db7c7ab5b [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.
Christian Heimesc3f30c42008-02-22 16:37:40 +00006(Note: news about 2.5c2 and later 2.5 releases is in the Misc/NEWS
7file of the release25-maint branch.)
Guido van Rossum439d1fa1998-12-21 21:41:14 +00008
9
10======================================================================
11
12
Christian Heimesc3f30c42008-02-22 16:37:40 +000013What's New in Python 2.5 release candidate 1?
14=============================================
15
16*Release date: 17-AUG-2006*
17
18Core and builtins
19-----------------
20
21- Unicode objects will no longer raise an exception when being
22 compared equal or unequal to a string and a UnicodeDecodeError
23 exception occurs, e.g. as result of a decoding failure.
24
25 Instead, the equal (==) and unequal (!=) comparison operators will
26 now issue a UnicodeWarning and interpret the two objects as
27 unequal. The UnicodeWarning can be filtered as desired using
28 the warning framework, e.g. silenced completely, turned into an
29 exception, logged, etc.
30
31 Note that compare operators other than equal and unequal will still
32 raise UnicodeDecodeError exceptions as they've always done.
33
34- Fix segfault when doing string formatting on subclasses of long.
35
36- Fix bug related to __len__ functions using values > 2**32 on 64-bit machines
37 with new-style classes.
38
39- Fix bug related to __len__ functions returning negative values with
40 classic classes.
41
42- Patch #1538606, Fix __index__() clipping. There were some problems
43 discovered with the API and how integers that didn't fit into Py_ssize_t
44 were handled. This patch attempts to provide enough alternatives
45 to effectively use __index__.
46
47- Bug #1536021: __hash__ may now return long int; the final hash
48 value is obtained by invoking hash on the long int.
49
50- Bug #1536786: buffer comparison could emit a RuntimeWarning.
51
52- Bug #1535165: fixed a segfault in input() and raw_input() when
53 sys.stdin is closed.
54
55- On Windows, the PyErr_Warn function is now exported from
56 the Python dll again.
57
58- Bug #1191458: tracing over for loops now produces a line event
59 on each iteration. Fixing this problem required changing the .pyc
60 magic number. This means that .pyc files generated before 2.5c1
61 will be regenerated.
62
63- Bug #1333982: string/number constants were inappropriately stored
64 in the byte code and co_consts even if they were not used, ie
65 immediately popped off the stack.
66
67- Fixed a reference-counting problem in property().
68
69
70Library
71-------
72
73- Fix a bug in the ``compiler`` package that caused invalid code to be
74 generated for generator expressions.
75
76- The distutils version has been changed to 2.5.0. The change to
77 keep it programmatically in sync with the Python version running
78 the code (introduced in 2.5b3) has been reverted. It will continue
79 to be maintained manually as static string literal.
80
81- If the Python part of a ctypes callback function returns None,
82 and this cannot be converted to the required C type, an exception is
83 printed with PyErr_WriteUnraisable. Before this change, the C
84 callback returned arbitrary values to the calling code.
85
86- The __repr__ method of a NULL ctypes.py_object() no longer raises
87 an exception.
88
89- uuid.UUID now has a bytes_le attribute. This returns the UUID in
90 little-endian byte order for Windows. In addition, uuid.py gained some
91 workarounds for clocks with low resolution, to stop the code yielding
92 duplicate UUIDs.
93
94- Patch #1540892: site.py Quitter() class attempts to close sys.stdin
95 before raising SystemExit, allowing IDLE to honor quit() and exit().
96
97- Bug #1224621: make tabnanny recognize IndentationErrors raised by tokenize.
98
99- Patch #1536071: trace.py should now find the full module name of a
100 file correctly even on Windows.
101
102- logging's atexit hook now runs even if the rest of the module has
103 already been cleaned up.
104
105- Bug #1112549, fix DoS attack on cgi.FieldStorage.
106
107- Bug #1531405, format_exception no longer raises an exception if
108 str(exception) raised an exception.
109
110- Fix a bug in the ``compiler`` package that caused invalid code to be
111 generated for nested functions.
112
113
114Extension Modules
115-----------------
116
117- Patch #1511317: don't crash on invalid hostname (alias) info.
118
119- Patch #1535500: fix segfault in BZ2File.writelines and make sure it
120 raises the correct exceptions.
121
122- Patch # 1536908: enable building ctypes on OpenBSD/AMD64. The
123 '-no-stack-protector' compiler flag for OpenBSD has been removed.
124
125- Patch #1532975 was applied, which fixes Bug #1533481: ctypes now
126 uses the _as_parameter_ attribute when objects are passed to foreign
127 function calls. The ctypes version number was changed to 1.0.1.
128
129- Bug #1530559, struct.pack raises TypeError where it used to convert.
130 Passing float arguments to struct.pack when integers are expected
131 now triggers a DeprecationWarning.
132
133
134Tests
135-----
136
137- test_socketserver should now work on cygwin and not fail sporadically
138 on other platforms.
139
140- test_mailbox should now work on cygwin versions 2006-08-10 and later.
141
142- Bug #1535182: really test the xreadlines() method of bz2 objects.
143
144- test_threading now skips testing alternate thread stack sizes on
145 platforms that don't support changing thread stack size.
146
147
148Documentation
149-------------
150
151- Patch #1534922: unittest docs were corrected and enhanced.
152
153
154Build
155-----
156
157- Bug #1535502, build _hashlib on Windows, and use masm assembler
158 code in OpenSSL.
159
160- Bug #1534738, win32 debug version of _msi should be _msi_d.pyd.
161
162- Bug #1530448, ctypes build failure on Solaris 10 was fixed.
163
164
165C API
166-----
167
168- New API for Unicode rich comparisons: PyUnicode_RichCompare()
169
170- Bug #1069160. Internal correctness changes were made to
171 ``PyThreadState_SetAsyncExc()``. A test case was added, and
172 the documentation was changed to state that the return value
173 is always 1 (normal) or 0 (if the specified thread wasn't found).
174
175
176What's New in Python 2.5 beta 3?
177================================
178
179*Release date: 03-AUG-2006*
180
181Core and builtins
182-----------------
183
184- _PyWeakref_GetWeakrefCount() now returns a Py_ssize_t; it previously
185 returned a long (see PEP 353).
186
187- Bug #1515471: string.replace() accepts character buffers again.
188
189- Add PyErr_WarnEx() so C code can pass the stacklevel to warnings.warn().
190 This provides the proper warning for struct.pack().
191 PyErr_Warn() is now deprecated in favor of PyErr_WarnEx().
192
193- Patch #1531113: Fix augmented assignment with yield expressions.
194 Also fix a SystemError when trying to assign to yield expressions.
195
196- Bug #1529871: The speed enhancement patch #921466 broke Python's compliance
197 with PEP 302. This was fixed by adding an ``imp.NullImporter`` type that is
198 used in ``sys.path_importer_cache`` to cache non-directory paths and avoid
199 excessive filesystem operations during imports.
200
201- Bug #1521947: When checking for overflow, ``PyOS_strtol()`` used some
202 operations on signed longs that are formally undefined by C.
203 Unfortunately, at least one compiler now cares about that, so complicated
204 the code to make that compiler happy again.
205
206- Bug #1524310: Properly report errors from FindNextFile in os.listdir.
207
208- Patch #1232023: Stop including current directory in search
209 path on Windows.
210
211- Fix some potential crashes found with failmalloc.
212
213- Fix warnings reported by Klocwork's static analysis tool.
214
215- Bug #1512814, Fix incorrect lineno's when code within a function
216 had more than 255 blank lines.
217
218- Patch #1521179: Python now accepts the standard options ``--help`` and
219 ``--version`` as well as ``/?`` on Windows.
220
221- Bug #1520864: unpacking singleton tuples in a 'for' loop (for x, in) works
222 again. Fixing this problem required changing the .pyc magic number.
223 This means that .pyc files generated before 2.5b3 will be regenerated.
224
225- Bug #1524317: Compiling Python ``--without-threads`` failed.
226 The Python core compiles again, and, in a build without threads, the
227 new ``sys._current_frames()`` returns a dictionary with one entry,
228 mapping the faux "thread id" 0 to the current frame.
229
230- Bug #1525447: build on MacOS X on a case-sensitive filesystem.
231
232
233Library
234-------
235
236- Fix #1693149. Now you can pass several modules separated by
237 comma to trace.py in the same --ignore-module option.
238
239- Correction of patch #1455898: In the mbcs decoder, set final=False
240 for stream decoder, but final=True for the decode function.
241
242- os.urandom no longer masks unrelated exceptions like SystemExit or
243 KeyboardInterrupt.
244
245- Bug #1525866: Don't copy directory stat times in
246 shutil.copytree on Windows
247
248- Bug #1002398: The documentation for os.path.sameopenfile now correctly
249 refers to file descriptors, not file objects.
250
251- The renaming of the xml package to xmlcore, and the import hackery done
252 to make it appear at both names, has been removed. Bug #1511497,
253 #1513611, and probably others.
254
255- Bug #1441397: The compiler module now recognizes module and function
256 docstrings correctly as it did in Python 2.4.
257
258- Bug #1529297: The rewrite of doctest for Python 2.4 unintentionally
259 lost that tests are sorted by name before being run. This rarely
260 matters for well-written tests, but can create baffling symptoms if
261 side effects from one test to the next affect outcomes. ``DocTestFinder``
262 has been changed to sort the list of tests it returns.
263
264- The distutils version has been changed to 2.5.0, and is now kept
265 in sync with sys.version_info[:3].
266
267- Bug #978833: Really close underlying socket in _socketobject.close.
268
269- Bug #1459963: urllib and urllib2 now normalize HTTP header names with
270 title().
271
272- Patch #1525766: In pkgutil.walk_packages, correctly pass the onerror callback
273 to recursive calls and call it with the failing package name.
274
275- Bug #1525817: Don't truncate short lines in IDLE's tool tips.
276
277- Patch #1515343: Fix printing of deprecated string exceptions with a
278 value in the traceback module.
279
280- Resync optparse with Optik 1.5.3: minor tweaks for/to tests.
281
282- Patch #1524429: Use repr() instead of backticks in Tkinter again.
283
284- Bug #1520914: Change time.strftime() to accept a zero for any position in its
285 argument tuple. For arguments where zero is illegal, the value is forced to
286 the minimum value that is correct. This is to support an undocumented but
287 common way people used to fill in inconsequential information in the time
288 tuple pre-2.4.
289
290- Patch #1220874: Update the binhex module for Mach-O.
291
292- The email package has improved RFC 2231 support, specifically for
293 recognizing the difference between encoded (name*0*=<blah>) and non-encoded
294 (name*0=<blah>) parameter continuations. This may change the types of
295 values returned from email.message.Message.get_param() and friends.
296 Specifically in some cases where non-encoded continuations were used,
297 get_param() used to return a 3-tuple of (None, None, string) whereas now it
298 will just return the string (since non-encoded continuations don't have
299 charset and language parts).
300
301 Also, whereas % values were decoded in all parameter continuations, they are
302 now only decoded in encoded parameter parts.
303
304- Bug #1517990: IDLE keybindings on MacOS X now work correctly
305
306- Bug #1517996: IDLE now longer shows the default Tk menu when a
307 path browser, class browser or debugger is the frontmost window on MacOS X
308
309- Patch #1520294: Support for getset and member descriptors in types.py,
310 inspect.py, and pydoc.py. Specifically, this allows for querying the type
311 of an object against these built-in types and more importantly, for getting
312 their docstrings printed in the interactive interpreter's help() function.
313
314
315Extension Modules
316-----------------
317
318- Patch #1519025 and bug #926423: If a KeyboardInterrupt occurs during
319 a socket operation on a socket with a timeout, the exception will be
320 caught correctly. Previously, the exception was not caught.
321
322- Patch #1529514: The _ctypes extension is now compiled on more
323 openbsd target platforms.
324
325- The ``__reduce__()`` method of the new ``collections.defaultdict`` had
326 a memory leak, affecting pickles and deep copies.
327
328- Bug #1471938: Fix curses module build problem on Solaris 8; patch by
329 Paul Eggert.
330
331- Patch #1448199: Release interpreter lock in _winreg.ConnectRegistry.
332
333- Patch #1521817: Index range checking on ctypes arrays containing
334 exactly one element enabled again. This allows iterating over these
335 arrays, without the need to check the array size before.
336
337- Bug #1521375: When the code in ctypes.util.find_library was
338 run with root privileges, it could overwrite or delete
339 /dev/null in certain cases; this is now fixed.
340
341- Bug #1467450: On Mac OS X 10.3, RTLD_GLOBAL is now used as the
342 default mode for loading shared libraries in ctypes.
343
344- Because of a misspelled preprocessor symbol, ctypes was always
345 compiled without thread support; this is now fixed.
346
347- pybsddb Bug #1527939: bsddb module DBEnv dbremove and dbrename
348 methods now allow their database parameter to be None as the
349 sleepycat API allows.
350
351- Bug #1526460: Fix socketmodule compile on NetBSD as it has a different
352 bluetooth API compared with Linux and FreeBSD.
353
354Tests
355-----
356
357- Bug #1501330: Change test_ossaudiodev to be much more tolerant in terms of
358 how long the test file should take to play. Now accepts taking 2.93 secs
359 (exact time) +/- 10% instead of the hard-coded 3.1 sec.
360
361- Patch #1529686: The standard tests ``test_defaultdict``, ``test_iterlen``,
362 ``test_uuid`` and ``test_email_codecs`` didn't actually run any tests when
363 run via ``regrtest.py``. Now they do.
364
365Build
366-----
367
368- Bug #1439538: Drop usage of test -e in configure as it is not portable.
369
370Mac
371---
372
373- PythonLauncher now works correctly when the path to the script contains
374 characters that are treated specially by the shell (such as quotes).
375
376- Bug #1527397: PythonLauncher now launches scripts with the working directory
377 set to the directory that contains the script instead of the user home
378 directory. That latter was an implementation accident and not what users
379 expect.
380
381
382What's New in Python 2.5 beta 2?
383================================
384
385*Release date: 11-JUL-2006*
386
387Core and builtins
388-----------------
389
390- Bug #1441486: The literal representation of -(sys.maxint - 1)
391 again evaluates to a int object, not a long.
392
393- Bug #1501934: The scope of global variables that are locally assigned
394 using augmented assignment is now correctly determined.
395
396- Bug #927248: Recursive method-wrapper objects can now safely
397 be released.
398
399- Bug #1417699: Reject locale-specific decimal point in float()
400 and atof().
401
402- Bug #1511381: codec_getstreamcodec() in codec.c is corrected to
403 omit a default "error" argument for NULL pointer. This allows
404 the parser to take a codec from cjkcodecs again.
405
406- Bug #1519018: 'as' is now validated properly in import statements.
407
408- On 64 bit systems, int literals that use less than 64 bits are
409 now ints rather than longs.
410
411- Bug #1512814, Fix incorrect lineno's when code at module scope
412 started after line 256.
413
414- New function ``sys._current_frames()`` returns a dict mapping thread
415 id to topmost thread stack frame. This is for expert use, and is
416 especially useful for debugging application deadlocks. The functionality
417 was previously available in Fazal Majid's ``threadframe`` extension
418 module, but it wasn't possible to do this in a wholly threadsafe way from
419 an extension.
420
421Library
422-------
423
424- Bug #1257728: Mention Cygwin in distutils error message about a missing
425 VS 2003.
426
427- Patch #1519566: Update turtle demo, make begin_fill idempotent.
428
429- Bug #1508010: msvccompiler now requires the DISTUTILS_USE_SDK
430 environment variable to be set in order to the SDK environment
431 for finding the compiler, include files, etc.
432
433- Bug #1515998: Properly generate logical ids for files in bdist_msi.
434
435- warnings.py now ignores ImportWarning by default
436
437- string.Template() now correctly handles tuple-values. Previously,
438 multi-value tuples would raise an exception and single-value tuples would
439 be treated as the value they contain, instead.
440
441- Bug #822974: Honor timeout in telnetlib.{expect,read_until}
442 even if some data are received.
443
444- Bug #1267547: Put proper recursive setup.py call into the
445 spec file generated by bdist_rpm.
446
447- Bug #1514693: Update turtle's heading when switching between
448 degrees and radians.
449
450- Reimplement turtle.circle using a polyline, to allow correct
451 filling of arcs.
452
453- Bug #1514703: Only setup canvas window in turtle when the canvas
454 is created.
455
456- Bug #1513223: .close() of a _socketobj now releases the underlying
457 socket again, which then gets closed as it becomes unreferenced.
458
459- Bug #1504333: Make sgmllib support angle brackets in quoted
460 attribute values.
461
462- Bug #853506: Fix IPv6 address parsing in unquoted attributes in
463 sgmllib ('[' and ']' were not accepted).
464
465- Fix a bug in the turtle module's end_fill function.
466
467- Bug #1510580: The 'warnings' module improperly required that a Warning
468 category be either a types.ClassType and a subclass of Warning. The proper
469 check is just that it is a subclass with Warning as the documentation states.
470
471- The compiler module now correctly compiles the new try-except-finally
472 statement (bug #1509132).
473
474- The wsgiref package is now installed properly on Unix.
475
476- A bug was fixed in logging.config.fileConfig() which caused a crash on
477 shutdown when fileConfig() was called multiple times.
478
479- The sqlite3 module did cut off data from the SQLite database at the first
480 null character before sending it to a custom converter. This has been fixed
481 now.
482
483Extension Modules
484-----------------
485
486- #1494314: Fix a regression with high-numbered sockets in 2.4.3. This
487 means that select() on sockets > FD_SETSIZE (typically 1024) work again.
488 The patch makes sockets use poll() internally where available.
489
490- Assigning None to pointer type fields in ctypes structures possible
491 overwrote the wrong fields, this is fixed now.
492
493- Fixed a segfault in _ctypes when ctypes.wintypes were imported
494 on non-Windows platforms.
495
496- Bug #1518190: The ctypes.c_void_p constructor now accepts any
497 integer or long, without range checking.
498
499- Patch #1517790: It is now possible to use custom objects in the ctypes
500 foreign function argtypes sequence as long as they provide a from_param
501 method, no longer is it required that the object is a ctypes type.
502
503- The '_ctypes' extension module now works when Python is configured
504 with the --without-threads option.
505
506- Bug #1513646: os.access on Windows now correctly determines write
507 access, again.
508
509- Bug #1512695: cPickle.loads could crash if it was interrupted with
510 a KeyboardInterrupt.
511
512- Bug #1296433: parsing XML with a non-default encoding and
513 a CharacterDataHandler could crash the interpreter in pyexpat.
514
515- Patch #1516912: improve Modules support for OpenVMS.
516
517Build
518-----
519
520- Automate Windows build process for the Win64 SSL module.
521
522- 'configure' now detects the zlib library the same way as distutils.
523 Previously, the slight difference could cause compilation errors of the
524 'zlib' module on systems with more than one version of zlib.
525
526- The MSI compileall step was fixed to also support a TARGETDIR
527 with spaces in it.
528
529- Bug #1517388: sqlite3.dll is now installed on Windows independent
530 of Tcl/Tk.
531
532- Bug #1513032: 'make install' failed on FreeBSD 5.3 due to lib-old
533 trying to be installed even though it's empty.
534
535Tests
536-----
537
538- Call os.waitpid() at the end of tests that spawn child processes in order
539 to minimize resources (zombies).
540
541Documentation
542-------------
543
544- Cover ImportWarning, PendingDeprecationWarning and simplefilter() in the
545 documentation for the warnings module.
546
547- Patch #1509163: MS Toolkit Compiler no longer available.
548
549- Patch #1504046: Add documentation for xml.etree.
550
551
552What's New in Python 2.5 beta 1?
553================================
554
555*Release date: 20-JUN-2006*
556
557Core and builtins
558-----------------
559
560- Patch #1507676: Error messages returned by invalid abstract object operations
561 (such as iterating over an integer) have been improved and now include the
562 type of the offending object to help with debugging.
563
564- Bug #992017: A classic class that defined a __coerce__() method that returned
565 its arguments swapped would infinitely recurse and segfault the interpreter.
566
567- Fix the socket tests so they can be run concurrently.
568
569- Removed 5 integers from C frame objects (PyFrameObject).
570 f_nlocals, f_ncells, f_nfreevars, f_stack_size, f_restricted.
571
572- Bug #532646: object.__call__() will continue looking for the __call__
573 attribute on objects until one without one is found. This leads to recursion
574 when you take a class and set its __call__ attribute to an instance of the
575 class. Originally fixed for classic classes, but this fix is for new-style.
576 Removes the infinite_rec_3 crasher.
577
578- The string and unicode methods startswith() and endswith() now accept
579 a tuple of prefixes/suffixes to look for. Implements RFE #1491485.
580
581- Buffer objects, at the C level, never used the char buffer
582 implementation even when the char buffer for the wrapped object was
583 explicitly requested (originally returned the read or write buffer).
584 Now a TypeError is raised if the char buffer is not present but is
585 requested.
586
587- Patch #1346214: Statements like "if 0: suite" are now again optimized
588 away like they were in Python 2.4.
589
590- Builtin exceptions are now full-blown new-style classes instead of
591 instances pretending to be classes, which speeds up exception handling
592 by about 80% in comparison to 2.5a2.
593
594- Patch #1494554: Update unicodedata.numeric and unicode.isnumeric to
595 Unicode 4.1.
596
597- Patch #921466: sys.path_importer_cache is now used to cache valid and
598 invalid file paths for the built-in import machinery which leads to
599 fewer open calls on startup.
600
601- Patch #1442927: ``long(str, base)`` is now up to 6x faster for non-power-
602 of-2 bases. The largest speedup is for inputs with about 1000 decimal
603 digits. Conversion from non-power-of-2 bases remains quadratic-time in
604 the number of input digits (it was and remains linear-time for bases
605 2, 4, 8, 16 and 32).
606
607- Bug #1334662: ``int(string, base)`` could deliver a wrong answer
608 when ``base`` was not 2, 4, 8, 10, 16 or 32, and ``string`` represented
609 an integer close to ``sys.maxint``. This was repaired by patch
610 #1335972, which also gives a nice speedup.
611
612- Patch #1337051: reduced size of frame objects.
613
614- PyErr_NewException now accepts a tuple of base classes as its
615 "base" parameter.
616
617- Patch #876206: function call speedup by retaining allocated frame
618 objects.
619
620- Bug #1462152: file() now checks more thoroughly for invalid mode
621 strings and removes a possible "U" before passing the mode to the
622 C library function.
623
624- Patch #1488312, Fix memory alignment problem on SPARC in unicode
625
626- Bug #1487966: Fix SystemError with conditional expression in assignment
627
628- WindowsError now has two error code attributes: errno, which carries
629 the error values from errno.h, and winerror, which carries the error
630 values from winerror.h. Previous versions put the winerror.h values
631 (from GetLastError()) into the errno attribute.
632
633- Patch #1475845: Raise IndentationError for unexpected indent.
634
635- Patch #1479181: split open() and file() from being aliases for each other.
636
637- Patch #1497053 & bug #1275608: Exceptions occurring in ``__eq__()``
638 methods were always silently ignored by dictionaries when comparing keys.
639 They are now passed through (except when using the C API function
640 ``PyDict_GetItem()``, whose semantics did not change).
641
642- Bug #1456209: In some obscure cases it was possible for a class with a
643 custom ``__eq__()`` method to confuse dict internals when class instances
644 were used as a dict's keys and the ``__eq__()`` method mutated the dict.
645 No, you don't have any code that did this ;-)
646
647Extension Modules
648-----------------
649
650- Bug #1295808: expat symbols should be namespaced in pyexpat
651
652- Patch #1462338: Upgrade pyexpat to expat 2.0.0
653
654- Change binascii.hexlify to accept a read-only buffer instead of only a char
655 buffer and actually follow its documentation.
656
657- Fixed a potentially invalid memory access of CJKCodecs' shift-jis decoder.
658
659- Patch #1478788 (modified version): The functional extension module has
660 been renamed to _functools and a functools Python wrapper module added.
661 This provides a home for additional function related utilities that are
662 not specifically about functional programming. See PEP 309.
663
664- Patch #1493701: performance enhancements for struct module.
665
666- Patch #1490224: time.altzone is now set correctly on Cygwin.
667
668- Patch #1435422: zlib's compress and decompress objects now have a
669 copy() method.
670
671- Patch #1454481: thread stack size is now tunable at runtime for thread
672 enabled builds on Windows and systems with Posix threads support.
673
674- On Win32, os.listdir now supports arbitrarily-long Unicode path names
675 (up to the system limit of 32K characters).
676
677- Use Win32 API to implement os.{access,chdir,chmod,mkdir,remove,rename,rmdir,utime}.
678 As a result, these functions now raise WindowsError instead of OSError.
679
680- ``time.clock()`` on Win64 should use the high-performance Windows
681 ``QueryPerformanceCounter()`` now (as was already the case on 32-bit
682 Windows platforms).
683
684- Calling Tk_Init twice is refused if the first call failed as that
685 may deadlock.
686
687- bsddb: added the DB_ARCH_REMOVE flag and fixed db.DBEnv.log_archive() to
688 accept it without potentially using an uninitialized pointer.
689
690- bsddb: added support for the DBEnv.log_stat() and DBEnv.lsn_reset() methods
691 assuming BerkeleyDB >= 4.0 and 4.4 respectively. [pybsddb project SF
692 patch numbers 1494885 and 1494902]
693
694- bsddb: added an interface for the BerkeleyDB >= 4.3 DBSequence class.
695 [pybsddb project SF patch number 1466734]
696
697- bsddb: fix DBCursor.pget() bug with keyword argument names when no data
698 parameter is supplied. [SF pybsddb bug #1477863]
699
700- bsddb: the __len__ method of a DB object has been fixed to return correct
701 results. It could previously incorrectly return 0 in some cases.
702 Fixes SF bug 1493322 (pybsddb bug 1184012).
703
704- bsddb: the bsddb.dbtables Modify method now raises the proper error and
705 aborts the db transaction safely when a modifier callback fails.
706 Fixes SF python patch/bug #1408584.
707
708- bsddb: multithreaded DB access using the simple bsddb module interface
709 now works reliably. It has been updated to use automatic BerkeleyDB
710 deadlock detection and the bsddb.dbutils.DeadlockWrap wrapper to retry
711 database calls that would previously deadlock. [SF python bug #775414]
712
713- Patch #1446489: add support for the ZIP64 extensions to zipfile.
714
715- Patch #1506645: add Python wrappers for the curses functions
716 is_term_resized, resize_term and resizeterm.
717
718Library
719-------
720
721- Patch #815924: Restore ability to pass type= and icon= in tkMessageBox
722 functions.
723
724- Patch #812986: Update turtle output even if not tracing.
725
726- Patch #1494750: Destroy master after deleting children in
727 Tkinter.BaseWidget.
728
729- Patch #1096231: Add ``default`` argument to Tkinter.Wm.wm_iconbitmap.
730
731- Patch #763580: Add name and value arguments to Tkinter variable
732 classes.
733
734- Bug #1117556: SimpleHTTPServer now tries to find and use the system's
735 mime.types file for determining MIME types.
736
737- Bug #1339007: Shelf objects now don't raise an exception in their
738 __del__ method when initialization failed.
739
740- Patch #1455898: The MBCS codec now supports the incremental mode for
741 double-byte encodings.
742
743- ``difflib``'s ``SequenceMatcher.get_matching_blocks()`` was changed to
744 guarantee that adjacent triples in the return list always describe
745 non-adjacent blocks. Previously, a pair of matching blocks could end
746 up being described by multiple adjacent triples that formed a partition
747 of the matching pair.
748
749- Bug #1498146: fix optparse to handle Unicode strings in option help,
750 description, and epilog.
751
752- Bug #1366250: minor optparse documentation error.
753
754- Bug #1361643: fix textwrap.dedent() so it handles tabs appropriately;
755 clarify docs.
756
757- The wsgiref package has been added to the standard library.
758
759- The functions update_wrapper() and wraps() have been added to the functools
760 module. These make it easier to copy relevant metadata from the original
761 function when writing wrapper functions.
762
763- The optional ``isprivate`` argument to ``doctest.testmod()``, and the
764 ``doctest.is_private()`` function, both deprecated in 2.4, were removed.
765
766- Patch #1359618: Speed up charmap encoder by using a trie structure
767 for lookup.
768
769- The functions in the ``pprint`` module now sort dictionaries by key
770 before computing the display. Before 2.5, ``pprint`` sorted a dictionary
771 if and only if its display required more than one line, although that
772 wasn't documented. The new behavior increases predictability; e.g.,
773 using ``pprint.pprint(a_dict)`` in a doctest is now reliable.
774
775- Patch #1497027: try HTTP digest auth before basic auth in urllib2
776 (thanks for J. J. Lee).
777
778- Patch #1496206: improve urllib2 handling of passwords with respect to
779 default HTTP and HTTPS ports.
780
781- Patch #1080727: add "encoding" parameter to doctest.DocFileSuite.
782
783- Patch #1281707: speed up gzip.readline.
784
785- Patch #1180296: Two new functions were added to the locale module:
786 format_string() to get the effect of "format % items" but locale-aware,
787 and currency() to format a monetary number with currency sign.
788
789- Patch #1486962: Several bugs in the turtle Tk demo module were fixed
790 and several features added, such as speed and geometry control.
791
792- Patch #1488881: add support for external file objects in bz2 compressed
793 tarfiles.
794
795- Patch #721464: pdb.Pdb instances can now be given explicit stdin and
796 stdout arguments, making it possible to redirect input and output
797 for remote debugging.
798
799- Patch #1484695: Update the tarfile module to version 0.8. This fixes
800 a couple of issues, notably handling of long file names using the
801 GNU LONGNAME extension.
802
803- Patch #1478292. ``doctest.register_optionflag(name)`` shouldn't create a
804 new flag when ``name`` is already the name of an option flag.
805
806- Bug #1385040: don't allow "def foo(a=1, b): pass" in the compiler
807 package.
808
809- Patch #1472854: make the rlcompleter.Completer class usable on non-
810 UNIX platforms.
811
812- Patch #1470846: fix urllib2 ProxyBasicAuthHandler.
813
814- Bug #1472827: correctly escape newlines and tabs in attribute values in
815 the saxutils.XMLGenerator class.
816
817
818Build
819-----
820
821- Bug #1502728: Correctly link against librt library on HP-UX.
822
823- OpenBSD 3.9 is supported now.
824
825- Patch #1492356: Port to Windows CE.
826
827- Bug/Patch #1481770: Use .so extension for shared libraries on HP-UX for ia64.
828
829- Patch #1471883: Add --enable-universalsdk.
830
831C API
832-----
833
834Tests
835-----
836
837Tools
838-----
839
840Documentation
841-------------
842
843
844
845What's New in Python 2.5 alpha 2?
846=================================
847
848*Release date: 27-APR-2006*
849
850Core and builtins
851-----------------
852
853- Bug #1465834: 'bdist_wininst preinstall script support' was fixed
854 by converting these apis from macros into exported functions again:
855
856 PyParser_SimpleParseFile PyParser_SimpleParseString PyRun_AnyFile
857 PyRun_AnyFileEx PyRun_AnyFileFlags PyRun_File PyRun_FileEx
858 PyRun_FileFlags PyRun_InteractiveLoop PyRun_InteractiveOne
859 PyRun_SimpleFile PyRun_SimpleFileEx PyRun_SimpleString
860 PyRun_String Py_CompileString
861
862- Under COUNT_ALLOCS, types are not necessarily immortal anymore.
863
864- All uses of PyStructSequence_InitType have been changed to initialize
865 the type objects only once, even if the interpreter is initialized
866 multiple times.
867
868- Bug #1454485, array.array('u') could crash the interpreter. This was
869 due to PyArgs_ParseTuple(args, 'u#', ...) trying to convert buffers (strings)
870 to unicode when it didn't make sense. 'u#' now requires a unicode string.
871
872- Py_UNICODE is unsigned. It was always documented as unsigned, but
873 due to a bug had a signed value in previous versions.
874
875- Patch #837242: ``id()`` of any Python object always gives a positive
876 number now, which might be a long integer. ``PyLong_FromVoidPtr`` and
877 ``PyLong_AsVoidPtr`` have been changed accordingly. Note that it has
878 never been correct to implement a ``__hash()__`` method that returns the
879 ``id()`` of an object:
880
881 def __hash__(self):
882 return id(self) # WRONG
883
884 because a hash result must be a (short) Python int but it was always
885 possible for ``id()`` to return a Python long. However, because ``id()``
886 could return negative values before, on a 32-bit box an ``id()`` result
887 was always usable as a hash value before this patch. That's no longer
888 necessarily so.
889
890- Python on OS X 10.3 and above now uses dlopen() (via dynload_shlib.c)
891 to load extension modules and now provides the dl module. As a result,
892 sys.setdlopenflags() now works correctly on these systems. (SF patch
893 #1454844)
894
895- Patch #1463867: enhanced garbage collection to allow cleanup of cycles
896 involving generators that have paused outside of any ``try`` or ``with``
897 blocks. (In 2.5a1, a paused generator that was part of a reference
898 cycle could not be garbage collected, regardless of whether it was
899 paused in a ``try`` or ``with`` block.)
900
901Extension Modules
902-----------------
903
904- Patch #1191065: Fix preprocessor problems on systems where recvfrom
905 is a macro.
906
907- Bug #1467952: os.listdir() now correctly raises an error if readdir()
908 fails with an error condition.
909
910- Fixed bsddb.db.DBError derived exceptions so they can be unpickled.
911
912- Bug #1117761: bsddb.*open() no longer raises an exception when using
913 the cachesize parameter.
914
915- Bug #1149413: bsddb.*open() no longer raises an exception when using
916 a temporary db (file=None) with the 'n' flag to truncate on open.
917
918- Bug #1332852: bsddb module minimum BerkeleyDB version raised to 3.3
919 as older versions cause excessive test failures.
920
921- Patch #1062014: AF_UNIX sockets under Linux have a special
922 abstract namespace that is now fully supported.
923
924Library
925-------
926
927- Bug #1223937: subprocess.CalledProcessError reports the exit status
928 of the process using the returncode attribute, instead of
929 abusing errno.
930
931- Patch #1475231: ``doctest`` has a new ``SKIP`` option, which causes
932 a doctest to be skipped (the code is not run, and the expected output
933 or exception is ignored).
934
935- Fixed contextlib.nested to cope with exceptions being raised and
936 caught inside exit handlers.
937
938- Updated optparse module to Optik 1.5.1 (allow numeric constants in
939 hex, octal, or binary; add ``append_const`` action; keep going if
940 gettext cannot be imported; added ``OptionParser.destroy()`` method;
941 added ``epilog`` for better help generation).
942
943- Bug #1473760: ``tempfile.TemporaryFile()`` could hang on Windows, when
944 called from a thread spawned as a side effect of importing a module.
945
946- The pydoc module now supports documenting packages contained in
947 .zip or .egg files.
948
949- The pkgutil module now has several new utility functions, such
950 as ``walk_packages()`` to support working with packages that are either
951 in the filesystem or zip files.
952
953- The mailbox module can now modify and delete messages from
954 mailboxes, in addition to simply reading them. Thanks to Gregory
955 K. Johnson for writing the code, and to the 2005 Google Summer of
956 Code for funding his work.
957
958- The ``__del__`` method of class ``local`` in module ``_threading_local``
959 returned before accomplishing any of its intended cleanup.
960
961- Patch #790710: Add breakpoint command lists in pdb.
962
963- Patch #1063914: Add Tkinter.Misc.clipboard_get().
964
965- Patch #1191700: Adjust column alignment in bdb breakpoint lists.
966
967- SimpleXMLRPCServer relied on the fcntl module, which is unavailable on
968 Windows. Bug #1469163.
969
970- The warnings, linecache, inspect, traceback, site, and doctest modules
971 were updated to work correctly with modules imported from zipfiles or
972 via other PEP 302 __loader__ objects.
973
974- Patch #1467770: Reduce usage of subprocess._active to processes which
975 the application hasn't waited on.
976
977- Patch #1462222: Fix Tix.Grid.
978
979- Fix exception when doing glob.glob('anything*/')
980
981- The pstats.Stats class accepts an optional stream keyword argument to
982 direct output to an alternate file-like object.
983
984Build
985-----
986
987- The Makefile now has a reindent target, which runs reindent.py on
988 the library.
989
990- Patch #1470875: Building Python with MS Free Compiler
991
992- Patch #1161914: Add a python-config script.
993
994- Patch #1324762:Remove ccpython.cc; replace --with-cxx with
995 --with-cxx-main. Link with C++ compiler only if --with-cxx-main was
996 specified. (Can be overridden by explicitly setting LINKCC.) Decouple
997 CXX from --with-cxx-main, see description in README.
998
999- Patch #1429775: Link extension modules with the shared libpython.
1000
1001- Fixed a libffi build problem on MIPS systems.
1002
1003- ``PyString_FromFormat``, ``PyErr_Format``, and ``PyString_FromFormatV``
1004 now accept formats "%u" for unsigned ints, "%lu" for unsigned longs,
1005 and "%zu" for unsigned integers of type ``size_t``.
1006
1007Tests
1008-----
1009
1010- test_contextlib now checks contextlib.nested can cope with exceptions
1011 being raised and caught inside exit handlers.
1012
1013- test_cmd_line now checks operation of the -m and -c command switches
1014
1015- The test_contextlib test in 2.5a1 wasn't actually run unless you ran
1016 it separately and by hand. It also wasn't cleaning up its changes to
1017 the current Decimal context.
1018
1019- regrtest.py now has a -M option to run tests that test the new limits of
1020 containers, on 64-bit architectures. Running these tests is only sensible
1021 on 64-bit machines with more than two gigabytes of memory. The argument
1022 passed is the maximum amount of memory for the tests to use.
1023
1024Tools
1025-----
1026
1027- Added the Python benchmark suite pybench to the Tools/ directory;
1028 contributed by Marc-Andre Lemburg.
1029
1030Documentation
1031-------------
1032
1033- Patch #1473132: Improve docs for ``tp_clear`` and ``tp_traverse``.
1034
1035- PEP 343: Added Context Types section to the library reference
1036 and attempted to bring other PEP 343 related documentation into
1037 line with the implementation and/or python-dev discussions.
1038
1039- Bug #1337990: clarified that ``doctest`` does not support examples
1040 requiring both expected output and an exception.
1041
1042
1043What's New in Python 2.5 alpha 1?
1044=================================
1045
1046*Release date: 05-APR-2006*
1047
1048Core and builtins
1049-----------------
1050
1051- PEP 338: -m command line switch now delegates to runpy.run_module
1052 allowing it to support modules in packages and zipfiles
1053
1054- On Windows, .DLL is not an accepted file name extension for
1055 extension modules anymore; extensions are only found if they
1056 end in .PYD.
1057
1058- Bug #1421664: sys.stderr.encoding is now set to the same value as
1059 sys.stdout.encoding.
1060
1061- __import__ accepts keyword arguments.
1062
1063- Patch #1460496: round() now accepts keyword arguments.
1064
1065- Fixed bug #1459029 - unicode reprs were double-escaped.
1066
1067- Patch #1396919: The system scope threads are reenabled on FreeBSD
1068 5.4 and later versions.
1069
1070- Bug #1115379: Compiling a Unicode string with an encoding declaration
1071 now gives a SyntaxError.
1072
1073- Previously, Python code had no easy way to access the contents of a
1074 cell object. Now, a ``cell_contents`` attribute has been added
1075 (closes patch #1170323).
1076
1077- Patch #1123430: Python's small-object allocator now returns an arena to
1078 the system ``free()`` when all memory within an arena becomes unused
1079 again. Prior to Python 2.5, arenas (256KB chunks of memory) were never
1080 freed. Some applications will see a drop in virtual memory size now,
1081 especially long-running applications that, from time to time, temporarily
1082 use a large number of small objects. Note that when Python returns an
1083 arena to the platform C's ``free()``, there's no guarantee that the
1084 platform C library will in turn return that memory to the operating system.
1085 The effect of the patch is to stop making that impossible, and in tests it
1086 appears to be effective at least on Microsoft C and gcc-based systems.
1087 Thanks to Evan Jones for hard work and patience.
1088
1089- Patch #1434038: property() now uses the getter's docstring if there is
1090 no "doc" argument given. This makes it possible to legitimately use
1091 property() as a decorator to produce a read-only property.
1092
1093- PEP 357, patch 1436368: add an __index__ method to int/long and a matching
1094 nb_index slot to the PyNumberMethods struct. The slot is consulted instead
1095 of requiring an int or long in slicing and a few other contexts, enabling
1096 other objects (e.g. Numeric Python's integers) to be used as slice indices.
1097
1098- Fixed various bugs reported by Coverity's Prevent tool.
1099
1100- PEP 352, patch #1104669: Make exceptions new-style objects. Introduced the
1101 new exception base class, BaseException, which has a new message attribute.
1102 KeyboardInterrupt and SystemExit to directly inherit from BaseException now.
1103 Raising a string exception now raises a DeprecationWarning.
1104
1105- Patch #1438387, PEP 328: relative and absolute imports. Imports can now be
1106 explicitly relative, using 'from .module import name' to mean 'from the same
1107 package as this module is in. Imports without dots still default to the
1108 old relative-then-absolute, unless 'from __future__ import
1109 absolute_import' is used.
1110
1111- Properly check if 'warnings' raises an exception (usually when a filter set
1112 to "error" is triggered) when raising a warning for raising string
1113 exceptions.
1114
1115- CO_GENERATOR_ALLOWED is no longer defined. This behavior is the default.
1116 The name was removed from Include/code.h.
1117
1118- PEP 308: conditional expressions were added: (x if cond else y).
1119
1120- Patch 1433928:
1121 - The copy module now "copies" function objects (as atomic objects).
1122 - dict.__getitem__ now looks for a __missing__ hook before raising
1123 KeyError.
1124
1125- PEP 343: with statement implemented. Needs ``from __future__ import
1126 with_statement``. Use of 'with' as a variable will generate a warning.
1127 Use of 'as' as a variable will also generate a warning (unless it's
1128 part of an import statement).
1129 The following objects have __context__ methods:
1130 - The built-in file type.
1131 - The thread.LockType type.
1132 - The following types defined by the threading module:
1133 Lock, RLock, Condition, Semaphore, BoundedSemaphore.
1134 - The decimal.Context class.
1135
1136- Fix the encodings package codec search function to only search
1137 inside its own package. Fixes problem reported in patch #1433198.
1138
1139 Note: Codec packages should implement and register their own
1140 codec search function. PEP 100 has the details.
1141
1142- PEP 353: Using ``Py_ssize_t`` as the index type.
1143
1144- ``PYMALLOC_DEBUG`` builds now add ``4*sizeof(size_t)`` bytes of debugging
1145 info to each allocated block, since the ``Py_ssize_t`` changes (PEP 353)
1146 now allow Python to make use of memory blocks exceeding 2**32 bytes for
1147 some purposes on 64-bit boxes. A ``PYMALLOC_DEBUG`` build was limited
1148 to 4-byte allocations before.
1149
1150- Patch #1400181, fix unicode string formatting to not use the locale.
1151 This is how string objects work. u'%f' could use , instead of .
1152 for the decimal point. Now both strings and unicode always use periods.
1153
1154- Bug #1244610, #1392915, fix build problem on OpenBSD 3.7 and 3.8.
1155 configure would break checking curses.h.
1156
1157- Bug #959576: The pwd module is now builtin. This allows Python to be
1158 built on UNIX platforms without $HOME set.
1159
1160- Bug #1072182, fix some potential problems if characters are signed.
1161
1162- Bug #889500, fix line number on SyntaxWarning for global declarations.
1163
1164- Bug #1378022, UTF-8 files with a leading BOM crashed the interpreter.
1165
1166- Support for converting hex strings to floats no longer works.
1167 This was not portable. float('0x3') now raises a ValueError.
1168
1169- Patch #1382163: Expose Subversion revision number to Python. New C API
1170 function Py_GetBuildNumber(). New attribute sys.subversion. Build number
1171 is now displayed in interactive prompt banner.
1172
1173- Implementation of PEP 341 - Unification of try/except and try/finally.
1174 "except" clauses can now be written together with a "finally" clause in
1175 one try statement instead of two nested ones. Patch #1355913.
1176
1177- Bug #1379994: Builtin unicode_escape and raw_unicode_escape codec
1178 now encodes backslash correctly.
1179
1180- Patch #1350409: Work around signal handling bug in Visual Studio 2005.
1181
1182- Bug #1281408: Py_BuildValue now works correctly even with unsigned longs
1183 and long longs.
1184
1185- SF Bug #1350188, "setdlopenflags" leads to crash upon "import"
1186 It was possible for dlerror() to return a NULL pointer, so
1187 it will now use a default error message in this case.
1188
1189- Replaced most Unicode charmap codecs with new ones using the
1190 new Unicode translate string feature in the builtin charmap
1191 codec; the codecs were created from the mapping tables available
1192 at ftp.unicode.org and contain a few updates (e.g. the Mac OS
1193 encodings now include a mapping for the Apple logo)
1194
1195- Added a few more codecs for Mac OS encodings
1196
1197- Sped up some Unicode operations.
1198
1199- A new AST parser implementation was completed. The abstract
1200 syntax tree is available for read-only (non-compile) access
1201 to Python code; an _ast module was added.
1202
1203- SF bug #1167751: fix incorrect code being produced for generator expressions.
1204 The following code now raises a SyntaxError: foo(a = i for i in range(10))
1205
1206- SF Bug #976608: fix SystemError when mtime of an imported file is -1.
1207
1208- SF Bug #887946: fix segfault when redirecting stdin from a directory.
1209 Provide a warning when a directory is passed on the command line.
1210
1211- Fix segfault with invalid coding.
1212
1213- SF bug #772896: unknown encoding results in MemoryError.
1214
1215- All iterators now have a Boolean value of True. Formerly, some iterators
1216 supported a __len__() method which evaluated to False when the iterator
1217 was empty.
1218
1219- On 64-bit platforms, when __len__() returns a value that cannot be
1220 represented as a C int, raise OverflowError.
1221
1222- test__locale is skipped on OS X < 10.4 (only partial locale support is
1223 present).
1224
1225- SF bug #893549: parsing keyword arguments was broken with a few format
1226 codes.
1227
1228- Changes donated by Elemental Security to make it work on AIX 5.3
1229 with IBM's 64-bit compiler (SF patch #1284289). This also closes SF
1230 bug #105470: test_pwd fails on 64bit system (Opteron).
1231
1232- Changes donated by Elemental Security to make it work on HP-UX 11 on
1233 Itanium2 with HP's 64-bit compiler (SF patch #1225212).
1234
1235- Disallow keyword arguments for type constructors that don't use them
1236 (fixes bug #1119418).
1237
1238- Forward UnicodeDecodeError into SyntaxError for source encoding errors.
1239
1240- SF bug #900092: When tracing (e.g. for hotshot), restore 'return' events for
1241 exceptions that cause a function to exit.
1242
1243- The implementation of set() and frozenset() was revised to use its
1244 own internal data structure. Memory consumption is reduced by 1/3
1245 and there are modest speed-ups as well. The API is unchanged.
1246
1247- SF bug #1238681: freed pointer is used in longobject.c:long_pow().
1248
1249- SF bug #1229429: PyObject_CallMethod failed to decrement some
1250 reference counts in some error exit cases.
1251
1252- SF bug #1185883: Python's small-object memory allocator took over
1253 a block managed by the platform C library whenever a realloc specified
1254 a small new size. However, there's no portable way to know then how
1255 much of the address space following the pointer is valid, so there's no
1256 portable way to copy data from the C-managed block into Python's
1257 small-object space without risking a memory fault. Python's small-object
1258 realloc now leaves such blocks under the control of the platform C
1259 realloc.
1260
1261- SF bug #1232517: An overflow error was not detected properly when
1262 attempting to convert a large float to an int in os.utime().
1263
1264- SF bug #1224347: hex longs now print with lowercase letters just
1265 like their int counterparts.
1266
1267- SF bug #1163563: the original fix for bug #1010677 ("thread Module
1268 Breaks PyGILState_Ensure()") broke badly in the case of multiple
1269 interpreter states; back out that fix and do a better job (see
1270 http://mail.python.org/pipermail/python-dev/2005-June/054258.html
1271 for a longer write-up of the problem).
1272
1273- SF patch #1180995: marshal now uses a binary format by default when
1274 serializing floats.
1275
1276- SF patch #1181301: on platforms that appear to use IEEE 754 floats,
1277 the routines that promise to produce IEEE 754 binary representations
1278 of floats now simply copy bytes around.
1279
1280- bug #967182: disallow opening files with 'wU' or 'aU' as specified by PEP
1281 278.
1282
1283- patch #1109424: int, long, float, complex, and unicode now check for the
1284 proper magic slot for type conversions when subclassed. Previously the
1285 magic slot was ignored during conversion. Semantics now match the way
1286 subclasses of str always behaved. int/long/float, conversion of an instance
1287 to the base class has been moved to the proper nb_* magic slot and out of
1288 PyNumber_*().
1289 Thanks Walter D�rwald.
1290
1291- Descriptors defined in C with a PyGetSetDef structure, where the setter is
1292 NULL, now raise an AttributeError when attempting to set or delete the
1293 attribute. Previously a TypeError was raised, but this was inconsistent
1294 with the equivalent pure-Python implementation.
1295
1296- It is now safe to call PyGILState_Release() before
1297 PyEval_InitThreads() (note that if there is reason to believe there
1298 are multiple threads around you still must call PyEval_InitThreads()
1299 before using the Python API; this fix is for extension modules that
1300 have no way of knowing if Python is multi-threaded yet).
1301
1302- Typing Ctrl-C whilst raw_input() was waiting in a build with threads
1303 disabled caused a crash.
1304
1305- Bug #1165306: instancemethod_new allowed the creation of a method
1306 with im_class == im_self == NULL, which caused a crash when called.
1307
1308- Move exception finalisation later in the shutdown process - this
1309 fixes the crash seen in bug #1165761
1310
1311- Added two new builtins, any() and all().
1312
1313- Defining a class with empty parentheses is now allowed
1314 (e.g., ``class C(): pass`` is no longer a syntax error).
1315 Patch #1176012 added support to the 'parser' module and 'compiler' package
1316 (thanks to logistix for that added support).
1317
1318- Patch #1115086: Support PY_LONGLONG in structmember.
1319
1320- Bug #1155938: new style classes did not check that __init__() was
1321 returning None.
1322
1323- Patch #802188: Report characters after line continuation character
1324 ('\') with a specific error message.
1325
1326- Bug #723201: Raise a TypeError for passing bad objects to 'L' format.
1327
1328- Bug #1124295: the __name__ attribute of file objects was
1329 inadvertently made inaccessible in restricted mode.
1330
1331- Bug #1074011: closing sys.std{out,err} now causes a flush() and
1332 an ferror() call.
1333
1334- min() and max() now support key= arguments with the same meaning as in
1335 list.sort().
1336
1337- The peephole optimizer now performs simple constant folding in expressions:
1338 (2+3) --> (5).
1339
1340- set and frozenset objects can now be marshalled. SF #1098985.
1341
1342- Bug #1077106: Poor argument checking could cause memory corruption
1343 in calls to os.read().
1344
1345- The parser did not complain about future statements in illegal
1346 positions. It once again reports a syntax error if a future
1347 statement occurs after anything other than a doc string.
1348
1349- Change the %s format specifier for str objects so that it returns a
1350 unicode instance if the argument is not an instance of basestring and
1351 calling __str__ on the argument returns a unicode instance.
1352
1353- Patch #1413181: changed ``PyThreadState_Delete()`` to forget about the
1354 current thread state when the auto-GIL-state machinery knows about
1355 it (since the thread state is being deleted, continuing to remember it
1356 can't help, but can hurt if another thread happens to get created with
1357 the same thread id).
1358
1359Extension Modules
1360-----------------
1361
1362- Patch #1380952: fix SSL objects timing out on consecutive read()s
1363
1364- Patch #1309579: wait3 and wait4 were added to the posix module.
1365
1366- Patch #1231053: The audioop module now supports encoding/decoding of alaw.
1367 In addition, the existing ulaw code was updated.
1368
1369- RFE #567972: Socket objects' family, type and proto properties are
1370 now exposed via new attributes.
1371
1372- Everything under lib-old was removed. This includes the following modules:
1373 Para, addpack, cmp, cmpcache, codehack, dircmp, dump, find, fmt, grep,
1374 lockfile, newdir, ni, packmail, poly, rand, statcache, tb, tzparse,
1375 util, whatsound, whrandom, zmod
1376
1377- The following modules were removed: regsub, reconvert, regex, regex_syntax.
1378
1379- re and sre were swapped, so help(re) provides full help. importing sre
1380 is deprecated. The undocumented re.engine variable no longer exists.
1381
1382- Bug #1448490: Fixed a bug that ISO-2022 codecs could not handle
1383 SS2 (single-shift 2) escape sequences correctly.
1384
1385- The unicodedata module was updated to the 4.1 version of the Unicode
1386 database. The 3.2 version is still available as unicodedata.db_3_2_0
1387 for applications that require this specific version (such as IDNA).
1388
1389- The timing module is no longer built by default. It was deprecated
1390 in PEP 4 in Python 2.0 or earlier.
1391
1392- Patch 1433928: Added a new type, defaultdict, to the collections module.
1393 This uses the new __missing__ hook behavior added to dict (see above).
1394
1395- Bug #854823: socketmodule now builds on Sun platforms even when
1396 INET_ADDRSTRLEN is not defined.
1397
1398- Patch #1393157: os.startfile() now has an optional argument to specify
1399 a "command verb" to invoke on the file.
1400
1401- Bug #876637, prevent stack corruption when socket descriptor
1402 is larger than FD_SETSIZE.
1403
1404- Patch #1407135, bug #1424041: harmonize mmap behavior of anonymous memory.
1405 mmap.mmap(-1, size) now returns anonymous memory in both Unix and Windows.
1406 mmap.mmap(0, size) should not be used on Windows for anonymous memory.
1407
1408- Patch #1422385: The nis module now supports access to domains other
1409 than the system default domain.
1410
1411- Use Win32 API to implement os.stat/fstat. As a result, subsecond timestamps
1412 are reported, the limit on path name lengths is removed, and stat reports
1413 WindowsError now (instead of OSError).
1414
1415- Add bsddb.db.DBEnv.set_tx_timestamp allowing time based database recovery.
1416
1417- Bug #1413192, fix seg fault in bsddb if a transaction was deleted
1418 before the env.
1419
1420- Patch #1103116: Basic AF_NETLINK support.
1421
1422- Bug #1402308, (possible) segfault when using mmap.mmap(-1, ...)
1423
1424- Bug #1400822, _curses over{lay,write} doesn't work when passing 6 ints.
1425 Also fix ungetmouse() which did not accept arguments properly.
1426 The code now conforms to the documented signature.
1427
1428- Bug #1400115, Fix segfault when calling curses.panel.userptr()
1429 without prior setting of the userptr.
1430
1431- Fix 64-bit problems in bsddb.
1432
1433- Patch #1365916: fix some unsafe 64-bit mmap methods.
1434
1435- Bug #1290333: Added a workaround for cjkcodecs' _codecs_cn build
1436 problem on AIX.
1437
1438- Bug #869197: os.setgroups rejects long integer arguments
1439
1440- Bug #1346533, select.poll() doesn't raise an error if timeout > sys.maxint
1441
1442- Bug #1344508, Fix UNIX mmap leaking file descriptors
1443
1444- Patch #1338314, Bug #1336623: fix tarfile so it can extract
1445 REGTYPE directories from tarfiles written by old programs.
1446
1447- Patch #1407992, fixes broken bsddb module db associate when using
1448 BerkeleyDB 3.3, 4.0 or 4.1.
1449
1450- Get bsddb module to build with BerkeleyDB version 4.4
1451
1452- Get bsddb module to build with BerkeleyDB version 3.2
1453
1454- Patch #1309009, Fix segfault in pyexpat when the XML document is in latin_1,
1455 but Python incorrectly assumes it is in UTF-8 format
1456
1457- Fix parse errors in the readline module when compiling without threads.
1458
1459- Patch #1288833: Removed thread lock from socket.getaddrinfo on
1460 FreeBSD 5.3 and later versions which got thread-safe getaddrinfo(3).
1461
1462- Patches #1298449 and #1298499: Add some missing checks for error
1463 returns in cStringIO.c.
1464
1465- Patch #1297028: fix segfault if call type on MultibyteCodec,
1466 MultibyteStreamReader, or MultibyteStreamWriter
1467
1468- Fix memory leak in posix.access().
1469
1470- Patch #1213831: Fix typo in unicodedata._getcode.
1471
1472- Bug #1007046: os.startfile() did not accept unicode strings encoded in
1473 the file system encoding.
1474
1475- Patch #756021: Special-case socket.inet_aton('255.255.255.255') for
1476 platforms that don't have inet_aton().
1477
1478- Bug #1215928: Fix bz2.BZ2File.seek() for 64-bit file offsets.
1479
1480- Bug #1191043: Fix bz2.BZ2File.(x)readlines for files containing one
1481 line without newlines.
1482
1483- Bug #728515: mmap.resize() now resizes the file on Unix as it did
1484 on Windows.
1485
1486- Patch #1180695: Add nanosecond stat resolution, and st_gen,
1487 st_birthtime for FreeBSD.
1488
1489- Patch #1231069: The fcntl.ioctl function now uses the 'I' code for
1490 the request code argument, which results in more C-like behaviour
1491 for large or negative values.
1492
1493- Bug #1234979: For the argument of thread.Lock.acquire, the Windows
1494 implementation treated all integer values except 1 as false.
1495
1496- Bug #1194181: bz2.BZ2File didn't handle mode 'U' correctly.
1497
1498- Patch #1212117: os.stat().st_flags is now accessible as a attribute
1499 if available on the platform.
1500
1501- Patch #1103951: Expose O_SHLOCK and O_EXLOCK in the posix module if
1502 available on the platform.
1503
1504- Bug #1166660: The readline module could segfault if hook functions
1505 were set in a different thread than that which called readline.
1506
1507- collections.deque objects now support a remove() method.
1508
1509- operator.itemgetter() and operator.attrgetter() now support retrieving
1510 multiple fields. This provides direct support for sorting on multiple
1511 keys (primary, secondary, etc).
1512
1513- os.access now supports Unicode path names on non-Win32 systems.
1514
1515- Patches #925152, #1118602: Avoid reading after the end of the buffer
1516 in pyexpat.GetInputContext.
1517
1518- Patches #749830, #1144555: allow UNIX mmap size to default to current
1519 file size.
1520
1521- Added functional.partial(). See PEP309.
1522
1523- Patch #1093585: raise a ValueError for negative history items in readline.
1524 {remove_history,replace_history}
1525
1526- The spwd module has been added, allowing access to the shadow password
1527 database.
1528
1529- stat_float_times is now True.
1530
1531- array.array objects are now picklable.
1532
1533- the cPickle module no longer accepts the deprecated None option in the
1534 args tuple returned by __reduce__().
1535
1536- itertools.islice() now accepts None for the start and step arguments.
1537 This allows islice() to work more readily with slices:
1538 islice(s.start, s.stop, s.step)
1539
1540- datetime.datetime() now has a strptime class method which can be used to
1541 create datetime object using a string and format.
1542
1543- Patch #1117961: Replace the MD5 implementation from RSA Data Security Inc
1544 with the implementation from http://sourceforge.net/projects/libmd5-rfc/.
1545
1546Library
1547-------
1548
1549- Patch #1388073: Numerous __-prefixed attributes of unittest.TestCase have
1550 been renamed to have only a single underscore prefix. This was done to
1551 make subclassing easier.
1552
1553- PEP 338: new module runpy defines a run_module function to support
1554 executing modules which provide access to source code or a code object
1555 via the PEP 302 import mechanisms.
1556
1557- The email module's parsedate_tz function now sets the daylight savings
1558 flag to -1 (unknown) since it can't tell from the date whether it should
1559 be set.
1560
1561- Patch #624325: urlparse.urlparse() and urlparse.urlsplit() results
1562 now sport attributes that provide access to the parts of the result.
1563
1564- Patch #1462498: sgmllib now handles entity and character references
1565 in attribute values.
1566
1567- Added the sqlite3 package. This is based on pysqlite2.1.3, and provides
1568 a DB-API interface in the standard library. You'll need sqlite 3.0.8 or
1569 later to build this - if you have an earlier version, the C extension
1570 module will not be built.
1571
1572- Bug #1460340: ``random.sample(dict)`` failed in various ways. Dicts
1573 aren't officially supported here, and trying to use them will probably
1574 raise an exception some day. But dicts have been allowed, and "mostly
1575 worked", so support for them won't go away without warning.
1576
1577- Bug #1445068: getpass.getpass() can now be given an explicit stream
1578 argument to specify where to write the prompt.
1579
1580- Patch #1462313, bug #1443328: the pickle modules now can handle classes
1581 that have __private names in their __slots__.
1582
1583- Bug #1250170: mimetools now handles socket.gethostname() failures gracefully.
1584
1585- patch #1457316: "setup.py upload" now supports --identity to select the
1586 key to be used for signing the uploaded code.
1587
1588- Queue.Queue objects now support .task_done() and .join() methods
1589 to make it easier to monitor when daemon threads have completed
1590 processing all enqueued tasks. Patch #1455676.
1591
1592- popen2.Popen objects now preserve the command in a .cmd attribute.
1593
1594- Added the ctypes ffi package.
1595
1596- email 4.0 package now integrated. This is largely the same as the email 3.0
1597 package that was included in Python 2.3, except that PEP 8 module names are
1598 now used (e.g. mail.message instead of email.Message). The MIME classes
1599 have been moved to a subpackage (e.g. email.mime.text instead of
1600 email.MIMEText). The old names are still supported for now. Several
1601 deprecated Message methods have been removed and lots of bugs have been
1602 fixed. More details can be found in the email package documentation.
1603
1604- Patches #1436130/#1443155: codecs.lookup() now returns a CodecInfo object
1605 (a subclass of tuple) that provides incremental decoders and encoders
1606 (a way to use stateful codecs without the stream API). Python functions
1607 codecs.getincrementaldecoder() and codecs.getincrementalencoder() as well
1608 as C functions PyCodec_IncrementalEncoder() and PyCodec_IncrementalDecoder()
1609 have been added.
1610
1611- Patch #1359365: Calling next() on a closed StringIO.String object raises
1612 a ValueError instead of a StopIteration now (like file and cString.String do).
1613 cStringIO.StringIO.isatty() will raise a ValueError now if close() has been
1614 called before (like file and StringIO.StringIO do).
1615
1616- A regrtest option -w was added to re-run failed tests in verbose mode.
1617
1618- Patch #1446372: quit and exit can now be called from the interactive
1619 interpreter to exit.
1620
1621- The function get_count() has been added to the gc module, and gc.collect()
1622 grew an optional 'generation' argument.
1623
1624- A library msilib to generate Windows Installer files, and a distutils
1625 command bdist_msi have been added.
1626
1627- PEP 343: new module contextlib.py defines decorator @contextmanager
1628 and helpful context managers nested() and closing().
1629
1630- The compiler package now supports future imports after the module docstring.
1631
1632- Bug #1413790: zipfile now sanitizes absolute archive names that are
1633 not allowed by the specs.
1634
1635- Patch #1215184: FileInput now can be given an opening hook which can
1636 be used to control how files are opened.
1637
1638- Patch #1212287: fileinput.input() now has a mode parameter for
1639 specifying the file mode input files should be opened with.
1640
1641- Patch #1215184: fileinput now has a fileno() function for getting the
1642 current file number.
1643
1644- Patch #1349274: gettext.install() now optionally installs additional
1645 translation functions other than _() in the builtin namespace.
1646
1647- Patch #1337756: fileinput now accepts Unicode filenames.
1648
1649- Patch #1373643: The chunk module can now read chunks larger than
1650 two gigabytes.
1651
1652- Patch #1417555: SimpleHTTPServer now returns Last-Modified headers.
1653
1654- Bug #1430298: It is now possible to send a mail with an empty
1655 return address using smtplib.
1656
1657- Bug #1432260: The names of lambda functions are now properly displayed
1658 in pydoc.
1659
1660- Patch #1412872: zipfile now sets the creator system to 3 (Unix)
1661 unless the system is Win32.
1662
1663- Patch #1349118: urllib now supports user:pass@ style proxy
1664 specifications, raises IOErrors when proxies for unsupported protocols
1665 are defined, and uses the https proxy on https redirections.
1666
1667- Bug #902075: urllib2 now supports 'host:port' style proxy specifications.
1668
1669- Bug #1407902: Add support for sftp:// URIs to urlparse.
1670
1671- Bug #1371247: Update Windows locale identifiers in locale.py.
1672
1673- Bug #1394565: SimpleHTTPServer now doesn't choke on query parameters
1674 any more.
1675
1676- Bug #1403410: The warnings module now doesn't get confused
1677 when it can't find out the module name it generates a warning for.
1678
1679- Patch #1177307: Added a new codec utf_8_sig for UTF-8 with a BOM signature.
1680
1681- Patch #1157027: cookielib mishandles RFC 2109 cookies in Netscape mode
1682
1683- Patch #1117398: cookielib.LWPCookieJar and .MozillaCookieJar now raise
1684 LoadError as documented, instead of IOError. For compatibility,
1685 LoadError subclasses IOError.
1686
1687- Added the hashlib module. It provides secure hash functions for MD5 and
1688 SHA1, 224, 256, 384, and 512. Note that recent developments make the
1689 historic MD5 and SHA1 unsuitable for cryptographic-strength applications.
1690 In <http://mail.python.org/pipermail/python-dev/2005-December/058850.html>
1691 Ronald L. Rivest offered this advice for Python:
1692
1693 "The consensus of researchers in this area (at least as
1694 expressed at the NIST Hash Function Workshop 10/31/05),
1695 is that SHA-256 is a good choice for the time being, but
1696 that research should continue, and other alternatives may
1697 arise from this research. The larger SHA's also seem OK."
1698
1699- Added a subset of Fredrik Lundh's ElementTree package. Available
1700 modules are xml.etree.ElementTree, xml.etree.ElementPath, and
1701 xml.etree.ElementInclude, from ElementTree 1.2.6.
1702
1703- Patch #1162825: Support non-ASCII characters in IDLE window titles.
1704
1705- Bug #1365984: urllib now opens "data:" URLs again.
1706
1707- Patch #1314396: prevent deadlock for threading.Thread.join() when an exception
1708 is raised within the method itself on a previous call (e.g., passing in an
1709 illegal argument)
1710
1711- Bug #1340337: change time.strptime() to always return ValueError when there
1712 is an error in the format string.
1713
1714- Patch #754022: Greatly enhanced webbrowser.py (by Oleg Broytmann).
1715
1716- Bug #729103: pydoc.py: Fix docother() method to accept additional
1717 "parent" argument.
1718
1719- Patch #1300515: xdrlib.py: Fix pack_fstring() to really use null bytes
1720 for padding.
1721
1722- Bug #1296004: httplib.py: Limit maximal amount of data read from the
1723 socket to avoid a MemoryError on Windows.
1724
1725- Patch #1166948: locale.py: Prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE
1726 to get the correct encoding.
1727
1728- Patch #1166938: locale.py: Parse LANGUAGE as a colon separated list of
1729 languages.
1730
1731- Patch #1268314: Cache lines in StreamReader.readlines for performance.
1732
1733- Bug #1290505: Fix clearing the regex cache for time.strptime().
1734
1735- Bug #1167128: Fix size of a symlink in a tarfile to be 0.
1736
1737- Patch #810023: Fix off-by-one bug in urllib.urlretrieve reporthook
1738 functionality.
1739
1740- Bug #1163178: Make IDNA return an empty string when the input is empty.
1741
1742- Patch #848017: Make Cookie more RFC-compliant. Use CRLF as default output
1743 separator and do not output trailing semicolon.
1744
1745- Patch #1062060: urllib.urlretrieve() now raises a new exception, named
1746 ContentTooShortException, when the actually downloaded size does not
1747 match the Content-Length header.
1748
1749- Bug #1121494: distutils.dir_utils.mkpath now accepts Unicode strings.
1750
1751- Bug #1178484: Return complete lines from codec stream readers
1752 even if there is an exception in later lines, resulting in
1753 correct line numbers for decoding errors in source code.
1754
1755- Bug #1192315: Disallow negative arguments to clear() in pdb.
1756
1757- Patch #827386: Support absolute source paths in msvccompiler.py.
1758
1759- Patch #1105730: Apply the new implementation of commonprefix in posixpath
1760 to ntpath, macpath, os2emxpath and riscospath.
1761
1762- Fix a problem in Tkinter introduced by SF patch #869468: delete bogus
1763 __hasattr__ and __delattr__ methods on class Tk that were breaking
1764 Tkdnd.
1765
1766- Bug #1015140: disambiguated the term "article id" in nntplib docs and
1767 docstrings to either "article number" or "message id".
1768
1769- Bug #1238170: threading.Thread.__init__ no longer has "kwargs={}" as a
1770 parameter, but uses the usual "kwargs=None".
1771
1772- textwrap now processes text chunks at O(n) speed instead of O(n**2).
1773 Patch #1209527 (Contributed by Connelly).
1774
1775- urllib2 has now an attribute 'httpresponses' mapping from HTTP status code
1776 to W3C name (404 -> 'Not Found'). RFE #1216944.
1777
1778- Bug #1177468: Don't cache the /dev/urandom file descriptor for os.urandom,
1779 as this can cause problems with apps closing all file descriptors.
1780
1781- Bug #839151: Fix an attempt to access sys.argv in the warnings module;
1782 it can be missing in embedded interpreters
1783
1784- Bug #1155638: Fix a bug which affected HTTP 0.9 responses in httplib.
1785
1786- Bug #1100201: Cross-site scripting was possible on BaseHTTPServer via
1787 error messages.
1788
1789- Bug #1108948: Cookie.py produced invalid JavaScript code.
1790
1791- The tokenize module now detects and reports indentation errors.
1792 Bug #1224621.
1793
1794- The tokenize module has a new untokenize() function to support a full
1795 roundtrip from lexed tokens back to Python source code. In addition,
1796 the generate_tokens() function now accepts a callable argument that
1797 terminates by raising StopIteration.
1798
1799- Bug #1196315: fix weakref.WeakValueDictionary constructor.
1800
1801- Bug #1213894: os.path.realpath didn't resolve symlinks that were the first
1802 component of the path.
1803
1804- Patch #1120353: The xmlrpclib module provides better, more transparent,
1805 support for datetime.{datetime,date,time} objects. With use_datetime set
1806 to True, applications shouldn't have to fiddle with the DateTime wrapper
1807 class at all.
1808
1809- distutils.commands.upload was added to support uploading distribution
1810 files to PyPI.
1811
1812- distutils.commands.register now encodes the data as UTF-8 before posting
1813 them to PyPI.
1814
1815- decimal operator and comparison methods now return NotImplemented
1816 instead of raising a TypeError when interacting with other types. This
1817 allows other classes to implement __radd__ style methods and have them
1818 work as expected.
1819
1820- Bug #1163325: Decimal infinities failed to hash. Attempting to
1821 hash a NaN raised an InvalidOperation instead of a TypeError.
1822
1823- Patch #918101: Add tarfile open mode r|* for auto-detection of the
1824 stream compression; add, for symmetry reasons, r:* as a synonym of r.
1825
1826- Patch #1043890: Add extractall method to tarfile.
1827
1828- Patch #1075887: Don't require MSVC in distutils if there is nothing
1829 to build.
1830
1831- Patch #1103407: Properly deal with tarfile iterators when untarring
1832 symbolic links on Windows.
1833
1834- Patch #645894: Use getrusage for computing the time consumption in
1835 profile.py if available.
1836
1837- Patch #1046831: Use get_python_version where appropriate in sysconfig.py.
1838
1839- Patch #1117454: Remove code to special-case cookies without values
1840 in LWPCookieJar.
1841
1842- Patch #1117339: Add cookielib special name tests.
1843
1844- Patch #1112812: Make bsddb/__init__.py more friendly for modulefinder.
1845
1846- Patch #1110248: SYNC_FLUSH the zlib buffer for GZipFile.flush.
1847
1848- Patch #1107973: Allow to iterate over the lines of a tarfile.ExFileObject.
1849
1850- Patch #1104111: Alter setup.py --help and --help-commands.
1851
1852- Patch #1121234: Properly cleanup _exit and tkerror commands.
1853
1854- Patch #1049151: xdrlib now unpacks booleans as True or False.
1855
1856- Fixed bug in a NameError bug in cookielib. Patch #1116583.
1857
1858- Applied a security fix to SimpleXMLRPCserver (PSF-2005-001). This
1859 disables recursive traversal through instance attributes, which can
1860 be exploited in various ways.
1861
1862- Bug #1222790: in SimpleXMLRPCServer, set the reuse-address and close-on-exec
1863 flags on the HTTP listening socket.
1864
1865- Bug #792570: SimpleXMLRPCServer had problems if the request grew too large.
1866 Fixed by reading the HTTP body in chunks instead of one big socket.read().
1867
1868- Patches #893642, #1039083: add allow_none, encoding arguments to
1869 constructors of SimpleXMLRPCServer and CGIXMLRPCRequestHandler.
1870
1871- Bug #1110478: Revert os.environ.update to do putenv again.
1872
1873- Bug #1103844: fix distutils.install.dump_dirs() with negated options.
1874
1875- os.{SEEK_SET, SEEK_CUR, SEEK_END} have been added for convenience.
1876
1877- Enhancements to the csv module:
1878
1879 + Dialects are now validated by the underlying C code, better
1880 reflecting its capabilities, and improving its compliance with
1881 PEP 305.
1882 + Dialect parameter parsing has been re-implemented to improve error
1883 reporting.
1884 + quotechar=None and quoting=QUOTE_NONE now work the way PEP 305
1885 dictates.
1886 + the parser now removes the escapechar prefix from escaped characters.
1887 + when quoting=QUOTE_NONNUMERIC, the writer now tests for numeric
1888 types, rather than any object that can be represented as a numeric.
1889 + when quoting=QUOTE_NONNUMERIC, the reader now casts unquoted fields
1890 to floats.
1891 + reader now allows \r characters to be quoted (previously it only allowed
1892 \n to be quoted).
1893 + writer doublequote handling improved.
1894 + Dialect classes passed to the module are no longer instantiated by
1895 the module before being parsed (the former validation scheme required
1896 this, but the mechanism was unreliable).
1897 + The dialect registry now contains instances of the internal
1898 C-coded dialect type, rather than references to python objects.
1899 + the internal c-coded dialect type is now immutable.
1900 + register_dialect now accepts the same keyword dialect specifications
1901 as the reader and writer, allowing the user to register dialects
1902 without first creating a dialect class.
1903 + a configurable limit to the size of parsed fields has been added -
1904 previously, an unmatched quote character could result in the entire
1905 file being read into the field buffer before an error was reported.
1906 + A new module method csv.field_size_limit() has been added that sets
1907 the parser field size limit (returning the former limit). The initial
1908 limit is 128kB.
1909 + A line_num attribute has been added to the reader object, which tracks
1910 the number of lines read from the source iterator. This is not
1911 the same as the number of records returned, as records can span
1912 multiple lines.
1913 + reader and writer objects were not being registered with the cyclic-GC.
1914 This has been fixed.
1915
1916- _DummyThread objects in the threading module now delete self.__block that is
1917 inherited from _Thread since it uses up a lock allocated by 'thread'. The
1918 lock primitives tend to be limited in number and thus should not be wasted on
1919 a _DummyThread object. Fixes bug #1089632.
1920
1921- The imghdr module now detects Exif files.
1922
1923- StringIO.truncate() now correctly adjusts the size attribute.
1924 (Bug #951915).
1925
1926- locale.py now uses an updated locale alias table (built using
1927 Tools/i18n/makelocalealias.py, a tool to parse the X11 locale
1928 alias file); the encoding lookup was enhanced to use Python's
1929 encoding alias table.
1930
1931- moved deprecated modules to Lib/lib-old: whrandom, tzparse, statcache.
1932
1933- the pickle module no longer accepts the deprecated None option in the
1934 args tuple returned by __reduce__().
1935
1936- optparse now optionally imports gettext. This allows its use in setup.py.
1937
1938- the pickle module no longer uses the deprecated bin parameter.
1939
1940- the shelve module no longer uses the deprecated binary parameter.
1941
1942- the pstats module no longer uses the deprecated ignore() method.
1943
1944- the filecmp module no longer uses the deprecated use_statcache argument.
1945
1946- unittest.TestCase.run() and unittest.TestSuite.run() can now be successfully
1947 extended or overridden by subclasses. Formerly, the subclassed method would
1948 be ignored by the rest of the module. (Bug #1078905).
1949
1950- heapq.nsmallest() and heapq.nlargest() now support key= arguments with
1951 the same meaning as in list.sort().
1952
1953- Bug #1076985: ``codecs.StreamReader.readline()`` now calls ``read()`` only
1954 once when a size argument is given. This prevents a buffer overflow in the
1955 tokenizer with very long source lines.
1956
1957- Bug #1083110: ``zlib.decompress.flush()`` would segfault if called
1958 immediately after creating the object, without any intervening
1959 ``.decompress()`` calls.
1960
1961- The reconvert.quote function can now emit triple-quoted strings. The
1962 reconvert module now has some simple documentation.
1963
1964- ``UserString.MutableString`` now supports negative indices in
1965 ``__setitem__`` and ``__delitem__``
1966
1967- Bug #1149508: ``textwrap`` now handles hyphenated numbers (eg. "2004-03-05")
1968 correctly.
1969
1970- Partial fixes for SF bugs #1163244 and #1175396: If a chunk read by
1971 ``codecs.StreamReader.readline()`` has a trailing "\r", read one more
1972 character even if the user has passed a size parameter to get a proper
1973 line ending. Remove the special handling of a "\r\n" that has been split
1974 between two lines.
1975
1976- Bug #1251300: On UCS-4 builds the "unicode-internal" codec will now complain
1977 about illegal code points. The codec now supports PEP 293 style error
1978 handlers.
1979
1980- Bug #1235646: ``codecs.StreamRecoder.next()`` now reencodes the data it reads
1981 from the input stream, so that the output is a byte string in the correct
1982 encoding instead of a unicode string.
1983
1984- Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than
1985 considering it exactly like a '*'.
1986
1987- Bug #1245379: Add "unicode-1-1-utf-7" as an alias for "utf-7" to
1988 ``encodings.aliases``.
1989
1990- ` uu.encode()`` and ``uu.decode()`` now support unicode filenames.
1991
1992- Patch #1413711: Certain patterns of differences were making difflib
1993 touch the recursion limit.
1994
1995- Bug #947906: An object oriented interface has been added to the calendar
1996 module. It's possible to generate HTML calendar now and the module can be
1997 called as a script (e.g. via ``python -mcalendar``). Localized month and
1998 weekday names can be ouput (even if an exotic encoding is used) using
1999 special classes that use unicode.
2000
2001Build
2002-----
2003
2004- Fix test_float, test_long, and test_struct failures on Tru64 with gcc
2005 by using -mieee gcc option.
2006
2007- Patch #1432345: Make python compile on DragonFly.
2008
2009- Build support for Win64-AMD64 was added.
2010
2011- Patch #1428494: Prefer linking against ncursesw over ncurses library.
2012
2013- Patch #881820: look for openpty and forkpty also in libbsd.
2014
2015- The sources of zlib are now part of the Python distribution (zlib 1.2.3).
2016 The zlib module is now builtin on Windows.
2017
2018- Use -xcode=pic32 for CCSHARED on Solaris with SunPro.
2019
2020- Bug #1189330: configure did not correctly determine the necessary
2021 value of LINKCC if python was built with GCC 4.0.
2022
2023- Upgrade Windows build to zlib 1.2.3 which eliminates a potential security
2024 vulnerability in zlib 1.2.1 and 1.2.2.
2025
2026- EXTRA_CFLAGS has been introduced as an environment variable to hold compiler
2027 flags that change binary compatibility. Changes were also made to
2028 distutils.sysconfig to also use the environment variable when used during
2029 compilation of the interpreter and of C extensions through distutils.
2030
2031- SF patch 1171735: Darwin 8's headers are anal about POSIX compliance,
2032 and linking has changed (prebinding is now deprecated, and libcc_dynamic
2033 no longer exists). This configure patch makes things right.
2034
2035- Bug #1158607: Build with --disable-unicode again.
2036
2037- spwdmodule.c is built only if either HAVE_GETSPNAM or HAVE_HAVE_GETSPENT is
2038 defined. Discovered as a result of not being able to build on OS X.
2039
2040- setup.py now uses the directories specified in LDFLAGS using the -L option
2041 and in CPPFLAGS using the -I option for adding library and include
2042 directories, respectively, for compiling extension modules against. This has
2043 led to the core being compiled using the values in CPPFLAGS. It also removes
2044 the need for the special-casing of both DarwinPorts and Fink for darwin since
2045 the proper directories can be specified in LDFLAGS (``-L/sw/lib`` for Fink,
2046 ``-L/opt/local/lib`` for DarwinPorts) and CPPFLAGS (``-I/sw/include`` for
2047 Fink, ``-I/opt/local/include`` for DarwinPorts).
2048
2049- Test in configure.in that checks for tzset no longer dependent on tm->tm_zone
2050 to exist in the struct (not required by either ISO C nor the UNIX 2 spec).
2051 Tests for sanity in tzname when HAVE_TZNAME defined were also defined.
2052 Closes bug #1096244. Thanks Gregory Bond.
2053
2054C API
2055-----
2056
2057- ``PyMem_{Del, DEL}`` and ``PyMem_{Free, FREE}`` no longer map to
2058 ``PyObject_{Free, FREE}``. They map to the system ``free()`` now. If memory
2059 is obtained via the ``PyObject_`` family, it must be released via the
2060 ``PyObject_`` family, and likewise for the ``PyMem_`` family. This has
2061 always been officially true, but when Python's small-object allocator was
2062 introduced, an attempt was made to cater to a few extension modules
2063 discovered at the time that obtained memory via ``PyObject_New`` but
2064 released it via ``PyMem_DEL``. It's years later, and if such code still
2065 exists it will fail now (probably with segfaults, but calling wrong
2066 low-level memory management functions can yield many symptoms).
2067
2068- Added a C API for set and frozenset objects.
2069
2070- Removed PyRange_New().
2071
2072- Patch #1313939: PyUnicode_DecodeCharmap() accepts a unicode string as the
2073 mapping argument now. This string is used as a mapping table. Byte values
2074 greater than the length of the string and 0xFFFE are treated as undefined
2075 mappings.
2076
2077
2078Tests
2079-----
2080
2081- In test_os, st_?time is now truncated before comparing it with ST_?TIME.
2082
2083- Patch #1276356: New resource "urlfetch" is implemented. This enables
2084 even impatient people to run tests that require remote files.
2085
2086
2087Documentation
2088-------------
2089
2090- Bug #1402224: Add warning to dl docs about crashes.
2091
2092- Bug #1396471: Document that Windows' ftell() can return invalid
2093 values for text files with UNIX-style line endings.
2094
2095- Bug #1274828: Document os.path.splitunc().
2096
2097- Bug #1190204: Clarify which directories are searched by site.py.
2098
2099- Bug #1193849: Clarify os.path.expanduser() documentation.
2100
2101- Bug #1243192: re.UNICODE and re.LOCALE affect \d, \D, \s and \S.
2102
2103- Bug #755617: Document the effects of os.chown() on Windows.
2104
2105- Patch #1180012: The documentation for modulefinder is now in the library reference.
2106
2107- Patch #1213031: Document that os.chown() accepts argument values of -1.
2108
2109- Bug #1190563: Document os.waitpid() return value with WNOHANG flag.
2110
2111- Bug #1175022: Correct the example code for property().
2112
2113- Document the IterableUserDict class in the UserDict module.
2114 Closes bug #1166582.
2115
2116- Remove all latent references for "Macintosh" that referred to semantics for
2117 Mac OS 9 and change to reflect the state for OS X.
2118 Closes patch #1095802. Thanks Jack Jansen.
2119
2120Mac
2121---
2122
2123
2124New platforms
2125-------------
2126
2127- FreeBSD 7 support is added.
2128
2129
2130Tools/Demos
2131-----------
2132
2133- Created Misc/Vim/vim_syntax.py to auto-generate a python.vim file in that
2134 directory for syntax highlighting in Vim. Vim directory was added and placed
2135 vimrc to it (was previous up a level).
2136
2137- Added two new files to Tools/scripts: pysource.py, which recursively
2138 finds Python source files, and findnocoding.py, which finds Python
2139 source files that need an encoding declaration.
2140 Patch #784089, credits to Oleg Broytmann.
2141
2142- Bug #1072853: pindent.py used an uninitialized variable.
2143
2144- Patch #1177597: Correct Complex.__init__.
2145
2146- Fixed a display glitch in Pynche, which could cause the right arrow to
2147 wiggle over by a pixel.
2148
2149
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00002150What's New in Python 2.4 final?
2151===============================
2152
2153*Release date: 30-NOV-2004*
2154
2155Core and builtins
2156-----------------
2157
2158- Bug 875692: Improve signal handling, especially when using threads, by
2159 forcing an early re-execution of PyEval_EvalFrame() "periodic" code when
2160 things_to_do is not cleared by Py_MakePendingCalls().
2161
2162
2163What's New in Python 2.4 (release candidate 1)
2164==============================================
2165
2166*Release date: 18-NOV-2004*
2167
2168Core and builtins
2169-----------------
2170
2171- Bug 1061968: Fixes in 2.4a3 to address thread bug 1010677 reintroduced
2172 the years-old thread shutdown race bug 225673. Numeric history lesson
2173 aside, all bugs in all three reports are fixed now.
2174
2175
2176Library
2177-------
2178
2179- Bug 1052242: If exceptions are raised by an atexit handler function an
2180 attempt is made to execute the remaining handlers. The last exception
2181 raised is re-raised.
2182
2183- ``doctest``'s new support for adding ``pdb.set_trace()`` calls to
2184 doctests was broken in a dramatic but shallow way. Fixed.
2185
2186- Bug 1065388: ``calendar``'s ``day_name``, ``day_abbr``, ``month_name``,
2187 and ``month_abbr`` attributes emulate sequences of locale-correct
2188 spellings of month and day names. Because the locale can change at
2189 any time, the correct spelling is recomputed whenever one of these is
2190 indexed. In the worst case, the index may be a slice object, so these
2191 recomputed every day or month name each time they were indexed. This is
2192 much slower than necessary in the usual case, when the index is just an
2193 integer. In that case, only the single spelling needed is recomputed
2194 now; and, when the index is a slice object, only the spellings needed
2195 by the slice are recomputed now.
2196
2197- Patch 1061679: Added ``__all__`` to pickletools.py.
2198
2199Build
2200-----
2201
2202- Bug 1034277 / Patch 1035255: Remove compilation of core against CoreServices
2203 and CoreFoundation on OS X. Involved removing PyMac_GetAppletScriptFile()
2204 which has no known users. Thanks Bob Ippolito.
2205
2206C API
2207-----
2208
2209- The PyRange_New() function is deprecated.
2210
2211
2212What's New in Python 2.4 beta 2?
2213================================
2214
2215*Release date: 03-NOV-2004*
2216
2217License
2218-------
2219
2220The Python Software Foundation changed the license under which Python
2221is released, to remove Python version numbers. There were no other
2222changes to the license. So, for example, wherever the license for
2223Python 2.3 said "Python 2.3", the new license says "Python". The
2224intent is to make it possible to refer to the PSF license in a more
2225durable way. For example, some people say they're confused by that
2226the Open Source Initiative's entry for the Python Software Foundation
2227License::
2228
2229 http://www.opensource.org/licenses/PythonSoftFoundation.php
2230
2231says "Python 2.1.1" all over it, wondering whether it applies only
2232to Python 2.1.1.
2233
2234The official name of the new license is the Python Software Foundation
2235License Version 2.
2236
2237Core and builtins
2238-----------------
2239
2240- Bug #1055820 Cyclic garbage collection was not protecting against that
2241 calling a live weakref to a piece of cyclic trash could resurrect an
2242 insane mutation of the trash if any Python code ran during gc (via
2243 running a dead object's __del__ method, running another callback on a
2244 weakref to a dead object, or via any Python code run in any other thread
2245 that managed to obtain the GIL while a __del__ or callback was running
2246 in the thread doing gc). The most likely symptom was "impossible"
2247 ``AttributeError`` exceptions, appearing seemingly at random, on weakly
2248 referenced objects. The cure was to clear all weakrefs to unreachable
2249 objects before allowing any callbacks to run.
2250
2251- Bug #1054139 _PyString_Resize() now invalidates its cached hash value.
2252
2253Extension Modules
2254-----------------
2255
2256- Bug #1048870: the compiler now generates distinct code objects for
2257 functions with identical bodies. This was producing confusing
2258 traceback messages which pointed to the function where the code
2259 object was first defined rather than the function being executed.
2260
2261Library
2262-------
2263
2264- Patch #1056967 changes the semantics of Template.safe_substitute() so that
2265 no ValueError is raised on an 'invalid' match group. Now the delimiter is
2266 returned.
2267
2268- Bug #1052503 pdb.runcall() was not passing along keyword arguments.
2269
2270- Bug #902037: XML.sax.saxutils.prepare_input_source() now combines relative
2271 paths with a base path before checking os.path.isfile().
2272
2273- The whichdb module can now be run from the command line.
2274
2275- Bug #1045381: time.strptime() can now infer the date using %U or %W (week of
2276 the year) when the day of the week and year are also specified.
2277
2278- Bug #1048816: fix bug in Ctrl-K at start of line in curses.textpad.Textbox
2279
2280- Bug #1017553: fix bug in tarfile.filemode()
2281
2282- Patch #737473: fix bug that old source code is shown in tracebacks even if
2283 the source code is updated and reloaded.
2284
2285Build
2286-----
2287
2288- Patch #1044395: --enable-shared is allowed in FreeBSD also.
2289
2290What's New in Python 2.4 beta 1?
2291================================
2292
2293*Release date: 15-OCT-2004*
2294
2295Core and builtins
2296-----------------
2297
2298- Patch #975056: Restartable signals were not correctly disabled on
2299 BSD systems. Consistently use PyOS_setsig() instead of signal().
2300
2301- The internal portable implementation of thread-local storage (TLS), used
2302 by the ``PyGILState_Ensure()``/``PyGILState_Release()`` API, was not
2303 thread-correct. This could lead to a variety of problems, up to and
2304 including segfaults. See bug 1041645 for an example.
2305
2306- Added a command line option, -m module, which searches sys.path for the
2307 module and then runs it. (Contributed by Nick Coghlan.)
2308
2309- The bytecode optimizer now folds tuples of constants into a single
2310 constant.
2311
2312- SF bug #513866: Float/long comparison anomaly. Prior to 2.4b1, when
2313 an integer was compared to a float, the integer was coerced to a float.
2314 That could yield spurious overflow errors (if the integer was very
2315 large), and to anomalies such as
2316 ``long(1e200)+1 == 1e200 == long(1e200)-1``. Coercion to float is no
2317 longer performed, and cases like ``long(1e200)-1 < 1e200``,
2318 ``long(1e200)+1 > 1e200`` and ``(1 << 20000) > 1e200`` are computed
2319 correctly now.
2320
2321Extension modules
2322-----------------
2323
2324- ``collections.deque`` objects didn't play quite right with garbage
2325 collection, which could lead to a segfault in a release build, or
2326 an assert failure in a debug build. Also, added overflow checks,
2327 better detection of mutation during iteration, and shielded deque
2328 comparisons from unusual subclass overrides of the __iter__() method.
2329
2330Library
2331-------
2332
2333- Patch 1046644: distutils build_ext grew two new options - --swig for
2334 specifying the swig executable to use, and --swig-opts to specify
2335 options to pass to swig. --swig-opts="-c++" is the new way to spell
2336 --swig-cpp.
2337
2338- Patch 983206: distutils now obeys environment variable LDSHARED, if
2339 it is set.
2340
2341- Added Peter Astrand's subprocess.py module. See PEP 324 for details.
2342
2343- time.strptime() now properly escapes timezones and all other locale-specific
2344 strings for regex-specific symbols. Was breaking under Japanese Windows when
2345 the timezone was specified as "Tokyo (standard time)".
2346 Closes bug #1039270.
2347
2348- Updates for the email package:
2349
2350 + email.Utils.formatdate() grew a 'usegmt' argument for HTTP support.
2351 + All deprecated APIs that in email 2.x issued warnings have been removed:
2352 _encoder argument to the MIMEText constructor, Message.add_payload(),
2353 Utils.dump_address_pair(), Utils.decode(), Utils.encode()
2354 + New deprecations: Generator.__call__(), Message.get_type(),
2355 Message.get_main_type(), Message.get_subtype(), the 'strict' argument to
2356 the Parser constructor. These will be removed in email 3.1.
2357 + Support for Python earlier than 2.3 has been removed (see PEP 291).
2358 + All defect classes have been renamed to end in 'Defect'.
2359 + Some FeedParser fixes; also a MultipartInvariantViolationDefect will be
2360 added to messages that claim to be multipart but really aren't.
2361 + Updates to documentation.
2362
2363- re's findall() and finditer() functions now take an optional flags argument
2364 just like the compile(), search(), and match() functions. Also, documented
2365 the previously existing start and stop parameters for the findall() and
2366 finditer() methods of regular expression objects.
2367
2368- rfc822 Messages now support iterating over the headers.
2369
2370- The (undocumented) tarfile.Tarfile.membernames has been removed;
2371 applications should use the getmember function.
2372
2373- httplib now offers symbolic constants for the HTTP status codes.
2374
2375- SF bug #1028306: Trying to compare a ``datetime.date`` to a
2376 ``datetime.datetime`` mistakenly compared only the year, month and day.
2377 Now it acts like a mixed-type comparison: ``False`` for ``==``,
2378 ``True`` for ``!=``, and raises ``TypeError`` for other comparison
2379 operators. Because datetime is a subclass of date, comparing only the
2380 base class (date) members can still be done, if that's desired, by
2381 forcing using of the approprate date method; e.g.,
2382 ``a_date.__eq__(a_datetime)`` is true if and only if the year, month
2383 and day members of ``a_date`` and ``a_datetime`` are equal.
2384
2385- bdist_rpm now supports command line options --force-arch,
2386 {pre,post}-install, {pre,post}-uninstall, and
2387 {prep,build,install,clean,verify}-script.
2388
2389- SF patch #998993: The UTF-8 and the UTF-16 stateful decoders now support
2390 decoding incomplete input (when the input stream is temporarily exhausted).
2391 ``codecs.StreamReader`` now implements buffering, which enables proper
2392 readline support for the UTF-16 decoders. ``codecs.StreamReader.read()``
2393 has a new argument ``chars`` which specifies the number of characters to
2394 return. ``codecs.StreamReader.readline()`` and
2395 ``codecs.StreamReader.readlines()`` have a new argument ``keepends``.
2396 Trailing "\n"s will be stripped from the lines if ``keepends`` is false.
2397
2398- The documentation for doctest is greatly expanded, and now covers all
2399 the new public features (of which there are many).
2400
2401- ``doctest.master`` was put back in, and ``doctest.testmod()`` once again
2402 updates it. This isn't good, because every ``testmod()`` call
2403 contributes to bloating the "hidden" state of ``doctest.master``, but
2404 some old code apparently relies on it. For now, all we can do is
2405 encourage people to stitch doctests together via doctest's unittest
2406 integration features instead.
2407
2408- httplib now handles ipv6 address/port pairs.
2409
2410- SF bug #1017864: ConfigParser now correctly handles default keys,
2411 processing them with ``ConfigParser.optionxform`` when supplied,
2412 consistent with the handling of config file entries and runtime-set
2413 options.
2414
2415- SF bug #997050: Document, test, & check for non-string values in
2416 ConfigParser. Moved the new string-only restriction added in
2417 rev. 1.65 to the SafeConfigParser class, leaving existing
2418 ConfigParser & RawConfigParser behavior alone, and documented the
2419 conditions under which non-string values work.
2420
2421Build
2422-----
2423
2424- Building on darwin now includes /opt/local/include and /opt/local/lib for
2425 building extension modules. This is so as to include software installed as
2426 a DarwinPorts port <http://darwinports.opendarwin.org/>
2427
2428- pyport.h now defines a Py_IS_NAN macro. It works as-is when the
2429 platform C computes true for ``x != x`` if and only if X is a NaN.
2430 Other platforms can override the default definition with a platform-
2431 specific spelling in that platform's pyconfig.h. You can also override
2432 pyport.h's default Py_IS_INFINITY definition now.
2433
2434C API
2435-----
2436
2437- SF patch 1044089: New function ``PyEval_ThreadsInitialized()`` returns
2438 non-zero if PyEval_InitThreads() has been called.
2439
2440- The undocumented and unused extern int ``_PyThread_Started`` was removed.
2441
2442- The C API calls ``PyInterpreterState_New()`` and ``PyThreadState_New()``
2443 are two of the very few advertised as being safe to call without holding
2444 the GIL. However, this wasn't true in a debug build, as bug 1041645
2445 demonstrated. In a debug build, Python redirects the ``PyMem`` family
2446 of calls to Python's small-object allocator, to get the benefit of
2447 its extra debugging capabilities. But Python's small-object allocator
2448 isn't threadsafe, relying on the GIL to avoid the expense of doing its
2449 own locking. ``PyInterpreterState_New()`` and ``PyThreadState_New()``
2450 call the platform ``malloc()`` directly now, regardless of build type.
2451
2452- PyLong_AsUnsignedLong[Mask] now support int objects as well.
2453
2454- SF patch #998993: ``PyUnicode_DecodeUTF8Stateful`` and
2455 ``PyUnicode_DecodeUTF16Stateful`` have been added, which implement stateful
2456 decoding.
2457
2458Tests
2459-----
2460
2461- test__locale ported to unittest
2462
2463Mac
2464---
2465
2466- ``plistlib`` now supports non-dict root objects. There is also a new
2467 interface for reading and writing plist files: ``readPlist(pathOrFile)``
2468 and ``writePlist(rootObject, pathOrFile)``
2469
2470Tools/Demos
2471-----------
2472
2473- The text file comparison scripts ``ndiff.py`` and ``diff.py`` now
2474 read the input files in universal-newline mode. This spares them
2475 from consuming a great deal of time to deduce the useless result that,
2476 e.g., a file with Windows line ends and a file with Linux line ends
2477 have no lines in common.
2478
2479
2480What's New in Python 2.4 alpha 3?
2481=================================
2482
2483*Release date: 02-SEP-2004*
2484
2485Core and builtins
2486-----------------
2487
2488- SF patch #1007189: ``from ... import ...`` statements now allow the name
2489 list to be surrounded by parentheses.
2490
2491- Some speedups for long arithmetic, thanks to Trevor Perrin. Gradeschool
2492 multiplication was sped a little by optimizing the C code. Gradeschool
2493 squaring was sped by about a factor of 2, by exploiting that about half
2494 the digit products are duplicates in a square. Because exponentiation
2495 uses squaring often, this also speeds long power. For example, the time
2496 to compute 17**1000000 dropped from about 14 seconds to 9 on my box due
2497 to this much. The cutoff for Karatsuba multiplication was raised,
2498 since gradeschool multiplication got quicker, and the cutoff was
2499 aggressively small regardless. The exponentiation algorithm was switched
2500 from right-to-left to left-to-right, which is more efficient for small
2501 bases. In addition, if the exponent is large, the algorithm now does
2502 5 bits (instead of 1 bit) at a time. That cut the time to compute
2503 17**1000000 on my box in half again, down to about 4.5 seconds.
2504
2505- OverflowWarning is no longer generated. PEP 237 scheduled this to
2506 occur in Python 2.3, but since OverflowWarning was disabled by default,
2507 nobody realized it was still being generated. On the chance that user
2508 code is still using them, the Python builtin OverflowWarning, and
2509 corresponding C API PyExc_OverflowWarning, will exist until Python 2.5.
2510
2511- Py_InitializeEx has been added.
2512
2513- Fix the order of application of decorators. The proper order is bottom-up;
2514 the first decorator listed is the last one called.
2515
2516- SF patch #1005778. Fix a seg fault if the list size changed while
2517 calling list.index(). This could happen if a rich comparison function
2518 modified the list.
2519
2520- The ``func_name`` (a.k.a. ``__name__``) attribute of user-defined
2521 functions is now writable.
2522
2523- code_new (a.k.a new.code()) now checks its arguments sufficiently
2524 carefully that passing them on to PyCode_New() won't trigger calls
2525 to Py_FatalError() or PyErr_BadInternalCall(). It is still the case
2526 that the returned code object might be entirely insane.
2527
2528- Subclasses of string can no longer be interned. The semantics of
2529 interning were not clear here -- a subclass could be mutable, for
2530 example -- and had bugs. Explicitly interning a subclass of string
2531 via intern() will raise a TypeError. Internal operations that attempt
2532 to intern a string subclass will have no effect.
2533
2534- Bug 1003935: xrange() could report bogus OverflowErrors. Documented
2535 what xrange() intends, and repaired tests accordingly.
2536
2537Extension modules
2538-----------------
2539
2540- difflib now supports HTML side-by-side diff.
2541
2542- os.urandom has been added for systems that support sources of random
2543 data.
2544
Sean Reifscheider54cf12b2007-09-17 17:55:36 +00002545- Patch 1012740: truncate() on a writable cStringIO now resets the
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00002546 position to the end of the stream. This is consistent with the original
2547 StringIO module and avoids inadvertently resurrecting data that was
2548 supposed to have been truncated away.
2549
2550- Added socket.socketpair().
2551
2552- Added CurrentByteIndex, CurrentColumnNumber, CurrentLineNumber
2553 members to xml.parsers.expat.XMLParser object.
2554
2555- The mpz, rotor, and xreadlines modules, all deprecated in earlier
2556 versions of Python, have now been removed.
2557
2558Library
2559-------
2560
2561- Patch #934356: if a module defines __all__, believe that rather than using
2562 heuristics for filtering out imported names.
2563
2564- Patch #941486: added os.path.lexists(), which returns True for broken
2565 symlinks, unlike os.path.exists().
2566
2567- the random module now uses os.urandom() for seeding if it is available.
2568 Added a new generator based on os.urandom().
2569
2570- difflib and diff.py can now generate HTML.
2571
2572- bdist_rpm now includes version and release in the BuildRoot, and
2573 replaces - by ``_`` in version and release.
2574
2575- distutils build/build_scripts now has an -e option to specify the
2576 path to the Python interpreter for installed scripts.
2577
2578- PEP 292 classes Template and SafeTemplate are added to the string module.
2579
2580- tarfile now generates GNU tar files by default.
2581
2582- HTTPResponse has now a getheaders method.
2583
2584- Patch #1006219: let inspect.getsource handle '@' decorators. Thanks Simon
2585 Percivall.
2586
2587- logging.handlers.SMTPHandler.date_time has been removed;
2588 the class now uses email.Utils.formatdate to generate the time stamp.
2589
2590- A new function tkFont.nametofont was added to return an existing
2591 font. The Font class constructor now has an additional exists argument
2592 which, if True, requests to return/configure an existing font, rather
2593 than creating a new one.
2594
2595- Updated the decimal package's min() and max() methods to match the
2596 latest revision of the General Decimal Arithmetic Specification.
2597 Quiet NaNs are ignored and equal values are sorted based on sign
2598 and exponent.
2599
2600- The decimal package's Context.copy() method now returns deep copies.
2601
2602- Deprecated sys.exitfunc in favor of the atexit module. The sys.exitfunc
2603 attribute will be kept around for backwards compatibility and atexit
2604 will just become the one preferred way to do it.
2605
2606- patch #675551: Add get_history_item and replace_history_item functions
2607 to the readline module.
2608
2609- bug #989672: pdb.doc and the help messages for the help_d and help_u methods
2610 of the pdb.Pdb class gives have been corrected. d(own) goes to a newer
2611 frame, u(p) to an older frame, not the other way around.
2612
2613- bug #990669: os.path.realpath() will resolve symlinks before normalizing the
2614 path, as normalizing the path may alter the meaning of the path if it
2615 contains symlinks.
2616
2617- bug #851123: shutil.copyfile will raise an exception when trying to copy a
2618 file onto a link to itself. Thanks Gregory Ball.
2619
2620- bug #570300: Fix inspect to resolve file locations using os.path.realpath()
2621 so as to properly list all functions in a module when the module itself is
2622 reached through a symlink. Thanks Johannes Gijsbers.
2623
2624- doctest refactoring continued. See the docs for details. As part of
2625 this effort, some old and little- (never?) used features are now
2626 deprecated: the Tester class, the module is_private() function, and the
2627 isprivate argument to testmod(). The Tester class supplied a feeble
2628 "by hand" way to combine multiple doctests, if you knew exactly what
2629 you were doing. The newer doctest features for unittest integration
2630 already did a better job of that, are stronger now than ever, and the
2631 new DocTestRunner class is a saner foundation if you want to do it by
2632 hand. The "private name" filtering gimmick was a mistake from the
2633 start, and testmod() changed long ago to ignore it by default. If
2634 you want to filter out tests, the new DocTestFinder class can be used
2635 to return a list of all doctests, and you can filter that list by
2636 any computable criteria before passing it to a DocTestRunner instance.
2637
2638- Bug #891637, patch #1005466: fix inspect.getargs() crash on def foo((bar)).
2639
2640Tools/Demos
2641-----------
2642
2643- IDLE's shortcut keys for windows are now case insensitive so that
2644 Control-V works the same as Control-v.
2645
2646- pygettext.py: Generate POT-Creation-Date header in ISO format.
2647
2648Build
2649-----
2650
2651- Backward incompatibility: longintrepr.h now triggers a compile-time
2652 error if SHIFT (the number of bits in a Python long "digit") isn't
2653 divisible by 5. This new requirement allows simple code for the new
2654 5-bits-at-a-time long_pow() implementation. If necessary, the
2655 restriction could be removed (by complicating long_pow(), or by
2656 falling back to the 1-bit-at-a-time algorithm), but there are no
2657 plans to do so.
2658
2659- bug #991962: When building with --disable-toolbox-glue on Darwin no
2660 attempt to build Mac-specific modules occurs.
2661
2662- The --with-tsc flag to configure to enable VM profiling with the
2663 processor's timestamp counter now works on PPC platforms.
2664
2665- patch #1006629: Define _XOPEN_SOURCE to 500 on Solaris 8/9 to match
2666 GCC's definition and avoid redefinition warnings.
2667
2668- Detect pthreads support (provided by gnu pth pthread emulation) on
2669 GNU/k*BSD systems.
2670
2671- bug #1005737, #1007249: Fixed several build problems and warnings
2672 found on old/legacy C compilers of HP-UX, IRIX and Tru64.
2673
2674C API
2675-----
2676
2677..
2678
2679Documentation
2680-------------
2681
2682- patch #1005936, bug #1009373: fix index entries which contain
2683 an underscore when viewed with Acrobat.
2684
2685- bug #990669: os.path.normpath may alter the meaning of a path if
2686 it contains symbolic links. This has been documented in a comment
2687 since 1992, but is now in the library reference as well.
2688
2689New platforms
2690-------------
2691
2692- FreeBSD 6 is now supported.
2693
2694Tests
2695-----
2696
2697..
2698
2699Windows
2700-------
2701
2702- Boosted the stack reservation for python.exe and pythonw.exe from
2703 the default 1MB to 2MB. Stack frames under VC 7.1 for 2.4 are enough
2704 bigger than under VC 6.0 for 2.3.4 that deeply recursive progams
2705 within the default sys.getrecursionlimit() default value of 1000 were
2706 able to suffer undetected C stack overflows. The standard test program
2707 test_compiler was one such program. If a Python process on Windows
2708 "just vanishes" without a trace, and without an error message of any
2709 kind, but with an exit code of 128, undetected stack overflow may be
2710 the problem.
2711
2712Mac
2713---
2714
2715..
2716
2717
2718What's New in Python 2.4 alpha 2?
2719=================================
2720
2721*Release date: 05-AUG-2004*
2722
2723Core and builtins
2724-----------------
2725
2726- Patch #980695: Implements efficient string concatenation for statements
2727 of the form s=s+t and s+=t. This will vary across implementations.
2728 Accordingly, the str.join() method is strongly preferred for performance
2729 sensitive code.
2730
2731- PEP-0318, Function Decorators have been added to the language. These are
2732 implemented using the Java-style @decorator syntax, like so::
2733
2734 @staticmethod
2735 def foo(bar):
2736
2737 (The PEP needs to be updated to reflect the current state)
2738
2739- When importing a module M raises an exception, Python no longer leaves M
2740 in sys.modules. Before 2.4a2 it did, and a subsequent import of M would
2741 succeed, picking up a module object from sys.modules reflecting as much
2742 of the initialization of M as completed before the exception was raised.
2743 Subsequent imports got no indication that M was in a partially-
2744 initialized state, and the importers could get into arbitrarily bad
2745 trouble as a result (the M they got was in an unintended state,
2746 arbitrarily far removed from M's author's intent). Now subsequent
2747 imports of M will continue raising exceptions (but if, for example, the
2748 source code for M is edited between import attempts, then perhaps later
2749 attempts will succeed, or raise a different exception).
2750
2751 This can break existing code, but in such cases the code was probably
2752 working before by accident. In the Python source, the only case of
2753 breakage discovered was in a test accidentally relying on a damaged
2754 module remaining in sys.modules. Cases are also known where tests
2755 deliberately provoking import errors remove damaged modules from
2756 sys.modules themselves, and such tests will break now if they do an
2757 unconditional del sys.modules[M].
2758
2759- u'%s' % obj will now try obj.__unicode__() first and fallback to
2760 obj.__str__() if no __unicode__ method can be found.
2761
2762- Patch #550732: Add PyArg_VaParseTupleAndKeywords(). Analogous to
2763 PyArg_VaParse(). Both are now documented. Thanks Greg Chapman.
2764
2765- Allow string and unicode return types from .encode()/.decode()
2766 methods on string and unicode objects. Added unicode.decode()
2767 which was missing for no apparent reason.
2768
2769- An attempt to fix the mess that is Python's behaviour with
2770 signal handlers and threads, complicated by readline's behaviour.
2771 It's quite possible that there are still bugs here.
2772
2773- Added C macros Py_CLEAR and Py_VISIT to ease the implementation of
2774 types that support garbage collection.
2775
2776- Compiler now treats None as a constant.
2777
2778- The type of values returned by __int__, __float__, __long__,
2779 __oct__, and __hex__ are now checked. Returning an invalid type
2780 will cause a TypeError to be raised. This matches the behavior of
2781 Jython.
2782
2783- Implemented bind_textdomain_codeset() in locale module.
2784
2785- Added a workaround for proper string operations in BSDs. str.split
2786 and str.is* methods can now work correctly with UTF-8 locales.
2787
2788- Bug #989185: unicode.iswide() and unicode.width() is dropped and
2789 the East Asian Width support is moved to unicodedata extension
2790 module.
2791
2792- Patch #941229: The source code encoding in interactive mode
2793 now refers sys.stdin.encoding not just ISO-8859-1 anymore. This
2794 allows for non-latin-1 users to write unicode strings directly.
2795
2796Extension modules
2797-----------------
2798
2799- cpickle now supports the same keyword arguments as pickle.
2800
2801Library
2802-------
2803
2804- Added new codecs and aliases for ISO_8859-11, ISO_8859-16 and
2805 TIS-620
2806
2807- Thanks to Edward Loper, doctest has been massively refactored, and
2808 many new features were added. Full docs will appear later. For now
2809 the doctest module comments and new test cases give good coverage.
2810 The refactoring provides many hook points for customizing behavior
2811 (such as how to report errors, and how to compare expected to actual
2812 output). New features include a <BLANKLINE> marker for expected
2813 output containing blank lines, options to produce unified or context
2814 diffs when actual output doesn't match expectations, an option to
2815 normalize whitespace before comparing, and an option to use an
2816 ellipsis to signify "don't care" regions of output.
2817
2818- Tkinter now supports the wish -sync and -use options.
2819
2820- The following methods in time support passing of None: ctime(), gmtime(),
2821 and localtime(). If None is provided, the current time is used (the
2822 same as when the argument is omitted).
2823 [SF bug 658254, patch 663482]
2824
2825- nntplib does now allow to ignore a .netrc file.
2826
2827- urllib2 now recognizes Basic authentication even if other authentication
2828 schemes are offered.
2829
2830- Bug #1001053. wave.open() now accepts unicode filenames.
2831
2832- gzip.GzipFile has a new fileno() method, to retrieve the handle of the
2833 underlying file object (provided it has a fileno() method). This is
2834 needed if you want to use os.fsync() on a GzipFile.
2835
2836- imaplib has two new methods: deleteacl and myrights.
2837
2838- nntplib has two new methods: description and descriptions. They
2839 use a more RFC-compliant way of getting a newsgroup description.
2840
2841- Bug #993394. Fix a possible red herring of KeyError in 'threading' being
2842 raised during interpreter shutdown from a registered function with atexit
2843 when dummy_threading is being used.
2844
2845- Bug #857297/Patch #916874. Fix an error when extracting a hard link
2846 from a tarfile.
2847
2848- Patch #846659. Fix an error in tarfile.py when using
2849 GNU longname/longlink creation.
2850
2851- The obsolete FCNTL.py has been deleted. The builtin fcntl module
2852 has been available (on platforms that support fcntl) since Python
2853 1.5a3, and all FCNTL.py did is export fcntl's names, after generating
2854 a deprecation warning telling you to use fcntl directly.
2855
2856- Several new unicode codecs are added: big5hkscs, euc_jis_2004,
2857 iso2022_jp_2004, shift_jis_2004.
2858
2859- Bug #788520. Queue.{get, get_nowait, put, put_nowait} have new
2860 implementations, exploiting Conditions (which didn't exist at the time
2861 Queue was introduced). A minor semantic change is that the Full and
2862 Empty exceptions raised by non-blocking calls now occur only if the
2863 queue truly was full or empty at the instant the queue was checked (of
2864 course the Queue may no longer be full or empty by the time a calling
2865 thread sees those exceptions, though). Before, the exceptions could
2866 also be raised if it was "merely inconvenient" for the implementation
2867 to determine the true state of the Queue (because the Queue was locked
2868 by some other method in progress).
2869
2870- Bugs #979794 and #980117: difflib.get_grouped_opcodes() now handles the
2871 case of comparing two empty lists. This affected both context_diff() and
2872 unified_diff(),
2873
2874- Bug #980938: smtplib now prints debug output to sys.stderr.
2875
2876- Bug #930024: posixpath.realpath() now handles infinite loops in symlinks by
2877 returning the last point in the path that was not part of any loop. Thanks
2878 AM Kuchling.
2879
2880- Bug #980327: ntpath not handles compressing erroneous slashes between the
2881 drive letter and the rest of the path. Also clearly handles UNC addresses now
2882 as well. Thanks Paul Moore.
2883
2884- bug #679953: zipfile.py should now work for files over 2 GB. The packed data
2885 for file sizes (compressed and uncompressed) was being stored as signed
2886 instead of unsigned.
2887
2888- decimal.py now only uses signals in the IBM spec. The other conditions are
2889 no longer part of the public API.
2890
2891- codecs module now has two new generic APIs: encode() and decode()
2892 which don't restrict the return types (unlike the unicode and
2893 string methods of the same name).
2894
2895- Non-blocking SSL sockets work again; they were broken in Python 2.3.
2896 SF patch 945642.
2897
2898- doctest unittest integration improvements:
2899
2900 o Improved the unitest test output for doctest-based unit tests
2901
2902 o Can now pass setUp and tearDown functions when creating
2903 DocTestSuites.
2904
2905- The threading module has a new class, local, for creating objects
2906 that provide thread-local data.
2907
2908- Bug #990307: when keep_empty_values is True, cgi.parse_qsl()
2909 no longer returns spurious empty fields.
2910
2911- Implemented bind_textdomain_codeset() in gettext module.
2912
2913- Introduced in gettext module the l*gettext() family of functions,
2914 which return translation strings encoded in the preferred encoding,
2915 as informed by locale module's getpreferredencoding().
2916
2917- optparse module (and tests) upgraded to Optik 1.5a1. Changes:
2918
2919 - Add expansion of default values in help text: the string
2920 "%default" in an option's help string is expanded to str() of
2921 that option's default value, or "none" if no default value.
2922
2923 - Bug #955889: option default values that happen to be strings are
2924 now processed in the same way as values from the command line; this
2925 allows generation of nicer help when using custom types. Can
2926 be disabled with parser.set_process_default_values(False).
2927
2928 - Bug #960515: don't crash when generating help for callback
2929 options that specify 'type', but not 'dest' or 'metavar'.
2930
2931 - Feature #815264: change the default help format for short options
2932 that take an argument from e.g. "-oARG" to "-o ARG"; add
2933 set_short_opt_delimiter() and set_long_opt_delimiter() methods to
2934 HelpFormatter to allow (slight) customization of the formatting.
2935
2936 - Patch #736940: internationalize Optik: all built-in user-
2937 targeted literal strings are passed through gettext.gettext(). (If
2938 you want translations (.po files), they're not included with Python
2939 -- you'll find them in the Optik source distribution from
2940 http://optik.sourceforge.net/ .)
2941
2942 - Bug #878453: respect $COLUMNS environment variable for
2943 wrapping help output.
2944
2945 - Feature #988122: expand "%prog" in the 'description' passed
2946 to OptionParser, just like in the 'usage' and 'version' strings.
2947 (This is *not* done in the 'description' passed to OptionGroup.)
2948
2949C API
2950-----
2951
2952- PyImport_ExecCodeModule() and PyImport_ExecCodeModuleEx(): if an
2953 error occurs while loading the module, these now delete the module's
2954 entry from sys.modules. All ways of loading modules eventually call
2955 one of these, so this is an error-case change in semantics for all
2956 ways of loading modules. In rare cases, a module loader may wish
2957 to keep a module object in sys.modules despite that the module's
2958 code cannot be executed. In such cases, the module loader must
2959 arrange to reinsert the name and module object in sys.modules.
2960 PyImport_ReloadModule() has been changed to reinsert the original
2961 module object into sys.modules if the module reload fails, so that
2962 its visible semantics have not changed.
2963
2964- A large pile of datetime field-extraction macros is now documented,
2965 thanks to Anthony Tuininga (patch #986010).
2966
2967Documentation
2968-------------
2969
2970- Improved the tutorial on creating types in C.
2971
2972 - point out the importance of reassigning data members before
2973 assigning their values
2974
2975 - correct my misconception about return values from visitprocs. Sigh.
2976
2977 - mention the labor saving Py_VISIT and Py_CLEAR macros.
2978
2979- Major rewrite of the math module docs, to address common confusions.
2980
2981Tests
2982-----
2983
2984- The test data files for the decimal test suite are now installed on
2985 platforms that use the Makefile.
2986
2987- SF patch 995225: The test file testtar.tar accidentally contained
2988 CVS keywords (like $Id$), which could cause spurious failures in
2989 test_tarfile.py depending on how the test file was checked out.
2990
2991
2992What's New in Python 2.4 alpha 1?
2993=================================
2994
2995*Release date: 08-JUL-2004*
2996
2997Core and builtins
2998-----------------
2999
3000- weakref.ref is now the type object also known as
3001 weakref.ReferenceType; it can be subclassed like any other new-style
3002 class. There's less per-entry overhead in WeakValueDictionary
3003 objects now (one object instead of three).
3004
3005- Bug #951851: Python crashed when reading import table of certain
3006 Windows DLLs.
3007
3008- Bug #215126. The locals argument to eval(), execfile(), and exec now
3009 accept any mapping type.
3010
3011- marshal now shares interned strings. This change introduces
3012 a new .pyc magic.
3013
3014- Bug #966623. classes created with type() in an exec(, {}) don't
3015 have a __module__, but code in typeobject assumed it would always
3016 be there.
3017
3018- Python no longer relies on the LC_NUMERIC locale setting to be
3019 the "C" locale; as a result, it no longer tries to prevent changing
3020 the LC_NUMERIC category.
3021
3022- Bug #952807: Unpickling pickled instances of subclasses of
3023 datetime.date, datetime.datetime and datetime.time could yield insane
3024 objects. Thanks to Jiwon Seo for a fix.
3025
3026- Bug #845802: Python crashes when __init__.py is a directory.
3027
3028- Unicode objects received two new methods: iswide() and width().
3029 These query East Asian width information, as specified in Unicode
3030 TR11.
3031
3032- Improved the tuple hashing algorithm to give fewer collisions in
3033 common cases. Fixes bug #942952.
3034
3035- Implemented generator expressions (PEP 289). Coded by Jiwon Seo.
3036
3037- Enabled the profiling of C extension functions (and builtins) - check
3038 new documentation and modified profile and bdb modules for more details
3039
3040- Set file.name to the object passed to open (instead of a new string)
3041
3042- Moved tracebackobject into traceback.h and renamed to PyTracebackObject
3043
3044- Optimized the byte coding for multiple assignments like "a,b=b,a" and
3045 "a,b,c=1,2,3". Improves their speed by 25% to 30%.
3046
3047- Limit the nested depth of a tuple for the second argument to isinstance()
3048 and issubclass() to the recursion limit of the interpreter.
3049 Fixes bug #858016 .
3050
3051- Optimized dict iterators, creating separate types for each
3052 and having them reveal their length. Also optimized the
3053 methods: keys(), values(), and items().
3054
3055- Implemented a newcode opcode, LIST_APPEND, that simplifies
3056 the generated bytecode for list comprehensions and further
3057 improves their performance (about 35%).
3058
3059- Implemented rich comparisons for floats, which seems to make
3060 comparisons involving NaNs somewhat less surprising when the
3061 underlying C compiler actually implements C99 semantics.
3062
3063- Optimized list.extend() to save memory and no longer create
3064 intermediate sequences. Also, extend() now pre-allocates the
3065 needed memory whenever the length of the iterable is known in
3066 advance -- this halves the time to extend the list.
3067
3068- Optimized list resize operations to make fewer calls to the system
3069 realloc(). Significantly speeds up list appends, list pops,
3070 list comprehensions, and the list constructor (when the input iterable
3071 length is not known).
3072
3073- Changed the internal list over-allocation scheme. For larger lists,
3074 overallocation ranged between 3% and 25%. Now, it is a constant 12%.
3075 For smaller lists (n<8), overallocation was upto eight elements. Now,
3076 the overallocation is no more than three elements -- this improves space
3077 utilization for applications that have large numbers of small lists.
3078
3079- Most list bodies now get re-used rather than freed. Speeds up list
3080 instantiation and deletion by saving calls to malloc() and free().
3081
3082- The dict.update() method now accepts all the same argument forms
3083 as the dict() constructor. This now includes item lists and/or
3084 keyword arguments.
3085
3086- Support for arbitrary objects supporting the read-only buffer
3087 interface as the co_code field of code objects (something that was
3088 only possible to create from C code) has been removed.
3089
3090- Made omitted callback and None equivalent for weakref.ref() and
3091 weakref.proxy(); the None case wasn't handled correctly in all
3092 cases.
3093
3094- Fixed problem where PyWeakref_NewRef() and PyWeakref_NewProxy()
3095 assumed that initial existing entries in an object's weakref list
3096 would not be removed while allocating a new weakref object. Since
3097 GC could be invoked at that time, however, that assumption was
3098 invalid. In a truly obscure case of GC being triggered during
3099 creation for a new weakref object for an referent which already
3100 has a weakref without a callback which is only referenced from
3101 cyclic trash, a memory error can occur. This consistently created a
3102 segfault in a debug build, but provided less predictable behavior in
3103 a release build.
3104
3105- input() builtin function now respects compiler flags such as
3106 __future__ statements. SF patch 876178.
3107
3108- Removed PendingDeprecationWarning from apply(). apply() remains
3109 deprecated, but the nuisance warning will not be issued.
3110
3111- At Python shutdown time (Py_Finalize()), 2.3 called cyclic garbage
3112 collection twice, both before and after tearing down modules. The
3113 call after tearing down modules has been disabled, because too much
3114 of Python has been torn down then for __del__ methods and weakref
3115 callbacks to execute sanely. The most common symptom was a sequence
3116 of uninformative messages on stderr when Python shut down, produced
3117 by threads trying to raise exceptions, but unable to report the nature
3118 of their problems because too much of the sys module had already been
3119 destroyed.
3120
3121- Removed FutureWarnings related to hex/oct literals and conversions
3122 and left shifts. (Thanks to Kalle Svensson for SF patch 849227.)
3123 This addresses most of the remaining semantic changes promised by
3124 PEP 237, except for repr() of a long, which still shows the trailing
3125 'L'. The PEP appears to promise warnings for operations that
3126 changed semantics compared to Python 2.3, but this is not
3127 implemented; we've suffered through enough warnings related to
3128 hex/oct literals and I think it's best to be silent now.
3129
3130- For str and unicode objects, the ljust(), center(), and rjust()
3131 methods now accept an optional argument specifying a fill
3132 character other than a space.
3133
3134- When method objects have an attribute that can be satisfied either
3135 by the function object or by the method object, the function
3136 object's attribute usually wins. Christian Tismer pointed out that
3137 that this is really a mistake, because this only happens for special
3138 methods (like __reduce__) where the method object's version is
3139 really more appropriate than the function's attribute. So from now
3140 on, all method attributes will have precedence over function
3141 attributes with the same name.
3142
3143- Critical bugfix, for SF bug 839548: if a weakref with a callback,
3144 its callback, and its weakly referenced object, all became part of
3145 cyclic garbage during a single run of garbage collection, the order
3146 in which they were torn down was unpredictable. It was possible for
3147 the callback to see partially-torn-down objects, leading to immediate
3148 segfaults, or, if the callback resurrected garbage objects, to
3149 resurrect insane objects that caused segfaults (or other surprises)
3150 later. In one sense this wasn't surprising, because Python's cyclic gc
3151 had no knowledge of Python's weakref objects. It does now. When
3152 weakrefs with callbacks become part of cyclic garbage now, those
3153 weakrefs are cleared first. The callbacks don't trigger then,
3154 preventing the problems. If you need callbacks to trigger, then just
3155 as when cyclic gc is not involved, you need to write your code so
3156 that weakref objects outlive the objects they weakly reference.
3157
3158- Critical bugfix, for SF bug 840829: if cyclic garbage collection
3159 happened to occur during a weakref callback for a new-style class
3160 instance, subtle memory corruption was the result (in a release build;
3161 in a debug build, a segfault occurred reliably very soon after).
3162 This has been repaired.
3163
3164- Compiler flags set in PYTHONSTARTUP are now active in __main__.
3165
3166- Added two builtin types, set() and frozenset().
3167
3168- Added a reversed() builtin function that returns a reverse iterator
3169 over a sequence.
3170
3171- Added a sorted() builtin function that returns a new sorted list
3172 from any iterable.
3173
3174- CObjects are now mutable (on the C level) through PyCObject_SetVoidPtr.
3175
3176- list.sort() now supports three keyword arguments: cmp, key, and reverse.
3177 The key argument can be a function of one argument that extracts a
3178 comparison key from the original record: mylist.sort(key=str.lower).
3179 The reverse argument is a boolean value and if True will change the
3180 sort order as if the comparison arguments were reversed. In addition,
3181 the documentation has been amended to provide a guarantee that all sorts
3182 starting with Py2.3 are guaranteed to be stable (the relative order of
3183 records with equal keys is unchanged).
3184
3185- Added test whether wchar_t is signed or not. A signed wchar_t is not
3186 usable as internal unicode type base for Py_UNICODE since the
3187 unicode implementation assumes an unsigned type.
3188
3189- Fixed a bug in the cache of length-one Unicode strings that could
3190 lead to a seg fault. The specific problem occurred when an earlier,
3191 non-fatal error left an uninitialized Unicode object in the
3192 freelist.
3193
3194- The % formatting operator now supports '%F' which is equivalent to
3195 '%f'. This has always been documented but never implemented.
3196
3197- complex(obj) could leak a little memory if obj wasn't a string or
3198 number.
3199
3200- zip() with no arguments now returns an empty list instead of raising
3201 a TypeError exception.
3202
3203- obj.__contains__() now returns True/False instead of 1/0. SF patch
3204 820195.
3205
3206- Python no longer tries to be smart about recursive comparisons.
3207 When comparing containers with cyclic references to themselves it
3208 will now just hit the recursion limit. See SF patch 825639.
3209
3210- str and unicode builtin types now have an rsplit() method that is
3211 same as split() except that it scans the string from the end
3212 working towards the beginning. See SF feature request 801847.
3213
3214- Fixed a bug in object.__reduce_ex__ when using protocol 2. Failure
3215 to clear the error when attempts to get the __getstate__ attribute
3216 fail caused intermittent errors and odd behavior.
3217
3218- buffer objects based on other objects no longer cache a pointer to
3219 the data and the data length. Instead, the appropriate tp_as_buffer
3220 method is called as necessary.
3221
3222- fixed: if a file is opened with an explicit buffer size >= 1, repeated
3223 close() calls would attempt to free() the buffer already free()ed on
3224 the first call.
3225
3226
3227Extension modules
3228-----------------
3229
3230- Added socket.getservbyport(), and make the second argument in
3231 getservbyname() and getservbyport() optional.
3232
3233- time module code that deals with input POSIX timestamps will now raise
3234 ValueError if more than a second is lost in precision when the
3235 timestamp is cast to the platform C time_t type. There's no chance
3236 that the platform will do anything sensible with the result in such
3237 cases. This includes ctime(), localtime() and gmtime(). Assorted
3238 fromtimestamp() and utcfromtimestamp() methods in the datetime module
3239 were also protected. Closes bugs #919012 and 975996.
3240
3241- fcntl.ioctl now warns if the mutate flag is not specified.
3242
3243- nt now properly allows to refer to UNC roots, e.g. in nt.stat().
3244
3245- the weakref module now supports additional objects: array.array,
3246 sre.pattern_objects, file objects, and sockets.
3247
3248- operator.isMappingType() and operator.isSequenceType() now give
3249 fewer false positives.
3250
3251- socket.sslerror is now a subclass of socket.error . Also added
3252 socket.error to the socket module's C API.
3253
3254- Bug #920575: A problem where the _locale module segfaults on
3255 nl_langinfo(ERA) caused by GNU libc's illegal NULL return is fixed.
3256
3257- array objects now support the copy module. Also, their resizing
3258 scheme has been updated to match that used for list objects. This improves
3259 the performance (speed and memory usage) of append() operations.
3260 Also, array.array() and array.extend() now accept any iterable argument
3261 for repeated appends without needing to create another temporary array.
3262
3263- cStringIO.writelines() now accepts any iterable argument and writes
3264 the lines one at a time rather than joining them and writing once.
3265 Made a parallel change to StringIO.writelines(). Saves memory and
3266 makes suitable for use with generator expressions.
3267
3268- time.strftime() now checks that the values in its time tuple argument
3269 are within the proper boundaries to prevent possible crashes from the
3270 platform's C library implementation of strftime(). Can possibly
3271 break code that uses values outside the range that didn't cause
3272 problems previously (such as sitting day of year to 0). Fixes bug
3273 #897625.
3274
3275- The socket module now supports Bluetooth sockets, if the
3276 system has <bluetooth/bluetooth.h>
3277
3278- Added a collections module containing a new datatype, deque(),
3279 offering high-performance, thread-safe, memory friendly appends
3280 and pops on either side of the deque.
3281
3282- Several modules now take advantage of collections.deque() for
3283 improved performance: Queue, mutex, shlex, threading, and pydoc.
3284
3285- The operator module has two new functions, attrgetter() and
3286 itemgetter() which are useful for creating fast data extractor
3287 functions for map(), list.sort(), itertools.groupby(), and
3288 other functions that expect a function argument.
3289
3290- socket.SHUT_{RD,WR,RDWR} was added.
3291
3292- os.getsid was added.
3293
3294- The pwd module incorrectly advertised its struct type as
3295 struct_pwent; this has been renamed to struct_passwd. (The old name
3296 is still supported for backwards compatibility.)
3297
3298- The xml.parsers.expat module now provides Expat 1.95.7.
3299
3300- socket.IPPROTO_IPV6 was added.
3301
3302- readline.clear_history was added.
3303
3304- select.select() now accepts sequences for its first three arguments.
3305
3306- cStringIO now supports the f.closed attribute.
3307
3308- The signal module now exposes SIGRTMIN and SIGRTMAX (if available).
3309
3310- curses module now supports use_default_colors(). [patch #739124]
3311
3312- Bug #811028: ncurses.h breakage on FreeBSD/MacOS X
3313
3314- Bug #814613: INET_ADDRSTRLEN fix needed for all compilers on SGI
3315
3316- Implemented non-recursive SRE matching scheme (#757624).
3317
3318- Implemented (?(id/name)yes|no) support in SRE (#572936).
3319
3320- random.seed() with no arguments or None uses time.time() as a default
3321 seed. Modified to match Py2.2 behavior and use fractional seconds so
3322 that successive runs are more likely to produce different sequences.
3323
3324- random.Random has a new method, getrandbits(k), which returns an int
3325 with k random bits. This method is now an optional part of the API
3326 for user defined generators. Any generator that defines genrandbits()
3327 can now use randrange() for ranges with a length >= 2**53. Formerly,
3328 randrange would return only even numbers for ranges that large (see
3329 SF bug #812202). Generators that do not define genrandbits() now
3330 issue a warning when randrange() is called with a range that large.
3331
3332- itertools has a new function, groupby() for aggregating iterables
3333 into groups sharing the same key (as determined by a key function).
3334 It offers some of functionality of SQL's groupby keyword and of
3335 the Unix uniq filter.
3336
3337- itertools now has a new tee() function which produces two independent
3338 iterators from a single iterable.
3339
3340- itertools.izip() with no arguments now returns an empty iterator instead
3341 of raising a TypeError exception.
3342
3343- Fixed #853061: allow BZ2Compressor.compress() to receive an empty string
3344 as parameter.
3345
3346Library
3347-------
3348
3349- Added a new module: cProfile, a C profiler with the same interface as the
3350 profile module. cProfile avoids some of the drawbacks of the hotshot
3351 profiler and provides a bit more information than the other two profilers.
3352 Based on "lsprof" (patch #1212837).
3353
3354- Bug #1266283: The new function "lexists" is now in os.path.__all__.
3355
3356- Bug #981530: Fix UnboundLocalError in shutil.rmtree(). This affects
3357 the documented behavior: the function passed to the onerror()
3358 handler can now also be os.listdir.
3359
3360- Bug #754449: threading.Thread objects no longer mask exceptions raised during
3361 interpreter shutdown with another exception from attempting to handle the
3362 original exception.
3363
3364- Added decimal.py per PEP 327.
3365
3366- Bug #981299: rsync is now a recognized protocol in urlparse that uses a
3367 "netloc" portion of a URL.
3368
3369- Bug #919012: shutil.move() will not try to move a directory into itself.
3370 Thanks Johannes Gijsbers.
3371
3372- Bug #934282: pydoc.stripid() is now case-insensitive. Thanks Robin Becker.
3373
3374- Bug #823209: cmath.log() now takes an optional base argument so that its
3375 API matches math.log().
3376
3377- Bug #957381: distutils bdist_rpm no longer fails on recent RPM versions
3378 that generate a -debuginfo.rpm
3379
3380- os.path.devnull has been added for all supported platforms.
3381
3382- Fixed #877165: distutils now picks the right C++ compiler command
3383 on cygwin and mingw32.
3384
3385- urllib.urlopen().readline() now handles HTTP/0.9 correctly.
3386
3387- refactored site.py into functions. Also wrote regression tests for the
3388 module.
3389
3390- The distutils install command now supports the --home option and
3391 installation scheme for all platforms.
3392
3393- asyncore.loop now has a repeat count parameter that defaults to
3394 looping forever.
3395
3396- The distutils sdist command now ignores all .svn directories, in
3397 addition to CVS and RCS directories. .svn directories hold
3398 administrative files for the Subversion source control system.
3399
3400- Added a new module: cookielib. Automatic cookie handling for HTTP
3401 clients. Also, support for cookielib has been added to urllib2, so
3402 urllib2.urlopen() can transparently handle cookies.
3403
3404- stringprep.py now uses built-in set() instead of sets.Set().
3405
3406- Bug #876278: Unbounded recursion in modulefinder
3407
3408- Bug #780300: Swap public and system ID in LexicalHandler.startDTD.
3409 Applications relying on the wrong order need to be corrected.
3410
3411- Bug #926075: Fixed a bug that returns a wrong pattern object
3412 for a string or unicode object in sre.compile() when a different
3413 type pattern with the same value exists.
3414
3415- Added countcallers arg to trace.Trace class (--trackcalls command line arg
3416 when run from the command prompt).
3417
3418- Fixed a caching bug in platform.platform() where the argument of 'terse' was
3419 not taken into consideration when caching value.
3420
3421- Added two new command-line arguments for profile (output file and
3422 default sort).
3423
3424- Added global runctx function to profile module
3425
3426- Add hlist missing entryconfigure and entrycget methods.
3427
3428- The ptcp154 codec was added for Kazakh character set support.
3429
3430- Support non-anonymous ftp URLs in urllib2.
3431
3432- The encodings package will now apply codec name aliases
3433 first before starting to try the import of the codec module.
3434 This simplifies overriding built-in codecs with external
3435 packages, e.g. the included CJK codecs with the JapaneseCodecs
3436 package, by adjusting the aliases dictionary in encodings.aliases
3437 accordingly.
3438
3439- base64 now supports RFC 3548 Base16, Base32, and Base64 encoding and
3440 decoding standards.
3441
3442- urllib2 now supports processors. A processor is a handler that
3443 implements an xxx_request or xxx_response method. These methods are
3444 called for all requests.
3445
3446- distutils compilers now compile source files in the same order as
3447 they are passed to the compiler.
3448
3449- pprint.pprint() and pprint.pformat() now have additional parameters
3450 indent, width and depth.
3451
3452- Patch #750542: pprint now will pretty print subclasses of list, tuple
3453 and dict too, as long as they don't overwrite __repr__().
3454
3455- Bug #848614: distutils' msvccompiler fails to find the MSVC6
3456 compiler because of incomplete registry entries.
3457
3458- httplib.HTTP.putrequest now offers to omit the implicit Accept-Encoding.
3459
3460- Patch #841977: modulefinder didn't find extension modules in packages
3461
3462- imaplib.IMAP4.thread was added.
3463
3464- Plugged a minor hole in tempfile.mktemp() due to the use of
3465 os.path.exists(), switched to using os.lstat() directly if possible.
3466
3467- bisect.py and heapq.py now have underlying C implementations
3468 for better performance.
3469
3470- heapq.py has two new functions, nsmallest() and nlargest().
3471
3472- traceback.format_exc has been added (similar to print_exc but it returns
3473 a string).
3474
3475- xmlrpclib.MultiCall has been added.
3476
3477- poplib.POP3_SSL has been added.
3478
3479- tmpfile.mkstemp now returns an absolute path even if dir is relative.
3480
3481- urlparse is RFC 2396 compliant.
3482
3483- The fieldnames argument to the csv module's DictReader constructor is now
3484 optional. If omitted, the first row of the file will be used as the
3485 list of fieldnames.
3486
3487- encodings.bz2_codec was added for access to bz2 compression
3488 using "a long string".encode('bz2')
3489
3490- Various improvements to unittest.py, realigned with PyUnit CVS.
3491
3492- dircache now passes exceptions to the caller, instead of returning
3493 empty lists.
3494
3495- The bsddb module and dbhash module now support the iterator and
3496 mapping protocols which make them more substitutable for dictionaries
3497 and shelves.
3498
3499- The csv module's DictReader and DictWriter classes now accept keyword
3500 arguments. This was an omission in the initial implementation.
3501
3502- The email package handles some RFC 2231 parameters with missing
3503 CHARSET fields better. It also includes a patch to parameter
3504 parsing when semicolons appear inside quotes.
3505
3506- sets.py now runs under Py2.2. In addition, the argument restrictions
3507 for most set methods (but not the operators) have been relaxed to
3508 allow any iterable.
3509
3510- _strptime.py now has a behind-the-scenes caching mechanism for the most
3511 recent TimeRE instance used along with the last five unique directive
3512 patterns. The overall module was also made more thread-safe.
3513
3514- random.cunifvariate() and random.stdgamma() were deprecated in Py2.3
3515 and removed in Py2.4.
3516
3517- Bug #823328: urllib2.py's HTTP Digest Auth support works again.
3518
3519- Patch #873597: CJK codecs are imported into rank of default codecs.
3520
3521Tools/Demos
3522-----------
3523
3524- A hotshotmain script was added to the Tools/scripts directory that
3525 makes it easy to run a script under control of the hotshot profiler.
3526
3527- The db2pickle and pickle2db scripts can now dump/load gdbm files.
3528
3529- The file order on the command line of the pickle2db script was reversed.
3530 It is now [ picklefile ] dbfile. This provides better symmetry with
3531 db2pickle. The file arguments to both scripts are now source followed by
3532 destination in situations where both files are given.
3533
3534- The pydoc script will display a link to the module documentation for
3535 modules determined to be part of the core distribution. The documentation
3536 base directory defaults to http://www.python.org/doc/current/lib/ but can
3537 be changed by setting the PYTHONDOCS environment variable.
3538
3539- texcheck.py now detects double word errors.
3540
3541- md5sum.py mistakenly opened input files in text mode by default, a
3542 silent and dangerous change from previous releases. It once again
3543 opens input files in binary mode by default. The -t and -b flags
3544 remain for compatibility with the 2.3 release, but -b is the default
3545 now.
3546
3547- py-electric-colon now works when pending-delete/delete-selection mode is
3548 in effect
3549
3550- py-help-at-point is no longer bound to the F1 key - it's still bound to
3551 C-c C-h
3552
3553- Pynche was fixed to not crash when there is no ~/.pynche file and no
3554 -d option was given.
3555
3556Build
3557-----
3558
3559- Bug #978645: Modules/getpath.c now builds properly in --disable-framework
3560 build under OS X.
3561
3562- Profiling using gprof is now available if Python is configured with
3563 --enable-profiling.
3564
3565- Profiling the VM using the Pentium TSC is now possible if Python
3566 is configured --with-tsc.
3567
3568- In order to find libraries, setup.py now also looks in /lib64, for use
3569 on AMD64.
3570
3571- Bug #934635: Fixed a bug where the configure script couldn't detect
3572 getaddrinfo() properly if the KAME stack had SCTP support.
3573
3574- Support for missing ANSI C header files (limits.h, stddef.h, etc) was
3575 removed.
3576
3577- Systems requiring the D4, D6 or D7 variants of pthreads are no longer
3578 supported (see PEP 11).
3579
3580- Universal newline support can no longer be disabled (see PEP 11).
3581
3582- Support for DGUX, SunOS 4, IRIX 4 and Minix was removed (see PEP 11).
3583
3584- Support for systems requiring --with-dl-dld or --with-sgi-dl was removed
3585 (see PEP 11).
3586
3587- Tests for sizeof(char) were removed since ANSI C mandates that
3588 sizeof(char) must be 1.
3589
3590C API
3591-----
3592
3593- Thanks to Anthony Tuininga, the datetime module now supplies a C API
3594 containing type-check macros and constructors. See new docs in the
3595 Python/C API Reference Manual for details.
3596
3597- Private function _PyTime_DoubleToTimet added, to convert a Python
3598 timestamp (C double) to platform time_t with some out-of-bounds
3599 checking. Declared in new header file timefuncs.h. It would be
3600 good to expose some other internal timemodule.c functions there.
3601
3602- New public functions PyEval_EvaluateFrame and PyGen_New to expose
3603 generator objects.
3604
3605- New public functions Py_IncRef() and Py_DecRef(), exposing the
3606 functionality of the Py_XINCREF() and Py_XDECREF macros. Useful for
3607 runtime dynamic embedding of Python. See patch #938302, by Bob
3608 Ippolito.
3609
3610- Added a new macro, PySequence_Fast_ITEMS, which retrieves a fast sequence's
3611 underlying array of PyObject pointers. Useful for high speed looping.
3612
3613- Created a new method flag, METH_COEXIST, which causes a method to be loaded
3614 even if already defined by a slot wrapper. This allows a __contains__
3615 method, for example, to co-exist with a defined sq_contains slot. This
3616 is helpful because the PyCFunction can take advantage of optimized calls
3617 whenever METH_O or METH_NOARGS flags are defined.
3618
3619- Added a new function, PyDict_Contains(d, k) which is like
3620 PySequence_Contains() but is specific to dictionaries and executes
3621 about 10% faster.
3622
3623- Added three new macros: Py_RETURN_NONE, Py_RETURN_TRUE, and Py_RETURN_FALSE.
3624 Each return the singleton they mention after Py_INCREF()ing them.
3625
3626- Added a new function, PyTuple_Pack(n, ...) for constructing tuples from a
3627 variable length argument list of Python objects without having to invoke
3628 the more complex machinery of Py_BuildValue(). PyTuple_Pack(3, a, b, c)
3629 is equivalent to Py_BuildValue("(OOO)", a, b, c).
3630
3631Windows
3632-------
3633
3634- The _winreg module could segfault when reading very large registry
3635 values, due to unchecked alloca() calls (SF bug 851056). The fix is
3636 uses either PyMem_Malloc(n) or PyString_FromStringAndSize(NULL, n),
3637 as appropriate, followed by a size check.
3638
3639- file.truncate() could misbehave if the file was open for update
3640 (modes r+, rb+, w+, wb+), and the most recent file operation before
3641 the truncate() call was an input operation. SF bug 801631.
3642
3643
3644What's New in Python 2.3 final?
3645===============================
3646
3647*Release date: 29-Jul-2003*
3648
3649IDLE
3650----
3651
3652- Bug 778400: IDLE hangs when selecting "Edit with IDLE" from explorer.
3653 This was unique to Windows, and was fixed by adding an -n switch to
3654 the command the Windows installer creates to execute "Edit with IDLE"
3655 context-menu actions.
3656
3657- IDLE displays a new message upon startup: some "personal firewall"
3658 kinds of programs (for example, ZoneAlarm) open a dialog of their
3659 own when any program opens a socket. IDLE does use sockets, talking
3660 on the computer's internal loopback interface. This connection is not
3661 visible on any external interface and no data is sent to or received
3662 from the Internet. So, if you get such a dialog when opening IDLE,
3663 asking whether to let pythonw.exe talk to address 127.0.0.1, say yes,
3664 and rest assured no communication external to your machine is taking
3665 place. If you don't allow it, IDLE won't be able to start.
3666
3667
3668What's New in Python 2.3 release candidate 2?
3669=============================================
3670
3671*Release date: 24-Jul-2003*
3672
3673Core and builtins
3674-----------------
3675
3676- It is now possible to import from zipfiles containing additional
3677 data bytes before the zip compatible archive. Zipfiles containing a
3678 comment at the end are still unsupported.
3679
3680Extension modules
3681-----------------
3682
3683- A longstanding bug in the parser module's initialization could cause
3684 fatal internal refcount confusion when the module got initialized more
3685 than once. This has been fixed.
3686
3687- Fixed memory leak in pyexpat; using the parser's ParseFile() method
3688 with open files that aren't instances of the standard file type
3689 caused an instance of the bound .read() method to be leaked on every
3690 call.
3691
3692- Fixed some leaks in the locale module.
3693
3694Library
3695-------
3696
3697- Lib/encodings/rot_13.py when used as a script, now more properly
3698 uses the first Python interpreter on your path.
3699
3700- Removed caching of TimeRE (and thus LocaleTime) in _strptime.py to
3701 fix a locale related bug in the test suite. Although another patch
3702 was needed to actually fix the problem, the cache code was not
3703 restored.
3704
3705IDLE
3706----
3707
3708- Calltips patches.
3709
3710Build
3711-----
3712
3713- For MacOSX, added -mno-fused-madd to BASECFLAGS to fix test_coercion
3714 on Panther (OSX 10.3).
3715
3716C API
3717-----
3718
3719Windows
3720-------
3721
3722- The tempfile module could do insane imports on Windows if PYTHONCASEOK
3723 was set, making temp file creation impossible. Repaired.
3724
3725- Add a patch to workaround pthread_sigmask() bugs in Cygwin.
3726
3727Mac
3728---
3729
3730- Various fixes to pimp.
3731
3732- Scripts runs with pythonw no longer had full window manager access.
3733
3734- Don't force boot-disk-only install, for reasons unknown it causes
3735 more problems than it solves.
3736
3737
3738What's New in Python 2.3 release candidate 1?
3739=============================================
3740
3741*Release date: 18-Jul-2003*
3742
3743Core and builtins
3744-----------------
3745
3746- The new function sys.getcheckinterval() returns the last value set
3747 by sys.setcheckinterval().
3748
3749- Several bugs in the symbol table phase of the compiler have been
3750 fixed. Errors could be lost and compilation could fail without
3751 reporting an error. SF patch 763201.
3752
3753- The interpreter is now more robust about importing the warnings
3754 module. In an executable generated by freeze or similar programs,
3755 earlier versions of 2.3 would fail if the warnings module could
3756 not be found on the file system. Fixes SF bug 771097.
3757
3758- A warning about assignments to module attributes that shadow
3759 builtins, present in earlier releases of 2.3, has been removed.
3760
3761- It is not possible to create subclasses of builtin types like str
3762 and tuple that define an itemsize. Earlier releases of Python 2.3
3763 allowed this by mistake, leading to crashes and other problems.
3764
3765- The thread_id is now initialized to 0 in a non-thread build. SF bug
3766 770247.
3767
3768- SF bug 762891: "del p[key]" on proxy object no longer raises SystemError.
3769
3770Extension modules
3771-----------------
3772
3773- weakref.proxy() can now handle "del obj[i]" for proxy objects
3774 defining __delitem__. Formerly, it generated a SystemError.
3775
3776- SSL no longer crashes the interpreter when the remote side disconnects.
3777
3778- On Unix the mmap module can again be used to map device files.
3779
3780- time.strptime now exclusively uses the Python implementation
3781 contained within the _strptime module.
3782
3783- The print slot of weakref proxy objects was removed, because it was
3784 not consistent with the object's repr slot.
3785
3786- The mmap module only checks file size for regular files, not
3787 character or block devices. SF patch 708374.
3788
3789- The cPickle Pickler garbage collection support was fixed to traverse
3790 the find_class attribute, if present.
3791
3792- There are several fixes for the bsddb3 wrapper module.
3793
3794 bsddb3 no longer crashes if an environment is closed before a cursor
3795 (SF bug 763298).
3796
3797 The DB and DBEnv set_get_returns_none function was extended to take
3798 a level instead of a boolean flag. The new level 2 means that in
3799 addition, cursor.set()/.get() methods return None instead of raising
3800 an exception.
3801
3802 A typo was fixed in DBCursor.join_item(), preventing a crash.
3803
3804Library
3805-------
3806
3807- distutils now supports MSVC 7.1
3808
3809- doctest now examines all docstrings by default. Previously, it would
3810 skip over functions with private names (as indicated by the underscore
3811 naming convention). The old default created too much of a risk that
3812 user tests were being skipped inadvertently. Note, this change could
3813 break code in the unlikely case that someone had intentionally put
3814 failing tests in the docstrings of private functions. The breakage
3815 is easily fixable by specifying the old behavior when calling testmod()
3816 or Tester().
3817
3818- There were several fixes to the way dumbdbms are closed. It's vital
3819 that a dumbdbm database be closed properly, else the on-disk data
3820 and directory files can be left in mutually inconsistent states.
3821 dumbdbm.py's _Database.__del__() method attempted to close the
3822 database properly, but a shutdown race in _Database._commit() could
3823 prevent this from working, so that a program trusting __del__() to
3824 get the on-disk files in synch could be badly surprised. The race
3825 has been repaired. A sync() method was also added so that shelve
3826 can guarantee data is written to disk.
3827
3828 The close() method can now be called more than once without complaint.
3829
3830- The classes in threading.py are now new-style classes. That they
3831 weren't before was an oversight.
3832
3833- The urllib2 digest authentication handlers now define the correct
3834 auth_header. The earlier versions would fail at runtime.
3835
3836- SF bug 763023: fix uncaught ZeroDivisionError in difflib ratio methods
3837 when there are no lines.
3838
3839- SF bug 763637: fix exception in Tkinter with after_cancel
3840 which could occur with Tk 8.4
3841
3842- SF bug 770601: CGIHTTPServer.py now passes the entire environment
3843 to child processes.
3844
3845- SF bug 765238: add filter to fnmatch's __all__.
3846
3847- SF bug 748201: make time.strptime() error messages more helpful.
3848
3849- SF patch 764470: Do not dump the args attribute of a Fault object in
3850 xmlrpclib.
3851
3852- SF patch 549151: urllib and urllib2 now redirect POSTs on 301
3853 responses.
3854
3855- SF patch 766650: The whichdb module was fixed to recognize dbm files
3856 generated by gdbm on OS/2 EMX.
3857
3858- SF bugs 763047 and 763052: fixes bug of timezone value being left as
3859 -1 when ``time.tzname[0] == time.tzname[1] and not time.daylight``
3860 is true when it should only when time.daylight is true.
3861
3862- SF bug 764548: re now allows subclasses of str and unicode to be
3863 used as patterns.
3864
3865- SF bug 763637: In Tkinter, change after_cancel() to handle tuples
3866 of varying sizes. Tk 8.4 returns a different number of values
3867 than Tk 8.3.
3868
3869- SF bug 763023: difflib.ratio() did not catch zero division.
3870
3871- The Queue module now has an __all__ attribute.
3872
3873Tools/Demos
3874-----------
3875
3876- See Lib/idlelib/NEWS.txt for IDLE news.
3877
3878- SF bug 753592: webchecker/wsgui now handles user supplied directories.
3879
3880- The trace.py script has been removed. It is now in the standard library.
3881
3882Build
3883-----
3884
3885- Python now compiles with -fno-strict-aliasing if possible (SF bug 766696).
3886
3887- The socket module compiles on IRIX 6.5.10.
3888
3889- An irix64 system is treated the same way as an irix6 system (SF
3890 patch 764560).
3891
3892- Several definitions were missing on FreeBSD 5.x unless the
3893 __BSD_VISIBLE symbol was defined. configure now defines it as
3894 needed.
3895
3896C API
3897-----
3898
3899- Unicode objects now support mbcs as a built-in encoding, so the C
3900 API can use it without deferring to the encodings package.
3901
3902Windows
3903-------
3904
3905- The Windows implementation of PyThread_start_new_thread() never
3906 checked error returns from Windows functions correctly. As a result,
3907 it could claim to start a new thread even when the Microsoft
3908 _beginthread() function failed (due to "too many threads" -- this is
3909 on the order of thousands when it happens). In these cases, the
3910 Python exception ::
3911
3912 thread.error: can't start new thread
3913
3914 is raised now.
3915
3916- SF bug 766669: Prevent a GPF on interpreter exit when sockets are in
3917 use. The interpreter now calls WSACleanup() from Py_Finalize()
3918 instead of from DLL teardown.
3919
3920Mac
3921---
3922
3923- Bundlebuilder now inherits default values in the right way. It was
3924 previously possible for app bundles to get a type of "BNDL" instead
3925 of "APPL." Other improvements include, a --build-id option to
3926 specify the CFBundleIdentifier and using the --python option to set
3927 the executable in the bundle.
3928
3929- Fixed two bugs in MacOSX framework handling.
3930
3931- pythonw did not allow user interaction in 2.3rc1, this has been fixed.
3932
3933- Python is now compiled with -mno-fused-madd, making all tests pass
3934 on Panther.
3935
3936What's New in Python 2.3 beta 2?
3937================================
3938
3939*Release date: 29-Jun-2003*
3940
3941Core and builtins
3942-----------------
3943
3944- A program can now set the environment variable PYTHONINSPECT to some
3945 string value in Python, and cause the interpreter to enter the
3946 interactive prompt at program exit, as if Python had been invoked
3947 with the -i option.
3948
3949- list.index() now accepts optional start and stop arguments. Similar
3950 changes were made to UserList.index(). SF feature request 754014.
3951
3952- SF patch 751998 fixes an unwanted side effect of the previous fix
3953 for SF bug 742860 (the next item).
3954
3955- SF bug 742860: "WeakKeyDictionary __delitem__ uses iterkeys". This
3956 wasn't threadsafe, was very inefficient (expected time O(len(dict))
3957 instead of O(1)), and could raise a spurious RuntimeError if another
3958 thread mutated the dict during __delitem__, or if a comparison function
3959 mutated it. It also neglected to raise KeyError when the key wasn't
3960 present; didn't raise TypeError when the key wasn't of a weakly
3961 referencable type; and broke various more-or-less obscure dict
3962 invariants by using a sequence of equality comparisons over the whole
3963 set of dict keys instead of computing the key's hash code to narrow
3964 the search to those keys with the same hash code. All of these are
3965 considered to be bugs. A new implementation of __delitem__ repairs all
3966 that, but note that fixing these bugs may change visible behavior in
3967 code relying (whether intentionally or accidentally) on old behavior.
3968
3969- SF bug 734869: Fixed a compiler bug that caused a fatal error when
3970 compiling a list comprehension that contained another list comprehension
3971 embedded in a lambda expression.
3972
3973- SF bug 705231: builtin pow() no longer lets the platform C pow()
3974 raise -1.0 to integer powers, because (at least) glibc gets it wrong
3975 in some cases. The result should be -1.0 if the power is odd and 1.0
3976 if the power is even, and any float with a sufficiently large exponent
3977 is (mathematically) an exact even integer.
3978
3979- SF bug 759227: A new-style class that implements __nonzero__() must
3980 return a bool or int (but not an int subclass) from that method. This
3981 matches the restriction on classic classes.
3982
3983- The encoding attribute has been added for file objects, and set to
3984 the terminal encoding on Unix and Windows.
3985
3986- The softspace attribute of file objects became read-only by oversight.
3987 It's writable again.
3988
3989- Reverted a 2.3 beta 1 change to iterators for subclasses of list and
3990 tuple. By default, the iterators now access data elements directly
3991 instead of going through __getitem__. If __getitem__ access is
3992 preferred, then __iter__ can be overridden.
3993
3994- SF bug 735247: The staticmethod and super types participate in
3995 garbage collection. Before this change, it was possible for leaks to
3996 occur in functions with non-global free variables that used these types.
3997
3998Extension modules
3999-----------------
4000
4001- the socket module has a new exception, socket.timeout, to allow
4002 timeouts to be handled separately from other socket errors.
4003
4004- SF bug 751276: cPickle has fixed to propagate exceptions raised in
4005 user code. In earlier versions, cPickle caught and ignored any
4006 exception when it performed operations that it expected to raise
4007 specific exceptions like AttributeError.
4008
4009- cPickle Pickler and Unpickler objects now participate in garbage
4010 collection.
4011
4012- mimetools.choose_boundary() could return duplicate strings at times,
4013 especially likely on Windows. The strings returned are now guaranteed
4014 unique within a single program run.
4015
4016- thread.interrupt_main() raises KeyboardInterrupt in the main thread.
4017 dummy_thread has also been modified to try to simulate the behavior.
4018
4019- array.array.insert() now treats negative indices as being relative
4020 to the end of the array, just like list.insert() does. (SF bug #739313)
4021
4022- The datetime module classes datetime, time, and timedelta are now
4023 properly subclassable.
4024
4025- _tkinter.{get|set}busywaitinterval was added.
4026
4027- itertools.islice() now accepts stop=None as documented.
4028 Fixes SF bug #730685.
4029
4030- the bsddb185 module is built in one restricted instance -
4031 /usr/include/db.h exists and defines HASHVERSION to be 2. This is true
4032 for many BSD-derived systems.
4033
4034
4035Library
4036-------
4037
4038- Some happy doctest extensions from Jim Fulton have been added to
4039 doctest.py. These are already being used in Zope3. The two
4040 primary ones:
4041
4042 doctest.debug(module, name) extracts the doctests from the named object
4043 in the given module, puts them in a temp file, and starts pdb running
4044 on that file. This is great when a doctest fails.
4045
4046 doctest.DocTestSuite(module=None) returns a synthesized unittest
4047 TestSuite instance, to be run by the unittest framework, which
4048 runs all the doctests in the module. This allows writing tests in
4049 doctest style (which can be clearer and shorter than writing tests
4050 in unittest style), without losing unittest's powerful testing
4051 framework features (which doctest lacks).
4052
4053- For compatibility with doctests created before 2.3, if an expected
4054 output block consists solely of "1" and the actual output block
4055 consists solely of "True", it's accepted as a match; similarly
4056 for "0" and "False". This is quite un-doctest-like, but is practical.
4057 The behavior can be disabled by passing the new doctest module
4058 constant DONT_ACCEPT_TRUE_FOR_1 to the new optionflags optional
4059 argument.
4060
4061- ZipFile.testzip() now only traps BadZipfile exceptions. Previously,
4062 a bare except caught to much and reported all errors as a problem
4063 in the archive.
4064
4065- The logging module now has a new function, makeLogRecord() making
4066 LogHandler easier to interact with DatagramHandler and SocketHandler.
4067
4068- The cgitb module has been extended to support plain text display (SF patch
4069 569574).
4070
4071- A brand new version of IDLE (from the IDLEfork project at
4072 SourceForge) is now included as Lib/idlelib. The old Tools/idle is
4073 no more.
4074
4075- Added a new module: trace (documentation missing). This module used
4076 to be distributed in Tools/scripts. It uses sys.settrace() to trace
4077 code execution -- either function calls or individual lines. It can
4078 generate tracing output during execution or a post-mortem report of
4079 code coverage.
4080
4081- The threading module has new functions settrace() and setprofile()
4082 that cooperate with the functions of the same name in the sys
4083 module. A function registered with the threading module will
4084 be used for all threads it creates. The new trace module uses this
4085 to provide tracing for code running in threads.
4086
4087- copy.py: applied SF patch 707900, fixing bug 702858, by Steven
4088 Taschuk. Copying a new-style class that had a reference to itself
4089 didn't work. (The same thing worked fine for old-style classes.)
4090 Builtin functions are now treated as atomic, fixing bug #746304.
4091
4092- difflib.py has two new functions: context_diff() and unified_diff().
4093
4094- More fixes to urllib (SF 549151): (a) When redirecting, always use
4095 GET. This is common practice and more-or-less sanctioned by the
4096 HTTP standard. (b) Add a handler for 307 redirection, which becomes
4097 an error for POST, but a regular redirect for GET and HEAD
4098
4099- Added optional 'onerror' argument to os.walk(), to control error
4100 handling.
4101
4102- inspect.is{method|data}descriptor was added, to allow pydoc display
4103 __doc__ of data descriptors.
4104
4105- Fixed socket speed loss caused by use of the _socketobject wrapper class
4106 in socket.py.
4107
4108- timeit.py now checks the current directory for imports.
4109
4110- urllib2.py now knows how to order proxy classes, so the user doesn't
4111 have to insert it in front of other classes, nor do dirty tricks like
4112 inserting a "dummy" HTTPHandler after a ProxyHandler when building an
4113 opener with proxy support.
4114
4115- Iterators have been added for dbm keys.
4116
4117- random.Random objects can now be pickled.
4118
4119Tools/Demos
4120-----------
4121
4122- pydoc now offers help on keywords and topics.
4123
4124- Tools/idle is gone; long live Lib/idlelib.
4125
4126- diff.py prints file diffs in context, unified, or ndiff formats,
4127 providing a command line interface to difflib.py.
4128
4129- texcheck.py is a new script for making a rough validation of Python LaTeX
4130 files.
4131
4132Build
4133-----
4134
4135- Setting DESTDIR during 'make install' now allows specifying a
4136 different root directory.
4137
4138C API
4139-----
4140
4141- PyType_Ready(): If a type declares that it participates in gc
4142 (Py_TPFLAGS_HAVE_GC), and its base class does not, and its base class's
4143 tp_free slot is the default _PyObject_Del, and type does not define
4144 a tp_free slot itself, _PyObject_GC_Del is assigned to type->tp_free.
4145 Previously _PyObject_Del was inherited, which could at best lead to a
4146 segfault. In addition, if even after this magic the type's tp_free
4147 slot is _PyObject_Del or NULL, and the type is a base type
4148 (Py_TPFLAGS_BASETYPE), TypeError is raised: since the type is a base
4149 type, its dealloc function must call type->tp_free, and since the type
4150 is gc'able, tp_free must not be NULL or _PyObject_Del.
4151
4152- PyThreadState_SetAsyncExc(): A new API (deliberately accessible only
4153 from C) to interrupt a thread by sending it an exception. It is
4154 intentional that you have to write your own C extension to call it
4155 from Python.
4156
4157
4158New platforms
4159-------------
4160
4161None this time.
4162
4163Tests
4164-----
4165
4166- test_imp rewritten so that it doesn't raise RuntimeError if run as a
4167 side effect of being imported ("import test.autotest").
4168
4169Windows
4170-------
4171
4172- The Windows installer ships with Tcl/Tk 8.4.3 (upgraded from 8.4.1).
4173
4174- The installer always suggested that Python be installed on the C:
4175 drive, due to a hardcoded "C:" generated by the Wise installation
4176 wizard. People with machines where C: is not the system drive
4177 usually want Python installed on whichever drive is their system drive
4178 instead. We removed the hardcoded "C:", and two testers on machines
4179 where C: is not the system drive report that the installer now
4180 suggests their system drive. Note that you can always select the
4181 directory you want in the "Select Destination Directory" dialog --
4182 that's what it's for.
4183
4184Mac
4185---
4186
4187- There's a new module called "autoGIL", which offers a mechanism to
4188 automatically release the Global Interpreter Lock when an event loop
4189 goes to sleep, allowing other threads to run. It's currently only
4190 supported on OSX, in the Mach-O version.
4191- The OSA modules now allow direct access to properties of the
4192 toplevel application class (in AppleScript terminology).
4193- The Package Manager can now update itself.
4194
4195SourceForge Bugs and Patches Applied
4196------------------------------------
4197
4198430160, 471893, 501716, 542562, 549151, 569574, 595837, 596434,
4199598163, 604210, 604716, 610332, 612627, 614770, 620190, 621891,
4200622042, 639139, 640236, 644345, 649742, 649742, 658233, 660022,
4201661318, 661676, 662807, 662923, 666219, 672855, 678325, 682347,
4202683486, 684981, 685773, 686254, 692776, 692959, 693094, 696777,
4203697989, 700827, 703666, 708495, 708604, 708901, 710733, 711902,
4204713722, 715782, 718286, 719359, 719367, 723136, 723831, 723962,
4205724588, 724767, 724767, 725942, 726150, 726446, 726869, 727051,
4206727719, 727719, 727805, 728277, 728563, 728656, 729096, 729103,
4207729293, 729297, 729300, 729317, 729395, 729622, 729817, 730170,
4208730296, 730594, 730685, 730826, 730963, 731209, 731403, 731504,
4209731514, 731626, 731635, 731643, 731644, 731644, 731689, 732124,
4210732143, 732234, 732284, 732284, 732479, 732761, 732783, 732951,
4211733667, 733781, 734118, 734231, 734869, 735051, 735293, 735527,
4212735613, 735694, 736962, 736962, 737970, 738066, 739313, 740055,
4213740234, 740301, 741806, 742126, 742741, 742860, 742860, 742911,
4214744041, 744104, 744238, 744687, 744877, 745055, 745478, 745525,
4215745620, 746012, 746304, 746366, 746801, 746953, 747348, 747667,
4216747954, 748846, 748849, 748973, 748975, 749191, 749210, 749759,
4217749831, 749911, 750008, 750092, 750542, 750595, 751038, 751107,
4218751276, 751451, 751916, 751941, 751956, 751998, 752671, 753451,
4219753602, 753617, 753845, 753925, 754014, 754340, 754447, 755031,
4220755087, 755147, 755245, 755683, 755987, 756032, 756996, 757058,
4221757229, 757818, 757821, 757822, 758112, 758910, 759227, 759889,
4222760257, 760703, 760792, 761104, 761337, 761519, 761830, 762455
4223
4224
4225What's New in Python 2.3 beta 1?
4226================================
4227
4228*Release date: 25-Apr-2003*
4229
4230Core and builtins
4231-----------------
4232
4233- New format codes B, H, I, k and K have been implemented for
4234 PyArg_ParseTuple and PyBuild_Value.
4235
4236- New builtin function sum(seq, start=0) returns the sum of all the
4237 items in iterable object seq, plus start (items are normally numbers,
4238 and cannot be strings).
4239
4240- bool() called without arguments now returns False rather than
4241 raising an exception. This is consistent with calling the
4242 constructors for the other builtin types -- called without argument
4243 they all return the false value of that type. (SF patch #724135)
4244
4245- In support of PEP 269 (making the pgen parser generator accessible
4246 from Python), some changes to the pgen code structure were made; a
4247 few files that used to be linked only with pgen are now linked with
4248 Python itself.
4249
4250- The repr() of a weakref object now shows the __name__ attribute of
4251 the referenced object, if it has one.
4252
4253- super() no longer ignores data descriptors, except __class__. See
4254 the thread started at
4255 http://mail.python.org/pipermail/python-dev/2003-April/034338.html
4256
4257- list.insert(i, x) now interprets negative i as it would be
4258 interpreted by slicing, so negative values count from the end of the
4259 list. This was the only place where such an interpretation was not
4260 placed on a list index.
4261
4262- range() now works even if the arguments are longs with magnitude
4263 larger than sys.maxint, as long as the total length of the sequence
4264 fits. E.g., range(2**100, 2**101, 2**100) is the following list:
4265 [1267650600228229401496703205376L]. (SF patch #707427.)
4266
4267- Some horridly obscure problems were fixed involving interaction
4268 between garbage collection and old-style classes with "ambitious"
4269 getattr hooks. If an old-style instance didn't have a __del__ method,
4270 but did have a __getattr__ hook, and the instance became reachable
4271 only from an unreachable cycle, and the hook resurrected or deleted
4272 unreachable objects when asked to resolve "__del__", anything up to
4273 a segfault could happen. That's been repaired.
4274
4275- dict.pop now takes an optional argument specifying a default
4276 value to return if the key is not in the dict. If a default is not
4277 given and the key is not found, a KeyError will still be raised.
4278 Parallel changes were made to UserDict.UserDict and UserDict.DictMixin.
4279 [SF patch #693753] (contributed by Michael Stone.)
4280
4281- sys.getfilesystemencoding() was added to expose
4282 Py_FileSystemDefaultEncoding.
4283
4284- New function sys.exc_clear() clears the current exception. This is
4285 rarely needed, but can sometimes be useful to release objects
4286 referenced by the traceback held in sys.exc_info()[2]. (SF patch
4287 #693195.)
4288
4289- On 64-bit systems, a dictionary could contain duplicate long/int keys
4290 if the key value was larger than 2**32. See SF bug #689659.
4291
4292- Fixed SF bug #663074. The codec system was using global static
4293 variables to store internal data. As a result, any attempts to use the
4294 unicode system with multiple active interpreters, or successive
4295 interpreter executions, would fail.
4296
4297- "%c" % u"a" now returns a unicode string instead of raising a
4298 TypeError. u"%c" % 0xffffffff now raises a OverflowError instead
4299 of a ValueError to be consistent with "%c" % 256. See SF patch #710127.
4300
4301Extension modules
4302-----------------
4303
4304- The socket module now provides the functions inet_pton and inet_ntop
4305 for converting between string and packed representation of IP
4306 addresses. There is also a new module variable, has_ipv6, which is
4307 True iff the current Python has IPv6 support. See SF patch #658327.
4308
4309- Tkinter wrappers around Tcl variables now pass objects directly
4310 to Tcl, instead of first converting them to strings.
4311
4312- The .*? pattern in the re module is now special-cased to avoid the
4313 recursion limit. (SF patch #720991 -- many thanks to Gary Herron
4314 and Greg Chapman.)
4315
4316- New function sys.call_tracing() allows pdb to debug code
4317 recursively.
4318
4319- New function gc.get_referents(obj) returns a list of objects
4320 directly referenced by obj. In effect, it exposes what the object's
4321 tp_traverse slot does, and can be helpful when debugging memory
4322 leaks.
4323
4324- The iconv module has been removed from this release.
4325
4326- The platform-independent routines for packing floats in IEEE formats
4327 (struct.pack's <f, >f, <d, and >d codes; pickle and cPickle's protocol 1
4328 pickling of floats) ignored that rounding can cause a carry to
4329 propagate. The worst consequence was that, in rare cases, <f and >f
4330 could produce strings that, when unpacked again, were a factor of 2
4331 away from the original float. This has been fixed. See SF bug
4332 #705836.
4333
4334- New function time.tzset() provides access to the C library tzset()
4335 function, if supported. (SF patch #675422.)
4336
4337- Using createfilehandler, deletefilehandler, createtimerhandler functions
4338 on Tkinter.tkinter (_tkinter module) no longer crashes the interpreter.
4339 See SF bug #692416.
4340
4341- Modified the fcntl.ioctl() function to allow modification of a passed
4342 mutable buffer (for details see the reference documentation).
4343
4344- Made user requested changes to the itertools module.
4345 Subsumed the times() function into repeat().
4346 Added chain() and cycle().
4347
4348- The rotor module is now deprecated; the encryption algorithm it uses
4349 is not believed to be secure, and including crypto code with Python
4350 has implications for exporting and importing it in various countries.
4351
4352- The socket module now always uses the _socketobject wrapper class, even on
4353 platforms which have dup(2). The makefile() method is built directly
4354 on top of the socket without duplicating the file descriptor, allowing
4355 timeouts to work properly.
4356
4357Library
4358-------
4359
4360- New generator function os.walk() is an easy-to-use alternative to
4361 os.path.walk(). See os module docs for details. os.path.walk()
4362 isn't deprecated at this time, but may become deprecated in a
4363 future release.
4364
4365- Added new module "platform" which provides a wide range of tools
4366 for querying platform dependent features.
4367
4368- netrc now allows ASCII punctuation characters in passwords.
4369
4370- shelve now supports the optional writeback argument, and exposes
4371 pickle protocol versions.
4372
4373- Several methods of nntplib.NNTP have grown an optional file argument
4374 which specifies a file where to divert the command's output
4375 (already supported by the body() method). (SF patch #720468)
4376
4377- The self-documenting XML server library DocXMLRPCServer was added.
4378
4379- Support for internationalized domain names has been added through
4380 the 'idna' and 'punycode' encodings, the 'stringprep' module, the
4381 'mkstringprep' tool, and enhancements to the socket and httplib
4382 modules.
4383
4384- htmlentitydefs has two new dictionaries: name2codepoint maps
4385 HTML entity names to Unicode codepoints (as integers).
4386 codepoint2name is the reverse mapping. See SF patch #722017.
4387
4388- pdb has a new command, "debug", which lets you step through
4389 arbitrary code from the debugger's (pdb) prompt.
4390
4391- unittest.failUnlessEqual and its equivalent unittest.assertEqual now
4392 return 'not a == b' rather than 'a != b'. This gives the desired
4393 result for classes that define __eq__ without defining __ne__.
4394
4395- sgmllib now supports SGML marked sections, in particular the
4396 MS Office extensions.
4397
4398- The urllib module now offers support for the iterator protocol.
4399 SF patch 698520 contributed by Brett Cannon.
4400
4401- New module timeit provides a simple framework for timing the
4402 execution speed of expressions and statements.
4403
4404- sets.Set objects now support mixed-type __eq__ and __ne__, instead
4405 of raising TypeError. If x is a Set object and y is a non-Set object,
4406 x == y is False, and x != y is True. This is akin to the change made
4407 for mixed-type comparisons of datetime objects in 2.3a2; more info
4408 about the rationale is in the NEWS entry for that. See also SF bug
4409 report <http://www.python.org/sf/693121>.
4410
4411- On Unix platforms, if os.listdir() is called with a Unicode argument,
4412 it now returns Unicode strings. (This behavior was added earlier
4413 to the Windows NT/2k/XP version of os.listdir().)
4414
4415- Distutils: both 'py_modules' and 'packages' keywords can now be specified
4416 in core.setup(). Previously you could supply one or the other, but
4417 not both of them. (SF patch #695090 from Bernhard Herzog)
4418
4419- New csv package makes it easy to read/write CSV files.
4420
4421- Module shlex has been extended to allow posix-like shell parsings,
4422 including a split() function for easy spliting of quoted strings and
4423 commands. An iterator interface was also implemented.
4424
4425Tools/Demos
4426-----------
4427
4428- New script combinerefs.py helps analyze new PYTHONDUMPREFS output.
4429 See the module docstring for details.
4430
4431Build
4432-----
4433
4434- Fix problem building on OSF1 because the compiler only accepted
4435 preprocessor directives that start in column 1. (SF bug #691793.)
4436
4437C API
4438-----
4439
4440- Added PyGC_Collect(), equivalent to calling gc.collect().
4441
4442- PyThreadState_GetDict() was changed not to raise an exception or
4443 issue a fatal error when no current thread state is available. This
4444 makes it possible to print dictionaries when no thread is active.
4445
4446- LONG_LONG was renamed to PY_LONG_LONG. Extensions that use this and
4447 need compatibility with previous versions can use this:
4448
4449 #ifndef PY_LONG_LONG
4450 #define PY_LONG_LONG LONG_LONG
4451 #endif
4452
4453- Added PyObject_SelfIter() to fill the tp_iter slot for the
4454 typical case where the method returns its self argument.
4455
4456- The extended type structure used for heap types (new-style
4457 classes defined by Python code using a class statement) is now
4458 exported from object.h as PyHeapTypeObject. (SF patch #696193.)
4459
4460New platforms
4461-------------
4462
4463None this time.
4464
4465Tests
4466-----
4467
4468- test_timeout now requires -u network to be passed to regrtest to run.
4469 See SF bug #692988.
4470
4471Windows
4472-------
4473
4474- os.fsync() now exists on Windows, and calls the Microsoft _commit()
4475 function.
4476
4477- New function winsound.MessageBeep() wraps the Win32 API
4478 MessageBeep().
4479
4480Mac
4481---
4482
4483- os.listdir() now returns Unicode strings on MacOS X when called with
4484 a Unicode argument. See the general news item under "Library".
4485
4486- A new method MacOS.WMAvailable() returns true if it is safe to access
4487 the window manager, false otherwise.
4488
4489- EasyDialogs dialogs are now movable-modal, and if the application is
4490 currently in the background they will ask to be moved to the foreground
4491 before displaying.
4492
4493- OSA Scripting support has improved a lot, and gensuitemodule.py can now
4494 be used by mere mortals. The documentation is now also more or less
4495 complete.
4496
4497- The IDE (in a framework build) now includes introductory documentation
4498 in Apple Help Viewer format.
4499
4500
4501What's New in Python 2.3 alpha 2?
4502=================================
4503
4504*Release date: 19-Feb-2003*
4505
4506Core and builtins
4507-----------------
4508
4509- Negative positions returned from PEP 293 error callbacks are now
4510 treated as being relative to the end of the input string. Positions
4511 that are out of bounds raise an IndexError.
4512
4513- sys.path[0] (the directory from which the script is loaded) is now
4514 turned into an absolute pathname, unless it is the empty string.
4515 (SF patch #664376.)
4516
4517- Finally fixed the bug in compile() and exec where a string ending
4518 with an indented code block but no newline would raise SyntaxError.
4519 This would have been a four-line change in parsetok.c... Except
4520 codeop.py depends on this behavior, so a compilation flag had to be
4521 invented that causes the tokenizer to revert to the old behavior;
4522 this required extra changes to 2 .h files, 2 .c files, and 2 .py
4523 files. (Fixes SF bug #501622.)
4524
4525- If a new-style class defines neither __new__ nor __init__, its
4526 constructor would ignore all arguments. This is changed now: the
4527 constructor refuses arguments in this case. This might break code
4528 that worked under Python 2.2. The simplest fix is to add a no-op
4529 __init__: ``def __init__(self, *args, **kw): pass``.
4530
4531- Through a bytecode optimizer bug (and I bet you didn't even know
4532 Python *had* a bytecode optimizer :-), "unsigned" hex/oct constants
4533 with a leading minus sign would come out with the wrong sign.
4534 ("Unsigned" hex/oct constants are those with a face value in the
4535 range sys.maxint+1 through sys.maxint*2+1, inclusive; these have
4536 always been interpreted as negative numbers through sign folding.)
4537 E.g. 0xffffffff is -1, and -(0xffffffff) is 1, but -0xffffffff would
4538 come out as -4294967295. This was the case in Python 2.2 through
4539 2.2.2 and 2.3a1, and in Python 2.4 it will once again have that
4540 value, but according to PEP 237 it really needs to be 1 now. This
4541 will be backported to Python 2.2.3 a well. (SF #660455)
4542
4543- int(s, base) sometimes sign-folds hex and oct constants; it only
4544 does this when base is 0 and s.strip() starts with a '0'. When the
4545 sign is actually folded, as in int("0xffffffff", 0) on a 32-bit
4546 machine, which returns -1, a FutureWarning is now issued; in Python
4547 2.4, this will return 4294967295L, as do int("+0xffffffff", 0) and
4548 int("0xffffffff", 16) right now. (PEP 347)
4549
4550- super(X, x): x may now be a proxy for an X instance, i.e.
4551 issubclass(x.__class__, X) but not issubclass(type(x), X).
4552
4553- isinstance(x, X): if X is a new-style class, this is now equivalent
4554 to issubclass(type(x), X) or issubclass(x.__class__, X). Previously
4555 only type(x) was tested. (For classic classes this was already the
4556 case.)
4557
4558- compile(), eval() and the exec statement now fully support source code
4559 passed as unicode strings.
4560
4561- int subclasses can be initialized with longs if the value fits in an int.
4562 See SF bug #683467.
4563
4564- long(string, base) takes time linear in len(string) when base is a power
4565 of 2 now. It used to take time quadratic in len(string).
4566
4567- filter returns now Unicode results for Unicode arguments.
4568
4569- raw_input can now return Unicode objects.
4570
4571- List objects' sort() method now accepts None as the comparison function.
4572 Passing None is semantically identical to calling sort() with no
4573 arguments.
4574
4575- Fixed crash when printing a subclass of str and __str__ returned self.
4576 See SF bug #667147.
4577
4578- Fixed an invalid RuntimeWarning and an undetected error when trying
4579 to convert a long integer into a float which couldn't fit.
4580 See SF bug #676155.
4581
4582- Function objects now have a __module__ attribute that is bound to
4583 the name of the module in which the function was defined. This
4584 applies for C functions and methods as well as functions and methods
4585 defined in Python. This attribute is used by pickle.whichmodule(),
4586 which changes the behavior of whichmodule slightly. In Python 2.2
4587 whichmodule() returns "__main__" for functions that are not defined
4588 at the top-level of a module (examples: methods, nested functions).
4589 Now whichmodule() will return the proper module name.
4590
4591Extension modules
4592-----------------
4593
4594- operator.isNumberType() now checks that the object has a nb_int or
4595 nb_float slot, rather than simply checking whether it has a non-NULL
4596 tp_as_number pointer.
4597
4598- The imp module now has ways to acquire and release the "import
4599 lock": imp.acquire_lock() and imp.release_lock(). Note: this is a
4600 reentrant lock, so releasing the lock only truly releases it when
4601 this is the last release_lock() call. You can check with
4602 imp.lock_held(). (SF bug #580952 and patch #683257.)
4603
4604- Change to cPickle to match pickle.py (see below and PEP 307).
4605
4606- Fix some bugs in the parser module. SF bug #678518.
4607
4608- Thanks to Scott David Daniels, a subtle bug in how the zlib
4609 extension implemented flush() was fixed. Scott also rewrote the
4610 zlib test suite using the unittest module. (SF bug #640230 and
4611 patch #678531.)
4612
4613- Added an itertools module containing high speed, memory efficient
4614 looping constructs inspired by tools from Haskell and SML.
4615
4616- The SSL module now handles sockets with a timeout set correctly (SF
4617 patch #675750, fixing SF bug #675552).
4618
4619- os/posixmodule has grown the sysexits.h constants (EX_OK and friends).
4620
4621- Fixed broken threadstate swap in readline that could cause fatal
4622 errors when a readline hook was being invoked while a background
4623 thread was active. (SF bugs #660476 and #513033.)
4624
4625- fcntl now exposes the strops.h I_* constants.
4626
4627- Fix a crash on Solaris that occurred when calling close() on
4628 an mmap'ed file which was already closed. (SF patch #665913)
4629
4630- Fixed several serious bugs in the zipimport implementation.
4631
4632- datetime changes:
4633
4634 The date class is now properly subclassable. (SF bug #720908)
4635
4636 The datetime and datetimetz classes have been collapsed into a single
4637 datetime class, and likewise the time and timetz classes into a single
4638 time class. Previously, a datetimetz object with tzinfo=None acted
4639 exactly like a datetime object, and similarly for timetz. This wasn't
4640 enough of a difference to justify distinct classes, and life is simpler
4641 now.
4642
4643 today() and now() now round system timestamps to the closest
4644 microsecond <http://www.python.org/sf/661086>. This repairs an
4645 irritation most likely seen on Windows systems.
4646
4647 In dt.astimezone(tz), if tz.utcoffset(dt) returns a duration,
4648 ValueError is raised if tz.dst(dt) returns None (2.3a1 treated it
4649 as 0 instead, but a tzinfo subclass wishing to participate in
4650 time zone conversion has to take a stand on whether it supports
4651 DST; if you don't care about DST, then code dst() to return 0 minutes,
4652 meaning that DST is never in effect).
4653
4654 The tzinfo methods utcoffset() and dst() must return a timedelta object
4655 (or None) now. In 2.3a1 they could also return an int or long, but that
4656 was an unhelpfully redundant leftover from an earlier version wherein
4657 they couldn't return a timedelta. TOOWTDI.
4658
4659 The example tzinfo class for local time had a bug. It was replaced
4660 by a later example coded by Guido.
4661
4662 datetime.astimezone(tz) no longer raises an exception when the
4663 input datetime has no UTC equivalent in tz. For typical "hybrid" time
4664 zones (a single tzinfo subclass modeling both standard and daylight
4665 time), this case can arise one hour per year, at the hour daylight time
4666 ends. See new docs for details. In short, the new behavior mimics
4667 the local wall clock's behavior of repeating an hour in local time.
4668
4669 dt.astimezone() can no longer be used to convert between naive and aware
4670 datetime objects. If you merely want to attach, or remove, a tzinfo
4671 object, without any conversion of date and time members, use
4672 dt.replace(tzinfo=whatever) instead, where "whatever" is None or a
4673 tzinfo subclass instance.
4674
4675 A new method tzinfo.fromutc(dt) can be overridden in tzinfo subclasses
4676 to give complete control over how a UTC time is to be converted to
4677 a local time. The default astimezone() implementation calls fromutc()
4678 as its last step, so a tzinfo subclass can affect that too by overriding
4679 fromutc(). It's expected that the default fromutc() implementation will
4680 be suitable as-is for "almost all" time zone subclasses, but the
4681 creativity of political time zone fiddling appears unbounded -- fromutc()
4682 allows the highly motivated to emulate any scheme expressible in Python.
4683
4684 datetime.now(): The optional tzinfo argument was undocumented (that's
4685 repaired), and its name was changed to tz ("tzinfo" is overloaded enough
4686 already). With a tz argument, now(tz) used to return the local date
4687 and time, and attach tz to it, without any conversion of date and time
4688 members. This was less than useful. Now now(tz) returns the current
4689 date and time as local time in tz's time zone, akin to ::
4690
4691 tz.fromutc(datetime.utcnow().replace(tzinfo=utc))
4692
4693 where "utc" is an instance of a tzinfo subclass modeling UTC. Without
4694 a tz argument, now() continues to return the current local date and time,
4695 as a naive datetime object.
4696
4697 datetime.fromtimestamp(): Like datetime.now() above, this had less than
4698 useful behavior when the optional tinzo argument was specified. See
4699 also SF bug report <http://www.python.org/sf/660872>.
4700
4701 date and datetime comparison: In order to prevent comparison from
4702 falling back to the default compare-object-addresses strategy, these
4703 raised TypeError whenever they didn't understand the other object type.
4704 They still do, except when the other object has a "timetuple" attribute,
4705 in which case they return NotImplemented now. This gives other
4706 datetime objects (e.g., mxDateTime) a chance to intercept the
4707 comparison.
4708
4709 date, time, datetime and timedelta comparison: When the exception
4710 for mixed-type comparisons in the last paragraph doesn't apply, if
4711 the comparison is == then False is returned, and if the comparison is
4712 != then True is returned. Because dict lookup and the "in" operator
4713 only invoke __eq__, this allows, for example, ::
4714
4715 if some_datetime in some_sequence:
4716
4717 and ::
4718
4719 some_dict[some_timedelta] = whatever
4720
4721 to work as expected, without raising TypeError just because the
4722 sequence is heterogeneous, or the dict has mixed-type keys. [This
4723 seems like a good idea to implement for all mixed-type comparisons
4724 that don't want to allow falling back to address comparison.]
4725
4726 The constructors building a datetime from a timestamp could raise
4727 ValueError if the platform C localtime()/gmtime() inserted "leap
4728 seconds". Leap seconds are ignored now. On such platforms, it's
4729 possible to have timestamps that differ by a second, yet where
4730 datetimes constructed from them are equal.
4731
4732 The pickle format of date, time and datetime objects has changed
4733 completely. The undocumented pickler and unpickler functions no
4734 longer exist. The undocumented __setstate__() and __getstate__()
4735 methods no longer exist either.
4736
4737Library
4738-------
4739
4740- The logging module was updated slightly; the WARN level was renamed
4741 to WARNING, and the matching function/method warn() to warning().
4742
4743- The pickle and cPickle modules were updated with a new pickling
4744 protocol (documented by pickletools.py, see below) and several
4745 extensions to the pickle customization API (__reduce__, __setstate__
4746 etc.). The copy module now uses more of the pickle customization
4747 API to copy objects that don't implement __copy__ or __deepcopy__.
4748 See PEP 307 for details.
4749
4750- The distutils "register" command now uses http://www.python.org/pypi
4751 as the default repository. (See PEP 301.)
4752
Skip Montanaro7a98be22007-08-16 14:35:24 +00004753- the platform dependent path related variables sep, altsep,
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00004754 pathsep, curdir, pardir and defpath are now defined in the platform
4755 dependent path modules (e.g. ntpath.py) rather than os.py, so these
4756 variables are now available via os.path. They continue to be
4757 available from the os module.
4758 (see <http://www.python.org/sf/680789>).
4759
4760- array.array was added to the types repr.py knows about (see
4761 <http://www.python.org/sf/680789>).
4762
4763- The new pickletools.py contains lots of documentation about pickle
4764 internals, and supplies some helpers for working with pickles, such as
4765 a symbolic pickle disassembler.
4766
4767- Xmlrpclib.py now supports the builtin boolean type.
4768
4769- py_compile has a new 'doraise' flag and a new PyCompileError
4770 exception.
4771
4772- SimpleXMLRPCServer now supports CGI through the CGIXMLRPCRequestHandler
4773 class.
4774
4775- The sets module now raises TypeError in __cmp__, to clarify that
4776 sets are not intended to be three-way-compared; the comparison
4777 operators are overloaded as subset/superset tests.
4778
4779- Bastion.py and rexec.py are disabled. These modules are not safe in
4780 Python 2.2. or 2.3.
4781
4782- realpath is now exported when doing ``from poxixpath import *``.
4783 It is also exported for ntpath, macpath, and os2emxpath.
4784 See SF bug #659228.
4785
4786- New module tarfile from Lars Gustäbel provides a comprehensive interface
4787 to tar archive files with transparent gzip and bzip2 compression.
4788 See SF patch #651082.
4789
4790- urlparse can now parse imap:// URLs. See SF feature request #618024.
4791
4792- Tkinter.Canvas.scan_dragto() provides an optional parameter to support
4793 the gain value which is passed to Tk. SF bug# 602259.
4794
4795- Fix logging.handlers.SysLogHandler protocol when using UNIX domain sockets.
4796 See SF patch #642974.
4797
4798- The dospath module was deleted. Use the ntpath module when manipulating
4799 DOS paths from other platforms.
4800
4801Tools/Demos
4802-----------
4803
4804- Two new scripts (db2pickle.py and pickle2db.py) were added to the
4805 Tools/scripts directory to facilitate conversion from the old bsddb module
4806 to the new one. While the user-visible API of the new module is
4807 compatible with the old one, it's likely that the version of the
4808 underlying database library has changed. To convert from the old library,
4809 run the db2pickle.py script using the old version of Python to convert it
4810 to a pickle file. After upgrading Python, run the pickle2db.py script
4811 using the new version of Python to reconstitute your database. For
4812 example:
4813
4814 % python2.2 db2pickle.py -h some.db > some.pickle
4815 % python2.3 pickle2db.py -h some.db.new < some.pickle
4816
4817 Run the scripts without any args to get a usage message.
4818
4819
4820Build
4821-----
4822
4823- The audio driver tests (test_ossaudiodev.py and
4824 test_linuxaudiodev.py) are no longer run by default. This is
4825 because they don't always work, depending on your hardware and
4826 software. To run these tests, you must use an invocation like ::
4827
4828 ./python Lib/test/regrtest.py -u audio test_ossaudiodev
4829
4830- On systems which build using the configure script, compiler flags which
4831 used to be lumped together using the OPT flag have been split into two
4832 groups, OPT and BASECFLAGS. OPT is meant to carry just optimization- and
4833 debug-related flags like "-g" and "-O3". BASECFLAGS is meant to carry
4834 compiler flags that are required to get a clean compile. On some
4835 platforms (many Linux flavors in particular) BASECFLAGS will be empty by
4836 default. On others, such as Mac OS X and SCO, it will contain required
4837 flags. This change allows people building Python to override OPT without
4838 fear of clobbering compiler flags which are required to get a clean build.
4839
4840- On Darwin/Mac OS X platforms, /sw/lib and /sw/include are added to the
4841 relevant search lists in setup.py. This allows users building Python to
4842 take advantage of the many packages available from the fink project
4843 <http://fink.sf.net/>.
4844
4845- A new Makefile target, scriptsinstall, installs a number of useful scripts
4846 from the Tools/scripts directory.
4847
4848C API
4849-----
4850
4851- PyEval_GetFrame() is now declared to return a ``PyFrameObject *``
4852 instead of a plain ``PyObject *``. (SF patch #686601.)
4853
4854- PyNumber_Check() now checks that the object has a nb_int or nb_float
4855 slot, rather than simply checking whether it has a non-NULL
4856 tp_as_number pointer.
4857
4858- A C type that inherits from a base type that defines tp_as_buffer
4859 will now inherit the tp_as_buffer pointer if it doesn't define one.
4860 (SF #681367)
4861
4862- The PyArg_Parse functions now issue a DeprecationWarning if a float
4863 argument is provided when an integer is specified (this affects the 'b',
4864 'B', 'h', 'H', 'i', and 'l' codes). Future versions of Python will
4865 raise a TypeError.
4866
4867Tests
4868-----
4869
4870- Several tests weren't being run from regrtest.py (test_timeout.py,
4871 test_tarfile.py, test_netrc.py, test_multifile.py,
4872 test_importhooks.py and test_imp.py). Now they are. (Note to
4873 developers: please read Lib/test/README when creating a new test, to
4874 make sure to do it right! All tests need to use either unittest or
4875 pydoc.)
4876
4877- Added test_posix.py, a test suite for the posix module.
4878
4879- Added test_hexoct.py, a test suite for hex/oct constant folding.
4880
4881Windows
4882-------
4883
4884- The timeout code for socket connect() didn't work right; this has
4885 now been fixed. test_timeout.py should pass (at least most of the
4886 time).
4887
4888- distutils' msvccompiler class now passes the preprocessor options to
4889 the resource compiler. See SF patch #669198.
4890
4891- The bsddb module now ships with Sleepycat's 4.1.25.NC, the latest
4892 release without strong cryptography.
4893
4894- sys.path[0], if it contains a directory name, is now always an
4895 absolute pathname. (SF patch #664376.)
4896
4897- The new logging package is now installed by the Windows installer. It
4898 wasn't in 2.3a1 due to oversight.
4899
4900Mac
4901---
4902
4903- There are new dialogs EasyDialogs.AskFileForOpen, AskFileForSave
4904 and AskFolder. The old macfs.StandardGetFile and friends are deprecated.
4905
4906- Most of the standard library now uses pathnames or FSRefs in preference
4907 of FSSpecs, and use the underlying Carbon.File and Carbon.Folder modules
4908 in stead of macfs. macfs will probably be deprecated in the future.
4909
4910- Type Carbon.File.FSCatalogInfo and supporting methods have been implemented.
4911 This also makes macfs.FSSpec.SetDates() work again.
4912
4913- There is a new module pimp, the package install manager for Python, and
4914 accompanying applet PackageManager. These allow you to easily download
4915 and install pretested extension packages either in source or binary
4916 form. Only in MacPython-OSX.
4917
4918- Applets are now built with bundlebuilder in MacPython-OSX, which should make
4919 them more robust and also provides a path towards BuildApplication. The
4920 downside of this change is that applets can no longer be run from the
4921 Terminal window, this will hopefully be fixed in the 2.3b1.
4922
4923
4924What's New in Python 2.3 alpha 1?
4925=================================
4926
4927*Release date: 31-Dec-2002*
4928
4929Type/class unification and new-style classes
4930--------------------------------------------
4931
4932- One can now assign to __bases__ and __name__ of new-style classes.
4933
4934- dict() now accepts keyword arguments so that dict(one=1, two=2)
4935 is the equivalent of {"one": 1, "two": 2}. Accordingly,
4936 the existing (but undocumented) 'items' keyword argument has
4937 been eliminated. This means that dict(items=someMapping) now has
4938 a different meaning than before.
4939
4940- int() now returns a long object if the argument is outside the
4941 integer range, so int("4" * 1000), int(1e200) and int(1L<<1000) will
4942 all return long objects instead of raising an OverflowError.
4943
4944- Assignment to __class__ is disallowed if either the old or the new
4945 class is a statically allocated type object (such as defined by an
4946 extension module). This prevents anomalies like 2.__class__ = bool.
4947
4948- New-style object creation and deallocation have been sped up
4949 significantly; they are now faster than classic instance creation
4950 and deallocation.
4951
4952- The __slots__ variable can now mention "private" names, and the
4953 right thing will happen (e.g. __slots__ = ["__foo"]).
4954
4955- The built-ins slice() and buffer() are now callable types. The
4956 types classobj (formerly class), code, function, instance, and
4957 instancemethod (formerly instance-method), which have no built-in
4958 names but are accessible through the types module, are now also
4959 callable. The type dict-proxy is renamed to dictproxy.
4960
4961- Cycles going through the __class__ link of a new-style instance are
4962 now detected by the garbage collector.
4963
4964- Classes using __slots__ are now properly garbage collected.
4965 [SF bug 519621]
4966
4967- Tightened the __slots__ rules: a slot name must be a valid Python
4968 identifier.
4969
4970- The constructor for the module type now requires a name argument and
4971 takes an optional docstring argument. Previously, this constructor
4972 ignored its arguments. As a consequence, deriving a class from a
4973 module (not from the module type) is now illegal; previously this
4974 created an unnamed module, just like invoking the module type did.
4975 [SF bug 563060]
4976
4977- A new type object, 'basestring', is added. This is a common base type
4978 for 'str' and 'unicode', and can be used instead of
4979 types.StringTypes, e.g. to test whether something is "a string":
4980 isinstance(x, basestring) is True for Unicode and 8-bit strings. This
4981 is an abstract base class and cannot be instantiated directly.
4982
4983- Changed new-style class instantiation so that when C's __new__
4984 method returns something that's not a C instance, its __init__ is
4985 not called. [SF bug #537450]
4986
4987- Fixed super() to work correctly with class methods. [SF bug #535444]
4988
4989- If you try to pickle an instance of a class that has __slots__ but
4990 doesn't define or override __getstate__, a TypeError is now raised.
4991 This is done by adding a bozo __getstate__ to the class that always
4992 raises TypeError. (Before, this would appear to be pickled, but the
4993 state of the slots would be lost.)
4994
4995Core and builtins
4996-----------------
4997
4998- Import from zipfiles is now supported. The name of a zipfile placed
4999 on sys.path causes the import statement to look for importable Python
5000 modules (with .py, pyc and .pyo extensions) and packages inside the
5001 zipfile. The zipfile import follows the specification (though not
5002 the sample implementation) of PEP 273. The semantics of __path__ are
5003 compatible with those that have been implemented in Jython since
5004 Jython 2.1.
5005
5006- PEP 302 has been accepted. Although it was initially developed to
5007 support zipimport, it offers a new, general import hook mechanism.
5008 Several new variables have been added to the sys module:
5009 sys.meta_path, sys.path_hooks, and sys.path_importer_cache; these
5010 make extending the import statement much more convenient than
5011 overriding the __import__ built-in function. For a description of
5012 these, see PEP 302.
5013
5014- A frame object's f_lineno attribute can now be written to from a
5015 trace function to change which line will execute next. A command to
5016 exploit this from pdb has been added. [SF patch #643835]
5017
5018- The _codecs support module for codecs.py was turned into a builtin
5019 module to assure that at least the builtin codecs are available
5020 to the Python parser for source code decoding according to PEP 263.
5021
5022- issubclass now supports a tuple as the second argument, just like
5023 isinstance does. ``issubclass(X, (A, B))`` is equivalent to
5024 ``issubclass(X, A) or issubclass(X, B)``.
5025
5026- Thanks to Armin Rigo, the last known way to provoke a system crash
5027 by cleverly arranging for a comparison function to mutate a list
5028 during a list.sort() operation has been fixed. The effect of
5029 attempting to mutate a list, or even to inspect its contents or
5030 length, while a sort is in progress, is not defined by the language.
5031 The C implementation of Python 2.3 attempts to detect mutations,
5032 and raise ValueError if one occurs, but there's no guarantee that
5033 all mutations will be caught, or that any will be caught across
5034 releases or implementations.
5035
5036- Unicode file name processing for Windows (PEP 277) is implemented.
5037 All platforms now have an os.path.supports_unicode_filenames attribute,
5038 which is set to True on Windows NT/2000/XP, and False elsewhere.
5039
5040- Codec error handling callbacks (PEP 293) are implemented.
5041 Error handling in unicode.encode or str.decode can now be customized.
5042
5043- A subtle change to the semantics of the built-in function intern():
5044 interned strings are no longer immortal. You must keep a reference
5045 to the return value intern() around to get the benefit.
5046
5047- Use of 'None' as a variable, argument or attribute name now
5048 issues a SyntaxWarning. In the future, None may become a keyword.
5049
5050- SET_LINENO is gone. co_lnotab is now consulted to determine when to
5051 call the trace function. C code that accessed f_lineno should call
5052 PyCode_Addr2Line instead (f_lineno is still there, but only kept up
5053 to date when there is a trace function set).
5054
5055- There's a new warning category, FutureWarning. This is used to warn
5056 about a number of situations where the value or sign of an integer
5057 result will change in Python 2.4 as a result of PEP 237 (integer
5058 unification). The warnings implement stage B0 mentioned in that
5059 PEP. The warnings are about the following situations:
5060
5061 - Octal and hex literals without 'L' prefix in the inclusive range
5062 [0x80000000..0xffffffff]; these are currently negative ints, but
5063 in Python 2.4 they will be positive longs with the same bit
5064 pattern.
5065
5066 - Left shifts on integer values that cause the outcome to lose
5067 bits or have a different sign than the left operand. To be
5068 precise: x<<n where this currently doesn't yield the same value
5069 as long(x)<<n; in Python 2.4, the outcome will be long(x)<<n.
5070
5071 - Conversions from ints to string that show negative values as
5072 unsigned ints in the inclusive range [0x80000000..0xffffffff];
5073 this affects the functions hex() and oct(), and the string
5074 formatting codes %u, %o, %x, and %X. In Python 2.4, these will
5075 show signed values (e.g. hex(-1) currently returns "0xffffffff";
5076 in Python 2.4 it will return "-0x1").
5077
5078- The bits manipulated under the cover by sys.setcheckinterval() have
5079 been changed. Both the check interval and the ticker used to be
5080 per-thread values. They are now just a pair of global variables.
5081 In addition, the default check interval was boosted from 10 to 100
5082 bytecode instructions. This may have some effect on systems that
5083 relied on the old default value. In particular, in multi-threaded
5084 applications which try to be highly responsive, response time will
5085 increase by some (perhaps imperceptible) amount.
5086
5087- When multiplying very large integers, a version of the so-called
5088 Karatsuba algorithm is now used. This is most effective if the
5089 inputs have roughly the same size. If they both have about N digits,
5090 Karatsuba multiplication has O(N**1.58) runtime (the exponent is
5091 log_base_2(3)) instead of the previous O(N**2). Measured results may
5092 be better or worse than that, depending on platform quirks. Besides
5093 the O() improvement in raw instruction count, the Karatsuba algorithm
5094 appears to have much better cache behavior on extremely large integers
5095 (starting in the ballpark of a million bits). Note that this is a
5096 simple implementation, and there's no intent here to compete with,
5097 e.g., GMP. It gives a very nice speedup when it applies, but a package
5098 devoted to fast large-integer arithmetic should run circles around it.
5099
5100- u'%c' will now raise a ValueError in case the argument is an
5101 integer outside the valid range of Unicode code point ordinals.
5102
5103- The tempfile module has been overhauled for enhanced security. The
5104 mktemp() function is now deprecated; new, safe replacements are
5105 mkstemp() (for files) and mkdtemp() (for directories), and the
5106 higher-level functions NamedTemporaryFile() and TemporaryFile().
5107 Use of some global variables in this module is also deprecated; the
5108 new functions have keyword arguments to provide the same
5109 functionality. All Lib, Tools and Demo modules that used the unsafe
5110 interfaces have been updated to use the safe replacements. Thanks
5111 to Zack Weinberg!
5112
5113- When x is an object whose class implements __mul__ and __rmul__,
5114 1.0*x would correctly invoke __rmul__, but 1*x would erroneously
5115 invoke __mul__. This was due to the sequence-repeat code in the int
5116 type. This has been fixed now.
5117
5118- Previously, "str1 in str2" required str1 to be a string of length 1.
5119 This restriction has been relaxed to allow str1 to be a string of
5120 any length. Thus "'el' in 'hello world'" returns True now.
5121
5122- File objects are now their own iterators. For a file f, iter(f) now
5123 returns f (unless f is closed), and f.next() is similar to
5124 f.readline() when EOF is not reached; however, f.next() uses a
5125 readahead buffer that messes up the file position, so mixing
5126 f.next() and f.readline() (or other methods) doesn't work right.
5127 Calling f.seek() drops the readahead buffer, but other operations
5128 don't. It so happens that this gives a nice additional speed boost
5129 to "for line in file:"; the xreadlines method and corresponding
5130 module are now obsolete. Thanks to Oren Tirosh!
5131
5132- Encoding declarations (PEP 263, phase 1) have been implemented. A
5133 comment of the form "# -*- coding: <encodingname> -*-" in the first
5134 or second line of a Python source file indicates the encoding.
5135
5136- list.sort() has a new implementation. While cross-platform results
5137 may vary, and in data-dependent ways, this is much faster on many
5138 kinds of partially ordered lists than the previous implementation,
5139 and reported to be just as fast on randomly ordered lists on
5140 several major platforms. This sort is also stable (if A==B and A
5141 precedes B in the list at the start, A precedes B after the sort too),
5142 although the language definition does not guarantee stability. A
5143 potential drawback is that list.sort() may require temp space of
5144 len(list)*2 bytes (``*4`` on a 64-bit machine). It's therefore possible
5145 for list.sort() to raise MemoryError now, even if a comparison function
5146 does not. See <http://www.python.org/sf/587076> for full details.
5147
5148- All standard iterators now ensure that, once StopIteration has been
5149 raised, all future calls to next() on the same iterator will also
5150 raise StopIteration. There used to be various counterexamples to
5151 this behavior, which could caused confusion or subtle program
5152 breakage, without any benefits. (Note that this is still an
5153 iterator's responsibility; the iterator framework does not enforce
5154 this.)
5155
5156- Ctrl+C handling on Windows has been made more consistent with
5157 other platforms. KeyboardInterrupt can now reliably be caught,
5158 and Ctrl+C at an interactive prompt no longer terminates the
5159 process under NT/2k/XP (it never did under Win9x). Ctrl+C will
5160 interrupt time.sleep() in the main thread, and any child processes
5161 created via the popen family (on win2k; we can't make win9x work
5162 reliably) are also interrupted (as generally happens on for Linux/Unix.)
5163 [SF bugs 231273, 439992 and 581232]
5164
5165- sys.getwindowsversion() has been added on Windows. This
5166 returns a tuple with information about the version of Windows
5167 currently running.
5168
5169- Slices and repetitions of buffer objects now consistently return
5170 a string. Formerly, strings would be returned most of the time,
5171 but a buffer object would be returned when the repetition count
5172 was one or when the slice range was all inclusive.
5173
5174- Unicode objects in sys.path are no longer ignored but treated
5175 as directory names.
5176
5177- Fixed string.startswith and string.endswith builtin methods
5178 so they accept negative indices. [SF bug 493951]
5179
5180- Fixed a bug with a continue inside a try block and a yield in the
5181 finally clause. [SF bug 567538]
5182
5183- Most builtin sequences now support "extended slices", i.e. slices
5184 with a third "stride" parameter. For example, "hello world"[::-1]
5185 gives "dlrow olleh".
5186
5187- A new warning PendingDeprecationWarning was added to provide
5188 direction on features which are in the process of being deprecated.
5189 The warning will not be printed by default. To see the pending
5190 deprecations, use -Walways::PendingDeprecationWarning::
5191 as a command line option or warnings.filterwarnings() in code.
5192
5193- Deprecated features of xrange objects have been removed as
5194 promised. The start, stop, and step attributes and the tolist()
5195 method no longer exist. xrange repetition and slicing have been
5196 removed.
5197
5198- New builtin function enumerate(x), from PEP 279. Example:
5199 enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c").
5200 The argument can be an arbitrary iterable object.
5201
5202- The assert statement no longer tests __debug__ at runtime. This means
5203 that assert statements cannot be disabled by assigning a false value
5204 to __debug__.
5205
5206- A method zfill() was added to str and unicode, that fills a numeric
5207 string to the left with zeros. For example,
5208 "+123".zfill(6) -> "+00123".
5209
5210- Complex numbers supported divmod() and the // and % operators, but
5211 these make no sense. Since this was documented, they're being
5212 deprecated now.
5213
5214- String and unicode methods lstrip(), rstrip() and strip() now take
5215 an optional argument that specifies the characters to strip. For
5216 example, "Foo!!!?!?!?".rstrip("?!") -> "Foo".
5217
5218- There's a new dictionary constructor (a class method of the dict
5219 class), dict.fromkeys(iterable, value=None). It constructs a
5220 dictionary with keys taken from the iterable and all values set to a
5221 single value. It can be used for building sets and for removing
5222 duplicates from sequences.
5223
5224- Added a new dict method pop(key). This removes and returns the
5225 value corresponding to key. [SF patch #539949]
5226
5227- A new built-in type, bool, has been added, as well as built-in
5228 names for its two values, True and False. Comparisons and sundry
5229 other operations that return a truth value have been changed to
5230 return a bool instead. Read PEP 285 for an explanation of why this
5231 is backward compatible.
5232
5233- Fixed two bugs reported as SF #535905: under certain conditions,
5234 deallocating a deeply nested structure could cause a segfault in the
5235 garbage collector, due to interaction with the "trashcan" code;
5236 access to the current frame during destruction of a local variable
5237 could access a pointer to freed memory.
5238
5239- The optional object allocator ("pymalloc") has been enabled by
5240 default. The recommended practice for memory allocation and
5241 deallocation has been streamlined. A header file is included,
5242 Misc/pymemcompat.h, which can be bundled with 3rd party extensions
5243 and lets them use the same API with Python versions from 1.5.2
5244 onwards.
5245
5246- PyErr_Display will provide file and line information for all exceptions
5247 that have an attribute print_file_and_line, not just SyntaxErrors.
5248
5249- The UTF-8 codec will now encode and decode Unicode surrogates
5250 correctly and without raising exceptions for unpaired ones.
5251
5252- Universal newlines (PEP 278) is implemented. Briefly, using 'U'
5253 instead of 'r' when opening a text file for reading changes the line
5254 ending convention so that any of '\r', '\r\n', and '\n' is
5255 recognized (even mixed in one file); all three are converted to
5256 '\n', the standard Python line end character.
5257
5258- file.xreadlines() now raises a ValueError if the file is closed:
5259 Previously, an xreadlines object was returned which would raise
5260 a ValueError when the xreadlines.next() method was called.
5261
5262- sys.exit() inadvertently allowed more than one argument.
5263 An exception will now be raised if more than one argument is used.
5264
5265- Changed evaluation order of dictionary literals to conform to the
5266 general left to right evaluation order rule. Now {f1(): f2()} will
5267 evaluate f1 first.
5268
5269- Fixed bug #521782: when a file was in non-blocking mode, file.read()
5270 could silently lose data or wrongly throw an unknown error.
5271
5272- The sq_repeat, sq_inplace_repeat, sq_concat and sq_inplace_concat
5273 slots are now always tried after trying the corresponding nb_* slots.
5274 This fixes a number of minor bugs (see bug #624807).
5275
5276- Fix problem with dynamic loading on 64-bit AIX (see bug #639945).
5277
5278Extension modules
5279-----------------
5280
5281- Added three operators to the operator module:
5282 operator.pow(a,b) which is equivalent to: a**b.
5283 operator.is_(a,b) which is equivalent to: a is b.
5284 operator.is_not(a,b) which is equivalent to: a is not b.
5285
5286- posix.openpty now works on all systems that have /dev/ptmx.
5287
5288- A module zipimport exists to support importing code from zip
5289 archives.
5290
5291- The new datetime module supplies classes for manipulating dates and
5292 times. The basic design came from the Zope "fishbowl process", and
5293 favors practical commercial applications over calendar esoterica. See
5294
5295 http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage
5296
5297- _tkinter now returns Tcl objects, instead of strings. Objects which
5298 have Python equivalents are converted to Python objects, other objects
5299 are wrapped. This can be configured through the wantobjects method,
5300 or Tkinter.wantobjects.
5301
5302- The PyBSDDB wrapper around the Sleepycat Berkeley DB library has
5303 been added as the package bsddb. The traditional bsddb module is
5304 still available in source code, but not built automatically anymore,
5305 and is now named bsddb185. This supports Berkeley DB versions from
5306 3.0 to 4.1. For help converting your databases from the old module (which
5307 probably used an obsolete version of Berkeley DB) to the new module, see
5308 the db2pickle.py and pickle2db.py scripts described in the Tools/Demos
5309 section above.
5310
5311- unicodedata was updated to Unicode 3.2. It supports normalization
5312 and names for Hangul syllables and CJK unified ideographs.
5313
5314- resource.getrlimit() now returns longs instead of ints.
5315
5316- readline now dynamically adjusts its input/output stream if
5317 sys.stdin/stdout changes.
5318
5319- The _tkinter module (and hence Tkinter) has dropped support for
5320 Tcl/Tk 8.0 and 8.1. Only Tcl/Tk versions 8.2, 8.3 and 8.4 are
5321 supported.
5322
5323- cPickle.BadPickleGet is now a class.
5324
5325- The time stamps in os.stat_result are floating point numbers
5326 after stat_float_times has been called.
5327
5328- If the size passed to mmap.mmap() is larger than the length of the
5329 file on non-Windows platforms, a ValueError is raised. [SF bug 585792]
5330
5331- The xreadlines module is slated for obsolescence.
5332
5333- The strptime function in the time module is now always available (a
5334 Python implementation is used when the C library doesn't define it).
5335
5336- The 'new' module is no longer an extension, but a Python module that
5337 only exists for backwards compatibility. Its contents are no longer
5338 functions but callable type objects.
5339
5340- The bsddb.*open functions can now take 'None' as a filename.
5341 This will create a temporary in-memory bsddb that won't be
5342 written to disk.
5343
5344- posix.getloadavg, posix.lchown, posix.killpg, posix.mknod, and
5345 posix.getpgid have been added where available.
5346
5347- The locale module now exposes the C library's gettext interface. It
5348 also has a new function getpreferredencoding.
5349
5350- A security hole ("double free") was found in zlib-1.1.3, a popular
5351 third party compression library used by some Python modules. The
5352 hole was quickly plugged in zlib-1.1.4, and the Windows build of
5353 Python now ships with zlib-1.1.4.
5354
5355- pwd, grp, and resource return enhanced tuples now, with symbolic
5356 field names.
5357
5358- array.array is now a type object. A new format character
5359 'u' indicates Py_UNICODE arrays. For those, .tounicode and
5360 .fromunicode methods are available. Arrays now support __iadd__
5361 and __imul__.
5362
5363- dl now builds on every system that has dlfcn.h. Failure in case
5364 of sizeof(int)!=sizeof(long)!=sizeof(void*) is delayed until dl.open
5365 is called.
5366
5367- The sys module acquired a new attribute, api_version, which evaluates
5368 to the value of the PYTHON_API_VERSION macro with which the
5369 interpreter was compiled.
5370
5371- Fixed bug #470582: sre module would return a tuple (None, 'a', 'ab')
5372 when applying the regular expression '^((a)c)?(ab)$' on 'ab'. It now
5373 returns (None, None, 'ab'), as expected. Also fixed handling of
5374 lastindex/lastgroup match attributes in similar cases. For example,
5375 when running the expression r'(a)(b)?b' over 'ab', lastindex must be
5376 1, not 2.
5377
5378- Fixed bug #581080: sre scanner was not checking the buffer limit
5379 before increasing the current pointer. This was creating an infinite
5380 loop in the search function, once the pointer exceeded the buffer
5381 limit.
5382
5383- The os.fdopen function now enforces a file mode starting with the
5384 letter 'r', 'w' or 'a', otherwise a ValueError is raised. This fixes
5385 bug #623464.
5386
5387- The linuxaudiodev module is now deprecated; it is being replaced by
5388 ossaudiodev. The interface has been extended to cover a lot more of
5389 OSS (see www.opensound.com), including most DSP ioctls and the
5390 OSS mixer API. Documentation forthcoming in 2.3a2.
5391
5392Library
5393-------
5394
5395- imaplib.py now supports SSL (Tino Lange and Piers Lauder).
5396
5397- Freeze's modulefinder.py has been moved to the standard library;
5398 slightly improved so it will issue less false missing submodule
5399 reports (see sf path #643711 for details). Documentation will follow
5400 with Python 2.3a2.
5401
5402- os.path exposes getctime.
5403
5404- unittest.py now has two additional methods called assertAlmostEqual()
5405 and failIfAlmostEqual(). They implement an approximate comparison
5406 by rounding the difference between the two arguments and comparing
5407 the result to zero. Approximate comparison is essential for
5408 unit tests of floating point results.
5409
5410- calendar.py now depends on the new datetime module rather than
5411 the time module. As a result, the range of allowable dates
5412 has been increased.
5413
5414- pdb has a new 'j(ump)' command to select the next line to be
5415 executed.
5416
5417- The distutils created windows installers now can run a
5418 postinstallation script.
5419
5420- doctest.testmod can now be called without argument, which means to
5421 test the current module.
5422
5423- When canceling a server that implemented threading with a keyboard
5424 interrupt, the server would shut down but not terminate (waiting on
5425 client threads). A new member variable, daemon_threads, was added to
5426 the ThreadingMixIn class in SocketServer.py to make it explicit that
5427 this behavior needs to be controlled.
5428
5429- A new module, optparse, provides a fancy alternative to getopt for
5430 command line parsing. It is a slightly modified version of Greg
5431 Ward's Optik package.
5432
5433- UserDict.py now defines a DictMixin class which defines all dictionary
5434 methods for classes that already have a minimum mapping interface.
5435 This greatly simplifies writing classes that need to be substitutable
5436 for dictionaries (such as the shelve module).
5437
5438- shelve.py now subclasses from UserDict.DictMixin. Now shelve supports
5439 all dictionary methods. This eases the transition to persistent
5440 storage for scripts originally written with dictionaries in mind.
5441
5442- shelve.open and the various classes in shelve.py now accept an optional
5443 binary flag, which defaults to False. If True, the values stored in the
5444 shelf are binary pickles.
5445
5446- A new package, logging, implements the logging API defined by PEP
5447 282. The code is written by Vinay Sajip.
5448
5449- StreamReader, StreamReaderWriter and StreamRecoder in the codecs
5450 modules are iterators now.
5451
5452- gzip.py now handles files exceeding 2GB. Files over 4GB also work
5453 now (provided the OS supports it, and Python is configured with large
5454 file support), but in that case the underlying gzip file format can
5455 record only the least-significant 32 bits of the file size, so that
5456 some tools working with gzipped files may report an incorrect file
5457 size.
5458
5459- xml.sax.saxutils.unescape has been added, to replace entity references
5460 with their entity value.
5461
5462- Queue.Queue.{put,get} now support an optional timeout argument.
5463
5464- Various features of Tk 8.4 are exposed in Tkinter.py. The multiple
5465 option of tkFileDialog is exposed as function askopenfile{,name}s.
5466
5467- Various configure methods of Tkinter have been stream-lined, so that
5468 tag_configure, image_configure, window_configure now return a
5469 dictionary when invoked with no argument.
5470
5471- Importing the readline module now no longer has the side effect of
5472 calling setlocale(LC_CTYPE, ""). The initial "C" locale, or
5473 whatever locale is explicitly set by the user, is preserved. If you
5474 want repr() of 8-bit strings in your preferred encoding to preserve
5475 all printable characters of that encoding, you have to add the
5476 following code to your $PYTHONSTARTUP file or to your application's
5477 main():
5478
5479 import locale
5480 locale.setlocale(locale.LC_CTYPE, "")
5481
5482- shutil.move was added. shutil.copytree now reports errors as an
5483 exception at the end, instead of printing error messages.
5484
5485- Encoding name normalization was generalized to not only
5486 replace hyphens with underscores, but also all other non-alphanumeric
5487 characters (with the exception of the dot which is used for Python
5488 package names during lookup). The aliases.py mapping was updated
5489 to the new standard.
5490
5491- mimetypes has two new functions: guess_all_extensions() which
5492 returns a list of all known extensions for a mime type, and
5493 add_type() which adds one mapping between a mime type and
5494 an extension to the database.
5495
5496- New module: sets, defines the class Set that implements a mutable
5497 set type using the keys of a dict to represent the set. There's
5498 also a class ImmutableSet which is useful when you need sets of sets
5499 or when you need to use sets as dict keys, and a class BaseSet which
5500 is the base class of the two.
5501
5502- Added random.sample(population,k) for random sampling without replacement.
5503 Returns a k length list of unique elements chosen from the population.
5504
5505- random.randrange(-sys.maxint-1, sys.maxint) no longer raises
5506 OverflowError. That is, it now accepts any combination of 'start'
5507 and 'stop' arguments so long as each is in the range of Python's
5508 bounded integers.
5509
5510- Thanks to Raymond Hettinger, random.random() now uses a new core
5511 generator. The Mersenne Twister algorithm is implemented in C,
5512 threadsafe, faster than the previous generator, has an astronomically
5513 large period (2**19937-1), creates random floats to full 53-bit
5514 precision, and may be the most widely tested random number generator
5515 in existence.
5516
5517 The random.jumpahead(n) method has different semantics for the new
5518 generator. Instead of jumping n steps ahead, it uses n and the
5519 existing state to create a new state. This means that jumpahead()
5520 continues to support multi-threaded code needing generators of
5521 non-overlapping sequences. However, it will break code which relies
5522 on jumpahead moving a specific number of steps forward.
5523
5524 The attributes random.whseed and random.__whseed have no meaning for
5525 the new generator. Code using these attributes should switch to a
5526 new class, random.WichmannHill which is provided for backward
5527 compatibility and to make an alternate generator available.
5528
5529- New "algorithms" module: heapq, implements a heap queue. Thanks to
5530 Kevin O'Connor for the code and François Pinard for an entertaining
5531 write-up explaining the theory and practical uses of heaps.
5532
5533- New encoding for the Palm OS character set: palmos.
5534
5535- binascii.crc32() and the zipfile module had problems on some 64-bit
5536 platforms. These have been fixed. On a platform with 8-byte C longs,
5537 crc32() now returns a signed-extended 4-byte result, so that its value
5538 as a Python int is equal to the value computed a 32-bit platform.
5539
5540- xml.dom.minidom.toxml and toprettyxml now take an optional encoding
5541 argument.
5542
5543- Some fixes in the copy module: when an object is copied through its
5544 __reduce__ method, there was no check for a __setstate__ method on
5545 the result [SF patch 565085]; deepcopy should treat instances of
5546 custom metaclasses the same way it treats instances of type 'type'
5547 [SF patch 560794].
5548
5549- Sockets now support timeout mode. After s.settimeout(T), where T is
5550 a float expressing seconds, subsequent operations raise an exception
5551 if they cannot be completed within T seconds. To disable timeout
5552 mode, use s.settimeout(None). There's also a module function,
5553 socket.setdefaulttimeout(T), which sets the default for all sockets
5554 created henceforth.
5555
5556- getopt.gnu_getopt was added. This supports GNU-style option
5557 processing, where options can be mixed with non-option arguments.
5558
5559- Stop using strings for exceptions. String objects used for
5560 exceptions are now classes deriving from Exception. The objects
5561 changed were: Tkinter.TclError, bdb.BdbQuit, macpath.norm_error,
5562 tabnanny.NannyNag, and xdrlib.Error.
5563
5564- Constants BOM_UTF8, BOM_UTF16, BOM_UTF16_LE, BOM_UTF16_BE,
5565 BOM_UTF32, BOM_UTF32_LE and BOM_UTF32_BE that represent the Byte
5566 Order Mark in UTF-8, UTF-16 and UTF-32 encodings for little and
5567 big endian systems were added to the codecs module. The old names
5568 BOM32_* and BOM64_* were off by a factor of 2.
5569
5570- Added conversion functions math.degrees() and math.radians().
5571
5572- math.log() now takes an optional argument: math.log(x[, base]).
5573
5574- ftplib.retrlines() now tests for callback is None rather than testing
5575 for False. Was causing an error when given a callback object which
5576 was callable but also returned len() as zero. The change may
5577 create new breakage if the caller relied on the undocumented behavior
5578 and called with callback set to [] or some other False value not
5579 identical to None.
5580
5581- random.gauss() uses a piece of hidden state used by nothing else,
5582 and the .seed() and .whseed() methods failed to reset it. In other
5583 words, setting the seed didn't completely determine the sequence of
5584 results produced by random.gauss(). It does now. Programs repeatedly
5585 mixing calls to a seed method with calls to gauss() may see different
5586 results now.
5587
5588- The pickle.Pickler class grew a clear_memo() method to mimic that
5589 provided by cPickle.Pickler.
5590
5591- difflib's SequenceMatcher class now does a dynamic analysis of
5592 which elements are so frequent as to constitute noise. For
5593 comparing files as sequences of lines, this generally works better
5594 than the IS_LINE_JUNK function, and function ndiff's linejunk
5595 argument defaults to None now as a result. A happy benefit is
5596 that SequenceMatcher may run much faster now when applied
5597 to large files with many duplicate lines (for example, C program
5598 text with lots of repeated "}" and "return NULL;" lines).
5599
5600- New Text.dump() method in Tkinter module.
5601
5602- New distutils commands for building packagers were added to
5603 support pkgtool on Solaris and swinstall on HP-UX.
5604
5605- distutils now has a new abstract binary packager base class
5606 command/bdist_packager, which simplifies writing packagers.
5607 This will hopefully provide the missing bits to encourage
5608 people to submit more packagers, e.g. for Debian, FreeBSD
5609 and other systems.
5610
5611- The UTF-16, -LE and -BE stream readers now raise a
5612 NotImplementedError for all calls to .readline(). Previously, they
5613 used to just produce garbage or fail with an encoding error --
5614 UTF-16 is a 2-byte encoding and the C lib's line reading APIs don't
5615 work well with these.
5616
5617- compileall now supports quiet operation.
5618
5619- The BaseHTTPServer now implements optional HTTP/1.1 persistent
5620 connections.
5621
5622- socket module: the SSL support was broken out of the main
5623 _socket module C helper and placed into a new _ssl helper
5624 which now gets imported by socket.py if available and working.
5625
5626- encodings package: added aliases for all supported IANA character
5627 sets
5628
5629- ftplib: to safeguard the user's privacy, anonymous login will use
5630 "anonymous@" as default password, rather than the real user and host
5631 name.
5632
5633- webbrowser: tightened up the command passed to os.system() so that
5634 arbitrary shell code can't be executed because a bogus URL was
5635 passed in.
5636
5637- gettext.translation has an optional fallback argument, and
5638 gettext.find an optional all argument. Translations will now fallback
5639 on a per-message basis. The module supports plural forms, by means
5640 of gettext.[d]ngettext and Translation.[u]ngettext.
5641
5642- distutils bdist commands now offer a --skip-build option.
5643
5644- warnings.warn now accepts a Warning instance as first argument.
5645
5646- The xml.sax.expatreader.ExpatParser class will no longer create
5647 circular references by using itself as the locator that gets passed
5648 to the content handler implementation. [SF bug #535474]
5649
5650- The email.Parser.Parser class now properly parses strings regardless
5651 of their line endings, which can be any of \r, \n, or \r\n (CR, LF,
5652 or CRLF). Also, the Header class's constructor default arguments
5653 has changed slightly so that an explicit maxlinelen value is always
5654 honored, and so unicode conversion error handling can be specified.
5655
5656- distutils' build_ext command now links C++ extensions with the C++
5657 compiler available in the Makefile or CXX environment variable, if
5658 running under \*nix.
5659
5660- New module bz2: provides a comprehensive interface for the bz2 compression
5661 library. It implements a complete file interface, one-shot (de)compression
5662 functions, and types for sequential (de)compression.
5663
5664- New pdb command 'pp' which is like 'p' except that it pretty-prints
5665 the value of its expression argument.
5666
5667- Now bdist_rpm distutils command understands a verify_script option in
5668 the config file, including the contents of the referred filename in
5669 the "%verifyscript" section of the rpm spec file.
5670
5671- Fixed bug #495695: webbrowser module would run graphic browsers in a
5672 unix environment even if DISPLAY was not set. Also, support for
5673 skipstone browser was included.
5674
5675- Fixed bug #636769: rexec would run unallowed code if subclasses of
5676 strings were used as parameters for certain functions.
5677
5678Tools/Demos
5679-----------
5680
5681- pygettext.py now supports globbing on Windows, and accepts module
5682 names in addition to accepting file names.
5683
5684- The SGI demos (Demo/sgi) have been removed. Nobody thought they
5685 were interesting any more. (The SGI library modules and extensions
5686 are still there; it is believed that at least some of these are
5687 still used and useful.)
5688
5689- IDLE supports the new encoding declarations (PEP 263); it can also
5690 deal with legacy 8-bit files if they use the locale's encoding. It
5691 allows non-ASCII strings in the interactive shell and executes them
5692 in the locale's encoding.
5693
5694- freeze.py now produces binaries which can import shared modules,
5695 unlike before when this failed due to missing symbol exports in
5696 the generated binary.
5697
5698Build
5699-----
5700
5701- On Unix, IDLE is now installed automatically.
5702
5703- The fpectl module is not built by default; it's dangerous or useless
5704 except in the hands of experts.
5705
5706- The public Python C API will generally be declared using PyAPI_FUNC
5707 and PyAPI_DATA macros, while Python extension module init functions
5708 will be declared with PyMODINIT_FUNC. DL_EXPORT/DL_IMPORT macros
5709 are deprecated.
5710
5711- A bug was fixed that could cause COUNT_ALLOCS builds to segfault, or
5712 get into infinite loops, when a new-style class got garbage-collected.
5713 Unfortunately, to avoid this, the way COUNT_ALLOCS works requires
5714 that new-style classes be immortal in COUNT_ALLOCS builds. Note that
5715 COUNT_ALLOCS is not enabled by default, in either release or debug
5716 builds, and that new-style classes are immortal only in COUNT_ALLOCS
5717 builds.
5718
5719- Compiling out the cyclic garbage collector is no longer an option.
5720 The old symbol WITH_CYCLE_GC is now ignored, and Python.h arranges
5721 that it's always defined (for the benefit of any extension modules
5722 that may be conditionalizing on it). A bonus is that any extension
5723 type participating in cyclic gc can choose to participate in the
5724 Py_TRASHCAN mechanism now too; in the absence of cyclic gc, this used
5725 to require editing the core to teach the trashcan mechanism about the
5726 new type.
5727
5728- According to Annex F of the current C standard,
5729
5730 The Standard C macro HUGE_VAL and its float and long double analogs,
5731 HUGE_VALF and HUGE_VALL, expand to expressions whose values are
5732 positive infinities.
5733
5734 Python only uses the double HUGE_VAL, and only to #define its own symbol
5735 Py_HUGE_VAL. Some platforms have incorrect definitions for HUGE_VAL.
5736 pyport.h used to try to worm around that, but the workarounds triggered
5737 other bugs on other platforms, so we gave up. If your platform defines
5738 HUGE_VAL incorrectly, you'll need to #define Py_HUGE_VAL to something
5739 that works on your platform. The only instance of this I'm sure about
5740 is on an unknown subset of Cray systems, described here:
5741
5742 http://www.cray.com/swpubs/manuals/SN-2194_2.0/html-SN-2194_2.0/x3138.htm
5743
5744 Presumably 2.3a1 breaks such systems. If anyone uses such a system, help!
5745
5746- The configure option --without-doc-strings can be used to remove the
5747 doc strings from the builtin functions and modules; this reduces the
5748 size of the executable.
5749
5750- The universal newlines option (PEP 278) is on by default. On Unix
5751 it can be disabled by passing --without-universal-newlines to the
5752 configure script. On other platforms, remove
5753 WITH_UNIVERSAL_NEWLINES from pyconfig.h.
5754
5755- On Unix, a shared libpython2.3.so can be created with --enable-shared.
5756
5757- All uses of the CACHE_HASH, INTERN_STRINGS, and DONT_SHARE_SHORT_STRINGS
5758 preprocessor symbols were eliminated. The internal decisions they
5759 controlled stopped being experimental long ago.
5760
5761- The tools used to build the documentation now work under Cygwin as
5762 well as Unix.
5763
5764- The bsddb and dbm module builds have been changed to try and avoid version
5765 skew problems and disable linkage with Berkeley DB 1.85 unless the
5766 installer knows what s/he's doing. See the section on building these
5767 modules in the README file for details.
5768
5769C API
5770-----
5771
5772- PyNumber_Check() now returns true for string and unicode objects.
5773 This is a result of these types having a partially defined
5774 tp_as_number slot. (This is not a feature, but an indication that
5775 PyNumber_Check() is not very useful to determine numeric behavior.
5776 It may be deprecated.)
5777
5778- The string object's layout has changed: the pointer member
5779 ob_sinterned has been replaced by an int member ob_sstate. On some
5780 platforms (e.g. most 64-bit systems) this may change the offset of
5781 the ob_sval member, so as a precaution the API_VERSION has been
5782 incremented. The apparently unused feature of "indirect interned
5783 strings", supported by the ob_sinterned member, is gone. Interned
5784 strings are now usually mortal; there is a new API,
5785 PyString_InternImmortal() that creates immortal interned strings.
5786 (The ob_sstate member can only take three values; however, while
5787 making it a char saves a few bytes per string object on average, in
5788 it also slowed things down a bit because ob_sval was no longer
5789 aligned.)
5790
5791- The Py_InitModule*() functions now accept NULL for the 'methods'
5792 argument. Modules without global functions are becoming more common
5793 now that factories can be types rather than functions.
5794
5795- New C API PyUnicode_FromOrdinal() which exposes unichr() at C
5796 level.
5797
5798- New functions PyErr_SetExcFromWindowsErr() and
5799 PyErr_SetExcFromWindowsErrWithFilename(). Similar to
5800 PyErr_SetFromWindowsErrWithFilename() and
5801 PyErr_SetFromWindowsErr(), but they allow to specify
5802 the exception type to raise. Available on Windows.
5803
5804- Py_FatalError() is now declared as taking a const char* argument. It
5805 was previously declared without const. This should not affect working
5806 code.
5807
5808- Added new macro PySequence_ITEM(o, i) that directly calls
5809 sq_item without rechecking that o is a sequence and without
5810 adjusting for negative indices.
5811
5812- PyRange_New() now raises ValueError if the fourth argument is not 1.
5813 This is part of the removal of deprecated features of the xrange
5814 object.
5815
5816- PyNumber_Coerce() and PyNumber_CoerceEx() now also invoke the type's
5817 coercion if both arguments have the same type but this type has the
5818 CHECKTYPES flag set. This is to better support proxies.
5819
5820- The type of tp_free has been changed from "``void (*)(PyObject *)``" to
5821 "``void (*)(void *)``".
5822
5823- PyObject_Del, PyObject_GC_Del are now functions instead of macros.
5824
5825- A type can now inherit its metatype from its base type. Previously,
5826 when PyType_Ready() was called, if ob_type was found to be NULL, it
5827 was always set to &PyType_Type; now it is set to base->ob_type,
5828 where base is tp_base, defaulting to &PyObject_Type.
5829
5830- PyType_Ready() accidentally did not inherit tp_is_gc; now it does.
5831
5832- The PyCore_* family of APIs have been removed.
5833
5834- The "u#" parser marker will now pass through Unicode objects as-is
5835 without going through the buffer API.
5836
5837- The enumerators of cmp_op have been renamed to use the prefix ``PyCmp_``.
5838
5839- An old #define of ANY as void has been removed from pyport.h. This
5840 hasn't been used since Python's pre-ANSI days, and the #define has
5841 been marked as obsolete since then. SF bug 495548 says it created
5842 conflicts with other packages, so keeping it around wasn't harmless.
5843
5844- Because Python's magic number scheme broke on January 1st, we decided
5845 to stop Python development. Thanks for all the fish!
5846
5847- Some of us don't like fish, so we changed Python's magic number
5848 scheme to a new one. See Python/import.c for details.
5849
5850New platforms
5851-------------
5852
5853- OpenVMS is now supported.
5854
5855- AtheOS is now supported.
5856
5857- the EMX runtime environment on OS/2 is now supported.
5858
5859- GNU/Hurd is now supported.
5860
5861Tests
5862-----
5863
5864- The regrtest.py script's -u option now provides a way to say "allow
5865 all resources except this one." For example, to allow everything
5866 except bsddb, give the option '-uall,-bsddb'.
5867
5868Windows
5869-------
5870
5871- The Windows distribution now ships with version 4.0.14 of the
5872 Sleepycat Berkeley database library. This should be a huge
5873 improvement over the previous Berkeley DB 1.85, which had many
5874 bugs.
5875 XXX What are the licensing issues here?
5876 XXX If a user has a database created with a previous version of
5877 XXX Python, what must they do to convert it?
5878 XXX I'm still not sure how to link this thing (see PCbuild/readme.txt).
5879 XXX The version # is likely to change before 2.3a1.
5880
5881- The Windows distribution now ships with a Secure Sockets Library (SLL)
5882 module (_ssl.pyd)
5883
5884- The Windows distribution now ships with Tcl/Tk version 8.4.1 (it
5885 previously shipped with Tcl/Tk 8.3.2).
5886
5887- When Python is built under a Microsoft compiler, sys.version now
5888 includes the compiler version number (_MSC_VER). For example, under
5889 MSVC 6, sys.version contains the substring "MSC v.1200 ". 1200 is
5890 the value of _MSC_VER under MSVC 6.
5891
5892- Sometimes the uninstall executable (UNWISE.EXE) vanishes. One cause
5893 of that has been fixed in the installer (disabled Wise's "delete in-
5894 use files" uninstall option).
5895
5896- Fixed a bug in urllib's proxy handling in Windows. [SF bug #503031]
5897
5898- The installer now installs Start menu shortcuts under (the local
5899 equivalent of) "All Users" when doing an Admin install.
5900
5901- file.truncate([newsize]) now works on Windows for all newsize values.
5902 It used to fail if newsize didn't fit in 32 bits, reflecting a
5903 limitation of MS _chsize (which is no longer used).
5904
5905- os.waitpid() is now implemented for Windows, and can be used to block
5906 until a specified process exits. This is similar to, but not exactly
5907 the same as, os.waitpid() on POSIX systems. If you're waiting for
5908 a specific process whose pid was obtained from one of the spawn()
5909 functions, the same Python os.waitpid() code works across platforms.
5910 See the docs for details. The docs were changed to clarify that
5911 spawn functions return, and waitpid requires, a process handle on
5912 Windows (not the same thing as a Windows process id).
5913
5914- New tempfile.TemporaryFile implementation for Windows: this doesn't
5915 need a TemporaryFileWrapper wrapper anymore, and should be immune
5916 to a nasty problem: before 2.3, if you got a temp file on Windows, it
5917 got wrapped in an object whose close() method first closed the
5918 underlying file, then deleted the file. This usually worked fine.
5919 However, the spawn family of functions on Windows create (at a low C
5920 level) the same set of open files in the spawned process Q as were
5921 open in the spawning process P. If a temp file f was among them, then
5922 doing f.close() in P first closed P's C-level file handle on f, but Q's
5923 C-level file handle on f remained open, so the attempt in P to delete f
5924 blew up with a "Permission denied" error (Windows doesn't allow
5925 deleting open files). This was surprising, subtle, and difficult to
5926 work around.
5927
5928- The os module now exports all the symbolic constants usable with the
5929 low-level os.open() on Windows: the new constants in 2.3 are
5930 O_NOINHERIT, O_SHORT_LIVED, O_TEMPORARY, O_RANDOM and O_SEQUENTIAL.
5931 The others were also available in 2.2: O_APPEND, O_BINARY, O_CREAT,
5932 O_EXCL, O_RDONLY, O_RDWR, O_TEXT, O_TRUNC and O_WRONLY. Contrary
5933 to Microsoft docs, O_SHORT_LIVED does not seem to imply O_TEMPORARY
5934 (so specify both if you want both; note that neither is useful unless
5935 specified with O_CREAT too).
5936
5937Mac
5938----
5939
5940- Mac/Relnotes is gone, the release notes are now here.
5941
5942- Python (the OSX-only, unix-based version, not the OS9-compatible CFM
5943 version) now fully supports unicode strings as arguments to various file
5944 system calls, eg. open(), file(), os.stat() and os.listdir().
5945
5946- The current naming convention for Python on the Macintosh is that MacPython
5947 refers to the unix-based OSX-only version, and MacPython-OS9 refers to the
5948 CFM-based version that runs on both OS9 and OSX.
5949
5950- All MacPython-OS9 functionality is now available in an OSX unix build,
5951 including the Carbon modules, the IDE, OSA support, etc. A lot of this
5952 will only work correctly in a framework build, though, because you cannot
5953 talk to the window manager unless your application is run from a .app
5954 bundle. There is a command line tool "pythonw" that runs your script
5955 with an interpreter living in such a .app bundle, this interpreter should
5956 be used to run any Python script using the window manager (including
5957 Tkinter or wxPython scripts).
5958
5959- Most of Mac/Lib has moved to Lib/plat-mac, which is again used both in
5960 MacPython-OSX and MacPython-OS9. The only modules remaining in Mac/Lib
5961 are specifically for MacPython-OS9 (CFM support, preference resources, etc).
5962
5963- A new utility PythonLauncher will start a Python interpreter when a .py or
5964 .pyw script is double-clicked in the Finder. By default .py scripts are
5965 run with a normal Python interpreter in a Terminal window and .pyw
5966 files are run with a window-aware pythonw interpreter without a Terminal
5967 window, but all this can be customized.
5968
5969- MacPython-OS9 is now Carbon-only, so it runs on Mac OS 9 or Mac OS X and
5970 possibly on Mac OS 8.6 with the right CarbonLib installed, but not on earlier
5971 releases.
5972
5973- Many tools such as BuildApplet.py and gensuitemodule.py now support a command
5974 line interface too.
5975
5976- All the Carbon classes are now PEP253 compliant, meaning that you can
5977 subclass them from Python. Most of the attributes have gone, you should
5978 now use the accessor function call API, which is also what Apple's
5979 documentation uses. Some attributes such as grafport.visRgn are still
5980 available for convenience.
5981
5982- New Carbon modules File (implementing the APIs in Files.h and Aliases.h)
5983 and Folder (APIs from Folders.h). The old macfs builtin module is
5984 gone, and replaced by a Python wrapper around the new modules.
5985
5986- Pathname handling should now be fully consistent: MacPython-OSX always uses
5987 unix pathnames and MacPython-OS9 always uses colon-separated Mac pathnames
5988 (also when running on Mac OS X).
5989
5990- New Carbon modules Help and AH give access to the Carbon Help Manager.
5991 There are hooks in the IDE to allow accessing the Python documentation
5992 (and Apple's Carbon and Cocoa documentation) through the Help Viewer.
5993 See Mac/OSX/README for converting the Python documentation to a
5994 Help Viewer compatible form and installing it.
5995
5996- OSA support has been redesigned and the generated Python classes now
5997 mirror the inheritance defined by the underlying OSA classes.
5998
5999- MacPython no longer maps both \r and \n to \n on input for any text file.
6000 This feature has been replaced by universal newline support (PEP278).
6001
6002- The default encoding for Python sourcefiles in MacPython-OS9 is no longer
6003 mac-roman (or whatever your local Mac encoding was) but "ascii", like on
6004 other platforms. If you really need sourcefiles with Mac characters in them
6005 you can change this in site.py.
6006
6007
6008What's New in Python 2.2 final?
6009===============================
6010
6011*Release date: 21-Dec-2001*
6012
6013Type/class unification and new-style classes
6014--------------------------------------------
6015
6016- pickle.py, cPickle: allow pickling instances of new-style classes
6017 with a custom metaclass.
6018
6019Core and builtins
6020-----------------
6021
6022- weakref proxy object: when comparing, unwrap both arguments if both
6023 are proxies.
6024
6025Extension modules
6026-----------------
6027
6028- binascii.b2a_base64(): fix a potential buffer overrun when encoding
6029 very short strings.
6030
6031- cPickle: the obscure "fast" mode was suspected of causing stack
6032 overflows on the Mac. Hopefully fixed this by setting the recursion
6033 limit much smaller. If the limit is too low (it only affects
6034 performance), you can change it by defining PY_CPICKLE_FAST_LIMIT
6035 when compiling cPickle.c (or in pyconfig.h).
6036
6037Library
6038-------
6039
6040- dumbdbm.py: fixed a dumb old bug (the file didn't get synched at
6041 close or delete time).
6042
6043- rfc822.py: fixed a bug where the address '<>' was converted to None
6044 instead of an empty string (also fixes the email.Utils module).
6045
6046- xmlrpclib.py: version 1.0.0; uses precision for doubles.
6047
6048- test suite: the pickle and cPickle tests were not executing any code
6049 when run from the standard regression test.
6050
6051Tools/Demos
6052-----------
6053
6054Build
6055-----
6056
6057C API
6058-----
6059
6060New platforms
6061-------------
6062
6063Tests
6064-----
6065
6066Windows
6067-------
6068
6069- distutils package: fixed broken Windows installers (bdist_wininst).
6070
6071- tempfile.py: prevent mysterious warnings when TemporaryFileWrapper
6072 instances are deleted at process exit time.
6073
6074- socket.py: prevent mysterious warnings when socket instances are
6075 deleted at process exit time.
6076
6077- posixmodule.c: fix a Windows crash with stat() of a filename ending
6078 in backslash.
6079
6080Mac
6081----
6082
6083- The Carbon toolbox modules have been upgraded to Universal Headers
6084 3.4, and experimental CoreGraphics and CarbonEvents modules have
6085 been added. All only for framework-enabled MacOSX.
6086
6087
6088What's New in Python 2.2c1?
6089===========================
6090
6091*Release date: 14-Dec-2001*
6092
6093Type/class unification and new-style classes
6094--------------------------------------------
6095
6096- Guido's tutorial introduction to the new type/class features has
6097 been extensively updated. See
6098
6099 http://www.python.org/2.2/descrintro.html
6100
6101 That remains the primary documentation in this area.
6102
6103- Fixed a leak: instance variables declared with __slots__ were never
6104 deleted!
6105
6106- The "delete attribute" method of descriptor objects is called
6107 __delete__, not __del__. In previous releases, it was mistakenly
6108 called __del__, which created an unfortunate overloading condition
6109 with finalizers. (The "get attribute" and "set attribute" methods
6110 are still called __get__ and __set__, respectively.)
6111
6112- Some subtle issues with the super built-in were fixed:
6113
6114 (a) When super itself is subclassed, its __get__ method would still
6115 return an instance of the base class (i.e., of super).
6116
6117 (b) super(C, C()).__class__ would return C rather than super. This
6118 is confusing. To fix this, I decided to change the semantics of
6119 super so that it only applies to code attributes, not to data
6120 attributes. After all, overriding data attributes is not
6121 supported anyway.
6122
6123 (c) The __get__ method didn't check whether the argument was an
6124 instance of the type used in creation of the super instance.
6125
6126- Previously, hash() of an instance of a subclass of a mutable type
6127 (list or dictionary) would return some value, rather than raising
6128 TypeError. This has been fixed. Also, directly calling
6129 dict.__hash__ and list.__hash__ now raises the same TypeError
6130 (previously, these were the same as object.__hash__).
6131
6132- New-style objects now support deleting their __dict__. This is for
6133 all intents and purposes equivalent to assigning a brand new empty
6134 dictionary, but saves space if the object is not used further.
6135
6136Core and builtins
6137-----------------
6138
6139- -Qnew now works as documented in PEP 238: when -Qnew is passed on
6140 the command line, all occurrences of "/" use true division instead
6141 of classic division. See the PEP for details. Note that "all"
6142 means all instances in library and 3rd-party modules, as well as in
6143 your own code. As the PEP says, -Qnew is intended for use only in
6144 educational environments with control over the libraries in use.
6145 Note that test_coercion.py in the standard Python test suite fails
6146 under -Qnew; this is expected, and won't be repaired until true
6147 division becomes the default (in the meantime, test_coercion is
6148 testing the current rules).
6149
6150- complex() now only allows the first argument to be a string
6151 argument, and raises TypeError if either the second arg is a string
6152 or if the second arg is specified when the first is a string.
6153
6154Extension modules
6155-----------------
6156
6157- gc.get_referents was renamed to gc.get_referrers.
6158
6159Library
6160-------
6161
6162- Functions in the os.spawn() family now release the global interpreter
6163 lock around calling the platform spawn. They should always have done
6164 this, but did not before 2.2c1. Multithreaded programs calling
6165 an os.spawn function with P_WAIT will no longer block all Python threads
6166 until the spawned program completes. It's possible that some programs
6167 relies on blocking, although more likely by accident than by design.
6168
6169- webbrowser defaults to netscape.exe on OS/2 now.
6170
6171- Tix.ResizeHandle exposes detach_widget, hide, and show.
6172
6173- The charset alias windows_1252 has been added.
6174
6175- types.StringTypes is a tuple containing the defined string types;
6176 usually this will be (str, unicode), but if Python was compiled
6177 without Unicode support it will be just (str,).
6178
6179- The pulldom and minidom modules were synchronized to PyXML.
6180
6181Tools/Demos
6182-----------
6183
6184- A new script called Tools/scripts/google.py was added, which fires
6185 off a search on Google.
6186
6187Build
6188-----
6189
6190- Note that release builds of Python should arrange to define the
6191 preprocessor symbol NDEBUG on the command line (or equivalent).
6192 In the 2.2 pre-release series we tried to define this by magic in
6193 Python.h instead, but it proved to cause problems for extension
6194 authors. The Unix, Windows and Mac builds now all define NDEBUG in
6195 release builds via cmdline (or equivalent) instead. Ports to
6196 other platforms should do likewise.
6197
6198- It is no longer necessary to use --with-suffix when building on a
6199 case-insensitive file system (such as Mac OS X HFS+). In the build
6200 directory an extension is used, but not in the installed python.
6201
6202C API
6203-----
6204
6205- New function PyDict_MergeFromSeq2() exposes the builtin dict
6206 constructor's logic for updating a dictionary from an iterable object
6207 producing key-value pairs.
6208
6209- PyArg_ParseTupleAndKeywords() requires that the number of entries in
6210 the keyword list equal the number of argument specifiers. This
6211 wasn't checked correctly, and PyArg_ParseTupleAndKeywords could even
6212 dump core in some bad cases. This has been repaired. As a result,
6213 PyArg_ParseTupleAndKeywords may raise RuntimeError in bad cases that
6214 previously went unchallenged.
6215
6216New platforms
6217-------------
6218
6219Tests
6220-----
6221
6222Windows
6223-------
6224
6225Mac
6226----
6227
6228- In unix-Python on Mac OS X (and darwin) sys.platform is now "darwin",
6229 without any trailing digits.
6230
6231- Changed logic for finding python home in Mac OS X framework Pythons.
6232 Now sys.executable points to the executable again, in stead of to
6233 the shared library. The latter is used only for locating the python
6234 home.
6235
6236
6237What's New in Python 2.2b2?
6238===========================
6239
6240*Release date: 16-Nov-2001*
6241
6242Type/class unification and new-style classes
6243--------------------------------------------
6244
6245- Multiple inheritance mixing new-style and classic classes in the
6246 list of base classes is now allowed, so this works now:
6247
6248 class Classic: pass
6249 class Mixed(Classic, object): pass
6250
6251 The MRO (method resolution order) for each base class is respected
6252 according to its kind, but the MRO for the derived class is computed
6253 using new-style MRO rules if any base class is a new-style class.
6254 This needs to be documented.
6255
6256- The new builtin dictionary() constructor, and dictionary type, have
6257 been renamed to dict. This reflects a decade of common usage.
6258
6259- dict() now accepts an iterable object producing 2-sequences. For
6260 example, dict(d.items()) == d for any dictionary d. The argument,
6261 and the elements of the argument, can be any iterable objects.
6262
6263- New-style classes can now have a __del__ method, which is called
6264 when the instance is deleted (just like for classic classes).
6265
6266- Assignment to object.__dict__ is now possible, for objects that are
6267 instances of new-style classes that have a __dict__ (unless the base
6268 class forbids it).
6269
6270- Methods of built-in types now properly check for keyword arguments
6271 (formerly these were silently ignored). The only built-in methods
6272 that take keyword arguments are __call__, __init__ and __new__.
6273
6274- The socket function has been converted to a type; see below.
6275
6276Core and builtins
6277-----------------
6278
6279- Assignment to __debug__ raises SyntaxError at compile-time. This
6280 was promised when 2.1c1 was released as "What's New in Python 2.1c1"
6281 (see below) says.
6282
6283- Clarified the error messages for unsupported operands to an operator
6284 (like 1 + '').
6285
6286Extension modules
6287-----------------
6288
6289- mmap has a new keyword argument, "access", allowing a uniform way for
6290 both Windows and Unix users to create read-only, write-through and
6291 copy-on-write memory mappings. This was previously possible only on
6292 Unix. A new keyword argument was required to support this in a
6293 uniform way because the mmap() signatures had diverged across
6294 platforms. Thanks to Jay T Miller for repairing this!
6295
6296- By default, the gc.garbage list now contains only those instances in
6297 unreachable cycles that have __del__ methods; in 2.1 it contained all
6298 instances in unreachable cycles. "Instances" here has been generalized
6299 to include instances of both new-style and old-style classes.
6300
6301- The socket module defines a new method for socket objects,
6302 sendall(). This is like send() but may make multiple calls to
6303 send() until all data has been sent. Also, the socket function has
6304 been converted to a subclassable type, like list and tuple (etc.)
6305 before it; socket and SocketType are now the same thing.
6306
6307- Various bugfixes to the curses module. There is now a test suite
6308 for the curses module (you have to run it manually).
6309
6310- binascii.b2a_base64 no longer places an arbitrary restriction of 57
6311 bytes on its input.
6312
6313Library
6314-------
6315
6316- tkFileDialog exposes a Directory class and askdirectory
6317 convenience function.
6318
6319- Symbolic group names in regular expressions must be unique. For
6320 example, the regexp r'(?P<abc>)(?P<abc>)' is not allowed, because a
6321 single name can't mean both "group 1" and "group 2" simultaneously.
6322 Python 2.2 detects this error at regexp compilation time;
6323 previously, the error went undetected, and results were
6324 unpredictable. Also in sre, the pattern.split(), pattern.sub(), and
6325 pattern.subn() methods have been rewritten in C. Also, an
6326 experimental function/method finditer() has been added, which works
6327 like findall() but returns an iterator.
6328
6329- Tix exposes more commands through the classes DirSelectBox,
6330 DirSelectDialog, ListNoteBook, Meter, CheckList, and the
6331 methods tix_addbitmapdir, tix_cget, tix_configure, tix_filedialog,
6332 tix_getbitmap, tix_getimage, tix_option_get, and tix_resetoptions.
6333
6334- Traceback objects are now scanned by cyclic garbage collection, so
6335 cycles created by casual use of sys.exc_info() no longer cause
6336 permanent memory leaks (provided garbage collection is enabled).
6337
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00006338- mimetypes.py has optional support for non-standard, but commonly
6339 found types. guess_type() and guess_extension() now accept an
6340 optional 'strict' flag, defaulting to true, which controls whether
6341 recognize non-standard types or not. A few non-standard types we
6342 know about have been added. Also, when run as a script, there are
6343 new -l and -e options.
6344
6345- statcache is now deprecated.
6346
6347- email.Utils.formatdate() now produces the preferred RFC 2822 style
6348 dates with numeric timezones (it used to produce obsolete dates
6349 hard coded to "GMT" timezone). An optional 'localtime' flag is
6350 added to produce dates in the local timezone, with daylight savings
6351 time properly taken into account.
6352
6353- In pickle and cPickle, instead of masking errors in load() by
6354 transforming them into SystemError, we let the original exception
6355 propagate out. Also, implement support for __safe_for_unpickling__
6356 in pickle, as it already was supported in cPickle.
6357
6358Tools/Demos
6359-----------
6360
6361Build
6362-----
6363
6364- The dbm module is built using libdb1 if available. The bsddb module
6365 is built with libdb3 if available.
6366
6367- Misc/Makefile.pre.in has been removed by BDFL pronouncement.
6368
6369C API
6370-----
6371
6372- New function PySequence_Fast_GET_SIZE() returns the size of a non-
6373 NULL result from PySequence_Fast(), more quickly than calling
6374 PySequence_Size().
6375
6376- New argument unpacking function PyArg_UnpackTuple() added.
6377
6378- New functions PyObject_CallFunctionObjArgs() and
6379 PyObject_CallMethodObjArgs() have been added to make it more
6380 convenient and efficient to call functions and methods from C.
6381
6382- PyArg_ParseTupleAndKeywords() no longer masks errors, so it's
6383 possible that this will propagate errors it didn't before.
6384
6385- New function PyObject_CheckReadBuffer(), which returns true if its
6386 argument supports the single-segment readable buffer interface.
6387
6388New platforms
6389-------------
6390
6391- We've finally confirmed that this release builds on HP-UX 11.00,
6392 *with* threads, and passes the test suite.
6393
6394- Thanks to a series of patches from Michael Muller, Python may build
6395 again under OS/2 Visual Age C++.
6396
6397- Updated RISCOS port by Dietmar Schwertberger.
6398
6399Tests
6400-----
6401
6402- Added a test script for the curses module. It isn't run automatically;
6403 regrtest.py must be run with '-u curses' to enable it.
6404
6405Windows
6406-------
6407
6408Mac
6409----
6410
6411- PythonScript has been moved to unsupported and is slated to be
6412 removed completely in the next release.
6413
6414- It should now be possible to build applets that work on both OS9 and
6415 OSX.
6416
6417- The core is now linked with CoreServices not Carbon; as a side
6418 result, default 8bit encoding on OSX is now ASCII.
6419
6420- Python should now build on OSX 10.1.1
6421
6422
6423What's New in Python 2.2b1?
6424===========================
6425
6426*Release date: 19-Oct-2001*
6427
6428Type/class unification and new-style classes
6429--------------------------------------------
6430
6431- New-style classes are now always dynamic (except for built-in and
6432 extension types). There is no longer a performance penalty, and I
6433 no longer see another reason to keep this baggage around. One relic
6434 remains: the __dict__ of a new-style class is a read-only proxy; you
6435 must set the class's attribute to modify it. As a consequence, the
6436 __defined__ attribute of new-style types no longer exists, for lack
6437 of need: there is once again only one __dict__ (although in the
6438 future a __cache__ may be resurrected with a similar function, if I
6439 can prove that it actually speeds things up).
6440
6441- C.__doc__ now works as expected for new-style classes (in 2.2a4 it
6442 always returned None, even when there was a class docstring).
6443
6444- doctest now finds and runs docstrings attached to new-style classes,
6445 class methods, static methods, and properties.
6446
6447Core and builtins
6448-----------------
6449
6450- A very subtle syntactical pitfall in list comprehensions was fixed.
6451 For example: [a+b for a in 'abc', for b in 'def']. The comma in
6452 this example is a mistake. Previously, this would silently let 'a'
6453 iterate over the singleton tuple ('abc',), yielding ['abcd', 'abce',
6454 'abcf'] rather than the intended ['ad', 'ae', 'af', 'bd', 'be',
6455 'bf', 'cd', 'ce', 'cf']. Now, this is flagged as a syntax error.
6456 Note that [a for a in <singleton>] is a convoluted way to say
6457 [<singleton>] anyway, so it's not like any expressiveness is lost.
6458
6459- getattr(obj, name, default) now only catches AttributeError, as
6460 documented, rather than returning the default value for all
6461 exceptions (which could mask bugs in a __getattr__ hook, for
6462 example).
6463
6464- Weak reference objects are now part of the core and offer a C API.
6465 A bug which could allow a core dump when binary operations involved
6466 proxy reference has been fixed. weakref.ReferenceError is now a
6467 built-in exception.
6468
6469- unicode(obj) now behaves more like str(obj), accepting arbitrary
6470 objects, and calling a __unicode__ method if it exists.
6471 unicode(obj, encoding) and unicode(obj, encoding, errors) still
6472 require an 8-bit string or character buffer argument.
6473
6474- isinstance() now allows any object as the first argument and a
6475 class, a type or something with a __bases__ tuple attribute for the
6476 second argument. The second argument may also be a tuple of a
6477 class, type, or something with __bases__, in which case isinstance()
6478 will return true if the first argument is an instance of any of the
6479 things contained in the second argument tuple. E.g.
6480
6481 isinstance(x, (A, B))
6482
6483 returns true if x is an instance of A or B.
6484
6485Extension modules
6486-----------------
6487
6488- thread.start_new_thread() now returns the thread ID (previously None).
6489
6490- binascii has now two quopri support functions, a2b_qp and b2a_qp.
6491
6492- readline now supports setting the startup_hook and the
6493 pre_event_hook, and adds the add_history() function.
6494
6495- os and posix supports chroot(), setgroups() and unsetenv() where
6496 available. The stat(), fstat(), statvfs() and fstatvfs() functions
6497 now return "pseudo-sequences" -- the various fields can now be
6498 accessed as attributes (e.g. os.stat("/").st_mtime) but for
6499 backwards compatibility they also behave as a fixed-length sequence.
6500 Some platform-specific fields (e.g. st_rdev) are only accessible as
6501 attributes.
6502
6503- time: localtime(), gmtime() and strptime() now return a
6504 pseudo-sequence similar to the os.stat() return value, with
6505 attributes like tm_year etc.
6506
6507- Decompression objects in the zlib module now accept an optional
6508 second parameter to decompress() that specifies the maximum amount
6509 of memory to use for the uncompressed data.
6510
6511- optional SSL support in the socket module now exports OpenSSL
6512 functions RAND_add(), RAND_egd(), and RAND_status(). These calls
6513 are useful on platforms like Solaris where OpenSSL does not
6514 automatically seed its PRNG. Also, the keyfile and certfile
6515 arguments to socket.ssl() are now optional.
6516
6517- posixmodule (and by extension, the os module on POSIX platforms) now
6518 exports O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW.
6519
6520Library
6521-------
6522
6523- doctest now excludes functions and classes not defined by the module
6524 being tested, thanks to Tim Hochberg.
6525
6526- HotShot, a new profiler implemented using a C-based callback, has
6527 been added. This substantially reduces the overhead of profiling,
6528 but it is still quite preliminary. Support modules and
6529 documentation will be added in upcoming releases (before 2.2 final).
6530
6531- profile now produces correct output in situations where an exception
6532 raised in Python is cleared by C code (e.g. hasattr()). This used
6533 to cause wrong output, including spurious claims of recursive
6534 functions and attribution of time spent to the wrong function.
6535
6536 The code and documentation for the derived OldProfile and HotProfile
6537 profiling classes was removed. The code hasn't worked for years (if
6538 you tried to use them, they raised exceptions). OldProfile
6539 intended to reproduce the behavior of the profiler Python used more
6540 than 7 years ago, and isn't interesting anymore. HotProfile intended
6541 to provide a faster profiler (but producing less information), and
6542 that's a worthy goal we intend to meet via a different approach (but
6543 without losing information).
6544
6545- Profile.calibrate() has a new implementation that should deliver
6546 a much better system-specific calibration constant. The constant can
6547 now be specified in an instance constructor, or as a Profile class or
6548 instance variable, instead of by editing profile.py's source code.
6549 Calibration must still be done manually (see the docs for the profile
6550 module).
6551
6552 Note that Profile.calibrate() must be overridden by subclasses.
6553 Improving the accuracy required exploiting detailed knowledge of
6554 profiler internals; the earlier method abstracted away the details
6555 and measured a simplified model instead, but consequently computed
6556 a constant too small by a factor of 2 on some modern machines.
6557
6558- quopri's encode and decode methods take an optional header parameter,
6559 which indicates whether output is intended for the header 'Q'
6560 encoding.
6561
6562- The SocketServer.ThreadingMixIn class now closes the request after
6563 finish_request() returns. (Not when it errors out though.)
6564
6565- The nntplib module's NNTP.body() method has grown a 'file' argument
6566 to allow saving the message body to a file.
6567
6568- The email package has added a class email.Parser.HeaderParser which
6569 only parses headers and does not recurse into the message's body.
6570 Also, the module/class MIMEAudio has been added for representing
6571 audio data (contributed by Anthony Baxter).
6572
6573- ftplib should be able to handle files > 2GB.
6574
6575- ConfigParser.getboolean() now also interprets TRUE, FALSE, YES, NO,
6576 ON, and OFF.
6577
6578- xml.dom.minidom NodeList objects now support the length attribute
6579 and item() method as required by the DOM specifications.
6580
6581Tools/Demos
6582-----------
6583
6584- Demo/dns was removed. It no longer serves any purpose; a package
6585 derived from it is now maintained by Anthony Baxter, see
6586 http://PyDNS.SourceForge.net.
6587
6588- The freeze tool has been made more robust, and two new options have
6589 been added: -X and -E.
6590
6591Build
6592-----
6593
6594- configure will use CXX in LINKCC if CXX is used to build main() and
6595 the system requires to link a C++ main using the C++ compiler.
6596
6597C API
6598-----
6599
6600- The documentation for the tp_compare slot is updated to require that
6601 the return value must be -1, 0, 1; an arbitrary number <0 or >0 is
6602 not correct. This is not yet enforced but will be enforced in
6603 Python 2.3; even later, we may use -2 to indicate errors and +2 for
6604 "NotImplemented". Right now, -1 should be used for an error return.
6605
6606- PyLong_AsLongLong() now accepts int (as well as long) arguments.
6607 Consequently, PyArg_ParseTuple's 'L' code also accepts int (as well
6608 as long) arguments.
6609
6610- PyThread_start_new_thread() now returns a long int giving the thread
6611 ID, if one can be calculated; it returns -1 for error, 0 if no
6612 thread ID is calculated (this is an incompatible change, but only
6613 the thread module used this API). This code has only really been
6614 tested on Linux and Windows; other platforms please beware (and
6615 report any bugs or strange behavior).
6616
6617- PyUnicode_FromEncodedObject() no longer accepts Unicode objects as
6618 input.
6619
6620New platforms
6621-------------
6622
6623Tests
6624-----
6625
6626Windows
6627-------
6628
6629- Installer: If you install IDLE, and don't disable file-extension
6630 registration, a new "Edit with IDLE" context (right-click) menu entry
6631 is created for .py and .pyw files.
6632
6633- The signal module now supports SIGBREAK on Windows, thanks to Steven
6634 Scott. Note that SIGBREAK is unique to Windows. The default SIGBREAK
6635 action remains to call Win32 ExitProcess(). This can be changed via
6636 signal.signal(). For example::
6637
6638 # Make Ctrl+Break raise KeyboardInterrupt, like Python's default Ctrl+C
6639 # (SIGINT) behavior.
6640 import signal
6641 signal.signal(signal.SIGBREAK, signal.default_int_handler)
6642
6643 try:
6644 while 1:
6645 pass
6646 except KeyboardInterrupt:
6647 # We get here on Ctrl+C or Ctrl+Break now; if we had not changed
6648 # SIGBREAK, only on Ctrl+C (and Ctrl+Break would terminate the
6649 # program without the possibility for any Python-level cleanup).
6650 print "Clean exit"
6651
6652
6653What's New in Python 2.2a4?
6654===========================
6655
6656*Release date: 28-Sep-2001*
6657
6658Type/class unification and new-style classes
6659--------------------------------------------
6660
6661- pydoc and inspect are now aware of new-style classes;
6662 e.g. help(list) at the interactive prompt now shows proper
6663 documentation for all operations on list objects.
6664
6665- Applications using Jim Fulton's ExtensionClass module can now safely
6666 be used with Python 2.2. In particular, Zope 2.4.1 now works with
6667 Python 2.2 (as well as with Python 2.1.1). The Demo/metaclass
6668 examples also work again. It is hoped that Gtk and Boost also work
6669 with 2.2a4 and beyond. (If you can confirm this, please write
6670 webmaster@python.org; if there are still problems, please open a bug
6671 report on SourceForge.)
6672
6673- property() now takes 4 keyword arguments: fget, fset, fdel and doc.
6674 These map to read-only attributes 'fget', 'fset', 'fdel', and '__doc__'
6675 in the constructed property object. fget, fset and fdel weren't
6676 discoverable from Python in 2.2a3. __doc__ is new, and allows to
6677 associate a docstring with a property.
6678
6679- Comparison overloading is now more completely implemented. For
6680 example, a str subclass instance can properly be compared to a str
6681 instance, and it can properly overload comparison. Ditto for most
6682 other built-in object types.
6683
6684- The repr() of new-style classes has changed; instead of <type
6685 'M.Foo'> a new-style class is now rendered as <class 'M.Foo'>,
6686 *except* for built-in types, which are still rendered as <type
6687 'Foo'> (to avoid upsetting existing code that might parse or
6688 otherwise rely on repr() of certain type objects).
6689
6690- The repr() of new-style objects is now always <Foo object at XXX>;
6691 previously, it was sometimes <Foo instance at XXX>.
6692
6693- For new-style classes, what was previously called __getattr__ is now
6694 called __getattribute__. This method, if defined, is called for
6695 *every* attribute access. A new __getattr__ hook more similar to the
6696 one in classic classes is defined which is called only if regular
6697 attribute access raises AttributeError; to catch *all* attribute
6698 access, you can use __getattribute__ (for new-style classes). If
6699 both are defined, __getattribute__ is called first, and if it raises
6700 AttributeError, __getattr__ is called.
6701
6702- The __class__ attribute of new-style objects can be assigned to.
6703 The new class must have the same C-level object layout as the old
6704 class.
6705
6706- The builtin file type can be subclassed now. In the usual pattern,
6707 "file" is the name of the builtin type, and file() is a new builtin
6708 constructor, with the same signature as the builtin open() function.
6709 file() is now the preferred way to open a file.
6710
6711- Previously, __new__ would only see sequential arguments passed to
6712 the type in a constructor call; __init__ would see both sequential
6713 and keyword arguments. This made no sense whatsoever any more, so
6714 now both __new__ and __init__ see all arguments.
6715
6716- Previously, hash() applied to an instance of a subclass of str or
6717 unicode always returned 0. This has been repaired.
6718
6719- Previously, an operation on an instance of a subclass of an
6720 immutable type (int, long, float, complex, tuple, str, unicode),
6721 where the subtype didn't override the operation (and so the
6722 operation was handled by the builtin type), could return that
6723 instance instead a value of the base type. For example, if s was of
6724 a str subclass type, s[:] returned s as-is. Now it returns a str
6725 with the same value as s.
6726
6727- Provisional support for pickling new-style objects has been added.
6728
6729Core
6730----
6731
6732- file.writelines() now accepts any iterable object producing strings.
6733
6734- PyUnicode_FromEncodedObject() now works very much like
6735 PyObject_Str(obj) in that it tries to use __str__/tp_str
6736 on the object if the object is not a string or buffer. This
6737 makes unicode() behave like str() when applied to non-string/buffer
6738 objects.
6739
6740- PyFile_WriteObject now passes Unicode objects to the file's write
6741 method. As a result, all file-like objects which may be the target
6742 of a print statement must support Unicode objects, i.e. they must
6743 at least convert them into ASCII strings.
6744
6745- Thread scheduling on Solaris should be improved; it is no longer
6746 necessary to insert a small sleep at the start of a thread in order
6747 to let other runnable threads be scheduled.
6748
6749Library
6750-------
6751
6752- StringIO.StringIO instances and cStringIO.StringIO instances support
6753 read character buffer compatible objects for their .write() methods.
6754 These objects are converted to strings and then handled as such
6755 by the instances.
6756
6757- The "email" package has been added. This is basically a port of the
6758 mimelib package <http://sf.net/projects/mimelib> with API changes
6759 and some implementations updated to use iterators and generators.
6760
6761- difflib.ndiff() and difflib.Differ.compare() are generators now. This
6762 restores the ability of Tools/scripts/ndiff.py to start producing output
6763 before the entire comparison is complete.
6764
6765- StringIO.StringIO instances and cStringIO.StringIO instances support
6766 iteration just like file objects (i.e. their .readline() method is
6767 called for each iteration until it returns an empty string).
6768
6769- The codecs module has grown four new helper APIs to access
6770 builtin codecs: getencoder(), getdecoder(), getreader(),
6771 getwriter().
6772
6773- SimpleXMLRPCServer: a new module (based upon SimpleHTMLServer)
6774 simplifies writing XML RPC servers.
6775
6776- os.path.realpath(): a new function that returns the absolute pathname
6777 after interpretation of symbolic links. On non-Unix systems, this
6778 is an alias for os.path.abspath().
6779
6780- operator.indexOf() (PySequence_Index() in the C API) now works with any
6781 iterable object.
6782
6783- smtplib now supports various authentication and security features of
6784 the SMTP protocol through the new login() and starttls() methods.
6785
6786- hmac: a new module implementing keyed hashing for message
6787 authentication.
6788
6789- mimetypes now recognizes more extensions and file types. At the
6790 same time, some mappings not sanctioned by IANA were removed.
6791
6792- The "compiler" package has been brought up to date to the state of
6793 Python 2.2 bytecode generation. It has also been promoted from a
6794 Tool to a standard library package. (Tools/compiler still exists as
6795 a sample driver.)
6796
6797Build
6798-----
6799
6800- Large file support (LFS) is now automatic when the platform supports
6801 it; no more manual configuration tweaks are needed. On Linux, at
6802 least, it's possible to have a system whose C library supports large
6803 files but whose kernel doesn't; in this case, large file support is
6804 still enabled but doesn't do you any good unless you upgrade your
6805 kernel or share your Python executable with another system whose
6806 kernel has large file support.
6807
6808- The configure script now supplies plausible defaults in a
6809 cross-compilation environment. This doesn't mean that the supplied
6810 values are always correct, or that cross-compilation now works
6811 flawlessly -- but it's a first step (and it shuts up most of
6812 autoconf's warnings about AC_TRY_RUN).
6813
6814- The Unix build is now a bit less chatty, courtesy of the parser
6815 generator. The build is completely silent (except for errors) when
6816 using "make -s", thanks to a -q option to setup.py.
6817
6818C API
6819-----
6820
6821- The "structmember" API now supports some new flag bits to deny read
6822 and/or write access to attributes in restricted execution mode.
6823
6824New platforms
6825-------------
6826
6827- Compaq's iPAQ handheld, running the "familiar" Linux distribution
6828 (http://familiar.handhelds.org).
6829
6830Tests
6831-----
6832
6833- The "classic" standard tests, which work by comparing stdout to
6834 an expected-output file under Lib/test/output/, no longer stop at
6835 the first mismatch. Instead the test is run to completion, and a
6836 variant of ndiff-style comparison is used to report all differences.
6837 This is much easier to understand than the previous style of reporting.
6838
6839- The unittest-based standard tests now use regrtest's test_main()
6840 convention, instead of running as a side-effect of merely being
6841 imported. This allows these tests to be run in more natural and
6842 flexible ways as unittests, outside the regrtest framework.
6843
6844- regrtest.py is much better integrated with unittest and doctest now,
6845 especially in regard to reporting errors.
6846
6847Windows
6848-------
6849
6850- Large file support now also works for files > 4GB, on filesystems
6851 that support it (NTFS under Windows 2000). See "What's New in
6852 Python 2.2a3" for more detail.
6853
6854
6855What's New in Python 2.2a3?
6856===========================
6857
6858*Release Date: 07-Sep-2001*
6859
6860Core
6861----
6862
6863- Conversion of long to float now raises OverflowError if the long is too
6864 big to represent as a C double.
6865
6866- The 3-argument builtin pow() no longer allows a third non-None argument
6867 if either of the first two arguments is a float, or if both are of
6868 integer types and the second argument is negative (in which latter case
6869 the arguments are converted to float, so this is really the same
6870 restriction).
6871
6872- The builtin dir() now returns more information, and sometimes much
6873 more, generally naming all attributes of an object, and all attributes
6874 reachable from the object via its class, and from its class's base
6875 classes, and so on from them too. Example: in 2.2a2, dir([]) returned
6876 an empty list. In 2.2a3,
6877
6878 >>> dir([])
6879 ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
6880 '__eq__', '__ge__', '__getattr__', '__getitem__', '__getslice__',
6881 '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__le__',
6882 '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__repr__',
6883 '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__',
6884 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
6885 'reverse', 'sort']
6886
6887 dir(module) continues to return only the module's attributes, though.
6888
6889- Overflowing operations on plain ints now return a long int rather
6890 than raising OverflowError. This is a partial implementation of PEP
6891 237. You can use -Wdefault::OverflowWarning to enable a warning for
6892 this situation, and -Werror::OverflowWarning to revert to the old
6893 OverflowError exception.
6894
6895- A new command line option, -Q<arg>, is added to control run-time
6896 warnings for the use of classic division. (See PEP 238.) Possible
6897 values are -Qold, -Qwarn, -Qwarnall, and -Qnew. The default is
6898 -Qold, meaning the / operator has its classic meaning and no
6899 warnings are issued. Using -Qwarn issues a run-time warning about
6900 all uses of classic division for int and long arguments; -Qwarnall
6901 also warns about classic division for float and complex arguments
6902 (for use with fixdiv.py).
6903 [Note: the remainder of this item (preserved below) became
6904 obsolete in 2.2c1 -- -Qnew has global effect in 2.2] ::
6905
6906 Using -Qnew is questionable; it turns on new division by default, but
6907 only in the __main__ module. You can usefully combine -Qwarn or
6908 -Qwarnall and -Qnew: this gives the __main__ module new division, and
6909 warns about classic division everywhere else.
6910
6911- Many built-in types can now be subclassed. This applies to int,
6912 long, float, str, unicode, and tuple. (The types complex, list and
6913 dictionary can also be subclassed; this was introduced earlier.)
6914 Note that restrictions apply when subclassing immutable built-in
6915 types: you can only affect the value of the instance by overloading
6916 __new__. You can add mutable attributes, and the subclass instances
6917 will have a __dict__ attribute, but you cannot change the "value"
6918 (as implemented by the base class) of an immutable subclass instance
6919 once it is created.
6920
6921- The dictionary constructor now takes an optional argument, a
6922 mapping-like object, and initializes the dictionary from its
6923 (key, value) pairs.
6924
6925- A new built-in type, super, has been added. This facilitates making
6926 "cooperative super calls" in a multiple inheritance setting. For an
6927 explanation, see http://www.python.org/2.2/descrintro.html#cooperation
6928
6929- A new built-in type, property, has been added. This enables the
6930 creation of "properties". These are attributes implemented by
6931 getter and setter functions (or only one of these for read-only or
6932 write-only attributes), without the need to override __getattr__.
6933 See http://www.python.org/2.2/descrintro.html#property
6934
6935- The syntax of floating-point and imaginary literals has been
6936 liberalized, to allow leading zeroes. Examples of literals now
6937 legal that were SyntaxErrors before:
6938
6939 00.0 0e3 0100j 07.5 00000000000000000008.
6940
6941- An old tokenizer bug allowed floating point literals with an incomplete
6942 exponent, such as 1e and 3.1e-. Such literals now raise SyntaxError.
6943
6944Library
6945-------
6946
6947- telnetlib includes symbolic names for the options, and support for
6948 setting an option negotiation callback. It also supports processing
6949 of suboptions.
6950
6951- The new C standard no longer requires that math libraries set errno to
6952 ERANGE on overflow. For platform libraries that exploit this new
6953 freedom, Python's overflow-checking was wholly broken. A new overflow-
6954 checking scheme attempts to repair that, but may not be reliable on all
6955 platforms (C doesn't seem to provide anything both useful and portable
6956 in this area anymore).
6957
6958- Asynchronous timeout actions are available through the new class
6959 threading.Timer.
6960
6961- math.log and math.log10 now return sensible results for even huge
6962 long arguments. For example, math.log10(10 ** 10000) ~= 10000.0.
6963
6964- A new function, imp.lock_held(), returns 1 when the import lock is
6965 currently held. See the docs for the imp module.
6966
6967- pickle, cPickle and marshal on 32-bit platforms can now correctly read
6968 dumps containing ints written on platforms where Python ints are 8 bytes.
6969 When read on a box where Python ints are 4 bytes, such values are
6970 converted to Python longs.
6971
6972- In restricted execution mode (using the rexec module), unmarshalling
6973 code objects is no longer allowed. This plugs a security hole.
6974
6975- unittest.TestResult instances no longer store references to tracebacks
6976 generated by test failures. This prevents unexpected dangling references
6977 to objects that should be garbage collected between tests.
6978
6979Tools
6980-----
6981
6982- Tools/scripts/fixdiv.py has been added which can be used to fix
6983 division operators as per PEP 238.
6984
6985Build
6986-----
6987
6988- If you are an adventurous person using Mac OS X you may want to look at
6989 Mac/OSX. There is a Makefile there that will build Python as a real Mac
6990 application, which can be used for experimenting with Carbon or Cocoa.
6991 Discussion of this on pythonmac-sig, please.
6992
6993C API
6994-----
6995
6996- New function PyObject_Dir(obj), like Python __builtin__.dir(obj).
6997
6998- Note that PyLong_AsDouble can fail! This has always been true, but no
6999 callers checked for it. It's more likely to fail now, because overflow
7000 errors are properly detected now. The proper way to check::
7001
7002 double x = PyLong_AsDouble(some_long_object);
7003 if (x == -1.0 && PyErr_Occurred()) {
7004 /* The conversion failed. */
7005 }
7006
7007- The GC API has been changed. Extensions that use the old API will still
7008 compile but will not participate in GC. To upgrade an extension
7009 module:
7010
7011 - rename Py_TPFLAGS_GC to PyTPFLAGS_HAVE_GC
7012
7013 - use PyObject_GC_New or PyObject_GC_NewVar to allocate objects and
7014 PyObject_GC_Del to deallocate them
7015
7016 - rename PyObject_GC_Init to PyObject_GC_Track and PyObject_GC_Fini
7017 to PyObject_GC_UnTrack
7018
7019 - remove PyGC_HEAD_SIZE from object size calculations
7020
7021 - remove calls to PyObject_AS_GC and PyObject_FROM_GC
7022
7023- Two new functions: PyString_FromFormat() and PyString_FromFormatV().
7024 These can be used safely to construct string objects from a
7025 sprintf-style format string (similar to the format string supported
7026 by PyErr_Format()).
7027
7028New platforms
7029-------------
7030
7031- Stephen Hansen contributed patches sufficient to get a clean compile
7032 under Borland C (Windows), but he reports problems running it and ran
7033 out of time to complete the port. Volunteers? Expect a MemoryError
7034 when importing the types module; this is probably shallow, and
7035 causing later failures too.
7036
7037Tests
7038-----
7039
7040Windows
7041-------
7042
7043- Large file support is now enabled on Win32 platforms as well as on
7044 Win64. This means that, for example, you can use f.tell() and f.seek()
7045 to manipulate files larger than 2 gigabytes (provided you have enough
7046 disk space, and are using a Windows filesystem that supports large
7047 partitions). Windows filesystem limits: FAT has a 2GB (gigabyte)
7048 filesize limit, and large file support makes no difference there.
7049 FAT32's limit is 4GB, and files >= 2GB are easier to use from Python now.
7050 NTFS has no practical limit on file size, and files of any size can be
7051 used from Python now.
7052
7053- The w9xpopen hack is now used on Windows NT and 2000 too when COMPSPEC
7054 points to command.com (patch from Brian Quinlan).
7055
7056
7057What's New in Python 2.2a2?
7058===========================
7059
7060*Release Date: 22-Aug-2001*
7061
7062Build
7063-----
7064
7065- Tim Peters developed a brand new Windows installer using Wise 8.1,
7066 generously donated to us by Wise Solutions.
7067
7068- configure supports a new option --enable-unicode, with the values
7069 ucs2 and ucs4 (new in 2.2a1). With --disable-unicode, the Unicode
7070 type and supporting code is completely removed from the interpreter.
7071
7072- A new configure option --enable-framework builds a Mac OS X framework,
7073 which "make frameworkinstall" will install. This provides a starting
7074 point for more mac-like functionality, join pythonmac-sig@python.org
7075 if you are interested in helping.
7076
7077- The NeXT platform is no longer supported.
7078
7079- The 'new' module is now statically linked.
7080
7081Tools
7082-----
7083
7084- The new Tools/scripts/cleanfuture.py can be used to automatically
7085 edit out obsolete future statements from Python source code. See
7086 the module docstring for details.
7087
7088Tests
7089-----
7090
7091- regrtest.py now knows which tests are expected to be skipped on some
7092 platforms, allowing to give clearer test result output. regrtest
7093 also has optional --use/-u switch to run normally disabled tests
7094 which require network access or consume significant disk resources.
7095
7096- Several new tests in the standard test suite, with special thanks to
7097 Nick Mathewson.
7098
7099Core
7100----
7101
7102- The floor division operator // has been added as outlined in PEP
7103 238. The / operator still provides classic division (and will until
7104 Python 3.0) unless "from __future__ import division" is included, in
7105 which case the / operator will provide true division. The operator
7106 module provides truediv() and floordiv() functions. Augmented
7107 assignment variants are included, as are the equivalent overloadable
7108 methods and C API methods. See the PEP for a full discussion:
7109 <http://python.sf.net/peps/pep-0238.html>
7110
7111- Future statements are now effective in simulated interactive shells
7112 (like IDLE). This should "just work" by magic, but read Michael
7113 Hudson's "Future statements in simulated shells" PEP 264 for full
7114 details: <http://python.sf.net/peps/pep-0264.html>.
7115
7116- The type/class unification (PEP 252-253) was integrated into the
7117 trunk and is not so tentative any more (the exact specification of
7118 some features is still tentative). A lot of work has done on fixing
7119 bugs and adding robustness and features (performance still has to
7120 come a long way).
7121
7122- Warnings about a mismatch in the Python API during extension import
7123 now use the Python warning framework (which makes it possible to
7124 write filters for these warnings).
7125
7126- A function's __dict__ (aka func_dict) will now always be a
7127 dictionary. It used to be possible to delete it or set it to None,
7128 but now both actions raise TypeErrors. It is still legal to set it
7129 to a dictionary object. Getting func.__dict__ before any attributes
7130 have been assigned now returns an empty dictionary instead of None.
7131
7132- A new command line option, -E, was added which disables the use of
7133 all environment variables, or at least those that are specifically
7134 significant to Python. Usually those have a name starting with
7135 "PYTHON". This was used to fix a problem where the tests fail if
7136 the user happens to have PYTHONHOME or PYTHONPATH pointing to an
7137 older distribution.
7138
7139Library
7140-------
7141
7142- New class Differ and new functions ndiff() and restore() in difflib.py.
7143 These package the algorithms used by the popular Tools/scripts/ndiff.py,
7144 for programmatic reuse.
7145
7146- New function xml.sax.saxutils.quoteattr(): Quote an XML attribute
7147 value using the minimal quoting required for the value; more
7148 reliable than using xml.sax.saxutils.escape() for attribute values.
7149
7150- Readline completion support for cmd.Cmd was added.
7151
7152- Calling os.tempnam() or os.tmpnam() generate RuntimeWarnings.
7153
7154- Added function threading.BoundedSemaphore()
7155
7156- Added Ka-Ping Yee's cgitb.py module.
7157
7158- The 'new' module now exposes the CO_xxx flags.
7159
7160- The gc module offers the get_referents function.
7161
7162New platforms
7163-------------
7164
7165C API
7166-----
7167
7168- Two new APIs PyOS_snprintf() and PyOS_vsnprintf() were added
7169 which provide a cross-platform implementations for the
7170 relatively new snprintf()/vsnprintf() C lib APIs. In contrast to
7171 the standard sprintf() and vsprintf() C lib APIs, these versions
7172 apply bounds checking on the used buffer which enhances protection
7173 against buffer overruns.
7174
7175- Unicode APIs now use name mangling to assure that mixing interpreters
7176 and extensions using different Unicode widths is rendered next to
7177 impossible. Trying to import an incompatible Unicode-aware extension
7178 will result in an ImportError. Unicode extensions writers must make
7179 sure to check the Unicode width compatibility in their extensions by
7180 using at least one of the mangled Unicode APIs in the extension.
7181
7182- Two new flags METH_NOARGS and METH_O are available in method definition
7183 tables to simplify implementation of methods with no arguments and a
7184 single untyped argument. Calling such methods is more efficient than
7185 calling corresponding METH_VARARGS methods. METH_OLDARGS is now
7186 deprecated.
7187
7188Windows
7189-------
7190
7191- "import module" now compiles module.pyw if it exists and nothing else
7192 relevant is found.
7193
7194
7195What's New in Python 2.2a1?
7196===========================
7197
7198*Release date: 18-Jul-2001*
7199
7200Core
7201----
7202
7203- TENTATIVELY, a large amount of code implementing much of what's
7204 described in PEP 252 (Making Types Look More Like Classes) and PEP
7205 253 (Subtyping Built-in Types) was added. This will be released
7206 with Python 2.2a1. Documentation will be provided separately
7207 through http://www.python.org/2.2/. The purpose of releasing this
7208 with Python 2.2a1 is to test backwards compatibility. It is
7209 possible, though not likely, that a decision is made not to release
7210 this code as part of 2.2 final, if any serious backwards
7211 incompatibilities are found during alpha testing that cannot be
7212 repaired.
7213
7214- Generators were added; this is a new way to create an iterator (see
7215 below) using what looks like a simple function containing one or
7216 more 'yield' statements. See PEP 255. Since this adds a new
7217 keyword to the language, this feature must be enabled by including a
7218 future statement: "from __future__ import generators" (see PEP 236).
7219 Generators will become a standard feature in a future release
7220 (probably 2.3). Without this future statement, 'yield' remains an
7221 ordinary identifier, but a warning is issued each time it is used.
7222 (These warnings currently don't conform to the warnings framework of
7223 PEP 230; we intend to fix this in 2.2a2.)
7224
7225- The UTF-16 codec was modified to be more RFC compliant. It will now
7226 only remove BOM characters at the start of the string and then
7227 only if running in native mode (UTF-16-LE and -BE won't remove a
7228 leading BMO character).
7229
7230- Strings now have a new method .decode() to complement the already
7231 existing .encode() method. These two methods provide direct access
7232 to the corresponding decoders and encoders of the registered codecs.
7233
7234 To enhance the usability of the .encode() method, the special
7235 casing of Unicode object return values was dropped (Unicode objects
7236 were auto-magically converted to string using the default encoding).
7237
7238 Both methods will now return whatever the codec in charge of the
7239 requested encoding returns as object, e.g. Unicode codecs will
7240 return Unicode objects when decoding is requested ("äöü".decode("latin-1")
7241 will return u"äöü"). This enables codec writer to create codecs
7242 for various simple to use conversions.
7243
7244 New codecs were added to demonstrate these new features (the .encode()
7245 and .decode() columns indicate the type of the returned objects):
7246
7247 +---------+-----------+-----------+-----------------------------+
7248 |Name | .encode() | .decode() | Description |
7249 +=========+===========+===========+=============================+
7250 |uu | string | string | UU codec (e.g. for email) |
7251 +---------+-----------+-----------+-----------------------------+
7252 |base64 | string | string | base64 codec |
7253 +---------+-----------+-----------+-----------------------------+
7254 |quopri | string | string | quoted-printable codec |
7255 +---------+-----------+-----------+-----------------------------+
7256 |zlib | string | string | zlib compression |
7257 +---------+-----------+-----------+-----------------------------+
7258 |hex | string | string | 2-byte hex codec |
7259 +---------+-----------+-----------+-----------------------------+
7260 |rot-13 | string | Unicode | ROT-13 Unicode charmap codec|
7261 +---------+-----------+-----------+-----------------------------+
7262
7263- Some operating systems now support the concept of a default Unicode
7264 encoding for file system operations. Notably, Windows supports 'mbcs'
7265 as the default. The Macintosh will also adopt this concept in the medium
7266 term, although the default encoding for that platform will be other than
7267 'mbcs'.
7268
7269 On operating system that support non-ASCII filenames, it is common for
7270 functions that return filenames (such as os.listdir()) to return Python
7271 string objects pre-encoded using the default file system encoding for
7272 the platform. As this encoding is likely to be different from Python's
7273 default encoding, converting this name to a Unicode object before passing
7274 it back to the Operating System would result in a Unicode error, as Python
7275 would attempt to use its default encoding (generally ASCII) rather than
7276 the default encoding for the file system.
7277
7278 In general, this change simply removes surprises when working with
7279 Unicode and the file system, making these operations work as you expect,
7280 increasing the transparency of Unicode objects in this context.
7281 See [????] for more details, including examples.
7282
7283- Float (and complex) literals in source code were evaluated to full
7284 precision only when running from a .py file; the same code loaded from a
7285 .pyc (or .pyo) file could suffer numeric differences starting at about the
7286 12th significant decimal digit. For example, on a machine with IEEE-754
7287 floating arithmetic,
7288
7289 x = 9007199254740992.0
7290 print long(x)
7291
7292 printed 9007199254740992 if run directly from .py, but 9007199254740000
7293 if from a compiled (.pyc or .pyo) file. This was due to marshal using
7294 str(float) instead of repr(float) when building code objects. marshal
7295 now uses repr(float) instead, which should reproduce floats to full
7296 machine precision (assuming the platform C float<->string I/O conversion
7297 functions are of good quality).
7298
7299 This may cause floating-point results to change in some cases, and
7300 usually for the better, but may also cause numerically unstable
7301 algorithms to break.
7302
7303- The implementation of dicts suffers fewer collisions, which has speed
7304 benefits. However, the order in which dict entries appear in dict.keys(),
7305 dict.values() and dict.items() may differ from previous releases for a
7306 given dict. Nothing is defined about this order, so no program should
7307 rely on it. Nevertheless, it's easy to write test cases that rely on the
7308 order by accident, typically because of printing the str() or repr() of a
7309 dict to an "expected results" file. See Lib/test/test_support.py's new
7310 sortdict(dict) function for a simple way to display a dict in sorted
7311 order.
7312
7313- Many other small changes to dicts were made, resulting in faster
7314 operation along the most common code paths.
7315
7316- Dictionary objects now support the "in" operator: "x in dict" means
7317 the same as dict.has_key(x).
7318
7319- The update() method of dictionaries now accepts generic mapping
7320 objects. Specifically the argument object must support the .keys()
7321 and __getitem__() methods. This allows you to say, for example,
7322 {}.update(UserDict())
7323
7324- Iterators were added; this is a generalized way of providing values
7325 to a for loop. See PEP 234. There's a new built-in function iter()
7326 to return an iterator. There's a new protocol to get the next value
7327 from an iterator using the next() method (in Python) or the
7328 tp_iternext slot (in C). There's a new protocol to get iterators
7329 using the __iter__() method (in Python) or the tp_iter slot (in C).
7330 Iterating (i.e. a for loop) over a dictionary generates its keys.
7331 Iterating over a file generates its lines.
7332
7333- The following functions were generalized to work nicely with iterator
7334 arguments::
7335
7336 map(), filter(), reduce(), zip()
7337 list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API)
7338 max(), min()
7339 join() method of strings
7340 extend() method of lists
7341 'x in y' and 'x not in y' (PySequence_Contains() in C API)
7342 operator.countOf() (PySequence_Count() in C API)
7343 right-hand side of assignment statements with multiple targets, such as ::
7344 x, y, z = some_iterable_object_returning_exactly_3_values
7345
7346- Accessing module attributes is significantly faster (for example,
7347 random.random or os.path or yourPythonModule.yourAttribute).
7348
7349- Comparing dictionary objects via == and != is faster, and now works even
7350 if the keys and values don't support comparisons other than ==.
7351
7352- Comparing dictionaries in ways other than == and != is slower: there were
7353 insecurities in the dict comparison implementation that could cause Python
7354 to crash if the element comparison routines for the dict keys and/or
7355 values mutated the dicts. Making the code bulletproof slowed it down.
7356
7357- Collisions in dicts are resolved via a new approach, which can help
7358 dramatically in bad cases. For example, looking up every key in a dict
7359 d with d.keys() == [i << 16 for i in range(20000)] is approximately 500x
7360 faster now. Thanks to Christian Tismer for pointing out the cause and
7361 the nature of an effective cure (last December! better late than never).
7362
7363- repr() is much faster for large containers (dict, list, tuple).
7364
7365
7366Library
7367-------
7368
7369- The constants ascii_letters, ascii_lowercase. and ascii_uppercase
7370 were added to the string module. These a locale-independent
7371 constants, unlike letters, lowercase, and uppercase. These are now
7372 use in appropriate locations in the standard library.
7373
7374- The flags used in dlopen calls can now be configured using
7375 sys.setdlopenflags and queried using sys.getdlopenflags.
7376
7377- Fredrik Lundh's xmlrpclib is now a standard library module. This
7378 provides full client-side XML-RPC support. In addition,
7379 Demo/xmlrpc/ contains two server frameworks (one SocketServer-based,
7380 one asyncore-based). Thanks to Eric Raymond for the documentation.
7381
7382- The xrange() object is simplified: it no longer supports slicing,
7383 repetition, comparisons, efficient 'in' checking, the tolist()
7384 method, or the start, stop and step attributes. See PEP 260.
7385
7386- A new function fnmatch.filter to filter lists of file names was added.
7387
7388- calendar.py uses month and day names based on the current locale.
7389
7390- strop is now *really* obsolete (this was announced before with 1.6),
7391 and issues DeprecationWarning when used (except for the four items
7392 that are still imported into string.py).
7393
7394- Cookie.py now sorts key+value pairs by key in output strings.
7395
7396- pprint.isrecursive(object) didn't correctly identify recursive objects.
7397 Now it does.
7398
7399- pprint functions now much faster for large containers (tuple, list, dict).
7400
7401- New 'q' and 'Q' format codes in the struct module, corresponding to C
7402 types "long long" and "unsigned long long" (on Windows, __int64). In
7403 native mode, these can be used only when the platform C compiler supports
7404 these types (when HAVE_LONG_LONG is #define'd by the Python config
7405 process), and then they inherit the sizes and alignments of the C types.
7406 In standard mode, 'q' and 'Q' are supported on all platforms, and are
7407 8-byte integral types.
7408
7409- The site module installs a new built-in function 'help' that invokes
7410 pydoc.help. It must be invoked as 'help()'; when invoked as 'help',
7411 it displays a message reminding the user to use 'help()' or
7412 'help(object)'.
7413
7414Tests
7415-----
7416
7417- New test_mutants.py runs dict comparisons where the key and value
7418 comparison operators mutate the dicts randomly during comparison. This
7419 rapidly causes Python to crash under earlier releases (not for the faint
7420 of heart: it can also cause Win9x to freeze or reboot!).
7421
7422- New test_pprint.py verifies that pprint.isrecursive() and
7423 pprint.isreadable() return sensible results. Also verifies that simple
7424 cases produce correct output.
7425
7426C API
7427-----
7428
7429- Removed the unused last_is_sticky argument from the internal
7430 _PyTuple_Resize(). If this affects you, you were cheating.
7431
Skip Montanaro4cb22042002-09-17 20:55:31 +00007432What's New in Python 2.1 (final)?
7433=================================
7434
7435We only changed a few things since the last release candidate, all in
7436Python library code:
7437
7438- A bug in the locale module was fixed that affected locales which
7439 define no grouping for numeric formatting.
7440
7441- A few bugs in the weakref module's implementations of weak
7442 dictionaries (WeakValueDictionary and WeakKeyDictionary) were fixed,
7443 and the test suite was updated to check for these bugs.
7444
7445- An old bug in the os.path.walk() function (introduced in Python
7446 2.0!) was fixed: a non-existent file would cause an exception
7447 instead of being ignored.
7448
7449- Fixed a few bugs in the new symtable module found by Neil Norwitz's
7450 PyChecker.
7451
7452
7453What's New in Python 2.1c2?
7454===========================
7455
7456A flurry of small changes, and one showstopper fixed in the nick of
7457time made it necessary to release another release candidate. The list
7458here is the *complete* list of patches (except version updates):
7459
7460Core
7461
7462- Tim discovered a nasty bug in the dictionary code, caused by
7463 PyDict_Next() calling dict_resize(), and the GC code's use of
7464 PyDict_Next() violating an assumption in dict_items(). This was
7465 fixed with considerable amounts of band-aid, but the net effect is a
7466 saner and more robust implementation.
7467
7468- Made a bunch of symbols static that were accidentally global.
7469
7470Build and Ports
7471
7472- The setup.py script didn't check for a new enough version of zlib
7473 (1.1.3 is needed). Now it does.
7474
7475- Changed "make clean" target to also remove shared libraries.
7476
7477- Added a more general warning about the SGI Irix optimizer to README.
7478
7479Library
7480
7481- Fix a bug in urllib.basejoin("http://host", "../file.html") which
7482 omitted the slash between host and file.html.
7483
7484- The mailbox module's _Mailbox class contained a completely broken
7485 and undocumented seek() method. Ripped it out.
7486
7487- Fixed a bunch of typos in various library modules (urllib2, smtpd,
7488 sgmllib, netrc, chunk) found by Neil Norwitz's PyChecker.
7489
7490- Fixed a few last-minute bugs in unittest.
7491
7492Extensions
7493
7494- Reverted the patch to the OpenSSL code in socketmodule.c to support
7495 RAND_status() and the EGD, and the subsequent patch that tried to
7496 fix it for pre-0.9.5 versions; the problem with the patch is that on
7497 some systems it issues a warning whenever socket is imported, and
7498 that's unacceptable.
7499
7500Tests
7501
7502- Fixed the pickle tests to work with "import test.test_pickle".
7503
7504- Tweaked test_locale.py to actually run the test Windows.
7505
7506- In distutils/archive_util.py, call zipfile.ZipFile() with mode "w",
7507 not "wb" (which is not a valid mode at all).
7508
7509- Fix pstats browser crashes. Import readline if it exists to make
7510 the user interface nicer.
7511
7512- Add "import thread" to the top of test modules that import the
7513 threading module (test_asynchat and test_threadedtempfile). This
7514 prevents test failures caused by a broken threading module resulting
7515 from a previously caught failed import.
7516
7517- Changed test_asynchat.py to set the SO_REUSEADDR option; this was
7518 needed on some platforms (e.g. Solaris 8) when the tests are run
7519 twice in succession.
7520
7521- Skip rather than fail test_sunaudiodev if no audio device is found.
7522
7523
7524What's New in Python 2.1c1?
7525===========================
7526
7527This list was significantly updated when 2.1c2 was released; the 2.1c1
7528release didn't mention most changes that were actually part of 2.1c1:
7529
7530Legal
7531
7532- Copyright was assigned to the Python Software Foundation (PSF) and a
7533 PSF license (very similar to the CNRI license) was added.
7534
7535- The CNRI copyright notice was updated to include 2001.
7536
7537Core
7538
7539- After a public outcry, assignment to __debug__ is no longer illegal;
7540 instead, a warning is issued. It will become illegal in 2.2.
7541
7542- Fixed a core dump with "%#x" % 0, and changed the semantics so that
7543 "%#x" now always prepends "0x", even if the value is zero.
7544
7545- Fixed some nits in the bytecode compiler.
7546
7547- Fixed core dumps when calling certain kinds of non-functions.
7548
7549- Fixed various core dumps caused by reference count bugs.
7550
7551Build and Ports
7552
7553- Use INSTALL_SCRIPT to install script files.
7554
7555- New port: SCO Unixware 7, by Billy G. Allie.
7556
7557- Updated RISCOS port.
7558
7559- Updated BeOS port and notes.
7560
7561- Various other porting problems resolved.
7562
7563Library
7564
7565- The TERMIOS and SOCKET modules are now truly obsolete and
7566 unnecessary. Their symbols are incorporated in the termios and
7567 socket modules.
7568
7569- Fixed some 64-bit bugs in pickle, cPickle, and struct, and added
7570 better tests for pickling.
7571
7572- threading: make Condition.wait() robust against KeyboardInterrupt.
7573
7574- zipfile: add support to zipfile to support opening an archive
7575 represented by an open file rather than a file name. Fix bug where
7576 the archive was not properly closed. Fixed a bug in this bugfix
7577 where flush() was called for a read-only file.
7578
7579- imputil: added an uninstall() method to the ImportManager.
7580
7581- Canvas: fixed bugs in lower() and tkraise() methods.
7582
7583- SocketServer: API change (added overridable close_request() method)
7584 so that the TCP server can explicitly close the request.
7585
7586- pstats: Eric Raymond added a simple interactive statistics browser,
7587 invoked when the module is run as a script.
7588
7589- locale: fixed a problem in format().
7590
7591- webbrowser: made it work when the BROWSER environment variable has a
7592 value like "/usr/bin/netscape". Made it auto-detect Konqueror for
7593 KDE 2. Fixed some other nits.
7594
7595- unittest: changes to allow using a different exception than
7596 AssertionError, and added a few more function aliases. Some other
7597 small changes.
7598
7599- urllib, urllib2: fixed redirect problems and a coupleof other nits.
7600
7601- asynchat: fixed a critical bug in asynchat that slipped through the
7602 2.1b2 release. Fixed another rare bug.
7603
7604- Fix some unqualified except: clauses (always a bad code example).
7605
7606XML
7607
7608- pyexpat: new API get_version_string().
7609
7610- Fixed some minidom bugs.
7611
7612Extensions
7613
7614- Fixed a core dump in _weakref. Removed the weakref.mapping()
7615 function (it adds nothing to the API).
7616
7617- Rationalized the use of header files in the readline module, to make
7618 it compile (albeit with some warnings) with the very recent readline
7619 4.2, without breaking for earlier versions.
7620
7621- Hopefully fixed a buffering problem in linuxaudiodev.
7622
7623- Attempted a fix to make the OpenSSL support in the socket module
7624 work again with pre-0.9.5 versions of OpenSSL.
7625
7626Tests
7627
7628- Added a test case for asynchat and asyncore.
7629
7630- Removed coupling between tests where one test failing could break
7631 another.
7632
7633Tools
7634
7635- Ping added an interactive help browser to pydoc, fixed some nits
7636 in the rest of the pydoc code, and added some features to his
7637 inspect module.
7638
7639- An updated python-mode.el version 4.1 which integrates Ken
7640 Manheimer's pdbtrack.el. This makes debugging Python code via pdb
7641 much nicer in XEmacs and Emacs. When stepping through your program
7642 with pdb, in either the shell window or the *Python* window, the
7643 source file and line will be tracked by an arrow. Very cool!
7644
7645- IDLE: syntax warnings in interactive mode are changed into errors.
7646
7647- Some improvements to Tools/webchecker (ignore some more URL types,
7648 follow some more links).
7649
7650- Brought the Tools/compiler package up to date.
7651
7652
7653What's New in Python 2.1 beta 2?
7654================================
7655
7656(Unlisted are many fixed bugs, more documentation, etc.)
7657
7658Core language, builtins, and interpreter
7659
7660- The nested scopes work (enabled by "from __future__ import
7661 nested_scopes") is completed; in particular, the future now extends
7662 into code executed through exec, eval() and execfile(), and into the
7663 interactive interpreter.
7664
7665- When calling a base class method (e.g. BaseClass.__init__(self)),
7666 this is now allowed even if self is not strictly spoken a class
7667 instance (e.g. when using metaclasses or the Don Beaudry hook).
7668
7669- Slice objects are now comparable but not hashable; this prevents
7670 dict[:] from being accepted but meaningless.
7671
7672- Complex division is now calculated using less braindead algorithms.
7673 This doesn't change semantics except it's more likely to give useful
7674 results in extreme cases. Complex repr() now uses full precision
7675 like float repr().
7676
7677- sgmllib.py now calls handle_decl() for simple <!...> declarations.
7678
7679- It is illegal to assign to the name __debug__, which is set when the
7680 interpreter starts. It is effectively a compile-time constant.
7681
7682- A warning will be issued if a global statement for a variable
7683 follows a use or assignment of that variable.
7684
7685Standard library
7686
7687- unittest.py, a unit testing framework by Steve Purcell (PyUNIT,
7688 inspired by JUnit), is now part of the standard library. You now
7689 have a choice of two testing frameworks: unittest requires you to
7690 write testcases as separate code, doctest gathers them from
7691 docstrings. Both approaches have their advantages and
7692 disadvantages.
7693
7694- A new module Tix was added, which wraps the Tix extension library
7695 for Tk. With that module, it is not necessary to statically link
7696 Tix with _tkinter, since Tix will be loaded with Tcl's "package
7697 require" command. See Demo/tix/.
7698
7699- tzparse.py is now obsolete.
7700
7701- In gzip.py, the seek() and tell() methods are removed -- they were
7702 non-functional anyway, and it's better if callers can test for their
7703 existence with hasattr().
7704
7705Python/C API
7706
7707- PyDict_Next(): it is now safe to call PyDict_SetItem() with a key
7708 that's already in the dictionary during a PyDict_Next() iteration.
7709 This used to fail occasionally when a dictionary resize operation
7710 could be triggered that would rehash all the keys. All other
7711 modifications to the dictionary are still off-limits during a
7712 PyDict_Next() iteration!
7713
7714- New extended APIs related to passing compiler variables around.
7715
7716- New abstract APIs PyObject_IsInstance(), PyObject_IsSubclass()
7717 implement isinstance() and issubclass().
7718
7719- Py_BuildValue() now has a "D" conversion to create a Python complex
7720 number from a Py_complex C value.
7721
7722- Extensions types which support weak references must now set the
7723 field allocated for the weak reference machinery to NULL themselves;
7724 this is done to avoid the cost of checking each object for having a
7725 weakly referencable type in PyObject_INIT(), since most types are
7726 not weakly referencable.
7727
7728- PyFrame_FastToLocals() and PyFrame_LocalsToFast() copy bindings for
7729 free variables and cell variables to and from the frame's f_locals.
7730
7731- Variants of several functions defined in pythonrun.h have been added
7732 to support the nested_scopes future statement. The variants all end
7733 in Flags and take an extra argument, a PyCompilerFlags *; examples:
7734 PyRun_AnyFileExFlags(), PyRun_InteractiveLoopFlags(). These
7735 variants may be removed in Python 2.2, when nested scopes are
7736 mandatory.
7737
7738Distutils
7739
7740- the sdist command now writes a PKG-INFO file, as described in PEP 241,
7741 into the release tree.
7742
7743- several enhancements to the bdist_wininst command from Thomas Heller
7744 (an uninstaller, more customization of the installer's display)
7745
7746- from Jack Jansen: added Mac-specific code to generate a dialog for
7747 users to specify the command-line (because providing a command-line with
7748 MacPython is awkward). Jack also made various fixes for the Mac
7749 and the Metrowerks compiler.
7750
7751- added 'platforms' and 'keywords' to the set of metadata that can be
7752 specified for a distribution.
7753
7754- applied patches from Jason Tishler to make the compiler class work with
7755 Cygwin.
7756
7757
7758What's New in Python 2.1 beta 1?
7759================================
7760
7761Core language, builtins, and interpreter
7762
7763- Following an outcry from the community about the amount of code
7764 broken by the nested scopes feature introduced in 2.1a2, we decided
7765 to make this feature optional, and to wait until Python 2.2 (or at
7766 least 6 months) to make it standard. The option can be enabled on a
7767 per-module basis by adding "from __future__ import nested_scopes" at
7768 the beginning of a module (before any other statements, but after
7769 comments and an optional docstring). See PEP 236 (Back to the
7770 __future__) for a description of the __future__ statement. PEP 227
7771 (Statically Nested Scopes) has been updated to reflect this change,
7772 and to clarify the semantics in a number of endcases.
7773
7774- The nested scopes code, when enabled, has been hardened, and most
7775 bugs and memory leaks in it have been fixed.
7776
7777- Compile-time warnings are now generated for a number of conditions
7778 that will break or change in meaning when nested scopes are enabled:
7779
7780 - Using "from...import *" or "exec" without in-clause in a function
7781 scope that also defines a lambda or nested function with one or
7782 more free (non-local) variables. The presence of the import* or
7783 bare exec makes it impossible for the compiler to determine the
7784 exact set of local variables in the outer scope, which makes it
7785 impossible to determine the bindings for free variables in the
7786 inner scope. To avoid the warning about import *, change it into
7787 an import of explicitly name object, or move the import* statement
7788 to the global scope; to avoid the warning about bare exec, use
7789 exec...in... (a good idea anyway -- there's a possibility that
7790 bare exec will be deprecated in the future).
7791
7792 - Use of a global variable in a nested scope with the same name as a
7793 local variable in a surrounding scope. This will change in
7794 meaning with nested scopes: the name in the inner scope will
7795 reference the variable in the outer scope rather than the global
7796 of the same name. To avoid the warning, either rename the outer
7797 variable, or use a global statement in the inner function.
7798
7799- An optional object allocator has been included. This allocator is
7800 optimized for Python objects and should be faster and use less memory
7801 than the standard system allocator. It is not enabled by default
7802 because of possible thread safety problems. The allocator is only
7803 protected by the Python interpreter lock and it is possible that some
7804 extension modules require a thread safe allocator. The object
7805 allocator can be enabled by providing the "--with-pymalloc" option to
7806 configure.
7807
7808Standard library
7809
7810- pyexpat now detects the expat version if expat.h defines it. A
7811 number of additional handlers are provided, which are only available
7812 since expat 1.95. In addition, the methods SetParamEntityParsing and
7813 GetInputContext of Parser objects are available with 1.95.x
7814 only. Parser objects now provide the ordered_attributes and
7815 specified_attributes attributes. A new module expat.model was added,
7816 which offers a number of additional constants if 1.95.x is used.
7817
7818- xml.dom offers the new functions registerDOMImplementation and
7819 getDOMImplementation.
7820
7821- xml.dom.minidom offers a toprettyxml method. A number of DOM
7822 conformance issues have been resolved. In particular, Element now
7823 has an hasAttributes method, and the handling of namespaces was
7824 improved.
7825
7826- Ka-Ping Yee contributed two new modules: inspect.py, a module for
7827 getting information about live Python code, and pydoc.py, a module
7828 for interactively converting docstrings to HTML or text.
7829 Tools/scripts/pydoc, which is now automatically installed into
7830 <prefix>/bin, uses pydoc.py to display documentation; try running
7831 "pydoc -h" for instructions. "pydoc -g" pops up a small GUI that
7832 lets you browse the module docstrings using a web browser.
7833
7834- New library module difflib.py, primarily packaging the SequenceMatcher
7835 class at the heart of the popular ndiff.py file-comparison tool.
7836
7837- doctest.py (a framework for verifying Python code examples in docstrings)
7838 is now part of the std library.
7839
7840Windows changes
7841
7842- A new entry in the Start menu, "Module Docs", runs "pydoc -g" -- a
7843 small GUI that lets you browse the module docstrings using your
7844 default web browser.
7845
7846- Import is now case-sensitive. PEP 235 (Import on Case-Insensitive
7847 Platforms) is implemented. See
7848
7849 http://python.sourceforge.net/peps/pep-0235.html
7850
7851 for full details, especially the "Current Lower-Left Semantics" section.
7852 The new Windows import rules are simpler than before:
7853
7854 A. If the PYTHONCASEOK environment variable exists, same as
7855 before: silently accept the first case-insensitive match of any
7856 kind; raise ImportError if none found.
7857
7858 B. Else search sys.path for the first case-sensitive match; raise
7859 ImportError if none found.
7860
7861 The same rules have been implemented on other platforms with case-
7862 insensitive but case-preserving filesystems too (including Cygwin, and
7863 several flavors of Macintosh operating systems).
7864
7865- winsound module: Under Win9x, winsound.Beep() now attempts to simulate
7866 what it's supposed to do (and does do under NT and 2000) via direct
7867 port manipulation. It's unknown whether this will work on all systems,
7868 but it does work on my Win98SE systems now and was known to be useless on
7869 all Win9x systems before.
7870
7871- Build: Subproject _test (effectively) renamed to _testcapi.
7872
7873New platforms
7874
7875- 2.1 should compile and run out of the box under MacOS X, even using HFS+.
7876 Thanks to Steven Majewski!
7877
7878- 2.1 should compile and run out of the box on Cygwin. Thanks to Jason
7879 Tishler!
7880
7881- 2.1 contains new files and patches for RISCOS, thanks to Dietmar
7882 Schwertberger! See RISCOS/README for more information -- it seems
7883 that because of the bizarre filename conventions on RISCOS, no port
7884 to that platform is easy.
7885
7886
7887What's New in Python 2.1 alpha 2?
7888=================================
7889
7890Core language, builtins, and interpreter
7891
7892- Scopes nest. If a name is used in a function or class, but is not
7893 local, the definition in the nearest enclosing function scope will
7894 be used. One consequence of this change is that lambda statements
7895 could reference variables in the namespaces where the lambda is
7896 defined. In some unusual cases, this change will break code.
7897
7898 In all previous version of Python, names were resolved in exactly
7899 three namespaces -- the local namespace, the global namespace, and
7900 the builtin namespace. According to this old definition, if a
7901 function A is defined within a function B, the names bound in B are
7902 not visible in A. The new rules make names bound in B visible in A,
7903 unless A contains a name binding that hides the binding in B.
7904
7905 Section 4.1 of the reference manual describes the new scoping rules
7906 in detail. The test script in Lib/test/test_scope.py demonstrates
7907 some of the effects of the change.
7908
7909 The new rules will cause existing code to break if it defines nested
7910 functions where an outer function has local variables with the same
7911 name as globals or builtins used by the inner function. Example:
7912
7913 def munge(str):
7914 def helper(x):
7915 return str(x)
7916 if type(str) != type(''):
7917 str = helper(str)
7918 return str.strip()
7919
7920 Under the old rules, the name str in helper() is bound to the
7921 builtin function str(). Under the new rules, it will be bound to
7922 the argument named str and an error will occur when helper() is
7923 called.
7924
7925- The compiler will report a SyntaxError if "from ... import *" occurs
7926 in a function or class scope. The language reference has documented
7927 that this case is illegal, but the compiler never checked for it.
7928 The recent introduction of nested scope makes the meaning of this
7929 form of name binding ambiguous. In a future release, the compiler
7930 may allow this form when there is no possibility of ambiguity.
7931
7932- repr(string) is easier to read, now using hex escapes instead of octal,
7933 and using \t, \n and \r instead of \011, \012 and \015 (respectively):
7934
7935 >>> "\texample \r\n" + chr(0) + chr(255)
7936 '\texample \r\n\x00\xff' # in 2.1
7937 '\011example \015\012\000\377' # in 2.0
7938
7939- Functions are now compared and hashed by identity, not by value, since
7940 the func_code attribute is writable.
7941
7942- Weak references (PEP 205) have been added. This involves a few
7943 changes in the core, an extension module (_weakref), and a Python
7944 module (weakref). The weakref module is the public interface. It
7945 includes support for "explicit" weak references, proxy objects, and
7946 mappings with weakly held values.
7947
7948- A 'continue' statement can now appear in a try block within the body
7949 of a loop. It is still not possible to use continue in a finally
7950 clause.
7951
7952Standard library
7953
7954- mailbox.py now has a new class, PortableUnixMailbox which is
7955 identical to UnixMailbox but uses a more portable scheme for
7956 determining From_ separators. Also, the constructors for all the
7957 classes in this module have a new optional `factory' argument, which
7958 is a callable used when new message classes must be instantiated by
7959 the next() method.
7960
7961- random.py is now self-contained, and offers all the functionality of
7962 the now-deprecated whrandom.py. See the docs for details. random.py
7963 also supports new functions getstate() and setstate(), for saving
7964 and restoring the internal state of the generator; and jumpahead(n),
7965 for quickly forcing the internal state to be the same as if n calls to
7966 random() had been made. The latter is particularly useful for multi-
7967 threaded programs, creating one instance of the random.Random() class for
7968 each thread, then using .jumpahead() to force each instance to use a
7969 non-overlapping segment of the full period.
7970
7971- random.py's seed() function is new. For bit-for-bit compatibility with
7972 prior releases, use the whseed function instead. The new seed function
7973 addresses two problems: (1) The old function couldn't produce more than
7974 about 2**24 distinct internal states; the new one about 2**45 (the best
7975 that can be done in the Wichmann-Hill generator). (2) The old function
7976 sometimes produced identical internal states when passed distinct
7977 integers, and there was no simple way to predict when that would happen;
7978 the new one guarantees to produce distinct internal states for all
7979 arguments in [0, 27814431486576L).
7980
7981- The socket module now supports raw packets on Linux. The socket
7982 family is AF_PACKET.
7983
7984- test_capi.py is a start at running tests of the Python C API. The tests
7985 are implemented by the new Modules/_testmodule.c.
7986
7987- A new extension module, _symtable, provides provisional access to the
7988 internal symbol table used by the Python compiler. A higher-level
7989 interface will be added on top of _symtable in a future release.
7990
7991- Removed the obsolete soundex module.
7992
7993- xml.dom.minidom now uses the standard DOM exceptions. Node supports
7994 the isSameNode method; NamedNodeMap the get method.
7995
7996- xml.sax.expatreader supports the lexical handler property; it
7997 generates comment, startCDATA, and endCDATA events.
7998
7999Windows changes
8000
8001- Build procedure: the zlib project is built in a different way that
8002 ensures the zlib header files used can no longer get out of synch with
8003 the zlib binary used. See PCbuild\readme.txt for details. Your old
8004 zlib-related directories can be deleted; you'll need to download fresh
8005 source for zlib and unpack it into a new directory.
8006
8007- Build: New subproject _test for the benefit of test_capi.py (see above).
8008
8009- Build: New subproject _symtable, for new DLL _symtable.pyd (a nascent
8010 interface to some Python compiler internals).
8011
8012- Build: Subproject ucnhash is gone, since the code was folded into the
8013 unicodedata subproject.
8014
8015What's New in Python 2.1 alpha 1?
8016=================================
8017
8018Core language, builtins, and interpreter
8019
8020- There is a new Unicode companion to the PyObject_Str() API
8021 called PyObject_Unicode(). It behaves in the same way as the
8022 former, but assures that the returned value is an Unicode object
8023 (applying the usual coercion if necessary).
8024
8025- The comparison operators support "rich comparison overloading" (PEP
8026 207). C extension types can provide a rich comparison function in
8027 the new tp_richcompare slot in the type object. The cmp() function
8028 and the C function PyObject_Compare() first try the new rich
8029 comparison operators before trying the old 3-way comparison. There
8030 is also a new C API PyObject_RichCompare() (which also falls back on
8031 the old 3-way comparison, but does not constrain the outcome of the
8032 rich comparison to a Boolean result).
8033
8034 The rich comparison function takes two objects (at least one of
8035 which is guaranteed to have the type that provided the function) and
8036 an integer indicating the opcode, which can be Py_LT, Py_LE, Py_EQ,
8037 Py_NE, Py_GT, Py_GE (for <, <=, ==, !=, >, >=), and returns a Python
8038 object, which may be NotImplemented (in which case the tp_compare
8039 slot function is used as a fallback, if defined).
8040
8041 Classes can overload individual comparison operators by defining one
8042 or more of the methods__lt__, __le__, __eq__, __ne__, __gt__,
8043 __ge__. There are no explicit "reflected argument" versions of
8044 these; instead, __lt__ and __gt__ are each other's reflection,
8045 likewise for__le__ and __ge__; __eq__ and __ne__ are their own
8046 reflection (similar at the C level). No other implications are
8047 made; in particular, Python does not assume that == is the Boolean
8048 inverse of !=, or that < is the Boolean inverse of >=. This makes
8049 it possible to define types with partial orderings.
8050
8051 Classes or types that want to implement (in)equality tests but not
8052 the ordering operators (i.e. unordered types) should implement ==
8053 and !=, and raise an error for the ordering operators.
8054
8055 It is possible to define types whose rich comparison results are not
8056 Boolean; e.g. a matrix type might want to return a matrix of bits
8057 for A < B, giving elementwise comparisons. Such types should ensure
8058 that any interpretation of their value in a Boolean context raises
8059 an exception, e.g. by defining __nonzero__ (or the tp_nonzero slot
8060 at the C level) to always raise an exception.
8061
8062- Complex numbers use rich comparisons to define == and != but raise
8063 an exception for <, <=, > and >=. Unfortunately, this also means
8064 that cmp() of two complex numbers raises an exception when the two
8065 numbers differ. Since it is not mathematically meaningful to compare
8066 complex numbers except for equality, I hope that this doesn't break
8067 too much code.
8068
8069- The outcome of comparing non-numeric objects of different types is
8070 not defined by the language, other than that it's arbitrary but
8071 consistent (see the Reference Manual). An implementation detail changed
8072 in 2.1a1 such that None now compares less than any other object. Code
8073 relying on this new behavior (like code that relied on the previous
8074 behavior) does so at its own risk.
8075
8076- Functions and methods now support getting and setting arbitrarily
8077 named attributes (PEP 232). Functions have a new __dict__
8078 (a.k.a. func_dict) which hold the function attributes. Methods get
8079 and set attributes on their underlying im_func. It is a TypeError
8080 to set an attribute on a bound method.
8081
8082- The xrange() object implementation has been improved so that
8083 xrange(sys.maxint) can be used on 64-bit platforms. There's still a
8084 limitation that in this case len(xrange(sys.maxint)) can't be
8085 calculated, but the common idiom "for i in xrange(sys.maxint)" will
8086 work fine as long as the index i doesn't actually reach 2**31.
8087 (Python uses regular ints for sequence and string indices; fixing
8088 that is much more work.)
8089
8090- Two changes to from...import:
8091
8092 1) "from M import X" now works even if (after loading module M)
8093 sys.modules['M'] is not a real module; it's basically a getattr()
8094 operation with AttributeError exceptions changed into ImportError.
8095
8096 2) "from M import *" now looks for M.__all__ to decide which names to
8097 import; if M.__all__ doesn't exist, it uses M.__dict__.keys() but
8098 filters out names starting with '_' as before. Whether or not
8099 __all__ exists, there's no restriction on the type of M.
8100
8101- File objects have a new method, xreadlines(). This is the fastest
8102 way to iterate over all lines in a file:
8103
8104 for line in file.xreadlines():
8105 ...do something to line...
8106
8107 See the xreadlines module (mentioned below) for how to do this for
8108 other file-like objects.
8109
8110- Even if you don't use file.xreadlines(), you may expect a speedup on
8111 line-by-line input. The file.readline() method has been optimized
8112 quite a bit in platform-specific ways: on systems (like Linux) that
8113 support flockfile(), getc_unlocked(), and funlockfile(), those are
8114 used by default. On systems (like Windows) without getc_unlocked(),
8115 a complicated (but still thread-safe) method using fgets() is used by
8116 default.
8117
8118 You can force use of the fgets() method by #define'ing
8119 USE_FGETS_IN_GETLINE at build time (it may be faster than
8120 getc_unlocked()).
8121
8122 You can force fgets() not to be used by #define'ing
8123 DONT_USE_FGETS_IN_GETLINE (this is the first thing to try if std test
8124 test_bufio.py fails -- and let us know if it does!).
8125
8126- In addition, the fileinput module, while still slower than the other
8127 methods on most platforms, has been sped up too, by using
8128 file.readlines(sizehint).
8129
8130- Support for run-time warnings has been added, including a new
8131 command line option (-W) to specify the disposition of warnings.
8132 See the description of the warnings module below.
8133
8134- Extensive changes have been made to the coercion code. This mostly
8135 affects extension modules (which can now implement mixed-type
8136 numerical operators without having to use coercion), but
8137 occasionally, in boundary cases the coercion semantics have changed
8138 subtly. Since this was a terrible gray area of the language, this
8139 is considered an improvement. Also note that __rcmp__ is no longer
8140 supported -- instead of calling __rcmp__, __cmp__ is called with
8141 reflected arguments.
8142
8143- In connection with the coercion changes, a new built-in singleton
8144 object, NotImplemented is defined. This can be returned for
8145 operations that wish to indicate they are not implemented for a
8146 particular combination of arguments. From C, this is
8147 Py_NotImplemented.
8148
8149- The interpreter accepts now bytecode files on the command line even
8150 if they do not have a .pyc or .pyo extension. On Linux, after executing
8151
8152import imp,sys,string
8153magic = string.join(["\\x%.2x" % ord(c) for c in imp.get_magic()],"")
8154reg = ':pyc:M::%s::%s:' % (magic, sys.executable)
8155open("/proc/sys/fs/binfmt_misc/register","wb").write(reg)
8156
8157 any byte code file can be used as an executable (i.e. as an argument
8158 to execve(2)).
8159
8160- %[xXo] formats of negative Python longs now produce a sign
8161 character. In 1.6 and earlier, they never produced a sign,
8162 and raised an error if the value of the long was too large
8163 to fit in a Python int. In 2.0, they produced a sign if and
8164 only if too large to fit in an int. This was inconsistent
8165 across platforms (because the size of an int varies across
8166 platforms), and inconsistent with hex() and oct(). Example:
8167
8168 >>> "%x" % -0x42L
8169 '-42' # in 2.1
8170 'ffffffbe' # in 2.0 and before, on 32-bit machines
8171 >>> hex(-0x42L)
8172 '-0x42L' # in all versions of Python
8173
8174 The behavior of %d formats for negative Python longs remains
8175 the same as in 2.0 (although in 1.6 and before, they raised
8176 an error if the long didn't fit in a Python int).
8177
8178 %u formats don't make sense for Python longs, but are allowed
8179 and treated the same as %d in 2.1. In 2.0, a negative long
8180 formatted via %u produced a sign if and only if too large to
8181 fit in an int. In 1.6 and earlier, a negative long formatted
8182 via %u raised an error if it was too big to fit in an int.
8183
8184- Dictionary objects have an odd new method, popitem(). This removes
8185 an arbitrary item from the dictionary and returns it (in the form of
8186 a (key, value) pair). This can be useful for algorithms that use a
8187 dictionary as a bag of "to do" items and repeatedly need to pick one
8188 item. Such algorithms normally end up running in quadratic time;
8189 using popitem() they can usually be made to run in linear time.
8190
8191Standard library
8192
8193- In the time module, the time argument to the functions strftime,
8194 localtime, gmtime, asctime and ctime is now optional, defaulting to
8195 the current time (in the local timezone).
8196
8197- The ftplib module now defaults to passive mode, which is deemed a
8198 more useful default given that clients are often inside firewalls
8199 these days. Note that this could break if ftplib is used to connect
8200 to a *server* that is inside a firewall, from outside; this is
8201 expected to be a very rare situation. To fix that, you can call
8202 ftp.set_pasv(0).
8203
8204- The module site now treats .pth files not only for path configuration,
8205 but also supports extensions to the initialization code: Lines starting
8206 with import are executed.
8207
8208- There's a new module, warnings, which implements a mechanism for
8209 issuing and filtering warnings. There are some new built-in
8210 exceptions that serve as warning categories, and a new command line
8211 option, -W, to control warnings (e.g. -Wi ignores all warnings, -We
8212 turns warnings into errors). warnings.warn(message[, category])
8213 issues a warning message; this can also be called from C as
8214 PyErr_Warn(category, message).
8215
8216- A new module xreadlines was added. This exports a single factory
8217 function, xreadlines(). The intention is that this code is the
8218 absolutely fastest way to iterate over all lines in an open
8219 file(-like) object:
8220
8221 import xreadlines
8222 for line in xreadlines.xreadlines(file):
8223 ...do something to line...
8224
8225 This is equivalent to the previous the speed record holder using
8226 file.readlines(sizehint). Note that if file is a real file object
8227 (as opposed to a file-like object), this is equivalent:
8228
8229 for line in file.xreadlines():
8230 ...do something to line...
8231
8232- The bisect module has new functions bisect_left, insort_left,
8233 bisect_right and insort_right. The old names bisect and insort
8234 are now aliases for bisect_right and insort_right. XXX_right
8235 and XXX_left methods differ in what happens when the new element
8236 compares equal to one or more elements already in the list: the
8237 XXX_left methods insert to the left, the XXX_right methods to the
8238 right. Code that doesn't care where equal elements end up should
8239 continue to use the old, short names ("bisect" and "insort").
8240
8241- The new curses.panel module wraps the panel library that forms part
8242 of SYSV curses and ncurses. Contributed by Thomas Gellekum.
8243
8244- The SocketServer module now sets the allow_reuse_address flag by
8245 default in the TCPServer class.
8246
8247- A new function, sys._getframe(), returns the stack frame pointer of
8248 the caller. This is intended only as a building block for
8249 higher-level mechanisms such as string interpolation.
8250
8251- The pyexpat module supports a number of new handlers, which are
8252 available only in expat 1.2. If invocation of a callback fails, it
8253 will report an additional frame in the traceback. Parser objects
8254 participate now in garbage collection. If expat reports an unknown
8255 encoding, pyexpat will try to use a Python codec; that works only
8256 for single-byte charsets. The parser type objects is exposed as
8257 XMLParserObject.
8258
8259- xml.dom now offers standard definitions for symbolic node type and
8260 exception code constants, and a hierarchy of DOM exceptions. minidom
8261 was adjusted to use them.
8262
8263- The conformance of xml.dom.minidom to the DOM specification was
8264 improved. It detects a number of additional error cases; the
8265 previous/next relationship works even when the tree is modified;
8266 Node supports the normalize() method; NamedNodeMap, DocumentType and
8267 DOMImplementation classes were added; Element supports the
8268 hasAttribute and hasAttributeNS methods; and Text supports the splitText
8269 method.
8270
8271Build issues
8272
8273- For Unix (and Unix-compatible) builds, configuration and building of
8274 extension modules is now greatly automated. Rather than having to
8275 edit the Modules/Setup file to indicate which modules should be
8276 built and where their include files and libraries are, a
8277 distutils-based setup.py script now takes care of building most
8278 extension modules. All extension modules built this way are built
8279 as shared libraries. Only a few modules that must be linked
8280 statically are still listed in the Setup file; you won't need to
8281 edit their configuration.
8282
8283- Python should now build out of the box on Cygwin. If it doesn't,
8284 mail to Jason Tishler (jlt63 at users.sourceforge.net).
8285
8286- Python now always uses its own (renamed) implementation of getopt()
8287 -- there's too much variation among C library getopt()
8288 implementations.
8289
8290- C++ compilers are better supported; the CXX macro is always set to a
8291 C++ compiler if one is found.
8292
8293Windows changes
8294
8295- select module: By default under Windows, a select() call
8296 can specify no more than 64 sockets. Python now boosts
8297 this Microsoft default to 512. If you need even more than
8298 that, see the MS docs (you'll need to #define FD_SETSIZE
8299 and recompile Python from source).
8300
8301- Support for Windows 3.1, DOS and OS/2 is gone. The Lib/dos-8x3
8302 subdirectory is no more!
8303
8304
8305What's New in Python 2.0?
8306=========================
8307
8308Below is a list of all relevant changes since release 1.6. Older
8309changes are in the file HISTORY. If you are making the jump directly
8310from Python 1.5.2 to 2.0, make sure to read the section for 1.6 in the
8311HISTORY file! Many important changes listed there.
8312
8313Alternatively, a good overview of the changes between 1.5.2 and 2.0 is
8314the document "What's New in Python 2.0" by Kuchling and Moshe Zadka:
Andrew M. Kuchlinge240d9b2004-03-21 18:48:22 +00008315http://www.amk.ca/python/2.0/.
Skip Montanaro4cb22042002-09-17 20:55:31 +00008316
8317--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)
8318
8319======================================================================
8320
8321What's new in 2.0 (since release candidate 1)?
8322==============================================
8323
8324Standard library
8325
8326- The copy_reg module was modified to clarify its intended use: to
8327 register pickle support for extension types, not for classes.
8328 pickle() will raise a TypeError if it is passed a class.
8329
8330- Fixed a bug in gettext's "normalize and expand" code that prevented
8331 it from finding an existing .mo file.
8332
8333- Restored support for HTTP/0.9 servers in httplib.
8334
8335- The math module was changed to stop raising OverflowError in case of
8336 underflow, and return 0 instead in underflow cases. Whether Python
8337 used to raise OverflowError in case of underflow was platform-
8338 dependent (it did when the platform math library set errno to ERANGE
8339 on underflow).
8340
8341- Fixed a bug in StringIO that occurred when the file position was not
8342 at the end of the file and write() was called with enough data to
8343 extend past the end of the file.
8344
8345- Fixed a bug that caused Tkinter error messages to get lost on
8346 Windows. The bug was fixed by replacing direct use of
8347 interp->result with Tcl_GetStringResult(interp).
8348
8349- Fixed bug in urllib2 that caused it to fail when it received an HTTP
8350 redirect response.
8351
8352- Several changes were made to distutils: Some debugging code was
8353 removed from util. Fixed the installer used when an external zip
8354 program (like WinZip) is not found; the source code for this
8355 installer is in Misc/distutils. check_lib() was modified to behave
8356 more like AC_CHECK_LIB by add other_libraries() as a parameter. The
8357 test for whether installed modules are on sys.path was changed to
8358 use both normcase() and normpath().
8359
8360- Several minor bugs were fixed in the xml package (the minidom,
8361 pulldom, expatreader, and saxutils modules).
8362
8363- The regression test driver (regrtest.py) behavior when invoked with
8364 -l changed: It now reports a count of objects that are recognized as
8365 garbage but not freed by the garbage collector.
8366
8367- The regression test for the math module was changed to test
8368 exceptional behavior when the test is run in verbose mode. Python
8369 cannot yet guarantee consistent exception behavior across platforms,
8370 so the exception part of test_math is run only in verbose mode, and
8371 may fail on your platform.
8372
8373Internals
8374
8375- PyOS_CheckStack() has been disabled on Win64, where it caused
8376 test_sre to fail.
8377
8378Build issues
8379
8380- Changed compiler flags, so that gcc is always invoked with -Wall and
8381 -Wstrict-prototypes. Users compiling Python with GCC should see
8382 exactly one warning, except if they have passed configure the
8383 --with-pydebug flag. The expected warning is for getopt() in
8384 Modules/main.c. This warning will be fixed for Python 2.1.
8385
8386- Fixed configure to add -threads argument during linking on OSF1.
8387
8388Tools and other miscellany
8389
8390- The compiler in Tools/compiler was updated to support the new
8391 language features introduced in 2.0: extended print statement, list
8392 comprehensions, and augmented assignments. The new compiler should
8393 also be backwards compatible with Python 1.5.2; the compiler will
8394 always generate code for the version of the interpreter it runs
8395 under.
8396
8397What's new in 2.0 release candidate 1 (since beta 2)?
8398=====================================================
8399
8400What is release candidate 1?
8401
8402We believe that release candidate 1 will fix all known bugs that we
8403intend to fix for the 2.0 final release. This release should be a bit
8404more stable than the previous betas. We would like to see even more
8405widespread testing before the final release, so we are producing this
8406release candidate. The final release will be exactly the same unless
8407any show-stopping (or brown bag) bugs are found by testers of the
8408release candidate.
8409
8410All the changes since the last beta release are bug fixes or changes
8411to support building Python for specific platforms.
8412
8413Core language, builtins, and interpreter
8414
8415- A bug that caused crashes when __coerce__ was used with augmented
8416 assignment, e.g. +=, was fixed.
8417
8418- Raise ZeroDivisionError when raising zero to a negative number,
8419 e.g. 0.0 ** -2.0. Note that math.pow is unrelated to the builtin
8420 power operator and the result of math.pow(0.0, -2.0) will vary by
8421 platform. On Linux, it raises a ValueError.
8422
8423- A bug in Unicode string interpolation was fixed that occasionally
8424 caused errors with formats including "%%". For example, the
8425 following expression "%% %s" % u"abc" no longer raises a TypeError.
8426
8427- Compilation of deeply nested expressions raises MemoryError instead
8428 of SyntaxError, e.g. eval("[" * 50 + "]" * 50).
8429
8430- In 2.0b2 on Windows, the interpreter wrote .pyc files in text mode,
8431 rendering them useless. They are now written in binary mode again.
8432
8433Standard library
8434
8435- Keyword arguments are now accepted for most pattern and match object
8436 methods in SRE, the standard regular expression engine.
8437
8438- In SRE, fixed error with negative lookahead and lookbehind that
8439 manifested itself as a runtime error in patterns like "(?<!abc)(def)".
8440
8441- Several bugs in the Unicode handling and error handling in _tkinter
8442 were fixed.
8443
8444- Fix memory management errors in Merge() and Tkapp_Call() routines.
8445
8446- Several changes were made to cStringIO to make it compatible with
8447 the file-like object interface and with StringIO. If operations are
8448 performed on a closed object, an exception is raised. The truncate
8449 method now accepts a position argument and readline accepts a size
8450 argument.
8451
8452- There were many changes made to the linuxaudiodev module and its
8453 test suite; as a result, a short, unexpected audio sample should now
8454 play when the regression test is run.
8455
8456 Note that this module is named poorly, because it should work
8457 correctly on any platform that supports the Open Sound System
8458 (OSS).
8459
8460 The module now raises exceptions when errors occur instead of
8461 crashing. It also defines the AFMT_A_LAW format (logarithmic A-law
8462 audio) and defines a getptr() method that calls the
8463 SNDCTL_DSP_GETxPTR ioctl defined in the OSS Programmer's Guide.
8464
8465- The library_version attribute, introduced in an earlier beta, was
8466 removed because it can not be supported with early versions of the C
8467 readline library, which provides no way to determine the version at
8468 compile-time.
8469
8470- The binascii module is now enabled on Win64.
8471
8472- tokenize.py no longer suffers "recursion depth" errors when parsing
8473 programs with very long string literals.
8474
8475Internals
8476
8477- Fixed several buffer overflow vulnerabilities in calculate_path(),
8478 which is called when the interpreter starts up to determine where
8479 the standard library is installed. These vulnerabilities affect all
8480 previous versions of Python and can be exploited by setting very
8481 long values for PYTHONHOME or argv[0]. The risk is greatest for a
8482 setuid Python script, although use of the wrapper in
8483 Misc/setuid-prog.c will eliminate the vulnerability.
8484
8485- Fixed garbage collection bugs in instance creation that were
8486 triggered when errors occurred during initialization. The solution,
8487 applied in cPickle and in PyInstance_New(), is to call
8488 PyObject_GC_Init() after the initialization of the object's
8489 container attributes is complete.
8490
8491- pyexpat adds definitions of PyModule_AddStringConstant and
8492 PyModule_AddObject if the Python version is less than 2.0, which
8493 provides compatibility with PyXML on Python 1.5.2.
8494
8495- If the platform has a bogus definition for LONG_BIT (the number of
8496 bits in a long), an error will be reported at compile time.
8497
8498- Fix bugs in _PyTuple_Resize() which caused hard-to-interpret garbage
8499 collection crashes and possibly other, unreported crashes.
8500
8501- Fixed a memory leak in _PyUnicode_Fini().
8502
8503Build issues
8504
8505- configure now accepts a --with-suffix option that specifies the
8506 executable suffix. This is useful for builds on Cygwin and Mac OS
8507 X, for example.
8508
8509- The mmap.PAGESIZE constant is now initialized using sysconf when
8510 possible, which eliminates a dependency on -lucb for Reliant UNIX.
8511
8512- The md5 file should now compile on all platforms.
8513
8514- The select module now compiles on platforms that do not define
8515 POLLRDNORM and related constants.
8516
8517- Darwin (Mac OS X): Initial support for static builds on this
8518 platform.
8519
8520- BeOS: A number of changes were made to the build and installation
8521 process. ar-fake now operates on a directory of object files.
8522 dl_export.h is gone, and its macros now appear on the mwcc command
8523 line during build on PPC BeOS.
8524
8525- Platform directory in lib/python2.0 is "plat-beos5" (or
8526 "plat-beos4", if building on BeOS 4.5), rather than "plat-beos".
8527
8528- Cygwin: Support for shared libraries, Tkinter, and sockets.
8529
8530- SunOS 4.1.4_JL: Fix test for directory existence in configure.
8531
8532Tools and other miscellany
8533
8534- Removed debugging prints from main used with freeze.
8535
8536- IDLE auto-indent no longer crashes when it encounters Unicode
8537 characters.
8538
8539What's new in 2.0 beta 2 (since beta 1)?
8540========================================
8541
8542Core language, builtins, and interpreter
8543
8544- Add support for unbounded ints in %d,i,u,x,X,o formats; for example
8545 "%d" % 2L**64 == "18446744073709551616".
8546
8547- Add -h and -V command line options to print the usage message and
8548 Python version number and exit immediately.
8549
8550- eval() and exec accept Unicode objects as code parameters.
8551
8552- getattr() and setattr() now also accept Unicode objects for the
8553 attribute name, which are converted to strings using the default
8554 encoding before lookup.
8555
8556- Multiplication on string and Unicode now does proper bounds
8557 checking; e.g. 'a' * 65536 * 65536 will raise ValueError, "repeated
8558 string is too long."
8559
8560- Better error message when continue is found in try statement in a
8561 loop.
8562
8563
8564Standard library and extensions
8565
8566- socket module: the OpenSSL code now adds support for RAND_status()
8567 and EGD (Entropy Gathering Device).
8568
8569- array: reverse() method of array now works. buffer_info() now does
8570 argument checking; it still takes no arguments.
8571
8572- asyncore/asynchat: Included most recent version from Sam Rushing.
8573
8574- cgi: Accept '&' or ';' as separator characters when parsing form data.
8575
8576- CGIHTTPServer: Now works on Windows (and perhaps even Mac).
8577
8578- ConfigParser: When reading the file, options spelled in upper case
8579 letters are now correctly converted to lowercase.
8580
8581- copy: Copy Unicode objects atomically.
8582
8583- cPickle: Fail gracefully when copy_reg can't be imported.
8584
8585- cStringIO: Implemented readlines() method.
8586
8587- dbm: Add get() and setdefault() methods to dbm object. Add constant
8588 `library' to module that names the library used. Added doc strings
8589 and method names to error messages. Uses configure to determine
8590 which ndbm.h file to include; Berkeley DB's nbdm and GDBM's ndbm is
8591 now available options.
8592
8593- distutils: Update to version 0.9.3.
8594
8595- dl: Add several dl.RTLD_ constants.
8596
8597- fpectl: Now supported on FreeBSD.
8598
8599- gc: Add DEBUG_SAVEALL option. When enabled all garbage objects
8600 found by the collector will be saved in gc.garbage. This is useful
8601 for debugging a program that creates reference cycles.
8602
8603- httplib: Three changes: Restore support for set_debuglevel feature
8604 of HTTP class. Do not close socket on zero-length response. Do not
8605 crash when server sends invalid content-length header.
8606
8607- mailbox: Mailbox class conforms better to qmail specifications.
8608
8609- marshal: When reading a short, sign-extend on platforms where shorts
8610 are bigger than 16 bits. When reading a long, repair the unportable
8611 sign extension that was being done for 64-bit machines. (It assumed
8612 that signed right shift sign-extends.)
8613
8614- operator: Add contains(), invert(), __invert__() as aliases for
8615 __contains__(), inv(), and __inv__() respectively.
8616
8617- os: Add support for popen2() and popen3() on all platforms where
8618 fork() exists. (popen4() is still in the works.)
8619
8620- os: (Windows only:) Add startfile() function that acts like double-
8621 clicking on a file in Explorer (or passing the file name to the
8622 DOS "start" command).
8623
8624- os.path: (Windows, DOS:) Treat trailing colon correctly in
8625 os.path.join. os.path.join("a:", "b") yields "a:b".
8626
8627- pickle: Now raises ValueError when an invalid pickle that contains
8628 a non-string repr where a string repr was expected. This behavior
8629 matches cPickle.
8630
8631- posixfile: Remove broken __del__() method.
8632
8633- py_compile: support CR+LF line terminators in source file.
8634
8635- readline: Does not immediately exit when ^C is hit when readline and
8636 threads are configured. Adds definition of rl_library_version. (The
8637 latter addition requires GNU readline 2.2 or later.)
8638
8639- rfc822: Domain literals returned by AddrlistClass method
8640 getdomainliteral() are now properly wrapped in brackets.
8641
8642- site: sys.setdefaultencoding() should only be called in case the
8643 standard default encoding ("ascii") is changed. This saves quite a
8644 few cycles during startup since the first call to
8645 setdefaultencoding() will initialize the codec registry and the
8646 encodings package.
8647
8648- socket: Support for size hint in readlines() method of object returned
8649 by makefile().
8650
8651- sre: Added experimental expand() method to match objects. Does not
8652 use buffer interface on Unicode strings. Does not hang if group id
8653 is followed by whitespace.
8654
8655- StringIO: Size hint in readlines() is now supported as documented.
8656
8657- struct: Check ranges for bytes and shorts.
8658
8659- urllib: Improved handling of win32 proxy settings. Fixed quote and
8660 quote_plus functions so that the always encode a comma.
8661
8662- Tkinter: Image objects are now guaranteed to have unique ids. Set
8663 event.delta to zero if Tk version doesn't support mousewheel.
8664 Removed some debugging prints.
8665
8666- UserList: now implements __contains__().
8667
8668- webbrowser: On Windows, use os.startfile() instead of os.popen(),
8669 which works around a bug in Norton AntiVirus 2000 that leads directly
8670 to a Blue Screen freeze.
8671
8672- xml: New version detection code allows PyXML to override standard
8673 XML package if PyXML version is greater than 0.6.1.
8674
8675- xml.dom: DOM level 1 support for basic XML. Includes xml.dom.minidom
8676 (conventional DOM), and xml.dom.pulldom, which allows building the DOM
8677 tree only for nodes which are sufficiently interesting to a specific
8678 application. Does not provide the HTML-specific extensions. Still
8679 undocumented.
8680
8681- xml.sax: SAX 2 support for Python, including all the handler
8682 interfaces needed to process XML 1.0 compliant XML. Some
8683 documentation is already available.
8684
8685- pyexpat: Renamed to xml.parsers.expat since this is part of the new,
8686 packagized XML support.
8687
8688
8689C API
8690
8691- Add three new convenience functions for module initialization --
8692 PyModule_AddObject(), PyModule_AddIntConstant(), and
8693 PyModule_AddStringConstant().
8694
8695- Cleaned up definition of NULL in C source code; all definitions were
8696 removed and add #error to Python.h if NULL isn't defined after
8697 #include of stdio.h.
8698
8699- Py_PROTO() macros that were removed in 2.0b1 have been restored for
8700 backwards compatibility (at the source level) with old extensions.
8701
8702- A wrapper API was added for signal() and sigaction(). Instead of
8703 either function, always use PyOS_getsig() to get a signal handler
8704 and PyOS_setsig() to set one. A new convenience typedef
8705 PyOS_sighandler_t is defined for the type of signal handlers.
8706
8707- Add PyString_AsStringAndSize() function that provides access to the
8708 internal data buffer and size of a string object -- or the default
8709 encoded version of a Unicode object.
8710
8711- PyString_Size() and PyString_AsString() accept Unicode objects.
8712
8713- The standard header <limits.h> is now included by Python.h (if it
8714 exists). INT_MAX and LONG_MAX will always be defined, even if
8715 <limits.h> is not available.
8716
8717- PyFloat_FromString takes a second argument, pend, that was
8718 effectively useless. It is now officially useless but preserved for
8719 backwards compatibility. If the pend argument is not NULL, *pend is
8720 set to NULL.
8721
8722- PyObject_GetAttr() and PyObject_SetAttr() now accept Unicode objects
8723 for the attribute name. See note on getattr() above.
8724
8725- A few bug fixes to argument processing for Unicode.
8726 PyArg_ParseTupleAndKeywords() now accepts "es#" and "es".
8727 PyArg_Parse() special cases "s#" for Unicode objects; it returns a
8728 pointer to the default encoded string data instead of to the raw
8729 UTF-16.
8730
8731- Py_BuildValue accepts B format (for bgen-generated code).
8732
8733
8734Internals
8735
8736- On Unix, fix code for finding Python installation directory so that
8737 it works when argv[0] is a relative path.
8738
8739- Added a true unicode_internal_encode() function and fixed the
8740 unicode_internal_decode function() to support Unicode objects directly
8741 rather than by generating a copy of the object.
8742
8743- Several of the internal Unicode tables are much smaller now, and
8744 the source code should be much friendlier to weaker compilers.
8745
8746- In the garbage collector: Fixed bug in collection of tuples. Fixed
8747 bug that caused some instances to be removed from the container set
8748 while they were still live. Fixed parsing in gc.set_debug() for
8749 platforms where sizeof(long) > sizeof(int).
8750
8751- Fixed refcount problem in instance deallocation that only occurred
8752 when Py_REF_DEBUG was defined and Py_TRACE_REFS was not.
8753
8754- On Windows, getpythonregpath is now protected against null data in
8755 registry key.
8756
8757- On Unix, create .pyc/.pyo files with O_EXCL flag to avoid a race
8758 condition.
8759
8760
8761Build and platform-specific issues
8762
8763- Better support of GNU Pth via --with-pth configure option.
8764
8765- Python/C API now properly exposed to dynamically-loaded extension
8766 modules on Reliant UNIX.
8767
8768- Changes for the benefit of SunOS 4.1.4 (really!). mmapmodule.c:
8769 Don't define MS_SYNC to be zero when it is undefined. Added missing
8770 prototypes in posixmodule.c.
8771
8772- Improved support for HP-UX build. Threads should now be correctly
8773 configured (on HP-UX 10.20 and 11.00).
8774
8775- Fix largefile support on older NetBSD systems and OpenBSD by adding
8776 define for TELL64.
8777
8778
8779Tools and other miscellany
8780
8781- ftpmirror: Call to main() is wrapped in if __name__ == "__main__".
8782
8783- freeze: The modulefinder now works with 2.0 opcodes.
8784
8785- IDLE:
8786 Move hackery of sys.argv until after the Tk instance has been
8787 created, which allows the application-specific Tkinter
8788 initialization to be executed if present; also pass an explicit
8789 className parameter to the Tk() constructor.
8790
8791
8792What's new in 2.0 beta 1?
8793=========================
8794
8795Source Incompatibilities
8796------------------------
8797
8798None. Note that 1.6 introduced several incompatibilities with 1.5.2,
8799such as single-argument append(), connect() and bind(), and changes to
8800str(long) and repr(float).
8801
8802
8803Binary Incompatibilities
8804------------------------
8805
8806- Third party extensions built for Python 1.5.x or 1.6 cannot be used
8807with Python 2.0; these extensions will have to be rebuilt for Python
88082.0.
8809
8810- On Windows, attempting to import a third party extension built for
8811Python 1.5.x or 1.6 results in an immediate crash; there's not much we
8812can do about this. Check your PYTHONPATH environment variable!
8813
8814- Python bytecode files (*.pyc and *.pyo) are not compatible between
8815releases.
8816
8817
8818Overview of Changes Since 1.6
8819-----------------------------
8820
8821There are many new modules (including brand new XML support through
8822the xml package, and i18n support through the gettext module); a list
8823of all new modules is included below. Lots of bugs have been fixed.
8824
8825The process for making major new changes to the language has changed
8826since Python 1.6. Enhancements must now be documented by a Python
8827Enhancement Proposal (PEP) before they can be accepted.
8828
8829There are several important syntax enhancements, described in more
8830detail below:
8831
8832 - Augmented assignment, e.g. x += 1
8833
8834 - List comprehensions, e.g. [x**2 for x in range(10)]
8835
8836 - Extended import statement, e.g. import Module as Name
8837
8838 - Extended print statement, e.g. print >> file, "Hello"
8839
8840Other important changes:
8841
8842 - Optional collection of cyclical garbage
8843
8844Python Enhancement Proposal (PEP)
8845---------------------------------
8846
8847PEP stands for Python Enhancement Proposal. A PEP is a design
8848document providing information to the Python community, or describing
8849a new feature for Python. The PEP should provide a concise technical
8850specification of the feature and a rationale for the feature.
8851
8852We intend PEPs to be the primary mechanisms for proposing new
8853features, for collecting community input on an issue, and for
8854documenting the design decisions that have gone into Python. The PEP
8855author is responsible for building consensus within the community and
8856documenting dissenting opinions.
8857
8858The PEPs are available at http://python.sourceforge.net/peps/.
8859
8860Augmented Assignment
8861--------------------
8862
8863This must have been the most-requested feature of the past years!
8864Eleven new assignment operators were added:
8865
8866 += -= *= /= %= **= <<= >>= &= ^= |=
8867
8868For example,
8869
8870 A += B
8871
8872is similar to
8873
8874 A = A + B
8875
8876except that A is evaluated only once (relevant when A is something
8877like dict[index].attr).
8878
8879However, if A is a mutable object, A may be modified in place. Thus,
8880if A is a number or a string, A += B has the same effect as A = A+B
8881(except A is only evaluated once); but if a is a list, A += B has the
8882same effect as A.extend(B)!
8883
8884Classes and built-in object types can override the new operators in
8885order to implement the in-place behavior; the not-in-place behavior is
8886used automatically as a fallback when an object doesn't implement the
8887in-place behavior. For classes, the method name is derived from the
8888method name for the corresponding not-in-place operator by inserting
8889an 'i' in front of the name, e.g. __iadd__ implements in-place
8890__add__.
8891
8892Augmented assignment was implemented by Thomas Wouters.
8893
8894
8895List Comprehensions
8896-------------------
8897
8898This is a flexible new notation for lists whose elements are computed
8899from another list (or lists). The simplest form is:
8900
8901 [<expression> for <variable> in <sequence>]
8902
8903For example, [i**2 for i in range(4)] yields the list [0, 1, 4, 9].
8904This is more efficient than a for loop with a list.append() call.
8905
8906You can also add a condition:
8907
8908 [<expression> for <variable> in <sequence> if <condition>]
8909
8910For example, [w for w in words if w == w.lower()] would yield the list
8911of words that contain no uppercase characters. This is more efficient
8912than a for loop with an if statement and a list.append() call.
8913
8914You can also have nested for loops and more than one 'if' clause. For
8915example, here's a function that flattens a sequence of sequences::
8916
8917 def flatten(seq):
8918 return [x for subseq in seq for x in subseq]
8919
8920 flatten([[0], [1,2,3], [4,5], [6,7,8,9], []])
8921
8922This prints
8923
8924 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
8925
8926List comprehensions originated as a patch set from Greg Ewing; Skip
8927Montanaro and Thomas Wouters also contributed. Described by PEP 202.
8928
8929
8930Extended Import Statement
8931-------------------------
8932
8933Many people have asked for a way to import a module under a different
8934name. This can be accomplished like this:
8935
8936 import foo
8937 bar = foo
8938 del foo
8939
8940but this common idiom gets old quickly. A simple extension of the
8941import statement now allows this to be written as follows:
8942
8943 import foo as bar
8944
8945There's also a variant for 'from ... import':
8946
8947 from foo import bar as spam
8948
8949This also works with packages; e.g. you can write this:
8950
8951 import test.regrtest as regrtest
8952
8953Note that 'as' is not a new keyword -- it is recognized only in this
8954context (this is only possible because the syntax for the import
8955statement doesn't involve expressions).
8956
8957Implemented by Thomas Wouters. Described by PEP 221.
8958
8959
8960Extended Print Statement
8961------------------------
8962
8963Easily the most controversial new feature, this extension to the print
8964statement adds an option to make the output go to a different file
8965than the default sys.stdout.
8966
8967For example, to write an error message to sys.stderr, you can now
8968write:
8969
8970 print >> sys.stderr, "Error: bad dog!"
8971
8972As a special feature, if the expression used to indicate the file
8973evaluates to None, the current value of sys.stdout is used. Thus:
8974
8975 print >> None, "Hello world"
8976
8977is equivalent to
8978
8979 print "Hello world"
8980
8981Design and implementation by Barry Warsaw. Described by PEP 214.
8982
8983
8984Optional Collection of Cyclical Garbage
8985---------------------------------------
8986
8987Python is now equipped with a garbage collector that can hunt down
8988cyclical references between Python objects. It's no replacement for
8989reference counting; in fact, it depends on the reference counts being
8990correct, and decides that a set of objects belong to a cycle if all
8991their reference counts can be accounted for from their references to
8992each other. This devious scheme was first proposed by Eric Tiedemann,
8993and brought to implementation by Neil Schemenauer.
8994
8995There's a module "gc" that lets you control some parameters of the
8996garbage collection. There's also an option to the configure script
8997that lets you enable or disable the garbage collection. In 2.0b1,
8998it's on by default, so that we (hopefully) can collect decent user
8999experience with this new feature. There are some questions about its
9000performance. If it proves to be too much of a problem, we'll turn it
9001off by default in the final 2.0 release.
9002
9003
9004Smaller Changes
9005---------------
9006
9007A new function zip() was added. zip(seq1, seq2, ...) is equivalent to
9008map(None, seq1, seq2, ...) when the sequences have the same length;
9009i.e. zip([1,2,3], [10,20,30]) returns [(1,10), (2,20), (3,30)]. When
9010the lists are not all the same length, the shortest list wins:
9011zip([1,2,3], [10,20]) returns [(1,10), (2,20)]. See PEP 201.
9012
9013sys.version_info is a tuple (major, minor, micro, level, serial).
9014
9015Dictionaries have an odd new method, setdefault(key, default).
9016dict.setdefault(key, default) returns dict[key] if it exists; if not,
9017it sets dict[key] to default and returns that value. Thus:
9018
9019 dict.setdefault(key, []).append(item)
9020
9021does the same work as this common idiom:
9022
9023 if not dict.has_key(key):
9024 dict[key] = []
9025 dict[key].append(item)
9026
9027There are two new variants of SyntaxError that are raised for
9028indentation-related errors: IndentationError and TabError.
9029
9030Changed \x to consume exactly two hex digits; see PEP 223. Added \U
9031escape that consumes exactly eight hex digits.
9032
9033The limits on the size of expressions and file in Python source code
9034have been raised from 2**16 to 2**32. Previous versions of Python
9035were limited because the maximum argument size the Python VM accepted
9036was 2**16. This limited the size of object constructor expressions,
9037e.g. [1,2,3] or {'a':1, 'b':2}, and the size of source files. This
9038limit was raised thanks to a patch by Charles Waldman that effectively
9039fixes the problem. It is now much more likely that you will be
9040limited by available memory than by an arbitrary limit in Python.
9041
9042The interpreter's maximum recursion depth can be modified by Python
9043programs using sys.getrecursionlimit and sys.setrecursionlimit. This
9044limit is the maximum number of recursive calls that can be made by
9045Python code. The limit exists to prevent infinite recursion from
9046overflowing the C stack and causing a core dump. The default value is
90471000. The maximum safe value for a particular platform can be found
9048by running Misc/find_recursionlimit.py.
9049
9050New Modules and Packages
9051------------------------
9052
9053atexit - for registering functions to be called when Python exits.
9054
9055imputil - Greg Stein's alternative API for writing custom import
9056hooks.
9057
9058pyexpat - an interface to the Expat XML parser, contributed by Paul
9059Prescod.
9060
9061xml - a new package with XML support code organized (so far) in three
9062subpackages: xml.dom, xml.sax, and xml.parsers. Describing these
9063would fill a volume. There's a special feature whereby a
9064user-installed package named _xmlplus overrides the standard
9065xmlpackage; this is intended to give the XML SIG a hook to distribute
9066backwards-compatible updates to the standard xml package.
9067
9068webbrowser - a platform-independent API to launch a web browser.
9069
9070
9071Changed Modules
9072---------------
9073
9074array -- new methods for array objects: count, extend, index, pop, and
9075remove
9076
9077binascii -- new functions b2a_hex and a2b_hex that convert between
9078binary data and its hex representation
9079
9080calendar -- Many new functions that support features including control
9081over which day of the week is the first day, returning strings instead
9082of printing them. Also new symbolic constants for days of week,
9083e.g. MONDAY, ..., SUNDAY.
9084
9085cgi -- FieldStorage objects have a getvalue method that works like a
9086dictionary's get method and returns the value attribute of the object.
9087
9088ConfigParser -- The parser object has new methods has_option,
9089remove_section, remove_option, set, and write. They allow the module
9090to be used for writing config files as well as reading them.
9091
9092ftplib -- ntransfercmd(), transfercmd(), and retrbinary() all now
9093optionally support the RFC 959 REST command.
9094
9095gzip -- readline and readlines now accept optional size arguments
9096
9097httplib -- New interfaces and support for HTTP/1.1 by Greg Stein. See
9098the module doc strings for details.
9099
9100locale -- implement getdefaultlocale for Win32 and Macintosh
9101
9102marshal -- no longer dumps core when marshaling deeply nested or
9103recursive data structures
9104
9105os -- new functions isatty, seteuid, setegid, setreuid, setregid
9106
9107os/popen2 -- popen2/popen3/popen4 support under Windows. popen2/popen3
9108support under Unix.
9109
9110os/pty -- support for openpty and forkpty
9111
9112os.path -- fix semantics of os.path.commonprefix
9113
9114smtplib -- support for sending very long messages
9115
9116socket -- new function getfqdn()
9117
9118readline -- new functions to read, write and truncate history files.
9119The readline section of the library reference manual contains an
9120example.
9121
9122select -- add interface to poll system call
9123
9124shutil -- new copyfileobj function
9125
9126SimpleHTTPServer, CGIHTTPServer -- Fix problems with buffering in the
9127HTTP server.
9128
9129Tkinter -- optimization of function flatten
9130
9131urllib -- scans environment variables for proxy configuration,
9132e.g. http_proxy.
9133
9134whichdb -- recognizes dumbdbm format
9135
9136
9137Obsolete Modules
9138----------------
9139
9140None. However note that 1.6 made a whole slew of modules obsolete:
9141stdwin, soundex, cml, cmpcache, dircache, dump, find, grep, packmail,
9142poly, zmod, strop, util, whatsound.
9143
9144
9145Changed, New, Obsolete Tools
9146----------------------------
9147
9148None.
9149
9150
9151C-level Changes
9152---------------
9153
9154Several cleanup jobs were carried out throughout the source code.
9155
9156All C code was converted to ANSI C; we got rid of all uses of the
9157Py_PROTO() macro, which makes the header files a lot more readable.
9158
9159Most of the portability hacks were moved to a new header file,
9160pyport.h; several other new header files were added and some old
9161header files were removed, in an attempt to create a more rational set
9162of header files. (Few of these ever need to be included explicitly;
9163they are all included by Python.h.)
9164
9165Trent Mick ensured portability to 64-bit platforms, under both Linux
9166and Win64, especially for the new Intel Itanium processor. Mick also
9167added large file support for Linux64 and Win64.
9168
9169The C APIs to return an object's size have been update to consistently
9170use the form PyXXX_Size, e.g. PySequence_Size and PyDict_Size. In
9171previous versions, the abstract interfaces used PyXXX_Length and the
9172concrete interfaces used PyXXX_Size. The old names,
9173e.g. PyObject_Length, are still available for backwards compatibility
9174at the API level, but are deprecated.
9175
9176The PyOS_CheckStack function has been implemented on Windows by
9177Fredrik Lundh. It prevents Python from failing with a stack overflow
9178on Windows.
9179
9180The GC changes resulted in creation of two new slots on object,
9181tp_traverse and tp_clear. The augmented assignment changes result in
9182the creation of a new slot for each in-place operator.
9183
9184The GC API creates new requirements for container types implemented in
9185C extension modules. See Include/objimpl.h for details.
9186
9187PyErr_Format has been updated to automatically calculate the size of
9188the buffer needed to hold the formatted result string. This change
9189prevents crashes caused by programmer error.
9190
9191New C API calls: PyObject_AsFileDescriptor, PyErr_WriteUnraisable.
9192
9193PyRun_AnyFileEx, PyRun_SimpleFileEx, PyRun_FileEx -- New functions
9194that are the same as their non-Ex counterparts except they take an
9195extra flag argument that tells them to close the file when done.
9196
9197XXX There were other API changes that should be fleshed out here.
9198
9199
9200Windows Changes
9201---------------
9202
9203New popen2/popen3/peopen4 in os module (see Changed Modules above).
9204
9205os.popen is much more usable on Windows 95 and 98. See Microsoft
9206Knowledge Base article Q150956. The Win9x workaround described there
9207is implemented by the new w9xpopen.exe helper in the root of your
9208Python installation. Note that Python uses this internally; it is not
9209a standalone program.
9210
9211Administrator privileges are no longer required to install Python
9212on Windows NT or Windows 2000. If you have administrator privileges,
9213Python's registry info will be written under HKEY_LOCAL_MACHINE.
9214Otherwise the installer backs off to writing Python's registry info
9215under HKEY_CURRENT_USER. The latter is sufficient for all "normal"
9216uses of Python, but will prevent some advanced uses from working
9217(for example, running a Python script as an NT service, or possibly
9218from CGI).
9219
9220[This was new in 1.6] The installer no longer runs a separate Tcl/Tk
9221installer; instead, it installs the needed Tcl/Tk files directly in the
9222Python directory. If you already have a Tcl/Tk installation, this
9223wastes some disk space (about 4 Megs) but avoids problems with
9224conflicting Tcl/Tk installations, and makes it much easier for Python
9225to ensure that Tcl/Tk can find all its files.
9226
9227[This was new in 1.6] The Windows installer now installs by default in
9228\Python20\ on the default volume, instead of \Program Files\Python-2.0\.
9229
9230
9231Updates to the changes between 1.5.2 and 1.6
9232--------------------------------------------
9233
9234The 1.6 NEWS file can't be changed after the release is done, so here
9235is some late-breaking news:
9236
9237New APIs in locale.py: normalize(), getdefaultlocale(), resetlocale(),
9238and changes to getlocale() and setlocale().
9239
9240The new module is now enabled per default.
9241
9242It is not true that the encodings codecs cannot be used for normal
9243strings: the string.encode() (which is also present on 8-bit strings
9244!) allows using them for 8-bit strings too, e.g. to convert files from
9245cp1252 (Windows) to latin-1 or vice-versa.
9246
9247Japanese codecs are available from Tamito KAJIYAMA:
9248http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/python/
9249
9250
9251======================================================================
9252
9253
Guido van Rossumf2eac992000-09-04 17:24:24 +00009254=======================================
9255==> Release 1.6 (September 5, 2000) <==
9256=======================================
9257
Guido van Rossuma598c932000-09-04 16:26:03 +00009258What's new in release 1.6?
9259==========================
9260
9261Below is a list of all relevant changes since release 1.5.2.
9262
9263
9264Source Incompatibilities
9265------------------------
9266
9267Several small incompatible library changes may trip you up:
9268
9269 - The append() method for lists can no longer be invoked with more
9270 than one argument. This used to append a single tuple made out of
9271 all arguments, but was undocumented. To append a tuple, use
9272 e.g. l.append((a, b, c)).
9273
9274 - The connect(), connect_ex() and bind() methods for sockets require
9275 exactly one argument. Previously, you could call s.connect(host,
9276 port), but this was undocumented. You must now write
9277 s.connect((host, port)).
9278
9279 - The str() and repr() functions are now different more often. For
9280 long integers, str() no longer appends a 'L'. Thus, str(1L) == '1',
9281 which used to be '1L'; repr(1L) is unchanged and still returns '1L'.
9282 For floats, repr() now gives 17 digits of precision, to ensure no
9283 precision is lost (on all current hardware).
9284
9285 - The -X option is gone. Built-in exceptions are now always
9286 classes. Many more library modules also have been converted to
9287 class-based exceptions.
9288
9289
9290Binary Incompatibilities
9291------------------------
9292
9293- Third party extensions built for Python 1.5.x cannot be used with
9294Python 1.6; these extensions will have to be rebuilt for Python 1.6.
9295
9296- On Windows, attempting to import a third party extension built for
9297Python 1.5.x results in an immediate crash; there's not much we can do
9298about this. Check your PYTHONPATH environment variable!
9299
9300
9301Overview of Changes since 1.5.2
9302-------------------------------
9303
9304For this overview, I have borrowed from the document "What's New in
9305Python 2.0" by Andrew Kuchling and Moshe Zadka:
Andrew M. Kuchlinge240d9b2004-03-21 18:48:22 +00009306http://www.amk.ca/python/2.0/ .
Guido van Rossuma598c932000-09-04 16:26:03 +00009307
9308There are lots of new modules and lots of bugs have been fixed. A
9309list of all new modules is included below.
9310
9311Probably the most pervasive change is the addition of Unicode support.
9312We've added a new fundamental datatype, the Unicode string, a new
9313build-in function unicode(), an numerous C APIs to deal with Unicode
9314and encodings. See the file Misc/unicode.txt for details, or
9315http://starship.python.net/crew/lemburg/unicode-proposal.txt.
9316
9317Two other big changes, related to the Unicode support, are the
9318addition of string methods and (yet another) new regular expression
9319engine.
9320
9321 - String methods mean that you can now say s.lower() etc. instead of
9322 importing the string module and saying string.lower(s) etc. One
9323 peculiarity is that the equivalent of string.join(sequence,
9324 delimiter) is delimiter.join(sequence). Use " ".join(sequence) for
9325 the effect of string.join(sequence); to make this more readable, try
9326 space=" " first. Note that the maxsplit argument defaults in
9327 split() and replace() have changed from 0 to -1.
9328
9329 - The new regular expression engine, SRE by Fredrik Lundh, is fully
9330 backwards compatible with the old engine, and is in fact invoked
9331 using the same interface (the "re" module). You can explicitly
9332 invoke the old engine by import pre, or the SRE engine by importing
9333 sre. SRE is faster than pre, and supports Unicode (which was the
9334 main reason to put effort in yet another new regular expression
9335 engine -- this is at least the fourth!).
9336
9337
9338Other Changes
9339-------------
9340
9341Other changes that won't break code but are nice to know about:
9342
9343Deleting objects is now safe even for deeply nested data structures.
9344
9345Long/int unifications: long integers can be used in seek() calls, as
9346slice indexes.
9347
9348String formatting (s % args) has a new formatting option, '%r', which
9349acts like '%s' but inserts repr(arg) instead of str(arg). (Not yet in
9350alpha 1.)
9351
9352Greg Ward's "distutils" package is included: this will make
9353installing, building and distributing third party packages much
9354simpler.
9355
9356There's now special syntax that you can use instead of the apply()
9357function. f(*args, **kwds) is equivalent to apply(f, args, kwds).
9358You can also use variations f(a1, a2, *args, **kwds) and you can leave
9359one or the other out: f(*args), f(**kwds).
9360
9361The built-ins int() and long() take an optional second argument to
9362indicate the conversion base -- of course only if the first argument
9363is a string. This makes string.atoi() and string.atol() obsolete.
9364(string.atof() was already obsolete).
9365
9366When a local variable is known to the compiler but undefined when
9367used, a new exception UnboundLocalError is raised. This is a class
9368derived from NameError so code catching NameError should still work.
9369The purpose is to provide better diagnostics in the following example:
9370 x = 1
9371 def f():
9372 print x
9373 x = x+1
9374This used to raise a NameError on the print statement, which confused
9375even experienced Python programmers (especially if there are several
9376hundreds of lines of code between the reference and the assignment to
9377x :-).
9378
9379You can now override the 'in' operator by defining a __contains__
9380method. Note that it has its arguments backwards: x in a causes
9381a.__contains__(x) to be called. That's why the name isn't __in__.
9382
9383The exception AttributeError will have a more friendly error message,
9384e.g.: <code>'Spam' instance has no attribute 'eggs'</code>. This may
9385<b>break code</b> that expects the message to be exactly the attribute
9386name.
9387
9388
9389New Modules in 1.6
9390------------------
9391
9392UserString - base class for deriving from the string type.
9393
9394distutils - tools for distributing Python modules.
9395
9396robotparser - parse a robots.txt file, for writing web spiders.
9397(Moved from Tools/webchecker/.)
9398
9399linuxaudiodev - audio for Linux.
9400
9401mmap - treat a file as a memory buffer. (Windows and Unix.)
9402
9403sre - regular expressions (fast, supports unicode). Currently, this
9404code is very rough. Eventually, the re module will be reimplemented
9405using sre (without changes to the re API).
9406
9407filecmp - supersedes the old cmp.py and dircmp.py modules.
9408
9409tabnanny - check Python sources for tab-width dependance. (Moved from
9410Tools/scripts/.)
9411
9412urllib2 - new and improved but incompatible version of urllib (still
9413experimental).
9414
9415zipfile - read and write zip archives.
9416
9417codecs - support for Unicode encoders/decoders.
9418
9419unicodedata - provides access to the Unicode 3.0 database.
9420
9421_winreg - Windows registry access.
9422
9423encodings - package which provides a large set of standard codecs --
9424currently only for the new Unicode support. It has a drop-in extension
9425mechanism which allows you to add new codecs by simply copying them
9426into the encodings package directory. Asian codec support will
9427probably be made available as separate distribution package built upon
9428this technique and the new distutils package.
9429
9430
9431Changed Modules
9432---------------
9433
9434readline, ConfigParser, cgi, calendar, posix, readline, xmllib, aifc,
9435chunk, wave, random, shelve, nntplib - minor enhancements.
9436
9437socket, httplib, urllib - optional OpenSSL support (Unix only).
9438
9439_tkinter - support for 8.0 up to 8.3. Support for versions older than
94408.0 has been dropped.
9441
9442string - most of this module is deprecated now that strings have
9443methods. This no longer uses the built-in strop module, but takes
9444advantage of the new string methods to provide transparent support for
9445both Unicode and ordinary strings.
9446
9447
9448Changes on Windows
9449------------------
9450
9451The installer no longer runs a separate Tcl/Tk installer; instead, it
9452installs the needed Tcl/Tk files directly in the Python directory. If
9453you already have a Tcl/Tk installation, this wastes some disk space
9454(about 4 Megs) but avoids problems with conflincting Tcl/Tk
9455installations, and makes it much easier for Python to ensure that
9456Tcl/Tk can find all its files. Note: the alpha installers don't
9457include the documentation.
9458
9459The Windows installer now installs by default in \Python16\ on the
9460default volume, instead of \Program Files\Python-1.6\.
9461
9462
9463Changed Tools
9464-------------
9465
9466IDLE - complete overhaul. See the <a href="../idle/">IDLE home
9467page</a> for more information. (Python 1.6 alpha 1 will come with
9468IDLE 0.6.)
9469
9470Tools/i18n/pygettext.py - Python equivalent of xgettext(1). A message
9471text extraction tool used for internationalizing applications written
9472in Python.
9473
9474
9475Obsolete Modules
9476----------------
9477
9478stdwin and everything that uses it. (Get Python 1.5.2 if you need
9479it. :-)
9480
9481soundex. (Skip Montanaro has a version in Python but it won't be
9482included in the Python release.)
9483
9484cmp, cmpcache, dircmp. (Replaced by filecmp.)
9485
9486dump. (Use pickle.)
9487
9488find. (Easily coded using os.walk().)
9489
9490grep. (Not very useful as a library module.)
9491
9492packmail. (No longer has any use.)
9493
9494poly, zmod. (These were poor examples at best.)
9495
9496strop. (No longer needed by the string module.)
9497
9498util. (This functionality was long ago built in elsewhere).
9499
9500whatsound. (Use sndhdr.)
9501
9502
9503Detailed Changes from 1.6b1 to 1.6
9504----------------------------------
9505
9506- Slight changes to the CNRI license. A copyright notice has been
9507added; the requirement to indicate the nature of modifications now
9508applies when making a derivative work available "to others" instead of
9509just "to the public"; the version and date are updated. The new
9510license has a new handle.
9511
9512- Added the Tools/compiler package. This is a project led by Jeremy
9513Hylton to write the Python bytecode generator in Python.
9514
9515- The function math.rint() is removed.
9516
9517- In Python.h, "#define _GNU_SOURCE 1" was added.
9518
9519- Version 0.9.1 of Greg Ward's distutils is included (instead of
9520version 0.9).
9521
9522- A new version of SRE is included. It is more stable, and more
9523compatible with the old RE module. Non-matching ranges are indicated
9524by -1, not None. (The documentation said None, but the PRE
9525implementation used -1; changing to None would break existing code.)
9526
9527- The winreg module has been renamed to _winreg. (There are plans for
9528a higher-level API called winreg, but this has not yet materialized in
9529a form that is acceptable to the experts.)
9530
9531- The _locale module is enabled by default.
9532
9533- Fixed the configuration line for the _curses module.
9534
9535- A few crashes have been fixed, notably <file>.writelines() with a
9536list containing non-string objects would crash, and there were
9537situations where a lost SyntaxError could dump core.
9538
9539- The <list>.extend() method now accepts an arbitrary sequence
9540argument.
9541
9542- If __str__() or __repr__() returns a Unicode object, this is
9543converted to an 8-bit string.
9544
9545- Unicode string comparisons is no longer aware of UTF-16
9546encoding peculiarities; it's a straight 16-bit compare.
9547
9548- The Windows installer now installs the LICENSE file and no longer
9549registers the Python DLL version in the registry (this is no longer
9550needed). It now uses Tcl/Tk 8.3.2.
9551
9552- A few portability problems have been fixed, in particular a
9553compilation error involving socklen_t.
9554
9555- The PC configuration is slightly friendlier to non-Microsoft
9556compilers.
9557
9558
9559======================================================================
9560
9561
Guido van Rossumf2eac992000-09-04 17:24:24 +00009562======================================
9563==> Release 1.5.2 (April 13, 1999) <==
9564======================================
9565
Guido van Rossum2001da42000-09-01 22:26:44 +00009566From 1.5.2c1 to 1.5.2 (final)
9567=============================
9568
9569Tue Apr 13 15:44:49 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9570
9571 * PCbuild/python15.wse: Bump version to 1.5.2 (final)
9572
9573 * PCbuild/python15.dsp: Added shamodule.c
9574
9575 * PC/config.c: Added sha module!
9576
9577 * README, Include/patchlevel.h: Prepare for final release.
9578
9579 * Misc/ACKS:
9580 More (Cameron Laird is honorary; the others are 1.5.2c1 testers).
9581
9582 * Python/thread_solaris.h:
9583 While I can't really test this thoroughly, Pat Knight and the Solaris
9584 man pages suggest that the proper thing to do is to add THR_NEW_LWP to
9585 the flags on thr_create(), and that there really isn't a downside, so
9586 I'll do that.
9587
9588 * Misc/ACKS:
9589 Bunch of new names who helped iron out the last wrinkles of 1.5.2.
9590
9591 * PC/python_nt.rc:
9592 Bump the myusterious M$ version number from 1,5,2,1 to 1,5,2,3.
9593 (I can't even display this on NT, maybe Win/98 can?)
9594
9595 * Lib/pstats.py:
9596 Fix mysterious references to jprofile that were in the source since
9597 its creation. I'm assuming these were once valid references to "Jim
9598 Roskind's profile"...
9599
9600 * Lib/Attic/threading_api.py:
9601 Removed; since long subsumed in Doc/lib/libthreading.tex
9602
9603 * Modules/socketmodule.c:
9604 Put back __osf__ support for gethostbyname_r(); the real bug was that
9605 it was being used even without threads. This of course might be an
9606 all-platform problem so now we only use the _r variant when we are
9607 using threads.
9608
9609Mon Apr 12 22:51:20 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9610
9611 * Modules/cPickle.c:
9612 Fix accidentally reversed NULL test in load_mark(). Suggested by
9613 Tamito Kajiyama. (This caused a bug only on platforms where malloc(0)
9614 returns NULL.)
9615
9616 * README:
9617 Add note about popen2 problem on Linux noticed by Pablo Bleyer.
9618
9619 * README: Add note about -D_REENTRANT for HP-UX 10.20.
9620
9621 * Modules/Makefile.pre.in: 'clean' target should remove hassignal.
9622
9623 * PC/Attic/vc40.mak, PC/readme.txt:
9624 Remove all VC++ info (except VC 1.5) from readme.txt;
9625 remove the VC++ 4.0 project file; remove the unused _tkinter extern defs.
9626
9627 * README: Clarify PC build instructions (point to PCbuild).
9628
9629 * Modules/zlibmodule.c: Cast added by Jack Jansen (for Mac port).
9630
9631 * Lib/plat-sunos5/CDIO.py, Lib/plat-linux2/CDROM.py:
9632 Forgot to add this file. CDROM device parameters.
9633
9634 * Lib/gzip.py: Two different changes.
9635
9636 1. Jack Jansen reports that on the Mac, the time may be negative, and
9637 solves this by adding a write32u() function that writes an unsigned
9638 long.
9639
9640 2. On 64-bit platforms the CRC comparison fails; I've fixed this by
9641 casting both values to be compared to "unsigned long" i.e. modulo
9642 0x100000000L.
9643
9644Sat Apr 10 18:42:02 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9645
9646 * PC/Attic/_tkinter.def: No longer needed.
9647
9648 * Misc/ACKS: Correct missed character in Andrew Dalke's name.
9649
9650 * README: Add DEC Ultrix notes (from Donn Cave's email).
9651
9652 * configure: The usual
9653
9654 * configure.in:
9655 Quote a bunch of shell variables used in test, related to long-long.
9656
9657 * Objects/fileobject.c, Modules/shamodule.c, Modules/regexpr.c:
9658 casts for picky compilers.
9659
9660 * Modules/socketmodule.c:
9661 3-arg gethostbyname_r doesn't really work on OSF/1.
9662
9663 * PC/vc15_w31/_.c, PC/vc15_lib/_.c, Tools/pynche/__init__.py:
9664 Avoid totally empty files.
9665
9666Fri Apr 9 14:56:35 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9667
9668 * Tools/scripts/fixps.py: Use re instead of regex.
9669 Don't rewrite the file in place.
9670 (Reported by Andy Dustman.)
9671
9672 * Lib/netrc.py, Lib/shlex.py: Get rid of #! line
9673
9674Thu Apr 8 23:13:37 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9675
9676 * PCbuild/python15.wse: Use the Tcl 8.0.5 installer.
9677 Add a variable %_TCL_% that makes it easier to switch to a different version.
9678
9679
9680======================================================================
9681
9682
9683From 1.5.2b2 to 1.5.2c1
9684=======================
9685
9686Thu Apr 8 23:13:37 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9687
9688 * PCbuild/python15.wse:
9689 Release 1.5.2c1. Add IDLE and Uninstall to program group.
9690 Don't distribute zlib.dll. Tweak some comments.
9691
9692 * PCbuild/zlib.dsp: Now using static zlib 1.1.3
9693
9694 * 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:
9695 The usual
9696
9697 * Include/patchlevel.h: Release 1.5.2c1
9698
9699 * README: Release 1.5.2c1.
9700
9701 * Misc/NEWS: News for the 1.5.2c1 release.
9702
9703 * Lib/test/test_strftime.py:
9704 On Windows, we suddenly find, strftime() may return "" for an
9705 unsupported format string. (I guess this is because the logic for
9706 deciding whether to reallocate the buffer or not has been improved.)
9707 This caused the test code to crash on result[0]. Fix this by assuming
9708 an empty result also means the format is not supported.
9709
9710 * Demo/tkinter/matt/window-creation-w-location.py:
9711 This demo imported some private code from Matt. Make it cripple along.
9712
9713 * Lib/lib-tk/Tkinter.py:
9714 Delete an accidentally checked-in feature that actually broke more
9715 than was worth it: when deleting a canvas item, it would try to
9716 automatically delete the bindings for that item. Since there's
9717 nothing that says you can't reuse the tag and still have the bindings,
9718 this is not correct. Also, it broke at least one demo
9719 (Demo/tkinter/matt/rubber-band-box-demo-1.py).
9720
9721 * Python/thread_wince.h: Win/CE thread support by Mark Hammond.
9722
9723Wed Apr 7 20:23:17 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9724
9725 * Modules/zlibmodule.c:
9726 Patch by Andrew Kuchling to unflush() (flush() for deflating).
9727 Without this, if inflate() returned Z_BUF_ERROR asking for more output
9728 space, we would report the error; now, we increase the buffer size and
9729 try again, just as for Z_OK.
9730
9731 * Lib/test/test_gzip.py: Use binary mode for all gzip files we open.
9732
9733 * Tools/idle/ChangeLog: New change log.
9734
9735 * Tools/idle/README.txt, Tools/idle/NEWS.txt: New version.
9736
9737 * Python/pythonrun.c:
9738 Alas, get rid of the Win specific hack to ask the user to press Return
9739 before exiting when an error happened. This didn't work right when
9740 Python is invoked from a daemon.
9741
9742 * Tools/idle/idlever.py: Version bump awaiting impending new release.
9743 (Not much has changed :-( )
9744
9745 * Lib/lib-tk/Tkinter.py:
9746 lower, tkraise/lift hide Misc.lower, Misc.tkraise/lift,
9747 so the preferred name for them is tag_lower, tag_raise
9748 (similar to tag_bind, and similar to the Text widget);
9749 unfortunately can't delete the old ones yet (maybe in 1.6)
9750
9751 * Python/thread.c, Python/strtod.c, Python/mystrtoul.c, Python/import.c, Python/ceval.c:
9752 Changes by Mark Hammond for Windows CE. Mostly of the form
9753 #ifdef DONT_HAVE_header_H ... #endif around #include <header.h>.
9754
9755 * Python/bltinmodule.c:
9756 Remove unused variable from complex_from_string() code.
9757
9758 * Include/patchlevel.h:
9759 Add the possibility of a gamma release (release candidate).
9760 Add '+' to string version number to indicate we're beyond b2 now.
9761
9762 * Modules/posixmodule.c: Add extern decl for fsync() for SunOS 4.x.
9763
9764 * Lib/smtplib.py: Changes by Per Cederquist and The Dragon.
9765
9766 Per writes:
9767
9768 """
9769 The application where Signum Support uses smtplib needs to be able to
9770 report good error messages to the user when sending email fails. To
9771 help in diagnosing problems it is useful to be able to report the
9772 entire message sent by the server, not only the SMTP error code of the
9773 offending command.
9774
9775 A lot of the functions in sendmail.py unfortunately discards the
9776 message, leaving only the code. The enclosed patch fixes that
9777 problem.
9778
9779 The enclosed patch also introduces a base class for exceptions that
9780 include an SMTP error code and error message, and make the code and
9781 message available on separate attributes, so that surrounding code can
9782 deal with them in whatever way it sees fit. I've also added some
9783 documentation to the exception classes.
9784
9785 The constructor will now raise an exception if it cannot connect to
9786 the SMTP server.
9787
9788 The data() method will raise an SMTPDataError if it doesn't receive
9789 the expected 354 code in the middle of the exchange.
9790
9791 According to section 5.2.10 of RFC 1123 a smtp client must accept "any
9792 text, including no text at all" after the error code. If the response
9793 of a HELO command contains no text self.helo_resp will be set to the
9794 empty string (""). The patch fixes the test in the sendmail() method
9795 so that helo_resp is tested against None; if it has the empty string
9796 as value the sendmail() method would invoke the helo() method again.
9797
9798 The code no longer accepts a -1 reply from the ehlo() method in
9799 sendmail().
9800
9801 [Text about removing SMTPRecipientsRefused deleted --GvR]
9802 """
9803
9804 and also:
9805
9806 """
9807 smtplib.py appends an extra blank line to the outgoing mail if the
9808 `msg' argument to the sendmail method already contains a trailing
9809 newline. This patch should fix the problem.
9810 """
9811
9812 The Dragon writes:
9813
9814 """
9815 Mostly I just re-added the SMTPRecipientsRefused exception
9816 (the exeption object now has the appropriate info in it ) [Per had
9817 removed this in his patch --GvR] and tweaked the behavior of the
9818 sendmail method whence it throws the newly added SMTPHeloException (it
9819 was closing the connection, which it shouldn't. whatever catches the
9820 exception should do that. )
9821
9822 I pondered the change of the return values to tuples all around,
9823 and after some thinking I decided that regularizing the return values was
9824 too much of the Right Thing (tm) to not do.
9825
9826 My one concern is that code expecting an integer & getting a tuple
9827 may fail silently.
9828
9829 (i.e. if it's doing :
9830
9831 x.somemethod() >= 400:
9832 expecting an integer, the expression will always be true if it gets a
9833 tuple instead. )
9834
9835 However, most smtplib code I've seen only really uses the
9836 sendmail() method, so this wouldn't bother it. Usually code I've seen
9837 that calls the other methods usually only calls helo() and ehlo() for
9838 doing ESMTP, a feature which was not in the smtplib included with 1.5.1,
9839 and thus I would think not much code uses it yet.
9840 """
9841
9842Tue Apr 6 19:38:18 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9843
9844 * Lib/test/test_ntpath.py:
9845 Fix the tests now that splitdrive() no longer treats UNC paths special.
9846 (Some tests converted to splitunc() tests.)
9847
9848 * Lib/ntpath.py:
9849 Withdraw the UNC support from splitdrive(). Instead, a new function
9850 splitunc() parses UNC paths. The contributor of the UNC parsing in
9851 splitdrive() doesn't like it, but I haven't heard a good reason to
9852 keep it, and it causes some problems. (I think there's a
9853 philosophical problem -- to me, the split*() functions are purely
9854 syntactical, and the fact that \\foo is not a valid path doesn't mean
9855 that it shouldn't be considered an absolute path.)
9856
9857 Also (quite separately, but strangely related to the philosophical
9858 issue above) fix abspath() so that if win32api exists, it doesn't fail
9859 when the path doesn't actually exist -- if GetFullPathName() fails,
9860 fall back on the old strategy (join with getcwd() if neccessary, and
9861 then use normpath()).
9862
9863 * configure.in, configure, config.h.in, acconfig.h:
9864 For BeOS PowerPC. Chris Herborth.
9865
9866Mon Apr 5 21:54:14 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9867
9868 * Modules/timemodule.c:
9869 Jonathan Giddy notes, and Chris Lawrence agrees, that some comments on
9870 #else/#endif are wrong, and that #if HAVE_TM_ZONE should be #ifdef.
9871
9872 * Misc/ACKS:
9873 Bunch of new contributors, including 9 who contributed to the Docs,
9874 reported by Fred.
9875
9876Mon Apr 5 18:37:59 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
9877
9878 * Lib/gzip.py:
9879 Oops, missed mode parameter to open().
9880
9881 * Lib/gzip.py:
9882 Made the default mode 'rb' instead of 'r', for better cross-platform
9883 support. (Based on comment on the documentation by Bernhard Reiter
9884 <bernhard@csd.uwm.edu>).
9885
9886Fri Apr 2 22:18:25 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9887
9888 * Tools/scripts/dutree.py:
9889 For reasons I dare not explain, this script should always execute
9890 main() when imported (in other words, it is not usable as a module).
9891
9892Thu Apr 1 15:32:30 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9893
9894 * Lib/test/test_cpickle.py: Jonathan Giddy write:
9895
9896 In test_cpickle.py, the module os got imported, but the line to remove
9897 the temp file has gone missing.
9898
9899Tue Mar 30 20:17:31 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9900
9901 * Lib/BaseHTTPServer.py: Per Cederqvist writes:
9902
9903 If you send something like "PUT / HTTP/1.0" to something derived from
9904 BaseHTTPServer that doesn't define do_PUT, you will get a response
9905 that begins like this:
9906
9907 HTTP/1.0 501 Unsupported method ('do_PUT')
9908 Server: SimpleHTTP/0.3 Python/1.5
9909 Date: Tue, 30 Mar 1999 18:53:53 GMT
9910
9911 The server should complain about 'PUT' instead of 'do_PUT'. This
9912 patch should fix the problem.
9913
9914Mon Mar 29 20:33:21 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9915
9916 * Lib/smtplib.py: Patch by Per Cederqvist, who writes:
9917
9918 """
9919 - It needlessly used the makefile() method for each response that is
9920 read from the SMTP server.
9921
9922 - If the remote SMTP server closes the connection unexpectedly the
9923 code raised an IndexError. It now raises an SMTPServerDisconnected
9924 exception instead.
9925
9926 - The code now checks that all lines in a multiline response actually
9927 contains an error code.
9928 """
9929
9930 The Dragon approves.
9931
9932Mon Mar 29 20:25:40 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
9933
9934 * Lib/compileall.py:
9935 When run as a script, report failures in the exit code as well.
9936 Patch largely based on changes by Andrew Dalke, as discussed in the
9937 distutils-sig.
9938
9939Mon Mar 29 20:23:41 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9940
9941 * Lib/urllib.py:
9942 Hack so that if a 302 or 301 redirect contains a relative URL, the
9943 right thing "just happens" (basejoin() with old URL).
9944
9945 * Modules/cPickle.c:
9946 Protection against picling to/from closed (real) file.
9947 The problem was reported by Moshe Zadka.
9948
9949 * Lib/test/test_cpickle.py:
9950 Test protection against picling to/from closed (real) file.
9951
9952 * Modules/timemodule.c: Chris Lawrence writes:
9953
9954 """
9955 The GNU folks, in their infinite wisdom, have decided not to implement
9956 altzone in libc6; this would not be horrible, except that timezone
9957 (which is implemented) includes the current DST setting (i.e. timezone
9958 for Central is 18000 in summer and 21600 in winter). So Python's
9959 timezone and altzone variables aren't set correctly during DST.
9960
9961 Here's a patch relative to 1.5.2b2 that (a) makes timezone and altzone
9962 show the "right" thing on Linux (by using the tm_gmtoff stuff
9963 available in BSD, which is how the GLIBC manual claims things should
9964 be done) and (b) should cope with the southern hemisphere. In pursuit
9965 of (b), I also took the liberty of renaming the "summer" and "winter"
9966 variables to "july" and "jan". This patch should also make certain
9967 time calculations on Linux actually work right (like the tz-aware
9968 functions in the rfc822 module).
9969
9970 (It's hard to find DST that's currently being used in the southern
9971 hemisphere; I tested using Africa/Windhoek.)
9972 """
9973
9974 * Lib/test/output/test_gzip:
9975 Jonathan Giddy discovered this file was missing.
9976
9977 * Modules/shamodule.c:
9978 Avoid warnings from AIX compiler. Reported by Vladimir (AIX is my
9979 middlename) Marangozov, patch coded by Greg Stein.
9980
9981 * Tools/idle/ScriptBinding.py, Tools/idle/PyShell.py:
9982 At Tim Peters' recommendation, add a dummy flush() method to PseudoFile.
9983
9984Sun Mar 28 17:55:32 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9985
9986 * Tools/scripts/ndiff.py: Tim Peters writes:
9987
9988 I should have waited overnight <wink/sigh>. Nothing wrong with the one I
9989 sent, but I couldn't resist going on to add new -r1 / -r2 cmdline options
9990 for recreating the original files from ndiff's output. That's attached, if
9991 you're game! Us Windows guys don't usually have a sed sitting around
9992 <wink>.
9993
9994Sat Mar 27 13:34:01 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
9995
9996 * Tools/scripts/ndiff.py: Tim Peters writes:
9997
9998 Attached is a cleaned-up version of ndiff (added useful module
9999 docstring, now echo'ed in case of cmd line mistake); added -q option
10000 to suppress initial file identification lines; + other minor cleanups,
10001 & a slightly faster match engine.
10002
10003Fri Mar 26 22:36:00 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
10004
10005 * Tools/scripts/dutree.py:
10006 During display, if EPIPE is raised, it's probably because a pager was
10007 killed. Discard the error in that case, but propogate it otherwise.
10008
10009Fri Mar 26 16:20:45 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10010
10011 * Lib/test/output/test_userlist, Lib/test/test_userlist.py:
10012 Test suite for UserList.
10013
10014 * Lib/UserList.py: Use isinstance() where appropriate.
10015 Reformatted with 4-space indent.
10016
10017Fri Mar 26 16:11:40 1999 Barry Warsaw <bwarsaw@eric.cnri.reston.va.us>
10018
10019 * Tools/pynche/PyncheWidget.py:
10020 Helpwin.__init__(): The text widget should get focus.
10021
10022 * Tools/pynche/pyColorChooser.py:
10023 Removed unnecessary import `from PyncheWidget import PyncheWidget'
10024
10025Fri Mar 26 15:32:05 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10026
10027 * Lib/test/output/test_userdict, Lib/test/test_userdict.py:
10028 Test suite for UserDict
10029
10030 * Lib/UserDict.py: Improved a bunch of things.
10031 The constructor now takes an optional dictionary.
10032 Use isinstance() where appropriate.
10033
10034Thu Mar 25 22:38:49 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10035
10036 * Lib/test/output/test_pickle, Lib/test/output/test_cpickle, Lib/test/test_pickle.py, Lib/test/test_cpickle.py:
10037 Basic regr tests for pickle/cPickle
10038
10039 * Lib/pickle.py:
10040 Don't use "exec" in find_class(). It's slow, unnecessary, and (as AMK
10041 points out) it doesn't work in JPython Applets.
10042
10043Thu Mar 25 21:50:27 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us>
10044
10045 * Lib/test/test_gzip.py:
10046 Added a simple test suite for gzip. It simply opens a temp file,
10047 writes a chunk of compressed data, closes it, writes another chunk, and
10048 reads the contents back to verify that they are the same.
10049
10050 * Lib/gzip.py:
10051 Based on a suggestion from bruce@hams.com, make a trivial change to
10052 allow using the 'a' flag as a mode for opening a GzipFile. gzip
10053 files, surprisingly enough, can be concatenated and then decompressed;
10054 the effect is to concatenate the two chunks of data.
10055
10056 If we support it on writing, it should also be supported on reading.
10057 This *wasn't* trivial, and required rearranging the code in the
10058 reading path, particularly the _read() method.
10059
10060 Raise IOError instead of RuntimeError in two cases, 'Not a gzipped file'
10061 and 'Unknown compression method'
10062
10063Thu Mar 25 21:25:01 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10064
10065 * Lib/test/test_b1.py:
10066 Add tests for float() and complex() with string args (Nick/Stephanie
10067 Lockwood).
10068
10069Thu Mar 25 21:21:08 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us>
10070
10071 * Modules/zlibmodule.c:
10072 Add an .unused_data attribute to decompressor objects. If .unused_data
10073 is not an empty string, this means that you have arrived at the
10074 end of the stream of compressed data, and the contents of .unused_data are
10075 whatever follows the compressed stream.
10076
10077Thu Mar 25 21:16:07 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10078
10079 * Python/bltinmodule.c:
10080 Patch by Nick and Stephanie Lockwood to implement complex() with a string
10081 argument. This closes TODO item 2.19.
10082
10083Wed Mar 24 19:09:00 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10084
10085 * Tools/webchecker/wcnew.py: Added Samuel Bayer's new webchecker.
10086 Unfortunately his code breaks wcgui.py in a way that's not easy
10087 to fix. I expect that this is a temporary situation --
10088 eventually Sam's changes will be merged back in.
10089 (The changes add a -t option to specify exceptions to the -x
10090 option, and explicit checking for #foo style fragment ids.)
10091
10092 * Objects/dictobject.c:
10093 Vladimir Marangozov contributed updated comments.
10094
10095 * Objects/bufferobject.c: Folded long lines.
10096
10097 * Lib/test/output/test_sha, Lib/test/test_sha.py:
10098 Added Jeremy's test code for the sha module.
10099
10100 * Modules/shamodule.c, Modules/Setup.in:
10101 Added Greg Stein and Andrew Kuchling's sha module.
10102 Fix comments about zlib version and URL.
10103
10104 * Lib/test/test_bsddb.py: Remove the temp file when we're done.
10105
10106 * Include/pythread.h: Conform to standard boilerplate.
10107
10108 * configure.in, configure, BeOS/linkmodule, BeOS/ar-fake:
10109 Chris Herborth: the new compiler in R4.1 needs some new options to work...
10110
10111 * Modules/socketmodule.c:
10112 Implement two suggestions by Jonathan Giddy: (1) in AIX, clear the
10113 data struct before calling gethostby{name,addr}_r(); (2) ignore the
10114 3/5/6 args determinations made by the configure script and switch on
10115 platform identifiers instead:
10116
10117 AIX, OSF have 3 args
10118 Sun, SGI have 5 args
10119 Linux has 6 args
10120
10121 On all other platforms, undef HAVE_GETHOSTBYNAME_R altogether.
10122
10123 * Modules/socketmodule.c:
10124 Vladimir Marangozov implements the AIX 3-arg gethostbyname_r code.
10125
10126 * Lib/mailbox.py:
10127 Add readlines() to _Subfile class. Not clear who would need it, but
10128 Chris Lawrence sent me a broken version; this one is a tad simpler and
10129 more conforming to the standard.
10130
10131Tue Mar 23 23:05:34 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us>
10132
10133 * Lib/gzip.py: use struct instead of bit-manipulate in Python
10134
10135Tue Mar 23 19:00:55 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10136
10137 * Modules/Makefile.pre.in:
10138 Add $(EXE) to various occurrences of python so it will work on Cygwin
10139 with egcs (after setting EXE=.exe). Patch by Norman Vine.
10140
10141 * configure, configure.in:
10142 Ack! It never defined HAVE_GETHOSTBYNAME_R so that code was never tested!
10143
10144Mon Mar 22 22:25:39 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10145
10146 * Include/thread.h:
10147 Adding thread.h -- unused but for b/w compatibility.
10148 As requested by Bill Janssen.
10149
10150 * configure.in, configure:
10151 Add code to test for all sorts of gethostbyname_r variants,
10152 donated by David Arnold.
10153
10154 * config.h.in, acconfig.h:
10155 Add symbols for gethostbyname_r variants (sigh).
10156
10157 * Modules/socketmodule.c: Clean up pass for the previous patches.
10158
10159 - Use HAVE_GETHOSTBYNAME_R_6_ARG instead of testing for Linux and
10160 glibc2.
10161
10162 - If gethostbyname takes 3 args, undefine HAVE_GETHOSTBYNAME_R --
10163 don't know what code should be used.
10164
10165 - New symbol USE_GETHOSTBYNAME_LOCK defined iff the lock should be used.
10166
10167 - Modify the gethostbyaddr() code to also hold on to the lock until
10168 after it is safe to release, overlapping with the Python lock.
10169
10170 (Note: I think that it could in theory be possible that Python code
10171 executed while gethostbyname_lock is held could attempt to reacquire
10172 the lock -- e.g. in a signal handler or destructor. I will simply say
10173 "don't do that then.")
10174
10175 * Modules/socketmodule.c: Jonathan Giddy writes:
10176
10177 Here's a patch to fix the race condition, which wasn't fixed by Rob's
10178 patch. It holds the gethostbyname lock until the results are copied out,
10179 which means that this lock and the Python global lock are held at the same
10180 time. This shouldn't be a problem as long as the gethostbyname lock is
10181 always acquired when the global lock is not held.
10182
10183Mon Mar 22 19:25:30 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us>
10184
10185 * Modules/zlibmodule.c:
10186 Fixed the flush() method of compression objects; the test for
10187 the end of loop was incorrect, and failed when the flushmode != Z_FINISH.
10188 Logic cleaned up and commented.
10189
10190 * Lib/test/test_zlib.py:
10191 Added simple test for the flush() method of compression objects, trying the
10192 different flush values Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH.
10193
10194Mon Mar 22 15:28:08 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10195
10196 * Lib/shlex.py:
10197 Bug reported by Tobias Thelen: missing "self." in assignment target.
10198
10199Fri Mar 19 21:50:11 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10200
10201 * Modules/arraymodule.c:
10202 Use an unsigned cast to avoid a warning in VC++.
10203
10204 * Lib/dospath.py, Lib/ntpath.py:
10205 New code for split() by Tim Peters, behaves more like posixpath.split().
10206
10207 * Objects/floatobject.c:
10208 Fix a problem with Vladimir's PyFloat_Fini code: clear the free list; if
10209 a block cannot be freed, add its free items back to the free list.
10210 This is necessary to avoid leaking when Python is reinitialized later.
10211
10212 * Objects/intobject.c:
10213 Fix a problem with Vladimir's PyInt_Fini code: clear the free list; if
10214 a block cannot be freed, add its free items back to the free list, and
10215 add its valid ints back to the small_ints array if they are in range.
10216 This is necessary to avoid leaking when Python is reinitialized later.
10217
10218 * Lib/types.py:
10219 Added BufferType, the type returned by the new builtin buffer(). Greg Stein.
10220
10221 * Python/bltinmodule.c:
10222 New builtin buffer() creates a derived read-only buffer from any
10223 object that supports the buffer interface (e.g. strings, arrays).
10224
10225 * Objects/bufferobject.c:
10226 Added check for negative offset for PyBuffer_FromObject and check for
10227 negative size for PyBuffer_FromMemory. Greg Stein.
10228
10229Thu Mar 18 15:10:44 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10230
10231 * Lib/urlparse.py: Sjoerd Mullender writes:
10232
10233 If a filename on Windows starts with \\, it is converted to a URL
10234 which starts with ////. If this URL is passed to urlparse.urlparse
10235 you get a path that starts with // (and an empty netloc). If you pass
10236 the result back to urlparse.urlunparse, you get a URL that starts with
10237 //, which is parsed differently by urlparse.urlparse. The fix is to
10238 add the (empty) netloc with accompanying slashes if the path in
10239 urlunparse starts with //. Do this for all schemes that use a netloc.
10240
10241 * Lib/nturl2path.py: Sjoerd Mullender writes:
10242
10243 Pathnames of files on other hosts in the same domain
10244 (\\host\path\to\file) are not translated correctly to URLs and back.
10245 The URL should be something like file:////host/path/to/file.
10246 Note that a combination of drive letter and remote host is not
10247 possible.
10248
10249Wed Mar 17 22:30:10 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10250
10251 * Lib/urlparse.py:
10252 Delete non-standard-conforming code in urljoin() that would use the
10253 netloc from the base url as the default netloc for the resulting url
10254 even if the schemes differ.
10255
10256 Once upon a time, when the web was wild, this was a valuable hack
10257 because some people had a URL referencing an ftp server colocated with
10258 an http server without having the host in the ftp URL (so they could
10259 replicate it or change the hostname easily).
10260
10261 More recently, after the file: scheme got added back to the list of
10262 schemes that accept a netloc, it turns out that this caused weirdness
10263 when joining an http: URL with a file: URL -- the resulting file: URL
10264 would always inherit the host from the http: URL because the file:
10265 scheme supports a netloc but in practice never has one.
10266
10267 There are two reasons to get rid of the old, once-valuable hack,
10268 instead of removing the file: scheme from the uses_netloc list. One,
10269 the RFC says that file: uses the netloc syntax, and does not endorse
10270 the old hack. Two, neither netscape 4.5 nor IE 4.0 support the old
10271 hack.
10272
10273 * Include/ceval.h, Include/abstract.h:
10274 Add DLL level b/w compat for PySequence_In and PyEval_CallObject
10275
10276Tue Mar 16 21:54:50 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10277
10278 * Lib/lib-tk/Tkinter.py: Bug reported by Jim Robinson:
10279
10280 An attempt to execute grid_slaves with arguments (0,0) results in
10281 *all* of the slaves being returned, not just the slave associated with
10282 row 0, column 0. This is because the test for arguments in the method
10283 does not test to see if row (and column) does not equal None, but
10284 rather just whether is evaluates to non-false. A value of 0 fails
10285 this test.
10286
10287Tue Mar 16 14:17:48 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
10288
10289 * Modules/cmathmodule.c:
10290 Docstring fix: acosh() returns the hyperbolic arccosine, not the
10291 hyperbolic cosine. Problem report via David Ascher by one of his
10292 students.
10293
10294Mon Mar 15 21:40:59 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10295
10296 * configure.in:
10297 Should test for gethost*by*name_r, not for gethostname_r (which
10298 doesn't exist and doesn't make sense).
10299
10300 * Modules/socketmodule.c:
10301 Patch by Rob Riggs for Linux -- glibc2 has a different argument
10302 converntion for gethostbyname_r() etc. than Solaris!
10303
10304 * Python/thread_pthread.h: Rob Riggs wrote:
10305
10306 """
10307 Spec says that on success pthread_create returns 0. It does not say
10308 that an error code will be < 0. Linux glibc2 pthread_create() returns
10309 ENOMEM (12) when one exceed process limits. (It looks like it should
10310 return EAGAIN, but that's another story.)
10311
10312 For reference, see:
10313 http://www.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html
10314 """
10315
10316 [I have a feeling that similar bugs were fixed before; perhaps someone
10317 could check that all error checks no check for != 0?]
10318
10319 * Tools/bgen/bgen/bgenObjectDefinition.py:
10320 New mixin class that defines cmp and hash that use
10321 the ob_itself pointer. This allows (when using the mixin)
10322 different Python objects pointing to the same C object and
10323 behaving well as dictionary keys.
10324
10325 Or so sez Jack Jansen...
10326
10327 * Lib/urllib.py: Yet another patch by Sjoerd Mullender:
10328
10329 Don't convert URLs to URLs using pathname2url.
10330
10331Fri Mar 12 22:15:43 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10332
10333 * Lib/cmd.py: Patch by Michael Scharf. He writes:
10334
10335 The module cmd requires for each do_xxx command a help_xxx
10336 function. I think this is a little old fashioned.
10337
10338 Here is a patch: use the docstring as help if no help_xxx
10339 function can be found.
10340
10341 [I'm tempted to rip out all the help_* functions from pdb, but I'll
10342 resist it. Any takers? --Guido]
10343
10344 * Tools/freeze/freeze.py: Bug submitted by Wayne Knowles, who writes:
10345
10346 Under Windows, python freeze.py -o hello hello.py
10347 creates all the correct files in the hello subdirectory, but the
10348 Makefile has the directory prefix in it for frozen_extensions.c
10349 nmake fails because it tries to locate hello/frozen_extensions.c
10350
10351 (His fix adds a call to os.path.basename() in the appropriate place.)
10352
10353 * Objects/floatobject.c, Objects/intobject.c:
10354 Vladimir has restructured his code somewhat so that the blocks are now
10355 represented by an explicit structure. (There are still too many casts
10356 in the code, but that may be unavoidable.)
10357
10358 Also added code so that with -vv it is very chatty about what it does.
10359
10360 * Demo/zlib/zlibdemo.py, Demo/zlib/minigzip.py:
10361 Change #! line to modern usage; also chmod +x
10362
10363 * Demo/pdist/rrcs, Demo/pdist/rcvs, Demo/pdist/rcsbump:
10364 Change #! line to modern usage
10365
10366 * Lib/nturl2path.py, Lib/urllib.py: From: Sjoerd Mullender
10367
10368 The filename to URL conversion didn't properly quote special
10369 characters.
10370 The URL to filename didn't properly unquote special chatacters.
10371
10372 * Objects/floatobject.c:
10373 OK, try again. Vladimir gave me a fix for the alignment bus error,
10374 so here's his patch again. This time it works (at least on Solaris,
10375 Linux and Irix).
10376
10377Thu Mar 11 23:21:23 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10378
10379 * Tools/idle/PathBrowser.py:
10380 Don't crash when sys.path contains an empty string.
10381
10382 * Tools/idle/PathBrowser.py:
10383 - Don't crash in the case where a superclass is a string instead of a
10384 pyclbr.Class object; this can happen when the superclass is
10385 unrecognizable (to pyclbr), e.g. when module renaming is used.
10386
10387 - Show a watch cursor when calling pyclbr (since it may take a while
10388 recursively parsing imported modules!).
10389
10390Thu Mar 11 16:04:04 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
10391
10392 * Lib/mimetypes.py:
10393 Added .rdf and .xsl as application/xml types. (.rdf is for the
10394 Resource Description Framework, a metadata encoding, and .xsl is for
10395 the Extensible Stylesheet Language.)
10396
10397Thu Mar 11 13:26:23 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10398
10399 * Lib/test/output/test_popen2, Lib/test/test_popen2.py:
10400 Test for popen2 module, by Chris Tismer.
10401
10402 * Objects/floatobject.c:
10403 Alas, Vladimir's patch caused a bus error (probably double
10404 alignment?), and I didn't test it. Withdrawing it for now.
10405
10406Wed Mar 10 22:55:47 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10407
10408 * Objects/floatobject.c:
10409 Patch by Vladimir Marangoz to allow freeing of the allocated blocks of
10410 floats on finalization.
10411
10412 * Objects/intobject.c:
10413 Patch by Vladimir Marangoz to allow freeing of the allocated blocks of
10414 integers on finalization.
10415
10416 * Tools/idle/EditorWindow.py, Tools/idle/Bindings.py:
10417 Add PathBrowser to File module
10418
10419 * Tools/idle/PathBrowser.py:
10420 "Path browser" - 4 scrolled lists displaying:
10421 directories on sys.path
10422 modules in selected directory
10423 classes in selected module
10424 methods of selected class
10425
10426 Sinlge clicking in a directory, module or class item updates the next
10427 column with info about the selected item. Double clicking in a
10428 module, class or method item opens the file (and selects the clicked
10429 item if it is a class or method).
10430
10431 I guess eventually I should be using a tree widget for this, but the
10432 ones I've seen don't work well enough, so for now I use the old
10433 Smalltalk or NeXT style multi-column hierarchical browser.
10434
10435 * Tools/idle/MultiScrolledLists.py:
10436 New utility: multiple scrolled lists in parallel
10437
10438 * Tools/idle/ScrolledList.py: - White background.
10439 - Display "(None)" (or text of your choosing) when empty.
10440 - Don't set the focus.
10441
10442Tue Mar 9 19:31:21 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10443
10444 * Lib/urllib.py:
10445 open_http also had the 'data is None' test backwards. don't call with the
10446 extra argument if data is None.
10447
10448 * Demo/embed/demo.c:
10449 Call Py_SetProgramName() instead of redefining getprogramname(),
10450 reflecting changes in the runtime around 1.5 or earlier.
10451
10452 * Python/ceval.c:
10453 Always test for an error return (usually NULL or -1) without setting
10454 an exception.
10455
10456 * Modules/timemodule.c: Patch by Chris Herborth for BeOS code.
10457 He writes:
10458
10459 I had an off-by-1000 error in floatsleep(),
10460 and the problem with time.clock() is that it's not implemented properly
10461 on QNX... ANSI says it's supposed to return _CPU_ time used by the
10462 process, but on QNX it returns the amount of real time used... so I was
10463 confused.
10464
10465 * Tools/bgen/bgen/macsupport.py: Small change by Jack Jansen.
10466 Test for self.returntype behaving like OSErr rather than being it.
10467
10468Thu Feb 25 16:14:58 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us>
10469
10470 * Lib/urllib.py:
10471 http_error had the 'data is None' test backwards. don't call with the
10472 extra argument if data is None.
10473
10474 * Lib/urllib.py: change indentation from 8 spaces to 4 spaces
10475
10476 * Lib/urllib.py: pleasing the tabnanny
10477
10478Thu Feb 25 14:26:02 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
10479
10480 * Lib/colorsys.py:
10481 Oops, one more "x, y, z" to convert...
10482
10483 * Lib/colorsys.py:
10484 Adjusted comment at the top to be less confusing, following Fredrik
10485 Lundh's example.
10486
10487 Converted comment to docstring.
10488
10489Wed Feb 24 18:49:15 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
10490
10491 * Lib/toaiff.py:
10492 Use sndhdr instead of the obsolete whatsound module.
10493
10494Wed Feb 24 18:42:38 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us>
10495
10496 * Lib/urllib.py:
10497 When performing a POST request, i.e. when the second argument to
10498 urlopen is used to specify form data, make sure the second argument is
10499 threaded through all of the http_error_NNN calls. This allows error
10500 handlers like the redirect and authorization handlers to properly
10501 re-start the connection.
10502
10503Wed Feb 24 16:25:17 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10504
10505 * Lib/mhlib.py: Patch by Lars Wirzenius:
10506
10507 o the initial comment is wrong: creating messages is already
10508 implemented
10509
10510 o Message.getbodytext: if the mail or it's part contains an
10511 empty content-transfer-encoding header, the code used to
10512 break; the change below treats an empty encoding value the same
10513 as the other types that do not need decoding
10514
10515 o SubMessage.getbodytext was missing the decode argument; the
10516 change below adds it; I also made it unconditionally return
10517 the raw text if decoding was not desired, because my own
10518 routines needed that (and it was easier than rewriting my
10519 own routines ;-)
10520
10521Wed Feb 24 00:35:43 1999 Barry Warsaw <bwarsaw@eric.cnri.reston.va.us>
10522
10523 * Python/bltinmodule.c (initerrors):
10524 Make sure that the exception tuples ("base-classes" when
10525 string-based exceptions are used) reflect the real class hierarchy,
10526 i.e. that SystemExit derives from Exception not StandardError.
10527
10528 * Lib/exceptions.py:
10529 Document the correct class hierarchy for SystemExit. It is not an
10530 error and so it derives from Exception and not SystemError. The
10531 docstring was incorrect but the implementation was fine.
10532
10533Tue Feb 23 23:07:51 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10534
10535 * Lib/shutil.py:
10536 Add import sys, needed by reference to sys.exc_info() in rmtree().
10537 Discovered by Mitch Chapman.
10538
10539 * config.h.in:
10540 Now that we don't have AC_CHECK_LIB(m, pow), the HAVE_LIBM symbol
10541 disappears. It wasn't used anywhere anyway...
10542
10543 * Modules/arraymodule.c:
10544 Carefully check for overflow when allocating the memory for fromfile
10545 -- someone tried to pass in sys.maxint and got bitten by the bogus
10546 calculations.
10547
10548 * configure.in:
10549 Get rid of AC_CHECK_LIB(m, pow) since this is taken care of later with
10550 LIBM (from --with-libm=...); this actually broke the customizability
10551 offered by the latter option. Thanks go to Clay Spence for reporting
10552 this.
10553
10554 * Lib/test/test_dl.py:
10555 1. Print the error message (carefully) when a dl.open() fails in verbose mode.
10556 2. When no test case worked, raise ImportError instead of failing.
10557
10558 * Python/bltinmodule.c:
10559 Patch by Tim Peters to improve the range checks for range() and
10560 xrange(), especially for platforms where int and long are different
10561 sizes (so sys.maxint isn't actually the theoretical limit for the
10562 length of a list, but the largest C int is -- sys.maxint is the
10563 largest Python int, which is actually a C long).
10564
10565 * Makefile.in:
10566 1. Augment the DG/UX rule so it doesn't break the BeOS build.
10567 2. Add $(EXE) to various occurrences of python so it will work on
10568 Cygwin with egcs (after setting EXE=.exe). These patches by
10569 Norman Vine.
10570
10571 * Lib/posixfile.py:
10572 According to Jeffrey Honig, bsd/os 2.0 - 4.0 should be added to the
10573 list (of bsd variants that have a different lock structure).
10574
10575 * Lib/test/test_fcntl.py:
10576 According to Jeffrey Honig, bsd/os 4.0 should be added to the list.
10577
10578 * Modules/timemodule.c:
10579 Patch by Tadayoshi Funaba (with some changes) to be smarter about
10580 guessing what happened when strftime() returns 0. Is it buffer
10581 overflow or was the result simply 0 bytes long? (This happens for an
10582 empty format string, or when the format string is a single %Z and the
10583 timezone is unknown.) if the buffer is at least 256 times as long as
10584 the format, assume the latter.
10585
10586Mon Feb 22 19:01:42 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10587
10588 * Lib/urllib.py:
10589 As Des Barry points out, we need to call pathname2url(file) in two
10590 calls to addinfourl() in open_file().
10591
10592 * Modules/Setup.in: Document *static* -- in two places!
10593
10594 * Modules/timemodule.c:
10595 We don't support leap seconds, so the seconds field of a time 9-tuple
10596 should be in the range [0-59]. Noted by Tadayoshi Funaba.
10597
10598 * Modules/stropmodule.c:
10599 In atoi(), don't use isxdigit() to test whether the last character
10600 converted was a "digit" -- use isalnum(). This test is there only to
10601 guard against "+" or "-" being interpreted as a valid int literal.
10602 Reported by Takahiro Nakayama.
10603
10604 * Lib/os.py:
10605 As Finn Bock points out, _P_WAIT etc. don't have a leading underscore
10606 so they don't need to be treated specially here.
10607
10608Mon Feb 22 15:38:58 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
10609
10610 * Misc/NEWS:
10611 Typo: "apparentlt" --> "apparently"
10612
10613Mon Feb 22 15:38:46 1999 Guido van Rossum <guido@eric.cnri.reston.va.us>
10614
10615 * Lib/urlparse.py: Steve Clift pointed out that 'file' allows a netloc.
10616
10617 * Modules/posixmodule.c:
10618 The docstring for ttyname(..) claims a second "mode" argument. The
10619 actual code does not allow such an argument. (Finn Bock.)
10620
10621 * Lib/lib-old/poly.py:
10622 Dang. Even though this is obsolete code, somebody found a bug, and I
10623 fix it. Oh well.
10624
10625Thu Feb 18 20:51:50 1999 Fred Drake <fdrake@eric.cnri.reston.va.us>
10626
10627 * Lib/pyclbr.py:
10628 Bow to font-lock at the end of the docstring, since it throws stuff
10629 off.
10630
10631 Make sure the path paramter to readmodule() is a list before adding it
10632 with sys.path, or the addition could fail.
10633
10634
10635======================================================================
10636
10637
10638From 1.5.2b1 to 1.5.2b2
10639=======================
10640
10641General
10642-------
10643
10644- Many memory leaks fixed.
10645
10646- Many small bugs fixed.
10647
10648- Command line option -OO (or -O -O) suppresses inclusion of doc
10649strings in resulting bytecode.
10650
10651Windows-specific changes
10652------------------------
10653
10654- New built-in module winsound provides an interface to the Win32
10655PlaySound() call.
10656
10657- Re-enable the audioop module in the config.c file.
10658
10659- On Windows, support spawnv() and associated P_* symbols.
10660
10661- Fixed the conversion of times() return values on Windows.
10662
10663- Removed freeze from the installer -- it doesn't work without the
10664source tree. (See FAQ 8.11.)
10665
10666- On Windows 95/98, the Tkinter module now is smart enough to find
10667Tcl/Tk even when the PATH environment variable hasn't been set -- when
10668the import of _tkinter fails, it searches in a standard locations,
10669patches os.environ["PATH"], and tries again. When it still fails, a
10670clearer error message is produced. This should avoid most
10671installation problems with Tkinter use (e.g. in IDLE).
10672
10673- The -i option doesn't make any calls to set[v]buf() for stdin --
10674this apparently screwed up _kbhit() and the _tkinter main loop.
10675
10676- The ntpath module (and hence, os.path on Windows) now parses out UNC
10677paths (e.g. \\host\mountpoint\dir\file) as "drive letters", so that
10678splitdrive() will \\host\mountpoint as the drive and \dir\file as the
10679path. ** EXPERIMENTAL **
10680
10681- Added a hack to the exit code so that if (1) the exit status is
10682nonzero and (2) we think we have our own DOS box (i.e. we're not
10683started from a command line shell), we print a message and wait for
10684the user to hit a key before the DOS box is closed.
10685
10686- Updated the installer to WISE 5.0g. Added a dialog warning about
10687the imminent Tcl installation. Added a dialog to specify the program
10688group name in the start menu. Upgraded the Tcl installer to Tcl
106898.0.4.
10690
10691Changes to intrinsics
10692---------------------
10693
10694- The repr() or str() of a module object now shows the __file__
10695attribute (i.e., the file which it was loaded), or the string
10696"(built-in)" if there is no __file__ attribute.
10697
10698- The range() function now avoids overflow during its calculations (if
10699at all possible).
10700
10701- New info string sys.hexversion, which is an integer encoding the
10702version in hexadecimal. In other words, hex(sys.hexversion) ==
107030x010502b2 for Python 1.5.2b2.
10704
10705New or improved ports
10706---------------------
10707
10708- Support for Nextstep descendants (future Mac systems).
10709
10710- Improved BeOS support.
10711
10712- Support dynamic loading of shared libraries on NetBSD platforms that
10713use ELF (i.e., MIPS and Alpha systems).
10714
10715Configuration/build changes
10716---------------------------
10717
10718- The Lib/test directory is no longer included in the default module
10719search path (sys.path) -- "test" has been a package ever since 1.5.
10720
10721- Now using autoconf 2.13.
10722
10723New library modules
10724-------------------
10725
10726- New library modules asyncore and asynchat: these form Sam Rushing's
10727famous asynchronous socket library. Sam has gracefully allowed me to
10728incorporate these in the standard Python library.
10729
10730- New module statvfs contains indexing constants for [f]statvfs()
10731return tuple.
10732
10733Changes to the library
10734----------------------
10735
10736- The wave module (platform-independent support for Windows sound
10737files) has been fixed to actually make it work.
10738
10739- The sunau module (platform-independent support for Sun/NeXT sound
10740files) has been fixed to work across platforms. Also, a weird
10741encoding bug in the header of the audio test data file has been
10742corrected.
10743
10744- Fix a bug in the urllib module that occasionally tripped up
10745webchecker and other ftp retrieves.
10746
10747- ConfigParser's get() method now accepts an optional keyword argument
10748(vars) that is substituted on top of the defaults that were setup in
10749__init__. You can now also have recusive references in your
10750configuration file.
10751
10752- Some improvements to the Queue module, including a put_nowait()
10753module and an optional "block" second argument, to get() and put(),
10754defaulting to 1.
10755
10756- The updated xmllib module is once again compatible with the version
10757present in Python 1.5.1 (this was accidentally broken in 1.5.2b1).
10758
10759- The bdb module (base class for the debugger) now supports
10760canonicalizing pathnames used in breakpoints. The derived class must
10761override the new canonical() method for this to work. Also changed
10762clear_break() to the backwards compatible old signature, and added
10763clear_bpbynumber() for the new functionality.
10764
10765- In sgmllib (and hence htmllib), recognize attributes even if they
10766don't have space in front of them. I.e. '<a
10767name="foo"href="bar.html">' will now have two attributes recognized.
10768
10769- In the debugger (pdb), change clear syntax to support three
10770alternatives: clear; clear file:line; clear bpno bpno ...
10771
10772- The os.path module now pretends to be a submodule within the os
10773"package", so you can do things like "from os.path import exists".
10774
10775- The standard exceptions now have doc strings.
10776
10777- In the smtplib module, exceptions are now classes. Also avoid
10778inserting a non-standard space after "TO" in rcpt() command.
10779
10780- The rfc822 module's getaddrlist() method now uses all occurrences of
10781the specified header instead of just the first. Some other bugfixes
10782too (to handle more weird addresses found in a very large test set,
10783and to avoid crashes on certain invalid dates), and a small test
10784module has been added.
10785
10786- Fixed bug in urlparse in the common-case code for HTTP URLs; it
10787would lose the query, fragment, and/or parameter information.
10788
10789- The sndhdr module no longer supports whatraw() -- it depended on a
10790rare extenral program.
10791
10792- The UserList module/class now supports the extend() method, like
10793real list objects.
10794
10795- The uu module now deals better with trailing garbage generated by
10796some broke uuencoders.
10797
10798- The telnet module now has an my_interact() method which uses threads
10799instead of select. The interact() method uses this by default on
10800Windows (where the single-threaded version doesn't work).
10801
10802- Add a class to mailbox.py for dealing with qmail directory
10803mailboxes. The test code was extended to notice these being used as
10804well.
10805
10806Changes to extension modules
10807----------------------------
10808
10809- Support for the [f]statvfs() system call, where it exists.
10810
10811- Fixed some bugs in cPickle where bad input could cause it to dump
10812core.
10813
10814- Fixed cStringIO to make the writelines() function actually work.
10815
10816- Added strop.expandtabs() so string.expandtabs() is now much faster.
10817
10818- Added fsync() and fdatasync(), if they appear to exist.
10819
10820- Support for "long files" (64-bit seek pointers).
10821
10822- Fixed a bug in the zlib module's flush() function.
10823
10824- Added access() system call. It returns 1 if access granted, 0 if
10825not.
10826
10827- The curses module implements an optional nlines argument to
10828w.scroll(). (It then calls wscrl(win, nlines) instead of scoll(win).)
10829
10830Changes to tools
10831----------------
10832
10833- Some changes to IDLE; see Tools/idle/NEWS.txt.
10834
10835- Latest version of Misc/python-mode.el included.
10836
10837Changes to Tkinter
10838------------------
10839
10840- Avoid tracebacks when an image is deleted after its root has been
10841destroyed.
10842
10843Changes to the Python/C API
10844---------------------------
10845
10846- When parentheses are used in a PyArg_Parse[Tuple]() call, any
10847sequence is now accepted, instead of requiring a tuple. This is in
10848line with the general trend towards accepting arbitrary sequences.
10849
10850- Added PyModule_GetFilename().
10851
10852- In PyNumber_Power(), remove unneeded and even harmful test for float
10853to the negative power (which is already and better done in
10854floatobject.c).
10855
10856- New version identification symbols; read patchlevel.h for info. The
10857version numbers are now exported by Python.h.
10858
10859- Rolled back the API version change -- it's back to 1007!
10860
10861- The frozenmain.c function calls PyInitFrozenExtensions().
10862
10863- Added 'N' format character to Py_BuildValue -- like 'O' but doesn't
10864INCREF.
10865
10866
10867======================================================================
10868
10869
10870From 1.5.2a2 to 1.5.2b1
10871=======================
10872
10873Changes to intrinsics
10874---------------------
10875
10876- New extension NotImplementedError, derived from RuntimeError. Not
10877used, but recommended use is for "abstract" methods to raise this.
10878
10879- The parser will now spit out a warning or error when -t or -tt is
10880used for parser input coming from a string, too.
10881
10882- The code generator now inserts extra SET_LINENO opcodes when
10883compiling multi-line argument lists.
10884
10885- When comparing bound methods, use identity test on the objects, not
10886equality test.
10887
10888New or improved ports
10889---------------------
10890
10891- Chris Herborth has redone his BeOS port; it now works on PowerPC
10892(R3/R4) and x86 (R4 only). Threads work too in this port.
10893
10894Renaming
10895--------
10896
10897- Thanks to Chris Herborth, the thread primitives now have proper Py*
10898names in the source code (they already had those for the linker,
10899through some smart macros; but the source still had the old, un-Py
10900names).
10901
10902Configuration/build changes
10903---------------------------
10904
10905- Improved support for FreeBSD/3.
10906
10907- Check for pthread_detach instead of pthread_create in libc.
10908
10909- The makesetup script now searches EXECINCLUDEPY before INCLUDEPY.
10910
10911- Misc/Makefile.pre.in now also looks at Setup.thread and Setup.local.
10912Otherwise modules such as thread didn't get incorporated in extensions.
10913
10914New library modules
10915-------------------
10916
10917- shlex.py by Eric Raymond provides a lexical analyzer class for
10918simple shell-like syntaxes.
10919
10920- netrc.py by Eric Raymond provides a parser for .netrc files. (The
10921undocumented Netrc class in ftplib.py is now obsolete.)
10922
10923- codeop.py is a new module that contains the compile_command()
10924function that was previously in code.py. This is so that JPython can
10925provide its own version of this function, while still sharing the
10926higher-level classes in code.py.
10927
10928- turtle.py is a new module for simple turtle graphics. I'm still
10929working on it; let me know if you use this to teach Python to children
10930or other novices without prior programming experience.
10931
10932Obsoleted library modules
10933-------------------------
10934
10935- poly.py and zmod.py have been moved to Lib/lib-old to emphasize
10936their status of obsoleteness. They don't do a particularly good job
10937and don't seem particularly relevant to the Python core.
10938
10939New tools
10940---------
10941
10942- I've added IDLE: my Integrated DeveLopment Environment for Python.
10943Requires Tcl/Tk (and Tkinter). Works on Windows and Unix (and should
10944work on Macintosh, but I haven't been able to test it there; it does
10945depend on new features in 1.5.2 and perhaps even new features in
109461.5.2b1, especially the new code module). This is very much a work in
10947progress. I'd like to hear how people like it compared to PTUI (or
10948any other IDE they are familiar with).
10949
10950- New tools by Barry Warsaw:
10951
10952 = audiopy: controls the Solaris Audio device
10953 = pynche: The PYthonically Natural Color and Hue Editor
10954 = world: Print mappings between country names and DNS country codes
10955
10956New demos
10957---------
10958
10959- Demo/scripts/beer.py prints the lyrics to an arithmetic drinking
10960song.
10961
10962- Demo/tkinter/guido/optionmenu.py shows how to do an option menu in
10963Tkinter. (By Fredrik Lundh -- not by me!)
10964
10965Changes to the library
10966----------------------
10967
10968- compileall.py now avoids recompiling .py files that haven't changed;
10969it adds a -f option to force recompilation.
10970
10971- New version of xmllib.py by Sjoerd Mullender (0.2 with latest
10972patches).
10973
10974- nntplib.py: statparse() no longer lowercases the message-id.
10975
10976- types.py: use type(__stdin__) for FileType.
10977
10978- urllib.py: fix translations for filenames with "funny" characters.
10979Patch by Sjoerd Mullender. Note that if you subclass one of the
10980URLopener classes, and you have copied code from the old urllib.py,
10981your subclass may stop working. A long-term solution is to provide
10982more methods so that you don't have to copy code.
10983
10984- cgi.py: In read_multi, allow a subclass to override the class we
10985instantiate when we create a recursive instance, by setting the class
10986variable 'FieldStorageClass' to the desired class. By default, this
10987is set to None, in which case we use self.__class__ (as before).
10988Also, a patch by Jim Fulton to pass additional arguments to recursive
10989calls to the FieldStorage constructor from its read_multi method.
10990
10991- UserList.py: In __getslice__, use self.__class__ instead of
10992UserList.
10993
10994- In SimpleHTTPServer.py, the server specified in test() should be
10995BaseHTTPServer.HTTPServer, in case the request handler should want to
10996reference the two attributes added by BaseHTTPServer.server_bind. (By
10997Jeff Rush, for Bobo). Also open the file in binary mode, so serving
10998images from a Windows box might actually work.
10999
11000- In CGIHTTPServer.py, the list of acceptable formats is -split-
11001on spaces but -joined- on commas, resulting in double commas
11002in the joined text. (By Jeff Rush.)
11003
11004- SocketServer.py, patch by Jeff Bauer: a minor change to declare two
11005new threaded versions of Unix Server classes, using the ThreadingMixIn
11006class: ThreadingUnixStreamServer, ThreadingUnixDatagramServer.
11007
11008- bdb.py: fix bomb on deleting a temporary breakpoint: there's no
11009method do_delete(); do_clear() was meant. By Greg Ward.
11010
11011- getopt.py: accept a non-list sequence for the long options (request
11012by Jack Jansen). Because it might be a common mistake to pass a
11013single string, this situation is treated separately. Also added
11014docstrings (copied from the library manual) and removed the (now
11015redundant) module comments.
11016
11017- tempfile.py: improvements to avoid security leaks.
11018
11019- code.py: moved compile_command() to new module codeop.py.
11020
11021- pickle.py: support pickle format 1.3 (binary float added). By Jim
11022Fulton. Also get rid of the undocumented obsolete Pickler dump_special
11023method.
11024
11025- uu.py: Move 'import sys' to top of module, as noted by Tim Peters.
11026
11027- imaplib.py: fix problem with some versions of IMAP4 servers that
11028choose to mix the case in their CAPABILITIES response.
11029
11030- cmp.py: use (f1, f2) as cache key instead of f1 + ' ' + f2. Noted
11031by Fredrik Lundh.
11032
11033Changes to extension modules
11034----------------------------
11035
11036- More doc strings for several modules were contributed by Chris
11037Petrilli: math, cmath, fcntl.
11038
11039- Fixed a bug in zlibmodule.c that could cause core dumps on
11040decompression of rarely occurring input.
11041
11042- cPickle.c: new version from Jim Fulton, with Open Source copyright
11043notice. Also, initialize self->safe_constructors early on to prevent
11044crash in early dealloc.
11045
11046- cStringIO.c: new version from Jim Fulton, with Open Source copyright
11047notice. Also fixed a core dump in cStringIO.c when doing seeks.
11048
11049- mpzmodule.c: fix signed character usage in mpz.mpz(stringobjecty).
11050
11051- readline.c: Bernard Herzog pointed out that rl_parse_and_bind
11052modifies its argument string (bad function!), so we make a temporary
11053copy.
11054
11055- sunaudiodev.c: Barry Warsaw added more smarts to get the device and
11056control pseudo-device, per audio(7I).
11057
11058Changes to tools
11059----------------
11060
11061- New, improved version of Barry Warsaw's Misc/python-mode.el (editing
11062support for Emacs).
11063
11064- tabnanny.py: added a -q ('quiet') option to tabnanny, which causes
11065only the names of offending files to be printed.
11066
11067- freeze: when printing missing modules, also print the module they
11068were imported from.
11069
11070- untabify.py: patch by Detlef Lannert to implement -t option
11071(set tab size).
11072
11073Changes to Tkinter
11074------------------
11075
11076- grid_bbox(): support new Tk API: grid bbox ?column row? ?column2
11077row2?
11078
11079- _tkinter.c: RajGopal Srinivasan noted that the latest code (1.5.2a2)
11080doesn't work when running in a non-threaded environment. He added
11081some #ifdefs that fix this.
11082
11083Changes to the Python/C API
11084---------------------------
11085
11086- Bumped API version number to 1008 -- enough things have changed!
11087
11088- There's a new macro, PyThreadState_GET(), which does the same work
11089as PyThreadState_Get() without the overhead of a function call (it
11090also avoids the error check). The two top calling locations of
11091PyThreadState_Get() have been changed to use this macro.
11092
11093- All symbols intended for export from a DLL or shared library are now
11094marked as such (with the DL_IMPORT() macro) in the header file that
11095declares them. This was needed for the BeOS port, and should also
11096make some other ports easier. The PC port no longer needs the file
11097with exported symbols (PC/python_nt.def). There's also a DL_EXPORT
11098macro which is only used for init methods in extension modules, and
11099for Py_Main().
11100
11101Invisible changes to internals
11102------------------------------
11103
11104- Fixed a bug in new_buffersize() in fileobject.c which could
11105return a buffer size that was way too large.
11106
11107- Use PySys_WriteStderr instead of fprintf in most places.
11108
11109- dictobject.c: remove dead code discovered by Vladimir Marangozov.
11110
11111- tupleobject.c: make tuples less hungry -- an extra item was
11112allocated but never used. Tip by Vladimir Marangozov.
11113
11114- mymath.h: Metrowerks PRO4 finally fixes the hypot snafu. (Jack
11115Jansen)
11116
11117- import.c: Jim Fulton fixes a reference count bug in
11118PyEval_GetGlobals.
11119
11120- glmodule.c: check in the changed version after running the stubber
11121again -- this solves the conflict with curses over the 'clear' entry
11122point much nicer. (Jack Jansen had checked in the changes to cstubs
11123eons ago, but I never regenrated glmodule.c :-( )
11124
11125- frameobject.c: fix reference count bug in PyFrame_New. Vladimir
11126Marangozov.
11127
11128- stropmodule.c: add a missing DECREF in an error exit. Submitted by
11129Jonathan Giddy.
11130
11131
11132======================================================================
11133
11134
11135From 1.5.2a1 to 1.5.2a2
11136=======================
11137
11138General
11139-------
11140
11141- It is now a syntax error to have a function argument without a
11142default following one with a default.
11143
11144- __file__ is now set to the .py file if it was parsed (it used to
11145always be the .pyc/.pyo file).
11146
11147- Don't exit with a fatal error during initialization when there's a
11148problem with the exceptions.py module.
11149
11150- New environment variable PYTHONOPTIMIZE can be used to set -O.
11151
11152- New version of python-mode.el for Emacs.
11153
11154Miscellaneous fixed bugs
11155------------------------
11156
11157- No longer print the (confusing) error message about stack underflow
11158while compiling.
11159
11160- Some threading and locking bugs fixed.
11161
11162- When errno is zero, report "Error", not "Success".
11163
11164Documentation
11165-------------
11166
11167- Documentation will be released separately.
11168
11169- Doc strings added to array and md5 modules by Chris Petrilli.
11170
11171Ports and build procedure
11172-------------------------
11173
11174- Stop installing when a move or copy fails.
11175
11176- New version of the OS/2 port code by Jeff Rush.
11177
11178- The makesetup script handles absolute filenames better.
11179
11180- The 'new' module is now enabled by default in the Setup file.
11181
11182- I *think* I've solved the problem with the Linux build blowing up
11183sometimes due to a conflict between sigcheck/intrcheck and
11184signalmodule.
11185
11186Built-in functions
11187------------------
11188
11189- The second argument to apply() can now be any sequence, not just a
11190tuple.
11191
11192Built-in types
11193--------------
11194
11195- Lists have a new method: L1.extend(L2) is equivalent to the common
11196idiom L1[len(L1):] = L2.
11197
11198- Better error messages when a sequence is indexed with a non-integer.
11199
11200- Bettter error message when calling a non-callable object (include
11201the type in the message).
11202
11203Python services
11204---------------
11205
11206- New version of cPickle.c fixes some bugs.
11207
11208- pickle.py: improved instantiation error handling.
11209
11210- code.py: reworked quite a bit. New base class
11211InteractiveInterpreter and derived class InteractiveConsole. Fixed
11212several problems in compile_command().
11213
11214- py_compile.py: print error message and continue on syntax errors.
11215Also fixed an old bug with the fstat code (it was never used).
11216
11217- pyclbr.py: support submodules of packages.
11218
11219String Services
11220---------------
11221
11222- StringIO.py: raise the right exception (ValueError) for attempted
11223I/O on closed StringIO objects.
11224
11225- re.py: fixed a bug in subn(), which caused .groups() to fail inside
11226the replacement function called by sub().
11227
11228- The struct module has a new format 'P': void * in native mode.
11229
11230Generic OS Services
11231-------------------
11232
11233- Module time: Y2K robustness. 2-digit year acceptance depends on
11234value of time.accept2dyear, initialized from env var PYTHONY2K,
11235default 0. Years 00-68 mean 2000-2068, while 69-99 mean 1969-1999
11236(POSIX or X/Open recommendation).
11237
11238- os.path: normpath(".//x") should return "x", not "/x".
11239
11240- getpass.py: fall back on default_getpass() when sys.stdin.fileno()
11241doesn't work.
11242
11243- tempfile.py: regenerate the template after a fork() call.
11244
11245Optional OS Services
11246--------------------
11247
11248- In the signal module, disable restarting interrupted system calls
11249when we have siginterrupt().
11250
11251Debugger
11252--------
11253
11254- No longer set __args__; this feature is no longer supported and can
11255affect the debugged code.
11256
11257- cmd.py, pdb.py and bdb.py have been overhauled by Richard Wolff, who
11258added aliases and some other useful new features, e.g. much better
11259breakpoint support: temporary breakpoint, disabled breakpoints,
11260breakpoints with ignore counts, and conditions; breakpoints can be set
11261on a file before it is loaded.
11262
11263Profiler
11264--------
11265
11266- Changes so that JPython can use it. Also fix the calibration code
11267so it actually works again
11268.
11269Internet Protocols and Support
11270------------------------------
11271
11272- imaplib.py: new version from Piers Lauder.
11273
11274- smtplib.py: change sendmail() method to accept a single string or a
11275list or strings as the destination (commom newbie mistake).
11276
11277- poplib.py: LIST with a msg argument fixed.
11278
11279- urlparse.py: some optimizations for common case (http).
11280
11281- urllib.py: support content-length in info() for ftp protocol;
11282support for a progress meter through a third argument to
11283urlretrieve(); commented out gopher test (the test site is dead).
11284
11285Internet Data handling
11286----------------------
11287
11288- sgmllib.py: support tags with - or . in their name.
11289
11290- mimetypes.py: guess_type() understands 'data' URLs.
11291
11292Restricted Execution
11293--------------------
11294
11295- The classes rexec.RModuleLoader and rexec.RModuleImporter no
11296longer exist.
11297
11298Tkinter
11299-------
11300
11301- When reporting an exception, store its info in sys.last_*. Also,
11302write all of it to stderr.
11303
11304- Added NS, EW, and NSEW constants, for grid's sticky option.
11305
11306- Fixed last-minute bug in 1.5.2a1 release: need to include "mytime.h".
11307
11308- Make bind variants without a sequence return a tuple of sequences
11309(formerly it returned a string, which wasn't very convenient).
11310
11311- Add image commands to the Text widget (these are new in Tk 8.0).
11312
11313- Added new listbox and canvas methods: {xview,yview}_{scroll,moveto}.)
11314
11315- Improved the thread code (but you still can't call update() from
11316another thread on Windows).
11317
11318- Fixed unnecessary references to _default_root in the new dialog
11319modules.
11320
11321- Miscellaneous problems fixed.
11322
11323
11324Windows General
11325---------------
11326
11327- Call LoadLibraryEx(..., ..., LOAD_WITH_ALTERED_SEARCH_PATH) to
11328search for dependent dlls in the directory containing the .pyd.
11329
11330- In debugging mode, call DebugBreak() in Py_FatalError().
11331
11332Windows Installer
11333-----------------
11334
11335- Install zlib.dll in the DLLs directory instead of in the win32
11336system directory, to avoid conflicts with other applications that have
11337their own zlib.dll.
11338
11339Test Suite
11340----------
11341
11342- test_long.py: new test for long integers, by Tim Peters.
11343
11344- regrtest.py: improved so it can be used for other test suites as
11345well.
11346
11347- test_strftime.py: use re to compare test results, to support legal
11348variants (e.g. on Linux).
11349
11350Tools and Demos
11351---------------
11352
11353- Four new scripts in Tools/scripts: crlf.py and lfcr.py (to
11354remove/add Windows style '\r\n' line endings), untabify.py (to remove
11355tabs), and rgrep.yp (reverse grep).
11356
11357- Improvements to Tools/freeze/. Each Python module is now written to
11358its own C file. This prevents some compilers or assemblers from
11359blowing up on large frozen programs, and saves recompilation time if
11360only a few modules are changed. Other changes too, e.g. new command
11361line options -x and -i.
11362
11363- Much improved (and smaller!) version of Tools/scripts/mailerdaemon.py.
11364
11365Python/C API
11366------------
11367
11368- New mechanism to support extensions of the type object while
11369remaining backward compatible with extensions compiled for previous
11370versions of Python 1.5. A flags field indicates presence of certain
11371fields.
11372
11373- Addition to the buffer API to differentiate access to bytes and
113748-bit characters (in anticipation of Unicode characters).
11375
11376- New argument parsing format t# ("text") to indicate 8-bit
11377characters; s# simply means 8-bit bytes, for backwards compatibility.
11378
11379- New object type, bufferobject.c is an example and can be used to
11380create buffers from memory.
11381
11382- Some support for 64-bit longs, including some MS platforms.
11383
11384- Many calls to fprintf(stderr, ...) have been replaced with calls to
11385PySys_WriteStderr(...).
11386
11387- The calling context for PyOS_Readline() has changed: it must now be
11388called with the interpreter lock held! It releases the lock around
11389the call to the function pointed to by PyOS_ReadlineFunctionPointer
11390(default PyOS_StdioReadline()).
11391
11392- New APIs PyLong_FromVoidPtr() and PyLong_AsVoidPtr().
11393
11394- Renamed header file "thread.h" to "pythread.h".
11395
11396- The code string of code objects may now be anything that supports the
11397buffer API.
11398
11399
11400======================================================================
11401
11402
11403From 1.5.1 to 1.5.2a1
11404=====================
11405
11406General
11407-------
11408
11409- When searching for the library, a landmark that is a compiled module
11410(string.pyc or string.pyo) is also accepted.
11411
11412- When following symbolic links to the python executable, use a loop
11413so that a symlink to a symlink can work.
11414
11415- Added a hack so that when you type 'quit' or 'exit' at the
11416interpreter, you get a friendly explanation of how to press Ctrl-D (or
11417Ctrl-Z) to exit.
11418
11419- New and improved Misc/python-mode.el (Python mode for Emacs).
11420
11421- Revert a new feature in Unix dynamic loading: for one or two
11422revisions, modules were loaded using the RTLD_GLOBAL flag. It turned
11423out to be a bad idea.
11424
11425Miscellaneous fixed bugs
11426------------------------
11427
11428- All patches on the patch page have been integrated. (But much more
11429has been done!)
11430
11431- Several memory leaks plugged (e.g. the one for classes with a
11432__getattr__ method).
11433
11434- Removed the only use of calloc(). This triggered an obscure bug on
11435multiprocessor Sparc Solaris 2.6.
11436
11437- Fix a peculiar bug that would allow "import sys.time" to succeed
11438(believing the built-in time module to be a part of the sys package).
11439
11440- Fix a bug in the overflow checking when converting a Python long to
11441a C long (failed to convert -2147483648L, and some other cases).
11442
11443Documentation
11444-------------
11445
11446- Doc strings have been added to many extension modules: __builtin__,
11447errno, select, signal, socket, sys, thread, time. Also to methods of
11448list objects (try [].append.__doc__). A doc string on a type will now
11449automatically be propagated to an instance if the instance has methods
11450that are accessed in the usual way.
11451
11452- The documentation has been expanded and the formatting improved.
11453(Remember that the documentation is now unbundled and has its own
11454release cycle though; see http://www.python.org/doc/.)
11455
11456- Added Misc/Porting -- a mini-FAQ on porting to a new platform.
11457
11458Ports and build procedure
11459-------------------------
11460
11461- The BeOS port is now integrated. Courtesy Chris Herborth.
11462
11463- Symbol files for FreeBSD 2.x and 3.x have been contributed
11464(Lib/plat-freebsd[23]/*).
11465
11466- Support HPUX 10.20 DCE threads.
11467
11468- Finally fixed the configure script so that (on SGI) if -OPT:Olimit=0
11469works, it won't also use -Olimit 1500 (which gives a warning for every
11470file). Also support the SGI_ABI environment variable better.
11471
11472- The makesetup script now understands absolute pathnames ending in .o
11473in the module -- it assumes it's a file for which we have no source.
11474
11475- Other miscellaneous improvements to the configure script and
11476Makefiles.
11477
11478- The test suite now uses a different sound sample.
11479
11480Built-in functions
11481------------------
11482
11483- Better checks for invalid input to int(), long(), string.atoi(),
11484string.atol(). (Formerly, a sign without digits would be accepted as
11485a legal ways to spell zero.)
11486
11487- Changes to map() and filter() to use the length of a sequence only
11488as a hint -- if an IndexError happens earlier, take that. (Formerly,
11489this was considered an error.)
11490
11491- Experimental feature in getattr(): a third argument can specify a
11492default (instead of raising AttributeError).
11493
11494- Implement round() slightly different, so that for negative ndigits
11495no additional errors happen in the last step.
11496
11497- The open() function now adds the filename to the exception when it
11498fails.
11499
11500Built-in exceptions
11501-------------------
11502
11503- New standard exceptions EnvironmentError and PosixError.
11504EnvironmentError is the base class for IOError and PosixError;
11505PosixError is the same as os.error. All this so that either exception
11506class can be instantiated with a third argument indicating a filename.
11507The built-in function open() and most os/posix functions that take a
11508filename argument now use this.
11509
11510Built-in types
11511--------------
11512
11513- List objects now have an experimental pop() method; l.pop() returns
11514and removes the last item; l.pop(i) returns and removes the item at
11515i. Also, the sort() method is faster again. Sorting is now also
11516safer: it is impossible for the sorting function to modify the list
11517while the sort is going on (which could cause core dumps).
11518
11519- Changes to comparisons: numbers are now smaller than any other type.
11520This is done to prevent the circularity where [] < 0L < 1 < [] is
11521true. As a side effect, cmp(None, 0) is now positive instead of
11522negative. This *shouldn't* affect any working code, but I've found
11523that the change caused several "sleeping" bugs to become active, so
11524beware!
11525
11526- Instance methods may now have other callable objects than just
11527Python functions as their im_func. Use new.instancemethod() or write
11528your own C code to create them; new.instancemethod() may be called
11529with None for the instance to create an unbound method.
11530
11531- Assignment to __name__, __dict__ or __bases__ of a class object is
11532now allowed (with stringent type checks); also allow assignment to
11533__getattr__ etc. The cached values for __getattr__ etc. are
11534recomputed after such assignments (but not for derived classes :-( ).
11535
11536- Allow assignment to some attributes of function objects: func_code,
11537func_defaults and func_doc / __doc__. (With type checks except for
11538__doc__ / func_doc .)
11539
11540Python services
11541---------------
11542
11543- New tests (in Lib/test): reperf.py (regular expression benchmark),
11544sortperf.py (list sorting benchmark), test_MimeWriter.py (test case
11545for the MimeWriter module).
11546
11547- Generalized test/regrtest.py so that it is useful for testing other
11548packages.
11549
11550- The ihooks.py module now understands package imports.
11551
11552- In code.py, add a class that subsumes Fredrik Lundh's
11553PythonInterpreter class. The interact() function now uses this.
11554
11555- In rlcompleter.py, in completer(), return None instead of raising an
11556IndexError when there are no more completions left.
11557
11558- Fixed the marshal module to test for certain common kinds of invalid
11559input. (It's still not foolproof!)
11560
11561- In the operator module, add an alias (now the preferred name)
11562"contains" for "sequenceincludes".
11563
11564String Services
11565---------------
11566
11567- In the string and strop modules, in the replace() function, treat an
11568empty pattern as an error (since it's not clear what was meant!).
11569
11570- Some speedups to re.py, especially the string substitution and split
11571functions. Also added new function/method findall(), to find all
11572occurrences of a given substring.
11573
11574- In cStringIO, add better argument type checking and support the
11575readonly 'closed' attribute (like regular files).
11576
11577- In the struct module, unsigned 1-2 byte sized formats no longer
11578result in long integer values.
11579
11580Miscellaneous services
11581----------------------
11582
11583- In whrandom.py, added new method and function randrange(), same as
11584choice(range(start, stop, step)) but faster. This addresses the
11585problem that randint() was accidentally defined as taking an inclusive
11586range. Also, randint(a, b) is now redefined as randrange(a, b+1),
11587adding extra range and type checking to its arguments!
11588
11589- Add some semi-thread-safety to random.gauss() (it used to be able to
11590crash when invoked from separate threads; now the worst it can do is
11591give a duplicate result occasionally).
11592
11593- Some restructuring and generalization done to cmd.py.
11594
11595- Major upgrade to ConfigParser.py; converted to using 're', added new
11596exceptions, support underscore in section header and option name. No
11597longer add 'name' option to every section; instead, add '__name__'.
11598
11599- In getpass.py, don't use raw_input() to ask for the password -- we
11600don't want it to show up in the readline history! Also don't catch
11601interrupts (the try-finally already does all necessary cleanup).
11602
11603Generic OS Services
11604-------------------
11605
11606- New functions in os.py: makedirs(), removedirs(), renames(). New
11607variable: linesep (the line separator as found in binary files,
11608i.e. '\n' on Unix, '\r\n' on DOS/Windows, '\r' on Mac. Do *not* use
11609this with files opened in (default) text mode; the line separator used
11610will always be '\n'!
11611
11612- Changes to the 'os.path' submodule of os.py: added getsize(),
11613getmtime(), getatime() -- these fetch the most popular items from the
11614stat return tuple.
11615
11616- In the time module, add strptime(), if it exists. (This parses a
11617time according to a format -- the inverse of strftime().) Also,
11618remove the call to mktime() from strftime() -- it messed up the
11619formatting of some non-local times.
11620
11621- In the socket module, added a new function gethostbyname_ex().
11622Also, don't use #ifdef to test for some symbols that are enums on some
11623platforms (and should exist everywhere).
11624
11625Optional OS Services
11626--------------------
11627
11628- Some fixes to gzip.py. In particular, the readlines() method now
11629returns the lines *with* trailing newline characters, like readlines()
11630of regular file objects. Also, it didn't work together with cPickle;
11631fixed that.
11632
11633- In whichdb.py, support byte-swapped dbhash (bsddb) files.
11634
11635- In anydbm.py, look at the type of an existing database to determine
11636which module to use to open it. (The anydbm.error exception is now a
11637tuple.)
11638
11639Unix Services
11640-------------
11641
11642- In the termios module, in tcsetattr(), initialize the structure vy
11643calling tcgetattr().
11644
11645- Added some of the "wait status inspection" macros as functions to
11646the posix module (and thus to the os module): WEXITSTATUS(),
11647WIFEXITED(), WIFSIGNALED(), WIFSTOPPED(), WSTOPSIG(), WTERMSIG().
11648
11649- In the syslog module, make the default facility more intuitive
11650(matching the docs).
11651
11652Debugger
11653--------
11654
11655- In pdb.py, support for setting breaks on files/modules that haven't
11656been loaded yet.
11657
11658Internet Protocols and Support
11659------------------------------
11660
11661- Changes in urllib.py; sped up unquote() and quote(). Fixed an
11662obscure bug in quote_plus(). Added urlencode(dict) -- convenience
11663function for sending a POST request with urlopen(). Use the getpass
11664module to ask for a password. Rewrote the (test) main program so that
11665when used as a script, it can retrieve one or more URLs to stdout.
11666Use -t to run the self-test. Made the proxy code work again.
11667
11668- In cgi.py, treat "HEAD" the same as "GET", so that CGI scripts don't
11669fail when someone asks for their HEAD. Also, for POST, set the
11670default content-type to application/x-www-form-urlencoded. Also, in
11671FieldStorage.__init__(), when method='GET', always get the query
11672string from environ['QUERY_STRING'] or sys.argv[1] -- ignore an
11673explicitly passed in fp.
11674
11675- The smtplib.py module now supports ESMTP and has improved standard
11676compliance, for picky servers.
11677
11678- Improved imaplib.py.
11679
11680- Fixed UDP support in SocketServer.py (it never worked).
11681
11682- Fixed a small bug in CGIHTTPServer.py.
11683
11684Internet Data handling
11685----------------------
11686
11687- In rfc822.py, add a new class AddressList. Also support a new
11688overridable method, isheader(). Also add a get() method similar to
11689dictionaries (and make getheader() an alias for it). Also, be smarter
11690about seekable (test whether fp.tell() works) and test for presence of
11691unread() method before trying seeks.
11692
11693- In sgmllib.py, restore the call to report_unbalanced() that was lost
11694long ago. Also some other improvements: handle <? processing
11695instructions >, allow . and - in entity names, and allow \r\n as line
11696separator.
11697
11698- Some restructuring and generalization done to multifile.py; support
11699a 'seekable' flag.
11700
11701Restricted Execution
11702--------------------
11703
11704- Improvements to rexec.py: package support; support a (minimal)
11705sys.exc_info(). Also made the (test) main program a bit fancier (you
11706can now use it to run arbitrary Python scripts in restricted mode).
11707
11708Tkinter
11709-------
11710
11711- On Unix, Tkinter can now safely be used from a multi-threaded
11712application. (Formerly, no threads would make progress while
11713Tkinter's mainloop() was active, because it didn't release the Python
11714interpreter lock.) Unfortunately, on Windows, threads other than the
11715main thread should not call update() or update_idletasks() because
11716this will deadlock the application.
11717
11718- An interactive interpreter that uses readline and Tkinter no longer
11719uses up all available CPU time.
11720
11721- Even if readline is not used, Tk windows created in an interactive
11722interpreter now get continuously updated. (This even works in Windows
11723as long as you don't hit a key.)
11724
11725- New demos in Demo/tkinter/guido/: brownian.py, redemo.py, switch.py.
11726
11727- No longer register Tcl_finalize() as a low-level exit handler. It
11728may call back into Python, and that's a bad idea.
11729
11730- Allow binding of Tcl commands (given as a string).
11731
11732- Some minor speedups; replace explicitly coded getint() with int() in
11733most places.
11734
11735- In FileDialog.py, remember the directory of the selected file, if
11736given.
11737
11738- Change the names of all methods in the Wm class: they are now
11739wm_title(), etc. The old names (title() etc.) are still defined as
11740aliases.
11741
11742- Add a new method of interpreter objects, interpaddr(). This returns
11743the address of the Tcl interpreter object, as an integer. Not very
11744useful for the Python programmer, but this can be called by another C
11745extension that needs to make calls into the Tcl/Tk C API and needs to
11746get the address of the Tcl interpreter object. A simple cast of the
11747return value to (Tcl_Interp *) will do the trick.
11748
11749Windows General
11750---------------
11751
11752- Don't insist on proper case for module source files if the filename
11753is all uppercase (e.g. FOO.PY now matches foo; but FOO.py still
11754doesn't). This should address problems with this feature on
11755oldfashioned filesystems (Novell servers?).
11756
11757Windows Library
11758---------------
11759
11760- os.environ is now all uppercase, but accesses are case insensitive,
11761and the putenv() calls made as a side effect of changing os.environ
11762are case preserving.
11763
11764- Removed samefile(), sameopenfile(), samestat() from os.path (aka
11765ntpath.py) -- these cannot be made to work reliably (at least I
11766wouldn't know how).
11767
11768- Fixed os.pipe() so that it returns file descriptors acceptable to
11769os.read() and os.write() (like it does on Unix), rather than Windows
11770file handles.
11771
11772- Added a table of WSA error codes to socket.py.
11773
11774- In the select module, put the (huge) file descriptor arrays on the
11775heap.
11776
11777- The getpass module now raises KeyboardInterrupt when it sees ^C.
11778
11779- In mailbox.py, fix tell/seek when using files opened in text mode.
11780
11781- In rfc822.py, fix tell/seek when using files opened in text mode.
11782
11783- In the msvcrt extension module, release the interpreter lock for
11784calls that may block: _locking(), _getch(), _getche(). Also fix a
11785bogus error return when open_osfhandle() doesn't have the right
11786argument list.
11787
11788Windows Installer
11789-----------------
11790
11791- The registry key used is now "1.5" instead of "1.5.x" -- so future
11792versions of 1.5 and Mark Hammond's win32all installer don't need to be
11793resynchronized.
11794
11795Windows Tools
11796-------------
11797
11798- Several improvements to freeze specifically for Windows.
11799
11800Windows Build Procedure
11801-----------------------
11802
11803- The VC++ project files and the WISE installer have been moved to the
11804PCbuild subdirectory, so they are distributed in the same subdirectory
11805where they must be used. This avoids confusion.
11806
11807- New project files for Windows 3.1 port by Jim Ahlstrom.
11808
11809- Got rid of the obsolete subdirectory PC/setup_nt/.
11810
11811- The projects now use distinct filenames for the .exe, .dll, .lib and
11812.pyd files built in debug mode (by appending "_d" to the base name,
11813before the extension). This makes it easier to switch between the two
11814and get the right versions. There's a pragma in config.h that directs
11815the linker to include the appropriate .lib file (so python15.lib no
11816longer needs to be explicit in your project).
11817
11818- The installer now installs more files (e.g. config.h). The idea is
11819that you shouldn't need the source distribution if you want build your
11820own extensions in C or C++.
11821
11822Tools and Demos
11823---------------
11824
11825- New script nm2def.py by Marc-Andre Lemburg, to construct
11826PC/python_nt.def automatically (some hand editing still required).
11827
11828- New tool ndiff.py: Tim Peters' text diffing tool.
11829
11830- Various and sundry improvements to the freeze script.
11831
11832- The script texi2html.py (which was part of the Doc tree but is no
11833longer used there) has been moved to the Tools/scripts subdirectory.
11834
11835- Some generalizations in the webchecker code. There's now a
11836primnitive gui for websucker.py: wsgui.py. (In Tools/webchecker/.)
11837
11838- The ftpmirror.py script now handles symbolic links properly, and
11839also files with multiple spaces in their names.
11840
11841- The 1.5.1 tabnanny.py suffers an assert error if fed a script whose
11842last line is both indented and lacks a newline. This is now fixed.
11843
11844Python/C API
11845------------
11846
11847- Added missing prototypes for PyEval_CallFunction() and
11848PyEval_CallMethod().
11849
11850- New macro PyList_SET_ITEM().
11851
11852- New macros to access object members for PyFunction, PyCFunction
11853objects.
11854
11855- New APIs PyImport_AppendInittab() an PyImport_ExtendInittab() to
11856dynamically add one or many entries to the table of built-in modules.
11857
11858- New macro Py_InitModule3(name, methods, doc) which calls
11859Py_InitModule4() with appropriate arguments. (The -4 variant requires
11860you to pass an obscure version number constant which is always the same.)
11861
11862- New APIs PySys_WriteStdout() and PySys_WriteStderr() to write to
11863sys.stdout or sys.stderr using a printf-like interface. (Used in
11864_tkinter.c, for example.)
11865
11866- New APIs for conversion between Python longs and C 'long long' if
11867your compiler supports it.
11868
11869- PySequence_In() is now called PySequence_Contains().
11870(PySequence_In() is still supported for b/w compatibility; it is
11871declared obsolete because its argument order is confusing.)
11872
11873- PyDict_GetItem() and PyDict_GetItemString() are changed so that they
11874*never* raise an exception -- (even if the hash() fails, simply clear
11875the error). This was necessary because there is lots of code out
11876there that already assumes this.
11877
11878- Changes to PySequence_Tuple() and PySequence_List() to use the
11879length of a sequence only as a hint -- if an IndexError happens
11880earlier, take that. (Formerly, this was considered an error.)
11881
11882- Reformatted abstract.c to give it a more familiar "look" and fixed
11883many error checking bugs.
11884
11885- Add NULL pointer checks to all calls of a C function through a type
11886object and extensions (e.g. nb_add).
11887
11888- The code that initializes sys.path now calls Py_GetPythonHome()
11889instead of getenv("PYTHONHOME"). This, together with the new API
11890Py_SetPythonHome(), makes it easier for embedding applications to
11891change the notion of Python's "home" directory (where the libraries
11892etc. are sought).
11893
11894- Fixed a very old bug in the parsing of "O?" format specifiers.
11895
11896
11897======================================================================
11898
11899
Guido van Rossumf2eac992000-09-04 17:24:24 +000011900========================================
11901==> Release 1.5.1 (October 31, 1998) <==
11902========================================
11903
Guido van Rossum439d1fa1998-12-21 21:41:14 +000011904From 1.5 to 1.5.1
11905=================
11906
11907General
11908-------
11909
11910- The documentation is now unbundled. It has also been extensively
11911modified (mostly to implement a new and more uniform formatting
11912style). We figure that most people will prefer to download one of the
11913preformatted documentation sets (HTML, PostScript or PDF) and that
11914only a minority have a need for the LaTeX or FrameMaker sources. Of
11915course, the unbundled documentation sources still released -- just not
11916in the same archive file, and perhaps not on the same date.
11917
11918- All bugs noted on the errors page (and many unnoted) are fixed. All
11919new bugs take their places.
11920
11921- No longer a core dump when attempting to print (or repr(), or str())
11922a list or dictionary that contains an instance of itself; instead, the
11923recursive entry is printed as [...] or {...}. See Py_ReprEnter() and
11924Py_ReprLeave() below. Comparisons of such objects still go beserk,
11925since this requires a different kind of fix; fortunately, this is a
11926less common scenario in practice.
11927
11928Syntax change
11929-------------
11930
11931- The raise statement can now be used without arguments, to re-raise
11932a previously set exception. This should be used after catching an
11933exception with an except clause only, either in the except clause or
11934later in the same function.
11935
11936Import and module handling
11937--------------------------
11938
11939- The implementation of import has changed to use a mutex (when
11940threading is supported). This means that when two threads
11941simultaneously import the same module, the import statements are
11942serialized. Recursive imports are not affected.
11943
11944- Rewrote the finalization code almost completely, to be much more
11945careful with the order in which modules are destroyed. Destructors
11946will now generally be able to reference built-in names such as None
11947without trouble.
11948
11949- Case-insensitive platforms such as Mac and Windows require the case
11950of a module's filename to match the case of the module name as
11951specified in the import statement (see below).
11952
11953- The code for figuring out the default path now distinguishes between
11954files, modules, executable files, and directories. When expecting a
11955module, we also look for the .pyc or .pyo file.
11956
11957Parser/tokenizer changes
11958------------------------
11959
11960- The tokenizer can now warn you when your source code mixes tabs and
11961spaces for indentation in a manner that depends on how much a tab is
11962worth in spaces. Use "python -t" or "python -v" to enable this
11963option. Use "python -tt" to turn the warnings into errors. (See also
11964tabnanny.py and tabpolice.py below.)
11965
11966- Return unsigned characters from tok_nextc(), so '\377' isn't
11967mistaken for an EOF character.
11968
11969- Fixed two pernicious bugs in the tokenizer that only affected AIX.
11970One was actually a general bug that was triggered by AIX's smaller I/O
11971buffer size. The other was a bug in the AIX optimizer's loop
11972unrolling code; swapping two statements made the problem go away.
11973
11974Tools, demos and miscellaneous files
11975------------------------------------
11976
11977- There's a new version of Misc/python-mode.el (the Emacs mode for
11978Python) which is much smarter about guessing the indentation style
11979used in a particular file. Lots of other cool features too!
11980
11981- There are two new tools in Tools/scripts: tabnanny.py and
11982tabpolice.py, implementing two different ways of checking whether a
11983file uses indentation in a way that is sensitive to the interpretation
11984of a tab. The preferred module is tabnanny.py (by Tim Peters).
11985
11986- Some new demo programs:
11987
11988 Demo/tkinter/guido/paint.py -- Dave Mitchell
11989 Demo/sockets/unixserver.py -- Piet van Oostrum
11990
11991
11992- Much better freeze support. The freeze script can now freeze
11993hierarchical module names (with a corresponding change to import.c),
11994and has a few extra options (e.g. to suppress freezing specific
11995modules). It also does much more on Windows NT.
11996
11997- Version 1.0 of the faq wizard is included (only very small changes
11998since version 0.9.0).
11999
12000- New feature for the ftpmirror script: when removing local files
12001(i.e., only when -r is used), do a recursive delete.
12002
12003Configuring and building Python
12004-------------------------------
12005
12006- Get rid of the check for -linet -- recent Sequent Dynix systems don't
12007need this any more and apparently it screws up their configuration.
12008
12009- Some changes because gcc on SGI doesn't support '-all'.
12010
12011- Changed the build rules to use $(LIBRARY) instead of
12012 -L.. -lpython$(VERSION)
12013since the latter trips up the SunOS 4.1.x linker (sigh).
12014
12015- Fix the bug where the '# dgux is broken' comment in the Makefile
12016tripped over Make on some platforms.
12017
12018- Changes for AIX: install the python.exp file; properly use
12019$(srcdir); the makexp_aix script now removes C++ entries of the form
12020Class::method.
12021
12022- Deleted some Makefile targets only used by the (long obsolete)
12023gMakefile hacks.
12024
12025Extension modules
12026-----------------
12027
12028- Performance and threading improvements to the socket and bsddb
12029modules, by Christopher Lindblad of Infoseek.
12030
12031- Added operator.__not__ and operator.not_.
12032
12033- In the thread module, when a thread exits due to an unhandled
12034exception, don't store the exception information in sys.last_*; it
12035prevents proper calling of destructors of local variables.
12036
12037- Fixed a number of small bugs in the cPickle module.
12038
12039- Changed find() and rfind() in the strop module so that
12040find("x","",2) returns -1, matching the implementation in string.py.
12041
12042- In the time module, be more careful with the result of ctime(), and
12043test for HAVE_MKTIME before usinmg mktime().
12044
12045- Doc strings contributed by Mitch Chapman to the termios, pwd, gdbm
12046modules.
12047
12048- Added the LOG_SYSLOG constant to the syslog module, if defined.
12049
12050Standard library modules
12051------------------------
12052
12053- All standard library modules have been converted to an indentation
12054style using either only tabs or only spaces -- never a mixture -- if
12055they weren't already consistent according to tabnanny. This means
12056that the new -t option (see above) won't complain about standard
12057library modules.
12058
12059- New standard library modules:
12060
12061 threading -- GvR and the thread-sig
12062 Java style thread objects -- USE THIS!!!
12063
12064 getpass -- Piers Lauder
12065 simple utilities to prompt for a password and to
12066 retrieve the current username
12067
12068 imaplib -- Piers Lauder
12069 interface for the IMAP4 protocol
12070
12071 poplib -- David Ascher, Piers Lauder
12072 interface for the POP3 protocol
12073
12074 smtplib -- Dragon De Monsyne
12075 interface for the SMTP protocol
12076
12077- Some obsolete modules moved to a separate directory (Lib/lib-old)
12078which is *not* in the default module search path:
12079
12080 Para
12081 addpack
12082 codehack
12083 fmt
12084 lockfile
12085 newdir
12086 ni
12087 rand
12088 tb
12089
12090- New version of the PCRE code (Perl Compatible Regular Expressions --
12091the re module and the supporting pcre extension) by Andrew Kuchling.
12092Incompatible new feature in re.sub(): the handling of escapes in the
12093replacement string has changed.
12094
12095- Interface change in the copy module: a __deepcopy__ method is now
12096called with the memo dictionary as an argument.
12097
12098- Feature change in the tokenize module: differentiate between NEWLINE
12099token (an official newline) and NL token (a newline that the grammar
12100ignores).
12101
12102- Several bugfixes to the urllib module. It is now truly thread-safe,
12103and several bugs and a portability problem have been fixed. New
12104features, all due to Sjoerd Mullender: When creating a temporary file,
12105it gives it an appropriate suffix. Support the "data:" URL scheme.
12106The open() method uses the tempcache.
12107
12108- New version of the xmllib module (this time with a test suite!) by
12109Sjoerd Mullender.
12110
12111- Added debugging code to the telnetlib module, to be able to trace
12112the actual traffic.
12113
12114- In the rfc822 module, added support for deleting a header (still no
12115support for adding headers, though). Also fixed a bug where an
12116illegal address would cause a crash in getrouteaddr(), fixed a
12117sign reversal in mktime_tz(), and use the local timezone by default
12118(the latter two due to Bill van Melle).
12119
12120- The normpath() function in the dospath and ntpath modules no longer
12121does case normalization -- for that, use the separate function
12122normcase() (which always existed); normcase() has been sped up and
12123fixed (it was the cause of a crash in Mark Hammond's installer in
12124certain locales).
12125
12126- New command supported by the ftplib module: rmd(); also fixed some
12127minor bugs.
12128
12129- The profile module now uses a different timer function by default --
12130time.clock() is generally better than os.times(). This makes it work
12131better on Windows NT, too.
12132
12133- The tempfile module now recovers when os.getcwd() raises an
12134exception.
12135
12136- Fixed some bugs in the random module; gauss() was subtly wrong, and
12137vonmisesvariate() should return a full circle. Courtesy Mike Miller,
12138Lambert Meertens (gauss()), and Magnus Kessler (vonmisesvariate()).
12139
12140- Better default seed in the whrandom module, courtesy Andrew Kuchling.
12141
12142- Fix slow close() in shelve module.
12143
12144- The Unix mailbox class in the mailbox module is now more robust when
12145a line begins with the string "From " but is definitely not the start
12146of a new message. The pattern used can be changed by overriding a
12147method or class variable.
12148
12149- Added a rmtree() function to the copy module.
12150
12151- Fixed several typos in the pickle module. Also fixed problems when
12152unpickling in restricted execution environments.
12153
12154- Added docstrings and fixed a typo in the py_compile and compileall
12155modules. At Mark Hammond's repeated request, py_compile now append a
12156newline to the source if it needs one. Both modules support an extra
12157parameter to specify the purported source filename (to be used in
12158error messages).
12159
12160- Some performance tweaks by Jeremy Hylton to the gzip module.
12161
12162- Fixed a bug in the merge order of dictionaries in the ConfigParser
12163module. Courtesy Barry Warsaw.
12164
12165- In the multifile module, support the optional second parameter to
12166seek() when possible.
12167
12168- Several fixes to the gopherlib module by Lars Marius Garshol. Also,
12169urlparse now correctly handles Gopher URLs with query strings.
12170
12171- Fixed a tiny bug in format_exception() in the traceback module.
12172Also rewrite tb_lineno() to be compatible with JPython (and not
12173disturb the current exception!); by Jim Hugunin.
12174
12175- The httplib module is more robust when servers send a short response
12176-- courtesy Tim O'Malley.
12177
12178Tkinter and friends
12179-------------------
12180
12181- Various typos and bugs fixed.
12182
12183- New module Tkdnd implements a drag-and-drop protocol (within one
12184application only).
12185
12186- The event_*() widget methods have been restructured slightly -- they
12187no longer use the default root.
12188
12189- The interfaces for the bind*() and unbind() widget methods have been
12190redesigned; the bind*() methods now return the name of the Tcl command
12191created for the callback, and this can be passed as a optional
12192argument to unbind() in order to delete the command (normally, such
12193commands are automatically unbound when the widget is destroyed, but
12194for some applications this isn't enough).
12195
12196- Variable objects now have trace methods to interface to Tcl's
12197variable tracing facilities.
12198
12199- Image objects now have an optional keyword argument, 'master', to
12200specify a widget (tree) to which they belong. The image_names() and
12201image_types() calls are now also widget methods.
12202
12203- There's a new global call, Tkinter.NoDefaultRoot(), which disables
12204all use of the default root by the Tkinter library. This is useful to
12205debug applications that are in the process of being converted from
12206relying on the default root to explicit specification of the root
12207widget.
12208
12209- The 'exit' command is deleted from the Tcl interpreter, since it
12210provided a loophole by which one could (accidentally) exit the Python
12211interpreter without invoking any cleanup code.
12212
12213- Tcl_Finalize() is now registered as a Python low-level exit handle,
12214so Tcl will be finalized when Python exits.
12215
12216The Python/C API
12217----------------
12218
12219- New function PyThreadState_GetDict() returns a per-thread dictionary
12220intended for storing thread-local global variables.
12221
12222- New functions Py_ReprEnter() and Py_ReprLeave() use the per-thread
12223dictionary to allow recursive container types to detect recursion in
12224their repr(), str() and print implementations.
12225
12226- New function PyObject_Not(x) calculates (not x) according to Python's
12227standard rules (basically, it negates the outcome PyObject_IsTrue(x).
12228
12229- New function _PyModule_Clear(), which clears a module's dictionary
12230carefully without removing the __builtins__ entry. This is implied
12231when a module object is deallocated (this used to clear the dictionary
12232completely).
12233
12234- New function PyImport_ExecCodeModuleEx(), which extends
12235PyImport_ExecCodeModule() by adding an extra parameter to pass it the
12236true file.
12237
12238- New functions Py_GetPythonHome() and Py_SetPythonHome(), intended to
12239allow embedded applications to force a different value for PYTHONHOME.
12240
12241- New global flag Py_FrozenFlag is set when this is a "frozen" Python
12242binary; it suppresses warnings about not being able to find the
12243standard library directories.
12244
12245- New global flag Py_TabcheckFlag is incremented by the -t option and
12246causes the tokenizer to issue warnings or errors about inconsistent
12247mixing of tabs and spaces for indentation.
12248
12249Miscellaneous minor changes and bug fixes
12250-----------------------------------------
12251
12252- Improved the error message when an attribute of an attribute-less
12253object is requested -- include the name of the attribute and the type
12254of the object in the message.
12255
12256- Sped up int(), long(), float() a bit.
12257
12258- Fixed a bug in list.sort() that would occasionally dump core.
12259
12260- Fixed a bug in PyNumber_Power() that caused numeric arrays to fail
12261when taken tothe real power.
12262
12263- Fixed a number of bugs in the file reading code, at least one of
12264which could cause a core dump on NT, and one of which would
12265occasionally cause file.read() to return less than the full contents
12266of the file.
12267
12268- Performance hack by Vladimir Marangozov for stack frame creation.
12269
12270- Make sure setvbuf() isn't used unless HAVE_SETVBUF is defined.
12271
12272Windows 95/NT
12273-------------
12274
12275- The .lib files are now part of the distribution; they are collected
12276in the subdirectory "libs" of the installation directory.
12277
12278- The extension modules (.pyd files) are now collected in a separate
12279subdirectory of the installation directory named "DLLs".
12280
12281- The case of a module's filename must now match the case of the
12282module name as specified in the import statement. This is an
12283experimental feature -- if it turns out to break in too many
12284situations, it will be removed (or disabled by default) in the future.
12285It can be disabled on a per-case basis by setting the environment
12286variable PYTHONCASEOK (to any value).
12287
12288
12289======================================================================
12290
12291
Guido van Rossumf2eac992000-09-04 17:24:24 +000012292=====================================
12293==> Release 1.5 (January 3, 1998) <==
12294=====================================
12295
12296
Guido van Rossum439d1fa1998-12-21 21:41:14 +000012297From 1.5b2 to 1.5
12298=================
12299
12300- Newly documentated module: BaseHTTPServer.py, thanks to Greg Stein.
12301
12302- Added doc strings to string.py, stropmodule.c, structmodule.c,
12303thanks to Charles Waldman.
12304
12305- Many nits fixed in the manuals, thanks to Fred Drake and many others
12306(especially Rob Hooft and Andrew Kuchling). The HTML version now uses
12307HTML markup instead of inline GIF images for tables; only two images
12308are left (for obsure bits of math). The index of the HTML version has
12309also been much improved. Finally, it is once again possible to
12310generate an Emacs info file from the library manual (but I don't
12311commit to supporting this in future versions).
12312
12313- New module: telnetlib.py (a simple telnet client library).
12314
12315- New tool: Tools/versioncheck/, by Jack Jansen.
12316
12317- Ported zlibmodule.c and bsddbmodule.c to NT; The project file for MS
12318DevStudio 5.0 now includes new subprojects to build the zlib and bsddb
12319extension modules.
12320
12321- Many small changes again to Tkinter.py -- mostly bugfixes and adding
12322missing routines. Thanks to Greg McFarlane for reporting a bunch of
12323problems and proofreading my fixes.
12324
12325- The re module and its documentation are up to date with the latest
12326version released to the string-sig (Dec. 22).
12327
12328- Stop test_grp.py from failing when the /etc/group file is empty
12329(yes, this happens!).
12330
12331- Fix bug in integer conversion (mystrtoul.c) that caused
123324294967296==0 to be true!
12333
12334- The VC++ 4.2 project file should be complete again.
12335
12336- In tempfile.py, use a better template on NT, and add a new optional
12337argument "suffix" with default "" to specify a specific extension for
12338the temporary filename (needed sometimes on NT but perhaps also handy
12339elsewhere).
12340
12341- Fixed some bugs in the FAQ wizard, and converted it to use re
12342instead of regex.
12343
12344- Fixed a mysteriously undetected error in dlmodule.c (it was using a
12345totally bogus routine name to raise an exception).
12346
12347- Fixed bug in import.c which wasn't using the new "dos-8x3" name yet.
12348
12349- Hopefully harmless changes to the build process to support shared
12350libraries on DG/UX. This adds a target to create
12351libpython$(VERSION).so; however this target is *only* for DG/UX.
12352
12353- Fixed a bug in the new format string error checking in getargs.c.
12354
12355- A simple fix for infinite recursion when printing __builtins__:
12356reset '_' to None before printing and set it to the printed variable
12357*after* printing (and only when printing is successful).
12358
12359- Fixed lib-tk/SimpleDialog.py to keep the dialog visible even if the
12360parent window is not (Skip Montanaro).
12361
12362- Fixed the two most annoying problems with ftp URLs in
12363urllib.urlopen(); an empty file now correctly raises an error, and it
12364is no longer required to explicitly close the returned "file" object
12365before opening another ftp URL to the same host and directory.
12366
12367
12368======================================================================
12369
12370
12371From 1.5b1 to 1.5b2
12372===================
12373
12374- Fixed a bug in cPickle.c that caused it to crash right away because
12375the version string had a different format.
12376
12377- Changes in pickle.py and cPickle.c: when unpickling an instance of a
12378class that doesn't define the __getinitargs__() method, the __init__()
12379constructor is no longer called. This makes a much larger group of
12380classes picklable by default, but may occasionally change semantics.
12381To force calling __init__() on unpickling, define a __getinitargs__()
12382method. Other changes too, in particular cPickle now handles classes
12383defined in packages correctly. The same change applies to copying
12384instances with copy.py. The cPickle.c changes and some pickle.py
12385changes are courtesy Jim Fulton.
12386
12387- Locale support in he "re" (Perl regular expressions) module. Use
12388the flag re.L (or re.LOCALE) to enable locale-specific matching
12389rules for \w and \b. The in-line syntax for this flag is (?L).
12390
12391- The built-in function isinstance(x, y) now also succeeds when y is
12392a type object and type(x) is y.
12393
12394- repr() and str() of class and instance objects now reflect the
12395package/module in which the class is defined.
12396
12397- Module "ni" has been removed. (If you really need it, it's been
12398renamed to "ni1". Let me know if this causes any problems for you.
12399Package authors are encouraged to write __init__.py files that
12400support both ni and 1.5 package support, so the same version can be
12401used with Python 1.4 as well as 1.5.)
12402
12403- The thread module is now automatically included when threads are
12404configured. (You must remove it from your existing Setup file,
12405since it is now in its own Setup.thread file.)
12406
12407- New command line option "-x" to skip the first line of the script;
12408handy to make executable scripts on non-Unix platforms.
12409
12410- In importdl.c, add the RTLD_GLOBAL to the dlopen() flags. I
12411haven't checked how this affects things, but it should make symbols
12412in one shared library available to the next one.
12413
12414- The Windows installer now installs in the "Program Files" folder on
12415the proper volume by default.
12416
12417- The Windows configuration adds a new main program, "pythonw", and
12418registers a new extension, ".pyw" that invokes this. This is a
12419pstandard Python interpreter that does not pop up a console window;
12420handy for pure Tkinter applications. All output to the original
12421stdout and stderr is lost; reading from the original stdin yields
12422EOF. Also, both python.exe and pythonw.exe now have a pretty icon
12423(a green snake in a box, courtesy Mark Hammond).
12424
12425- Lots of improvements to emacs-mode.el again. See Barry's web page:
12426http://www.python.org/ftp/emacs/pmdetails.html.
12427
12428- Lots of improvements and additions to the library reference manual;
12429many by Fred Drake.
12430
12431- Doc strings for the following modules: rfc822.py, posixpath.py,
12432ntpath.py, httplib.py. Thanks to Mitch Chapman and Charles Waldman.
12433
12434- Some more regression testing.
12435
12436- An optional 4th (maxsplit) argument to strop.replace().
12437
12438- Fixed handling of maxsplit in string.splitfields().
12439
12440- Tweaked os.environ so it can be pickled and copied.
12441
12442- The portability problems caused by indented preprocessor commands
12443and C++ style comments should be gone now.
12444
12445- In random.py, added Pareto and Weibull distributions.
12446
12447- The crypt module is now disabled in Modules/Setup.in by default; it
12448is rarely needed and causes errors on some systems where users often
12449don't know how to deal with those.
12450
12451- Some improvements to the _tkinter build line suggested by Case Roole.
12452
12453- A full suite of platform specific files for NetBSD 1.x, submitted by
12454Anders Andersen.
12455
12456- New Solaris specific header STROPTS.py.
12457
12458- Moved a confusing occurrence of *shared* from the comments in
12459Modules/Setup.in (people would enable this one instead of the real
12460one, and get disappointing results).
12461
12462- Changed the default mode for directories to be group-writable when
12463the installation process creates them.
12464
12465- Check for pthread support in "-l_r" for FreeBSD/NetBSD, and support
12466shared libraries for both.
12467
12468- Support FreeBSD and NetBSD in posixfile.py.
12469
12470- Support for the "event" command, new in Tk 4.2. By Case Roole.
12471
12472- Add Tix_SafeInit() support to tkappinit.c.
12473
12474- Various bugs fixed in "re.py" and "pcre.c".
12475
12476- Fixed a bug (broken use of the syntax table) in the old "regexpr.c".
12477
12478- In frozenmain.c, stdin is made unbuffered too when PYTHONUNBUFFERED
12479is set.
12480
12481- Provide default blocksize for retrbinary in ftplib.py (Skip
12482Montanaro).
12483
12484- In NT, pick the username up from different places in user.py (Jeff
12485Bauer).
12486
12487- Patch to urlparse.urljoin() for ".." and "..#1", Marc Lemburg.
12488
12489- Many small improvements to Jeff Rush' OS/2 support.
12490
12491- ospath.py is gone; it's been obsolete for so many years now...
12492
12493- The reference manual is now set up to prepare better HTML (still
12494using webmaker, alas).
12495
12496- Add special handling to /Tools/freeze for Python modules that are
12497imported implicitly by the Python runtime: 'site' and 'exceptions'.
12498
12499- Tools/faqwiz 0.8.3 -- add an option to suppress URL processing
12500inside <PRE>, by "Scott".
12501
12502- Added ConfigParser.py, a generic parser for sectioned configuration
12503files.
12504
12505- In _localemodule.c, LC_MESSAGES is not always defined; put it
12506between #ifdefs.
12507
12508- Typo in resource.c: RUSAGE_CHILDERN -> RUSAGE_CHILDREN.
12509
12510- Demo/scripts/newslist.py: Fix the way the version number is gotten
12511out of the RCS revision.
12512
12513- PyArg_Parse[Tuple] now explicitly check for bad characters at the
12514end of the format string.
12515
12516- Revamped PC/example_nt to support VC++ 5.x.
12517
12518- <listobject>.sort() now uses a modified quicksort by Raymund Galvin,
12519after studying the GNU libg++ quicksort. This should be much faster
12520if there are lots of duplicates, and otherwise at least as good.
12521
12522- Added "uue" as an alias for "uuencode" to mimetools.py. (Hm, the
12523uudecode bug where it complaints about trailing garbage is still there
12524:-( ).
12525
12526- pickle.py requires integers in text mode to be in decimal notation
12527(it used to accept octal and hex, even though it would only generate
12528decimal numbers).
12529
12530- In string.atof(), don't fail when the "re" module is unavailable.
12531Plug the ensueing security leak by supplying an empty __builtins__
12532directory to eval().
12533
12534- A bunch of small fixes and improvements to Tkinter.py.
12535
12536- Fixed a buffer overrun in PC/getpathp.c.
12537
12538
12539======================================================================
12540
12541
12542From 1.5a4 to 1.5b1
12543===================
12544
12545- The Windows NT/95 installer now includes full HTML of all manuals.
12546It also has a checkbox that lets you decide whether to install the
12547interpreter and library. The WISE installer script for the installer
12548is included in the source tree as PC/python15.wse, and so are the
12549icons used for Python files. The config.c file for the Windows build
12550is now complete with the pcre module.
12551
12552- sys.ps1 and sys.ps2 can now arbitrary objects; their str() is
12553evaluated for the prompt.
12554
12555- The reference manual is brought up to date (more or less -- it still
12556needs work, e.g. in the area of package import).
12557
12558- The icons used by latex2html are now included in the Doc
12559subdirectory (mostly so that tarring up the HTML files can be fully
12560automated). A simple index.html is also added to Doc (it only works
12561after you have successfully run latex2html).
12562
12563- For all you would-be proselytizers out there: a new version of
12564Misc/BLURB describes Python more concisely, and Misc/comparisons
12565compares Python to several other languages. Misc/BLURB.WINDOWS
12566contains a blurb specifically aimed at Windows programmers (by Mark
12567Hammond).
12568
12569- A new version of the Python mode for Emacs is included as
12570Misc/python-mode.el. There are too many new features to list here.
12571See http://www.python.org/ftp/emacs/pmdetails.html for more info.
12572
12573- New module fileinput makes iterating over the lines of a list of
12574files easier. (This still needs some more thinking to make it more
12575extensible.)
12576
12577- There's full OS/2 support, courtesy Jeff Rush. To build the OS/2
12578version, see PC/readme.txt and PC/os2vacpp. This is for IBM's Visual
12579Age C++ compiler. I expect that Jeff will also provide a binary
12580release for this platform.
12581
12582- On Linux, the configure script now uses '-Xlinker -export-dynamic'
12583instead of '-rdynamic' to link the main program so that it exports its
12584symbols to shared libraries it loads dynamically. I hope this doesn't
12585break on older Linux versions; it is needed for mklinux and appears to
12586work on Linux 2.0.30.
12587
12588- Some Tkinter resstructuring: the geometry methods that apply to a
12589master are now properly usable on toplevel master widgets. There's a
12590new (internal) widget class, BaseWidget. New, longer "official" names
12591for the geometry manager methods have been added,
12592e.g. "grid_columnconfigure()" instead of "columnconfigure()". The old
12593shorter names still work, and where there's ambiguity, pack wins over
12594place wins over grid. Also, the bind_class method now returns its
12595value.
12596
12597- New, RFC-822 conformant parsing of email addresses and address lists
12598in the rfc822 module, courtesy Ben Escoto.
12599
12600- New, revamped tkappinit.c with support for popular packages (PIL,
12601TIX, BLT, TOGL). For the last three, you need to execute the Tcl
12602command "load {} Tix" (or Blt, or Togl) to gain access to them.
12603The Modules/Setup line for the _tkinter module has been rewritten
12604using the cool line-breaking feature of most Bourne shells.
12605
12606- New socket method connect_ex() returns the error code from connect()
12607instead of raising an exception on errors; this makes the logic
12608required for asynchronous connects simpler and more efficient.
12609
12610- New "locale" module with (still experimental) interface to the
12611standard C library locale interface, courtesy Martin von Loewis. This
12612does not repeat my mistake in 1.5a4 of always calling
12613setlocale(LC_ALL, ""). In fact, we've pretty much decided that
12614Python's standard numerical formatting operations should always use
12615the conventions for the C locale; the locale module contains utility
12616functions to format numbers according to the user specified locale.
12617(All this is accomplished by an explicit call to setlocale(LC_NUMERIC,
12618"C") after locale-changing calls.) See the library manual. (Alas, the
12619promised changes to the "re" module for locale support have not been
12620materialized yet. If you care, volunteer!)
12621
12622- Memory leak plugged in Py_BuildValue when building a dictionary.
12623
12624- Shared modules can now live inside packages (hierarchical module
12625namespaces). No changes to the shared module itself are needed.
12626
12627- Improved policy for __builtins__: this is a module in __main__ and a
12628dictionary everywhere else.
12629
12630- Python no longer catches SIGHUP and SIGTERM by default. This was
12631impossible to get right in the light of thread contexts. If you want
12632your program to clean up when a signal happens, use the signal module
12633to set up your own signal handler.
12634
12635- New Python/C API PyNumber_CoerceEx() does not return an exception
12636when no coercion is possible. This is used to fix a problem where
12637comparing incompatible numbers for equality would raise an exception
12638rather than return false as in Python 1.4 -- it once again will return
12639false.
12640
12641- The errno module is changed again -- the table of error messages
12642(errorstr) is removed. Instead, you can use os.strerror(). This
12643removes redundance and a potential locale dependency.
12644
12645- New module xmllib, to parse XML files. By Sjoerd Mullender.
12646
12647- New C API PyOS_AfterFork() is called after fork() in posixmodule.c.
12648It resets the signal module's notion of what the current process ID
12649and thread are, so that signal handlers will work after (and across)
12650calls to os.fork().
12651
12652- Fixed most occurrences of fatal errors due to missing thread state.
12653
12654- For vgrind (a flexible source pretty printer) fans, there's a simple
12655Python definition in Misc/vgrindefs, courtesy Neale Pickett.
12656
12657- Fixed memory leak in exec statement.
12658
12659- The test.pystone module has a new function, pystones(loops=LOOPS),
12660which returns a (benchtime, stones) tuple. The main() function now
12661calls this and prints the report.
12662
12663- Package directories now *require* the presence of an __init__.py (or
12664__init__.pyc) file before they are considered as packages. This is
12665done to prevent accidental subdirectories with common names from
12666overriding modules with the same name.
12667
12668- Fixed some strange exceptions in __del__ methods in library modules
12669(e.g. urllib). This happens because the builtin names are already
12670deleted by the time __del__ is called. The solution (a hack, but it
12671works) is to set some instance variables to 0 instead of None.
12672
12673- The table of built-in module initializers is replaced by a pointer
12674variable. This makes it possible to switch to a different table at
12675run time, e.g. when a collection of modules is loaded from a shared
12676library. (No example code of how to do this is given, but it is
12677possible.) The table is still there of course, its name prefixed with
12678an underscore and used to initialize the pointer.
12679
12680- The warning about a thread still having a frame now only happens in
12681verbose mode.
12682
12683- Change the signal finialization so that it also resets the signal
12684handlers. After this has been called, our signal handlers are no
12685longer active!
12686
12687- New version of tokenize.py (by Ka-Ping Yee) recognizes raw string
12688literals. There's now also a test fort this module.
12689
12690- The copy module now also uses __dict__.update(state) instead of
12691going through individual attribute assignments, for class instances
12692without a __setstate__ method.
12693
12694- New module reconvert translates old-style (regex module) regular
12695expressions to new-style (re module, Perl-style) regular expressions.
12696
12697- Most modules that used to use the regex module now use the re
12698module. The grep module has a new pgrep() function which uses
12699Perl-style regular expressions.
12700
12701- The (very old, backwards compatibility) regexp.py module has been
12702deleted.
12703
12704- Restricted execution (rexec): added the pcre module (support for the
12705re module) to the list of trusted extension modules.
12706
12707- New version of Jim Fulton's CObject object type, adds
12708PyCObject_FromVoidPtrAndDesc() and PyCObject_GetDesc() APIs.
12709
12710- Some patches to Lee Busby's fpectl mods that accidentally didn't
12711make it into 1.5a4.
12712
12713- In the string module, add an optional 4th argument to count(),
12714matching find() etc.
12715
12716- Patch for the nntplib module by Charles Waldman to add optional user
12717and password arguments to NNTP.__init__(), for nntp servers that need
12718them.
12719
12720- The str() function for class objects now returns
12721"modulename.classname" instead of returning the same as repr().
12722
12723- The parsing of \xXX escapes no longer relies on sscanf().
12724
12725- The "sharedmodules" subdirectory of the installation is renamed to
12726"lib-dynload". (You may have to edit your Modules/Setup file to fix
12727this in an existing installation!)
12728
12729- Fixed Don Beaudry's mess-up with the OPT test in the configure
12730script. Certain SGI platforms will still issue a warning for each
12731compile; there's not much I can do about this since the compiler's
12732exit status doesn't indicate that I was using an obsolete option.
12733
12734- Fixed Barry's mess-up with {}.get(), and added test cases for it.
12735
12736- Shared libraries didn't quite work under AIX because of the change
12737in status of the GNU readline interface. Fix due to by Vladimir
12738Marangozov.
12739
12740
12741======================================================================
12742
12743
12744From 1.5a3 to 1.5a4
12745===================
12746
12747- faqwiz.py: version 0.8; Recognize https:// as URL; <html>...</html>
12748feature; better install instructions; removed faqmain.py (which was an
12749older version).
12750
12751- nntplib.py: Fixed some bugs reported by Lars Wirzenius (to Debian)
12752about the treatment of lines starting with '.'. Added a minimal test
12753function.
12754
12755- struct module: ignore most whitespace in format strings.
12756
12757- urllib.py: close the socket and temp file in URLopener.retrieve() so
12758that multiple retrievals using the same connection work.
12759
12760- All standard exceptions are now classes by default; use -X to make
12761them strings (for backward compatibility only).
12762
12763- There's a new standard exception hierarchy, defined in the standard
12764library module exceptions.py (which you never need to import
12765explicitly). See
12766http://grail.cnri.reston.va.us/python/essays/stdexceptions.html for
12767more info.
12768
12769- Three new C API functions:
12770
12771 - int PyErr_GivenExceptionMatches(obj1, obj2)
12772
12773 Returns 1 if obj1 and obj2 are the same object, or if obj1 is an
12774 instance of type obj2, or of a class derived from obj2
12775
12776 - int PyErr_ExceptionMatches(obj)
12777
12778 Higher level wrapper around PyErr_GivenExceptionMatches() which uses
12779 PyErr_Occurred() as obj1. This will be the more commonly called
12780 function.
12781
12782 - void PyErr_NormalizeException(typeptr, valptr, tbptr)
12783
12784 Normalizes exceptions, and places the normalized values in the
12785 arguments. If type is not a class, this does nothing. If type is a
12786 class, then it makes sure that value is an instance of the class by:
12787
12788 1. if instance is of the type, or a class derived from type, it does
12789 nothing.
12790
12791 2. otherwise it instantiates the class, using the value as an
12792 argument. If value is None, it uses an empty arg tuple, and if
12793 the value is a tuple, it uses just that.
12794
12795- Another new C API function: PyErr_NewException() creates a new
12796exception class derived from Exception; when -X is given, it creates a
12797new string exception.
12798
12799- core interpreter: remove the distinction between tuple and list
12800unpacking; allow an arbitrary sequence on the right hand side of any
12801unpack instruction. (UNPACK_LIST and UNPACK_TUPLE now do the same
12802thing, which should really be called UNPACK_SEQUENCE.)
12803
12804- classes: Allow assignments to an instance's __dict__ or __class__,
12805so you can change ivars (including shared ivars -- shock horror) and
12806change classes dynamically. Also make the check on read-only
12807attributes of classes less draconic -- only the specials names
12808__dict__, __bases__, __name__ and __{get,set,del}attr__ can't be
12809assigned.
12810
12811- Two new built-in functions: issubclass() and isinstance(). Both
12812take classes as their second arguments. The former takes a class as
12813the first argument and returns true iff first is second, or is a
12814subclass of second. The latter takes any object as the first argument
12815and returns true iff first is an instance of the second, or any
12816subclass of second.
12817
12818- configure: Added configuration tests for presence of alarm(),
12819pause(), and getpwent().
12820
12821- Doc/Makefile: changed latex2html targets.
12822
12823- classes: Reverse the search order for the Don Beaudry hook so that
12824the first class with an applicable hook wins. Makes more sense.
12825
12826- Changed the checks made in Py_Initialize() and Py_Finalize(). It is
12827now legal to call these more than once. The first call to
12828Py_Initialize() initializes, the first call to Py_Finalize()
12829finalizes. There's also a new API, Py_IsInitalized() which checks
12830whether we are already initialized (in case you want to leave things
12831as they were).
12832
12833- Completely disable the declarations for malloc(), realloc() and
12834free(). Any 90's C compiler has these in header files, and the tests
12835to decide whether to suppress the declarations kept failing on some
12836platforms.
12837
12838- *Before* (instead of after) signalmodule.o is added, remove both
12839intrcheck.o and sigcheck.o. This should get rid of warnings in ar or
12840ld on various systems.
12841
12842- Added reop to PC/config.c
12843
12844- configure: Decided to use -Aa -D_HPUX_SOURCE on HP-UX platforms.
12845Removed outdated HP-UX comments from README. Added Cray T3E comments.
12846
12847- Various renames of statically defined functions that had name
12848conflicts on some systems, e.g. strndup (GNU libc), join (Cray),
12849roundup (sys/types.h).
12850
12851- urllib.py: Interpret three slashes in file: URL as local file (for
12852Netscape on Windows/Mac).
12853
12854- copy.py: Make sure the objects returned by __getinitargs__() are
12855kept alive (in the memo) to avoid a certain kind of nasty crash. (Not
12856easily reproducable because it requires a later call to
12857__getinitargs__() to return a tuple that happens to be allocated at
12858the same address.)
12859
12860- Added definition of AR to toplevel Makefile. Renamed @buildno temp
12861file to buildno1.
12862
12863- Moved Include/assert.h to Parser/assert.h, which seems to be the
12864only place where it's needed.
12865
12866- Tweaked the dictionary lookup code again for some more speed
12867(Vladimir Marangozov).
12868
12869- NT build: Changed the way python15.lib is included in the other
12870projects. Per Mark Hammond's suggestion, add it to the extra libs in
12871Settings instead of to the project's source files.
12872
12873- regrtest.py: Change default verbosity so that there are only three
12874levels left: -q, default and -v. In default mode, the name of each
12875test is now printed. -v is the same as the old -vv. -q is more quiet
12876than the old default mode.
12877
12878- Removed the old FAQ from the distribution. You now have to get it
12879from the web!
12880
12881- Removed the PC/make_nt.in file from the distribution; it is no
12882longer needed.
12883
12884- Changed the build sequence so that shared modules are built last.
12885This fixes things for AIX and doesn't hurt elsewhere.
12886
12887- Improved test for GNU MP v1 in mpzmodule.c
12888
12889- fileobject.c: ftell() on Linux discards all buffered data; changed
12890read() code to use lseek() instead to get the same effect
12891
12892- configure.in, configure, importdl.c: NeXT sharedlib fixes
12893
12894- tupleobject.c: PyTuple_SetItem asserts refcnt==1
12895
12896- resource.c: Different strategy regarding whether to declare
12897getrusage() and getpagesize() -- #ifdef doesn't work, Linux has
12898conflicting decls in its headers. Choice: only declare the return
12899type, not the argument prototype, and not on Linux.
12900
12901- importdl.c, configure*: set sharedlib extensions properly for NeXT
12902
12903- configure*, Makefile.in, Modules/Makefile.pre.in: AIX shared libraries
12904fixed; moved addition of PURIFY to LINKCC to configure
12905
12906- reopmodule.c, regexmodule.c, regexpr.c, zlibmodule.c: needed casts
12907added to shup up various compilers.
12908
12909- _tkinter.c: removed buggy mac #ifndef
12910
12911- Doc: various Mac documentation changes, added docs for 'ic' module
12912
12913- PC/make_nt.in: deleted
12914
12915- test_time.py, test_strftime.py: tweaks to catch %Z (which may return
12916"")
12917
12918- test_rotor.py: print b -> print `b`
12919
12920- Tkinter.py: (tagOrId) -> (tagOrId,)
12921
12922- Tkinter.py: the Tk class now also has a configure() method and
12923friends (they have been moved to the Misc class to accomplish this).
12924
12925- dict.get(key[, default]) returns dict[key] if it exists, or default
12926if it doesn't. The default defaults to None. This is quicker for
12927some applications than using either has_key() or try:...except
12928KeyError:....
12929
12930- Tools/webchecker/: some small changes to webchecker.py; added
12931websucker.py (a simple web site mirroring script).
12932
12933- Dictionary objects now have a get() method (also in UserDict.py).
12934dict.get(key, default) returns dict[key] if it exists and default
12935otherwise; default defaults to None.
12936
12937- Tools/scripts/logmerge.py: print the author, too.
12938
12939- Changes to import: support for "import a.b.c" is now built in. See
12940http://grail.cnri.reston.va.us/python/essays/packages.html
12941for more info. Most important deviations from "ni.py": __init__.py is
12942executed in the package's namespace instead of as a submodule; and
12943there's no support for "__" or "__domain__". Note that "ni.py" is not
12944changed to match this -- it is simply declared obsolete (while at the
12945same time, it is documented...:-( ).
12946Unfortunately, "ihooks.py" has not been upgraded (but see "knee.py"
12947for an example implementation of hierarchical module import written in
12948Python).
12949
12950- More changes to import: the site.py module is now imported by
12951default when Python is initialized; use -S to disable it. The site.py
12952module extends the path with several more directories: site-packages
12953inside the lib/python1.5/ directory, site-python in the lib/
12954directory, and pathnames mentioned in *.pth files found in either of
12955those directories. See
12956http://grail.cnri.reston.va.us/python/essays/packages.html
12957for more info.
12958
12959- Changes to standard library subdirectory names: those subdirectories
12960that are not packages have been renamed with a hypen in their name,
12961e.g. lib-tk, lib-stdwin, plat-win, plat-linux2, plat-sunos5, dos-8x3.
12962The test suite is now a package -- to run a test, you must now use
12963"import test.test_foo".
12964
12965- A completely new re.py module is provided (thanks to Andrew
12966Kuchling, Tim Peters and Jeffrey Ollie) which uses Philip Hazel's
12967"pcre" re compiler and engine. For a while, the "old" re.py (which
12968was new in 1.5a3!) will be kept around as re1.py. The "old" regex
12969module and underlying parser and engine are still present -- while
12970regex is now officially obsolete, it will probably take several major
12971release cycles before it can be removed.
12972
12973- The posix module now has a strerror() function which translates an
12974error code to a string.
12975
12976- The emacs.py module (which was long obsolete) has been removed.
12977
12978- The universal makefile Misc/Makefile.pre.in now features an
12979"install" target. By default, installed shared libraries go into
12980$exec_prefix/lib/python$VERSION/site-packages/.
12981
12982- The install-sh script is installed with the other configuration
12983specific files (in the config/ subdirectory).
12984
12985- It turns out whatsound.py and sndhdr.py were identical modules.
12986Since there's also an imghdr.py file, I propose to make sndhdr.py the
12987official one. For compatibility, whatsound.py imports * from
12988sndhdr.py.
12989
12990- Class objects have a new attribute, __module__, giving the name of
12991the module in which they were declared. This is useful for pickle and
12992for printing the full name of a class exception.
12993
12994- Many extension modules no longer issue a fatal error when their
12995initialization fails; the importing code now checks whether an error
12996occurred during module initialization, and correctly propagates the
12997exception to the import statement.
12998
12999- Most extension modules now raise class-based exceptions (except when
13000-X is used).
13001
13002- Subtle changes to PyEval_{Save,Restore}Thread(): always swap the
13003thread state -- just don't manipulate the lock if it isn't there.
13004
13005- Fixed a bug in Python/getopt.c that made it do the wrong thing when
13006an option was a single '-'. Thanks to Andrew Kuchling.
13007
13008- New module mimetypes.py will guess a MIME type from a filename's
13009extension.
13010
13011- Windows: the DLL version is now settable via a resource rather than
13012being hardcoded. This can be used for "branding" a binary Python
13013distribution.
13014
13015- urllib.py is now threadsafe -- it now uses re instead of regex, and
13016sys.exc_info() instead of sys.exc_{type,value}.
13017
13018- Many other library modules that used to use
13019sys.exc_{type,value,traceback} are now more thread-safe by virtue of
13020using sys.exc_info().
13021
13022- The functions in popen2 have an optional buffer size parameter.
13023Also, the command argument can now be either a string (passed to the
13024shell) or a list of arguments (passed directly to execv).
13025
13026- Alas, the thread support for _tkinter released with 1.5a3 didn't
13027work. It's been rewritten. The bad news is that it now requires a
13028modified version of a file in the standard Tcl distribution, which you
13029must compile with a -I option pointing to the standard Tcl source
13030tree. For this reason, the thread support is disabled by default.
13031
13032- The errno extension module adds two tables: errorcode maps errno
13033numbers to errno names (e.g. EINTR), and errorstr maps them to
13034message strings. (The latter is redundant because the new call
13035posix.strerror() now does the same, but alla...) (Marc-Andre Lemburg)
13036
13037- The readline extension module now provides some interfaces to
13038internal readline routines that make it possible to write a completer
13039in Python. An example completer, rlcompleter.py, is provided.
13040
13041 When completing a simple identifier, it completes keywords,
13042 built-ins and globals in __main__; when completing
13043 NAME.NAME..., it evaluates (!) the expression up to the last
13044 dot and completes its attributes.
13045
13046 It's very cool to do "import string" type "string.", hit the
13047 completion key (twice), and see the list of names defined by
13048 the string module!
13049
13050 Tip: to use the tab key as the completion key, call
13051
13052 readline.parse_and_bind("tab: complete")
13053
13054- The traceback.py module has a new function tb_lineno() by Marc-Andre
13055Lemburg which extracts the line number from the linenumber table in
13056the code object. Apparently the traceback object doesn't contains the
13057right linenumber when -O is used. Rather than guessing whether -O is
13058on or off, the module itself uses tb_lineno() unconditionally.
13059
13060- Fixed Demo/tkinter/matt/canvas-moving-or-creating.py: change bind()
13061to tag_bind() so it works again.
13062
13063- The pystone script is now a standard library module. Example use:
13064"import test.pystone; test.pystone.main()".
13065
13066- The import of the readline module in interactive mode is now also
13067attempted when -i is specified. (Yes, I know, giving in to Marc-Andre
13068Lemburg, who asked for this. :-)
13069
13070- rfc822.py: Entirely rewritten parseaddr() function by Sjoerd
13071Mullender, to be closer to the standard. This fixes the getaddr()
13072method. Unfortunately, getaddrlist() is as broken as ever, since it
13073splits on commas without regard for RFC 822 quoting conventions.
13074
13075- pprint.py: correctly emit trailing "," in singleton tuples.
13076
13077- _tkinter.c: export names for its type objects, TkappType and
13078TkttType.
13079
13080- pickle.py: use __module__ when defined; fix a particularly hard to
13081reproduce bug that confuses the memo when temporary objects are
13082returned by custom pickling interfaces; and a semantic change: when
13083unpickling the instance variables of an instance, use
13084inst.__dict__.update(value) instead of a for loop with setattr() over
13085the value.keys(). This is more consistent (the pickling doesn't use
13086getattr() either but pickles inst.__dict__) and avoids problems with
13087instances that have a __setattr__ hook. But it *is* a semantic change
13088(because the setattr hook is no longer used). So beware!
13089
13090- config.h is now installed (at last) in
13091$exec_prefix/include/python1.5/. For most sites, this means that it
13092is actually in $prefix/include/python1.5/, with all the other Python
13093include files, since $prefix and $exec_prefix are the same by
13094default.
13095
13096- The imp module now supports parts of the functionality to implement
13097import of hierarchical module names. It now supports find_module()
13098and load_module() for all types of modules. Docstrings have been
13099added for those functions in the built-in imp module that are still
13100relevant (some old interfaces are obsolete). For a sample
13101implementation of hierarchical module import in Python, see the new
13102library module knee.py.
13103
13104- The % operator on string objects now allows arbitrary nested parens
13105in a %(...)X style format. (Brad Howes)
13106
13107- Reverse the order in which Setup and Setup.local are passed to the
13108makesetup script. This allows variable definitions in Setup.local to
13109override definitions in Setup. (But you'll still have to edit Setup
13110if you want to disable modules that are enabled by default, or if such
13111modules need non-standard options.)
13112
13113- Added PyImport_ImportModuleEx(name, globals, locals, fromlist); this
13114is like PyImport_ImporModule(name) but receives the globals and locals
13115dict and the fromlist arguments as well. (The name is a char*; the
13116others are PyObject*s).
13117
13118- The 'p' format in the struct extension module alloded to above is
13119new in 1.5a4.
13120
13121- The types.py module now uses try-except in a few places to make it
13122more likely that it can be imported in restricted mode. Some type
13123names are undefined in that case, e.g. CodeType (inaccessible),
13124FileType (not always accessible), and TracebackType and FrameType
13125(inaccessible).
13126
13127- In urllib.py: added separate administration of temporary files
13128created y URLopener.retrieve() so cleanup() can properly remove them.
13129The old code removed everything in tempcache which was a bad idea if
13130the user had passed a non-temp file into it. Also, in basejoin(),
13131interpret relative paths starting in "../". This is necessary if the
13132server uses symbolic links.
13133
13134- The Windows build procedure and project files are now based on
13135Microsoft Visual C++ 5.x. The build now takes place in the PCbuild
13136directory. It is much more robust, and properly builds separate Debug
13137and Release versions. (The installer will be added shortly.)
13138
13139- Added casts and changed some return types in regexpr.c to avoid
13140compiler warnings or errors on some platforms.
13141
13142- The AIX build tools for shared libraries now supports VPATH. (Donn
13143Cave)
13144
13145- By default, disable the "portable" multimedia modules audioop,
13146imageop, and rgbimg, since they don't work on 64-bit platforms.
13147
13148- Fixed a nasty bug in cStringIO.c when code was actually using the
13149close() method (the destructors would try to free certain fields a
13150second time).
13151
13152- For those who think they need it, there's a "user.py" module. This
13153is *not* imported by default, but can be imported to run user-specific
13154setup commands, ~/.pythonrc.py.
13155
13156- Various speedups suggested by Fredrik Lundh, Marc-Andre Lemburg,
13157Vladimir Marangozov, and others.
13158
13159- Added os.altsep; this is '/' on DOS/Windows, and None on systems
13160with a sane filename syntax.
13161
13162- os.py: Write out the dynamic OS choice, to avoid exec statements.
13163Adding support for a new OS is now a bit more work, but I bet that
13164'dos' or 'nt' will cover most situations...
13165
13166- The obsolete exception AccessError is now really gone.
13167
13168- Tools/faqwiz/: New installation instructions show how to maintain
13169multiple FAQs. Removed bootstrap script from end of faqwiz.py module.
13170Added instructions to bootstrap script, too. Version bumped to 0.8.1.
13171Added <html>...</html> feature suggested by Skip Montanaro. Added
13172leading text for Roulette, default to 'Hit Reload ...'. Fix typo in
13173default SRCDIR.
13174
13175- Documentation for the relatively new modules "keyword" and "symbol"
13176has been added (to the end of the section on the parser extension
13177module).
13178
13179- In module bisect.py, but functions have two optional argument 'lo'
13180and 'hi' which allow you to specify a subsequence of the array to
13181operate on.
13182
13183- In ftplib.py, changed most methods to return their status (even when
13184it is always "200 OK") rather than swallowing it.
13185
13186- main() now calls setlocale(LC_ALL, ""), if setlocale() and
13187<locale.h> are defined.
13188
13189- Changes to configure.in, the configure script, and both
13190Makefile.pre.in files, to support SGI's SGI_ABI platform selection
13191environment variable.
13192
13193
13194======================================================================
13195
13196
13197From 1.4 to 1.5a3
13198=================
13199
13200Security
13201--------
13202
13203- If you are using the setuid script C wrapper (Misc/setuid-prog.c),
13204please use the new version. The old version has a huge security leak.
13205
13206Miscellaneous
13207-------------
13208
13209- Because of various (small) incompatible changes in the Python
13210bytecode interpreter, the magic number for .pyc files has changed
13211again.
13212
13213- The default module search path is now much saner. Both on Unix and
13214Windows, it is essentially derived from the path to the executable
13215(which can be overridden by setting the environment variable
13216$PYTHONHOME). The value of $PYTHONPATH on Windows is now inserted in
13217front of the default path, like in Unix (instead of overriding the
13218default path). On Windows, the directory containing the executable is
13219added to the end of the path.
13220
13221- A new version of python-mode.el for Emacs has been included. Also,
13222a new file ccpy-style.el has been added to configure Emacs cc-mode for
13223the preferred style in Python C sources.
13224
13225- On Unix, when using sys.argv[0] to insert the script directory in
13226front of sys.path, expand a symbolic link. You can now install a
13227program in a private directory and have a symbolic link to it in a
13228public bin directory, and it will put the private directory in the
13229module search path. Note that the symlink is expanded in sys.path[0]
13230but not in sys.argv[0], so you can still tell the name by which you
13231were invoked.
13232
13233- It is now recommended to use ``#!/usr/bin/env python'' instead of
13234``#!/usr/local/bin/python'' at the start of executable scripts, except
13235for CGI scripts. It has been determined that the use of /usr/bin/env
13236is more portable than that of /usr/local/bin/python -- scripts almost
13237never have to be edited when the Python interpreter lives in a
13238non-standard place. Note that this doesn't work for CGI scripts since
13239the python executable often doesn't live in the HTTP server's default
13240search path.
13241
13242- The silly -s command line option and the corresponding
13243PYTHONSUPPRESS environment variable (and the Py_SuppressPrint global
13244flag in the Python/C API) are gone.
13245
13246- Most problems on 64-bit platforms should now be fixed. Andrew
13247Kuchling helped. Some uncommon extension modules are still not
13248clean (image and audio ops?).
13249
13250- Fixed a bug where multiple anonymous tuple arguments would be mixed up
13251when using the debugger or profiler (reported by Just van Rossum).
13252The simplest example is ``def f((a,b),(c,d)): print a,b,c,d''; this
13253would print the wrong value when run under the debugger or profiler.
13254
13255- The hacks that the dictionary implementation used to speed up
13256repeated lookups of the same C string were removed; these were a
13257source of subtle problems and don't seem to serve much of a purpose
13258any longer.
13259
13260- All traces of support for the long dead access statement have been
13261removed from the sources.
13262
13263- Plugged the two-byte memory leak in the tokenizer when reading an
13264interactive EOF.
13265
13266- There's a -O option to the interpreter that removes SET_LINENO
13267instructions and assert statements (see below); it uses and produces
13268.pyo files instead of .pyc files. The speedup is only a few percent
13269in most cases. The line numbers are still available in the .pyo file,
13270as a separate table (which is also available in .pyc files). However,
13271the removal of the SET_LINENO instructions means that the debugger
13272(pdb) can't set breakpoints on lines in -O mode. The traceback module
13273contains a function to extract a line number from the code object
13274referenced in a traceback object. In the future it should be possible
13275to write external bytecode optimizers that create better optimized
13276.pyo files, and there should be more control over optimization;
13277consider the -O option a "teaser". Without -O, the assert statement
13278actually generates code that first checks __debug__; if this variable
13279is false, the assertion is not checked. __debug__ is a built-in
13280variable whose value is initialized to track the -O flag (it's true
13281iff -O is not specified). With -O, no code is generated for assert
13282statements, nor for code of the form ``if __debug__: <something>''.
13283Sorry, no further constant folding happens.
13284
13285
13286Performance
13287-----------
13288
13289- It's much faster (almost twice for pystone.py -- see
13290Tools/scripts). See the entry on string interning below.
13291
13292- Some speedup by using separate free lists for method objects (both
13293the C and the Python variety) and for floating point numbers.
13294
13295- Big speedup by allocating frame objects with a single malloc() call.
13296The Python/C API for frames is changed (you shouldn't be using this
13297anyway).
13298
13299- Significant speedup by inlining some common opcodes for common operand
13300types (e.g. i+i, i-i, and list[i]). Fredrik Lundh.
13301
13302- Small speedup by reordering the method tables of some common
13303objects (e.g. list.append is now first).
13304
13305- Big optimization to the read() method of file objects. A read()
13306without arguments now attempts to use fstat to allocate a buffer of
13307the right size; for pipes and sockets, it will fall back to doubling
13308the buffer size. While that the improvement is real on all systems,
13309it is most dramatic on Windows.
13310
13311
13312Documentation
13313-------------
13314
13315- Many new pieces of library documentation were contributed, mostly by
13316Andrew Kuchling. Even cmath is now documented! There's also a
13317chapter of the library manual, "libundoc.tex", which provides a
13318listing of all undocumented modules, plus their status (e.g. internal,
13319obsolete, or in need of documentation). Also contributions by Sue
13320Williams, Skip Montanaro, and some module authors who succumbed to
13321pressure to document their own contributed modules :-). Note that
13322printing the documentation now kills fewer trees -- the margins have
13323been reduced.
13324
13325- I have started documenting the Python/C API. Unfortunately this project
13326hasn't been completed yet. It will be complete before the final release of
13327Python 1.5, though. At the moment, it's better to read the LaTeX source
13328than to attempt to run it through LaTeX and print the resulting dvi file.
13329
13330- The posix module (and hence os.py) now has doc strings! Thanks to Neil
13331Schemenauer. I received a few other contributions of doc strings. In most
13332other places, doc strings are still wishful thinking...
13333
13334
13335Language changes
13336----------------
13337
13338- Private variables with leading double underscore are now a permanent
13339feature of the language. (These were experimental in release 1.4. I have
13340favorable experience using them; I can't label them "experimental"
13341forever.)
13342
13343- There's new string literal syntax for "raw strings". Prefixing a string
13344literal with the letter r (or R) disables all escape processing in the
13345string; for example, r'\n' is a two-character string consisting of a
13346backslash followed by the letter n. This combines with all forms of string
13347quotes; it is actually useful for triple quoted doc strings which might
13348contain references to \n or \t. An embedded quote prefixed with a
13349backslash does not terminate the string, but the backslash is still
13350included in the string; for example, r'\'' is a two-character string
13351consisting of a backslash and a quote. (Raw strings are also
13352affectionately known as Robin strings, after their inventor, Robin
13353Friedrich.)
13354
13355- There's a simple assert statement, and a new exception
13356AssertionError. For example, ``assert foo > 0'' is equivalent to ``if
13357not foo > 0: raise AssertionError''. Sorry, the text of the asserted
13358condition is not available; it would be too complicated to generate
13359code for this (since the code is generated from a parse tree).
13360However, the text is displayed as part of the traceback!
13361
13362- The raise statement has a new feature: when using "raise SomeClass,
13363somevalue" where somevalue is not an instance of SomeClass, it
13364instantiates SomeClass(somevalue). In 1.5a4, if somevalue is an
13365instance of a *derived* class of SomeClass, the exception class raised
13366is set to somevalue.__class__, and SomeClass is ignored after that.
13367
13368- Duplicate keyword arguments are now detected at compile time;
13369f(a=1,a=2) is now a syntax error.
13370
13371
13372Changes to builtin features
13373---------------------------
13374
13375- There's a new exception FloatingPointError (used only by Lee Busby's
13376patches to catch floating point exceptions, at the moment).
13377
13378- The obsolete exception ConflictError (presumably used by the long
13379obsolete access statement) has been deleted.
13380
13381- There's a new function sys.exc_info() which returns the tuple
13382(sys.exc_type, sys.exc_value, sys.exc_traceback) in a thread-safe way.
13383
13384- There's a new variable sys.executable, pointing to the executable file
13385for the Python interpreter.
13386
13387- The sort() methods for lists no longer uses the C library qsort(); I
13388wrote my own quicksort implementation, with lots of help (in the form
13389of a kind of competition) from Tim Peters. This solves a bug in
13390dictionary comparisons on some Solaris versions when Python is built
13391with threads, and makes sorting lists even faster.
13392
13393- The semantics of comparing two dictionaries have changed, to make
13394comparison of unequal dictionaries faster. A shorter dictionary is
13395always considered smaller than a larger dictionary. For dictionaries
13396of the same size, the smallest differing element determines the
13397outcome (which yields the same results as before in this case, without
13398explicit sorting). Thanks to Aaron Watters for suggesting something
13399like this.
13400
13401- The semantics of try-except have changed subtly so that calling a
13402function in an exception handler that itself raises and catches an
13403exception no longer overwrites the sys.exc_* variables. This also
13404alleviates the problem that objects referenced in a stack frame that
13405caught an exception are kept alive until another exception is caught
13406-- the sys.exc_* variables are restored to their previous value when
13407returning from a function that caught an exception.
13408
13409- There's a new "buffer" interface. Certain objects (e.g. strings and
13410arrays) now support the "buffer" protocol. Buffer objects are acceptable
13411whenever formerly a string was required for a write operation; mutable
13412buffer objects can be the target of a read operation using the call
13413f.readinto(buffer). A cool feature is that regular expression matching now
13414also work on array objects. Contribution by Jack Jansen. (Needs
13415documentation.)
13416
13417- String interning: dictionary lookups are faster when the lookup
13418string object is the same object as the key in the dictionary, not
13419just a string with the same value. This is done by having a pool of
13420"interned" strings. Most names generated by the interpreter are now
13421automatically interned, and there's a new built-in function intern(s)
13422that returns the interned version of a string. Interned strings are
13423not a different object type, and interning is totally optional, but by
13424interning most keys a speedup of about 15% was obtained for the
13425pystone benchmark.
13426
13427- Dictionary objects have several new methods; clear() and copy() have
13428the obvious semantics, while update(d) merges the contents of another
13429dictionary d into this one, overriding existing keys. The dictionary
13430implementation file is now called dictobject.c rather than the
13431confusing mappingobject.c.
13432
13433- The intrinsic function dir() is much smarter; it looks in __dict__,
13434__members__ and __methods__.
13435
13436- The intrinsic functions int(), long() and float() can now take a
13437string argument and then do the same thing as string.atoi(),
13438string.atol(), and string.atof(). No second 'base' argument is
13439allowed, and complex() does not take a string (nobody cared enough).
13440
13441- When a module is deleted, its globals are now deleted in two phases.
13442In the first phase, all variables whose name begins with exactly one
13443underscore are replaced by None; in the second phase, all variables
13444are deleted. This makes it possible to have global objects whose
13445destructors depend on other globals. The deletion order within each
13446phase is still random.
13447
13448- It is no longer an error for a function to be called without a
13449global variable __builtins__ -- an empty directory will be provided
13450by default.
13451
13452- Guido's corollary to the "Don Beaudry hook": it is now possible to
13453do metaprogramming by using an instance as a base class. Not for the
13454faint of heart; and undocumented as yet, but basically if a base class
13455is an instance, its class will be instantiated to create the new
13456class. Jim Fulton will love it -- it also works with instances of his
13457"extension classes", since it is triggered by the presence of a
13458__class__ attribute on the purported base class. See
13459Demo/metaclasses/index.html for an explanation and see that directory
13460for examples.
13461
13462- Another change is that the Don Beaudry hook is now invoked when
13463*any* base class is special. (Up to 1.5a3, the *last* special base
13464class is used; in 1.5a4, the more rational choice of the *first*
13465special base class is used.)
13466
13467- New optional parameter to the readlines() method of file objects.
13468This indicates the number of bytes to read (the actual number of bytes
13469read will be somewhat larger due to buffering reading until the end of
13470the line). Some optimizations have also been made to speed it up (but
13471not as much as read()).
13472
13473- Complex numbers no longer have the ".conj" pseudo attribute; use
13474z.conjugate() instead, or complex(z.real, -z.imag). Complex numbers
13475now *do* support the __members__ and __methods__ special attributes.
13476
13477- The complex() function now looks for a __complex__() method on class
13478instances before giving up.
13479
13480- Long integers now support arbitrary shift counts, so you can now
13481write 1L<<1000000, memory permitting. (Python 1.4 reports "outrageous
13482shift count for this.)
13483
13484- The hex() and oct() functions have been changed so that for regular
13485integers, they never emit a minus sign. For example, on a 32-bit
13486machine, oct(-1) now returns '037777777777' and hex(-1) returns
13487'0xffffffff'. While this may seem inconsistent, it is much more
13488useful. (For long integers, a minus sign is used as before, to fit
13489the result in memory :-)
13490
13491- The hash() function computes better hashes for several data types,
13492including strings, floating point numbers, and complex numbers.
13493
13494
13495New extension modules
13496---------------------
13497
13498- New extension modules cStringIO.c and cPickle.c, written by Jim
13499Fulton and other folks at Digital Creations. These are much more
13500efficient than their Python counterparts StringIO.py and pickle.py,
13501but don't support subclassing. cPickle.c clocks up to 1000 times
13502faster than pickle.py; cStringIO.c's improvement is less dramatic but
13503still significant.
13504
13505- New extension module zlibmodule.c, interfacing to the free zlib
13506library (gzip compatible compression). There's also a module gzip.py
13507which provides a higher level interface. Written by Andrew Kuchling
13508and Jeremy Hylton.
13509
13510- New module readline; see the "miscellaneous" section above.
13511
13512- New Unix extension module resource.c, by Jeremy Hylton, provides
13513access to getrlimit(), getrusage(), setrusage(), getpagesize(), and
13514related symbolic constants.
13515
13516- New extension puremodule.c, by Barry Warsaw, which interfaces to the
13517Purify(TM) C API. See also the file Misc/PURIFY.README. It is also
13518possible to enable Purify by simply setting the PURIFY Makefile
13519variable in the Modules/Setup file.
13520
13521
13522Changes in extension modules
13523----------------------------
13524
13525- The struct extension module has several new features to control byte
13526order and word size. It supports reading and writing IEEE floats even
13527on platforms where this is not the native format. It uses uppercase
13528format codes for unsigned integers of various sizes (always using
13529Python long ints for 'I' and 'L'), 's' with a size prefix for strings,
13530and 'p' for "Pascal strings" (with a leading length byte, included in
13531the size; blame Hannu Krosing; new in 1.5a4). A prefix '>' forces
13532big-endian data and '<' forces little-endian data; these also select
13533standard data sizes and disable automatic alignment (use pad bytes as
13534needed).
13535
13536- The array module supports uppercase format codes for unsigned data
13537formats (like the struct module).
13538
13539- The fcntl extension module now exports the needed symbolic
13540constants. (Formerly these were in FCNTL.py which was not available
13541or correct for all platforms.)
13542
13543- The extension modules dbm, gdbm and bsddb now check that the
13544database is still open before making any new calls.
13545
13546- The dbhash module is no more. Use bsddb instead. (There's a third
13547party interface for the BSD 2.x code somewhere on the web; support for
13548bsddb will be deprecated.)
13549
13550- The gdbm module now supports a sync() method.
13551
13552- The socket module now has some new functions: getprotobyname(), and
13553the set {ntoh,hton}{s,l}().
13554
13555- Various modules now export their type object: socket.SocketType,
13556array.ArrayType.
13557
13558- The socket module's accept() method now returns unknown addresses as
13559a tuple rather than raising an exception. (This can happen in
13560promiscuous mode.) Theres' also a new function getprotobyname().
13561
13562- The pthread support for the thread module now works on most platforms.
13563
13564- STDWIN is now officially obsolete. Support for it will eventually
13565be removed from the distribution.
13566
13567- The binascii extension module is now hopefully fully debugged.
13568(XXX Oops -- Fredrik Lundh promised me a uuencode fix that I never
13569received.)
13570
13571- audioop.c: added a ratecv() function; better handling of overflow in
13572add().
13573
13574- posixmodule.c: now exports the O_* flags (O_APPEND etc.). On
13575Windows, also O_TEXT and O_BINARY. The 'error' variable (the
13576exception is raises) is renamed -- its string value is now "os.error",
13577so newbies don't believe they have to import posix (or nt) to catch
13578it when they see os.error reported as posix.error. The execve()
13579function now accepts any mapping object for the environment.
13580
13581- A new version of the al (audio library) module for SGI was
13582contributed by Sjoerd Mullender.
13583
13584- The regex module has a new function get_syntax() which retrieves the
13585syntax setting set by set_syntax(). The code was also sanitized,
13586removing worries about unclean error handling. See also below for its
13587successor, re.py.
13588
13589- The "new" module (which creates new objects of various types) once
13590again has a fully functioning new.function() method. Dangerous as
13591ever! Also, new.code() has several new arguments.
13592
13593- A problem has been fixed in the rotor module: on systems with signed
13594characters, rotor-encoded data was not portable when the key contained
135958-bit characters. Also, setkey() now requires its argument rather
13596than having broken code to default it.
13597
13598- The sys.builtin_module_names variable is now a tuple. Another new
13599variables in sys is sys.executable (the full path to the Python
13600binary, if known).
13601
13602- The specs for time.strftime() have undergone some revisions. It
13603appears that not all format characters are supported in the same way
13604on all platforms. Rather than reimplement it, we note these
13605differences in the documentation, and emphasize the shared set of
13606features. There's also a thorough test set (that occasionally finds
13607problems in the C library implementation, e.g. on some Linuxes),
13608thanks to Skip Montanaro.
13609
13610- The nis module seems broken when used with NIS+; unfortunately
13611nobody knows how to fix it. It should still work with old NIS.
13612
13613
13614New library modules
13615-------------------
13616
13617- New (still experimental) Perl-style regular expression module,
13618re.py, which uses a new interface for matching as well as a new
13619syntax; the new interface avoids the thread-unsafety of the regex
13620interface. This comes with a helper extension reopmodule.c and vastly
13621rewritten regexpr.c. Most work on this was done by Jeffrey Ollie, Tim
13622Peters, and Andrew Kuchling. See the documentation libre.tex. In
136231.5, the old regex module is still fully supported; in the future, it
13624will become obsolete.
13625
13626- New module gzip.py; see zlib above.
13627
13628- New module keyword.py exports knowledge about Python's built-in
13629keywords. (New version by Ka-Ping Yee.)
13630
13631- New module pprint.py (with documentation) which supports
13632pretty-printing of lists, tuples, & dictionaries recursively. By Fred
13633Drake.
13634
13635- New module code.py. The function code.compile_command() can
13636determine whether an interactively entered command is complete or not,
13637distinguishing incomplete from invalid input. (XXX Unfortunately,
13638this seems broken at this moment, and I don't have the time to fix
13639it. It's probably better to add an explicit interface to the parser
13640for this.)
13641
13642- There is now a library module xdrlib.py which can read and write the
13643XDR data format as used by Sun RPC, for example. It uses the struct
13644module.
13645
13646
13647Changes in library modules
13648--------------------------
13649
13650- Module codehack.py is now completely obsolete.
13651
13652- The pickle.py module has been updated to make it compatible with the
13653new binary format that cPickle.c produces. By default it produces the
13654old all-ASCII format compatible with the old pickle.py, still much
13655faster than pickle.py; it will read both formats automatically. A few
13656other updates have been made.
13657
13658- A new helper module, copy_reg.py, is provided to register extensions
13659to the pickling code.
13660
13661- Revamped module tokenize.py is much more accurate and has an
13662interface that makes it a breeze to write code to colorize Python
13663source code. Contributed by Ka-Ping Yee.
13664
13665- In ihooks.py, ModuleLoader.load_module() now closes the file under
13666all circumstances.
13667
13668- The tempfile.py module has a new class, TemporaryFile, which creates
13669an open temporary file that will be deleted automatically when
13670closed. This works on Windows and MacOS as well as on Unix. (Jim
13671Fulton.)
13672
13673- Changes to the cgi.py module: Most imports are now done at the
13674top of the module, which provides a speedup when using ni (Jim
13675Fulton). The problem with file upload to a Windows platform is solved
13676by using the new tempfile.TemporaryFile class; temporary files are now
13677always opened in binary mode (Jim Fulton). The cgi.escape() function
13678now takes an optional flag argument that quotes '"' to '&quot;'. It
13679is now possible to invoke cgi.py from a command line script, to test
13680cgi scripts more easily outside an http server. There's an optional
13681limit to the size of uploads to POST (Skip Montanaro). Added a
13682'strict_parsing' option to all parsing functions (Jim Fulton). The
13683function parse_qs() now uses urllib.unquote() on the name as well as
13684the value of fields (Clarence Gardner). The FieldStorage class now
13685has a __len__() method.
13686
13687- httplib.py: the socket object is no longer closed; all HTTP/1.*
13688responses are now accepted; and it is now thread-safe (by not using
13689the regex module).
13690
13691- BaseHTTPModule.py: treat all HTTP/1.* versions the same.
13692
13693- The popen2.py module is now rewritten using a class, which makes
13694access to the standard error stream and the process id of the
13695subprocess possible.
13696
13697- Added timezone support to the rfc822.py module, in the form of a
13698getdate_tz() method and a parsedate_tz() function; also a mktime_tz().
13699Also added recognition of some non-standard date formats, by Lars
13700Wirzenius, and RFC 850 dates (Chris Lawrence).
13701
13702- mhlib.py: various enhancements, including almost compatible parsing
13703of message sequence specifiers without invoking a subprocess. Also
13704added a createmessage() method by Lars Wirzenius.
13705
13706- The StringIO.StringIO class now supports readline(nbytes). (Lars
13707Wirzenius.) (Of course, you should be using cStringIO for performance.)
13708
13709- UserDict.py supports the new dictionary methods as well.
13710
13711- Improvements for whrandom.py by Tim Peters: use 32-bit arithmetic to
13712speed it up, and replace 0 seed values by 1 to avoid degeneration.
13713A bug was fixed in the test for invalid arguments.
13714
13715- Module ftplib.py: added support for parsing a .netrc file (Fred
13716Drake). Also added an ntransfercmd() method to the FTP class, which
13717allows access to the expected size of a transfer when available, and a
13718parse150() function to the module which parses the corresponding 150
13719response.
13720
13721- urllib.py: the ftp cache is now limited to 10 entries. Added
13722quote_plus() and unquote_plus() functions which are like quote() and
13723unquote() but also replace spaces with '+' or vice versa, for
13724encoding/decoding CGI form arguments. Catch all errors from the ftp
13725module. HTTP requests now add the Host: header line. The proxy
13726variable names are now mapped to lower case, for Windows. The
13727spliturl() function no longer erroneously throws away all data past
13728the first newline. The basejoin() function now intereprets "../"
13729correctly. I *believe* that the problems with "exception raised in
13730__del__" under certain circumstances have been fixed (mostly by
13731changes elsewher in the interpreter).
13732
13733- In urlparse.py, there is a cache for results in urlparse.urlparse();
13734its size limit is set to 20. Also, new URL schemes shttp, https, and
13735snews are "supported".
13736
13737- shelve.py: use cPickle and cStringIO when available. Also added
13738a sync() method, which calls the database's sync() method if there is
13739one.
13740
13741- The mimetools.py module now uses the available Python modules for
13742decoding quoted-printable, uuencode and base64 formats, rather than
13743creating a subprocess.
13744
13745- The python debugger (pdb.py, and its base class bdb.py) now support
13746conditional breakpoints. See the docs.
13747
13748- The modules base64.py, uu.py and quopri.py can now be used as simple
13749command line utilities.
13750
13751- Various small fixes to the nntplib.py module that I can't bother to
13752document in detail.
13753
13754- Sjoerd Mullender's mimify.py module now supports base64 encoding and
13755includes functions to handle the funny encoding you sometimes see in mail
13756headers. It is now documented.
13757
13758- mailbox.py: Added BabylMailbox. Improved the way the mailbox is
13759gotten from the environment.
13760
13761- Many more modules now correctly open files in binary mode when this
13762is necessary on non-Unix platforms.
13763
13764- The copying functions in the undocumented module shutil.py are
13765smarter.
13766
13767- The Writer classes in the formatter.py module now have a flush()
13768method.
13769
13770- The sgmllib.py module accepts hyphens and periods in the middle of
13771attribute names. While this is against the SGML standard, there is
13772some HTML out there that uses this...
13773
13774- The interface for the Python bytecode disassembler module, dis.py,
13775has been enhanced quite a bit. There's now one main function,
13776dis.dis(), which takes almost any kind of object (function, module,
13777class, instance, method, code object) and disassembles it; without
13778arguments it disassembles the last frame of the last traceback. The
13779other functions have changed slightly, too.
13780
13781- The imghdr.py module recognizes new image types: BMP, PNG.
13782
13783- The string.py module has a new function replace(str, old, new,
13784[maxsplit]) which does substring replacements. It is actually
13785implemented in C in the strop module. The functions [r]find() an
13786[r]index() have an optional 4th argument indicating the end of the
13787substring to search, alsoo implemented by their strop counterparts.
13788(Remember, never import strop -- import string uses strop when
13789available with zero overhead.)
13790
13791- The string.join() function now accepts any sequence argument, not
13792just lists and tuples.
13793
13794- The string.maketrans() requires its first two arguments to be
13795present. The old version didn't require them, but there's not much
13796point without them, and the documentation suggests that they are
13797required, so we fixed the code to match the documentation.
13798
13799- The regsub.py module has a function clear_cache(), which clears its
13800internal cache of compiled regular expressions. Also, the cache now
13801takes the current syntax setting into account. (However, this module
13802is now obsolete -- use the sub() or subn() functions or methods in the
13803re module.)
13804
13805- The undocumented module Complex.py has been removed, now that Python
13806has built-in complex numbers. A similar module remains as
13807Demo/classes/Complex.py, as an example.
13808
13809
13810Changes to the build process
13811----------------------------
13812
13813- The way GNU readline is configured is totally different. The
13814--with-readline configure option is gone. It is now an extension
13815module, which may be loaded dynamically. You must enable it (and
Thomas Wouters89f507f2006-12-13 04:49:30 +000013816specify the correct libraries to link with) in the Modules/Setup file.
Guido van Rossum439d1fa1998-12-21 21:41:14 +000013817Importing the module installs some hooks which enable command line
13818editing. When the interpreter shell is invoked interactively, it
13819attempts to import the readline module; when this fails, the default
13820input mechanism is used. The hook variables are PyOS_InputHook and
13821PyOS_ReadlineFunctionPointer. (Code contributed by Lee Busby, with
13822ideas from William Magro.)
13823
13824- New build procedure: a single library, libpython1.5.a, is now built,
13825which contains absolutely everything except for a one-line main()
13826program (which calls Py_Main(argc, argv) to start the interpreter
13827shell). This makes life much simpler for applications that need to
13828embed Python. The serial number of the build is now included in the
13829version string (sys.version).
13830
13831- As far as I can tell, neither gcc -Wall nor the Microsoft compiler
13832emits a single warning any more when compiling Python.
13833
13834- A number of new Makefile variables have been added for special
13835situations, e.g. LDLAST is appended to the link command. These are
13836used by editing the Makefile or passing them on the make command
13837line.
13838
13839- A set of patches from Lee Busby has been integrated that make it
13840possible to catch floating point exceptions. Use the configure option
13841--with-fpectl to enable the patches; the extension modules fpectl and
13842fpetest provide control to enable/disable and test the feature,
13843respectively.
13844
13845- The support for shared libraries under AIX is now simpler and more
13846robust. Thanks to Vladimir Marangozov for revamping his own patches!
13847
13848- The Modules/makesetup script now reads a file Setup.local as well as
13849a file Setup. Most changes to the Setup script can be done by editing
13850Setup.local instead, which makes it easier to carry a particular setup
13851over from one release to the next.
13852
13853- The Modules/makesetup script now copies any "include" lines it
13854encounters verbatim into the output Makefile. It also recognizes .cxx
13855and .cpp as C++ source files.
13856
13857- The configure script is smarter about C compiler options; e.g. with
13858gcc it uses -O2 and -g when possible, and on some other platforms it
13859uses -Olimit 1500 to avoid a warning from the optimizer about the main
13860loop in ceval.c (which has more than 1000 basic blocks).
13861
13862- The configure script now detects whether malloc(0) returns a NULL
13863pointer or a valid block (of length zero). This avoids the nonsense
13864of always adding one byte to all malloc() arguments on most platforms.
13865
13866- The configure script has a new option, --with-dec-threads, to enable
13867DEC threads on DEC Alpha platforms. Also, --with-threads is now an
13868alias for --with-thread (this was the Most Common Typo in configure
13869arguments).
13870
13871- Many changes in Doc/Makefile; amongst others, latex2html is now used
13872to generate HTML from all latex documents.
13873
13874
13875Change to the Python/C API
13876--------------------------
13877
13878- Because some interfaces have changed, the PYTHON_API macro has been
13879bumped. Most extensions built for the old API version will still run,
13880but I can't guarantee this. Python prints a warning message on
13881version mismatches; it dumps core when the version mismatch causes a
13882serious problem :-)
13883
13884- I've completed the Grand Renaming, with the help of Roger Masse and
13885Barry Warsaw. This makes reading or debugging the code much easier.
13886Many other unrelated code reorganizations have also been carried out.
13887The allobjects.h header file is gone; instead, you would have to
13888include Python.h followed by rename2.h. But you're better off running
13889Tools/scripts/fixcid.py -s Misc/RENAME on your source, so you can omit
13890the rename2.h; it will disappear in the next release.
13891
13892- Various and sundry small bugs in the "abstract" interfaces have been
13893fixed. Thanks to all the (involuntary) testers of the Python 1.4
13894version! Some new functions have been added, e.g. PySequence_List(o),
13895equivalent to list(o) in Python.
13896
13897- New API functions PyLong_FromUnsignedLong() and
13898PyLong_AsUnsignedLong().
13899
13900- The API functions in the file cgensupport.c are no longer
13901supported. This file has been moved to Modules and is only ever
13902compiled when the SGI specific 'gl' module is built.
13903
13904- PyObject_Compare() can now raise an exception. Check with
13905PyErr_Occurred(). The comparison function in an object type may also
13906raise an exception.
13907
13908- The slice interface uses an upper bound of INT_MAX when no explicit
13909upper bound is given (e.x. for a[1:]). It used to ask the object for
13910its length and do the calculations.
13911
13912- Support for multiple independent interpreters. See Doc/api.tex,
13913functions Py_NewInterpreter() and Py_EndInterpreter(). Since the
13914documentation is incomplete, also see the new Demo/pysvr example
13915(which shows how to use these in a threaded application) and the
13916source code.
13917
13918- There is now a Py_Finalize() function which "de-initializes"
13919Python. It is possible to completely restart the interpreter
13920repeatedly by calling Py_Finalize() followed by Py_Initialize(). A
13921change of functionality in Py_Initialize() means that it is now a
13922fatal error to call it while the interpreter is already initialized.
13923The old, half-hearted Py_Cleanup() routine is gone. Use of Py_Exit()
13924is deprecated (it is nothing more than Py_Finalize() followed by
13925exit()).
13926
13927- There are no known memory leaks left. While Py_Finalize() doesn't
13928free *all* allocated memory (some of it is hard to track down),
13929repeated calls to Py_Finalize() and Py_Initialize() do not create
13930unaccessible heap blocks.
13931
13932- There is now explicit per-thread state. (Inspired by, but not the
13933same as, Greg Stein's free threading patches.)
13934
13935- There is now better support for threading C applications. There are
13936now explicit APIs to manipulate the interpreter lock. Read the source
13937or the Demo/pysvr example; the new functions are
13938PyEval_{Acquire,Release}{Lock,Thread}().
13939
13940- The test macro DEBUG has changed to Py_DEBUG, to avoid interference
13941with other libraries' DEBUG macros. Likewise for any other test
13942macros that didn't yet start with Py_.
13943
13944- New wrappers around malloc() and friends: Py_Malloc() etc. call
13945malloc() and call PyErr_NoMemory() when it fails; PyMem_Malloc() call
13946just malloc(). Use of these wrappers could be essential if multiple
13947memory allocators exist (e.g. when using certain DLL setups under
13948Windows). (Idea by Jim Fulton.)
13949
13950- New C API PyImport_Import() which uses whatever __import__() hook
13951that is installed for the current execution environment. By Jim
13952Fulton.
13953
13954- It is now possible for an extension module's init function to fail
13955non-fatally, by calling one of the PyErr_* functions and returning.
13956
13957- The PyInt_AS_LONG() and PyFloat_AS_DOUBLE() macros now cast their
13958argument to the proper type, like the similar PyString macros already
13959did. (Suggestion by Marc-Andre Lemburg.) Similar for PyList_GET_SIZE
13960and PyList_GET_ITEM.
13961
13962- Some of the Py_Get* function, like Py_GetVersion() (but not yet
13963Py_GetPath()) are now declared as returning a const char *. (More
13964should follow.)
13965
13966- Changed the run-time library to check for exceptions after object
13967comparisons. PyObject_Compare() can now return an exception; use
13968PyErr_Occurred() to check (there is *no* special return value).
13969
13970- PyFile_WriteString() and Py_Flushline() now return error indicators
13971instead of clearing exceptions. This fixes an obscure bug where using
13972these would clear a pending exception, discovered by Just van Rossum.
13973
13974- There's a new function, PyArg_ParseTupleAndKeywords(), which parses
13975an argument list including keyword arguments. Contributed by Geoff
13976Philbrick.
13977
13978- PyArg_GetInt() is gone.
13979
13980- It's no longer necessary to include graminit.h when calling one of
13981the extended parser API functions. The three public grammar start
13982symbols are now in Python.h as Py_single_input, Py_file_input, and
13983Py_eval_input.
13984
13985- The CObject interface has a new function,
13986PyCObject_Import(module, name). It calls PyCObject_AsVoidPtr()
13987on the object referenced by "module.name".
13988
13989
13990Tkinter
13991-------
13992
13993- On popular demand, _tkinter once again installs a hook for readline
13994that processes certain Tk events while waiting for the user to type
13995(using PyOS_InputHook).
13996
13997- A patch by Craig McPheeters plugs the most obnoxious memory leaks,
13998caused by command definitions referencing widget objects beyond their
13999lifetime.
14000
14001- New standard dialog modules: tkColorChooser.py, tkCommonDialog.py,
14002tkMessageBox.py, tkFileDialog.py, tkSimpleDialog.py These interface
14003with the new Tk dialog scripts, and provide more "native platform"
14004style file selection dialog boxes on some platforms. Contributed by
14005Fredrik Lundh.
14006
14007- Tkinter.py: when the first Tk object is destroyed, it sets the
14008hiddel global _default_root to None, so that when another Tk object is
14009created it becomes the new default root. Other miscellaneous
14010changes and fixes.
14011
14012- The Image class now has a configure method.
14013
14014- Added a bunch of new winfo options to Tkinter.py; we should now be
14015up to date with Tk 4.2. The new winfo options supported are:
14016mananger, pointerx, pointerxy, pointery, server, viewable, visualid,
14017visualsavailable.
14018
14019- The broken bind() method on Canvas objects defined in the Canvas.py
14020module has been fixed. The CanvasItem and Group classes now also have
14021an unbind() method.
14022
14023- The problem with Tkinter.py falling back to trying to import
14024"tkinter" when "_tkinter" is not found has been fixed -- it no longer
14025tries "tkinter", ever. This makes diagnosing the problem "_tkinter
14026not configured" much easier and will hopefully reduce the newsgroup
14027traffic on this topic.
14028
14029- The ScrolledText module once again supports the 'cnf' parameter, to
14030be compatible with the examples in Mark Lutz' book (I know, I know,
14031too late...)
14032
14033- The _tkinter.c extension module has been revamped. It now support
14034Tk versions 4.1 through 8.0; support for 4.0 has been dropped. It
14035works well under Windows and Mac (with the latest Tk ports to those
14036platforms). It also supports threading -- it is safe for one
14037(Python-created) thread to be blocked in _tkinter.mainloop() while
14038other threads modify widgets. To make the changes visible, those
14039threads must use update_idletasks()method. (The patch for threading
14040in 1.5a3 was broken; in 1.5a4, it is back in a different version,
14041which requires access to the Tcl sources to get it to work -- hence it
14042is disabled by default.)
14043
14044- A bug in _tkinter.c has been fixed, where Split() with a string
14045containing an unmatched '"' could cause an exception or core dump.
14046
14047- Unfortunately, on Windows and Mac, Tk 8.0 no longer supports
14048CreateFileHandler, so _tkinter.createfilehandler is not available on
14049those platforms when using Tk 8.0 or later. I will have to rethink
14050how to interface with Tcl's lower-level event mechanism, or with its
14051channels (which are like Python's file-like objects). Jack Jansen has
14052provided a fix for the Mac, so createfilehandler *is* actually
14053supported there; maybe I can adapt his fix for Windows.
14054
14055
14056Tools and Demos
14057---------------
14058
14059- A new regression test suite is provided, which tests most of the
14060standard and built-in modules. The regression test is run by invoking
14061the script Lib/test/regrtest.py. Barry Warsaw wrote the test harnass;
14062he and Roger Masse contributed most of the new tests.
14063
14064- New tool: faqwiz -- the CGI script that is used to maintain the
14065Python FAQ (http://grail.cnri.reston.va.us/cgi-bin/faqw.py). In
14066Tools/faqwiz.
14067
14068- New tool: webchecker -- a simple extensible web robot that, when
14069aimed at a web server, checks that server for dead links. Available
14070are a command line utility as well as a Tkinter based GUI version. In
14071Tools/webchecker. A simplified version of this program is dissected
14072in my article in O'Reilly's WWW Journal, the issue on Scripting
14073Languages (Vol 2, No 2); Scripting the Web with Python (pp 97-120).
14074Includes a parser for robots.txt files by Skip Montanaro.
14075
14076- New small tools: cvsfiles.py (prints a list of all files under CVS
14077n a particular directory tree), treesync.py (a rather Guido-specific
14078script to synchronize two source trees, one on Windows NT, the other
14079one on Unix under CVS but accessible from the NT box), and logmerge.py
14080(sort a collection of RCS or CVS logs by date). In Tools/scripts.
14081
14082- The freeze script now also works under Windows (NT). Another
14083feature allows the -p option to be pointed at the Python source tree
14084instead of the installation prefix. This was loosely based on part of
14085xfreeze by Sam Rushing and Bill Tutt.
14086
14087- New examples (Demo/extend) that show how to use the generic
14088extension makefile (Misc/Makefile.pre.in).
14089
14090- Tools/scripts/h2py.py now supports C++ comments.
14091
14092- Tools/scripts/pystone.py script is upgraded to version 1.1; there
14093was a bug in version 1.0 (distributed with Python 1.4) that leaked
14094memory. Also, in 1.1, the LOOPS variable is incremented to 10000.
14095
14096- Demo/classes/Rat.py completely rewritten by Sjoerd Mullender.
14097
14098
14099Windows (NT and 95)
14100-------------------
14101
14102- New project files for Developer Studio (Visual C++) 5.0 for Windows
14103NT (the old VC++ 4.2 Makefile is also still supported, but will
14104eventually be withdrawn due to its bulkiness).
14105
14106- See the note on the new module search path in the "Miscellaneous" section
14107above.
14108
14109- Support for Win32s (the 32-bit Windows API under Windows 3.1) is
14110basically withdrawn. If it still works for you, you're lucky.
14111
14112- There's a new extension module, msvcrt.c, which provides various
14113low-level operations defined in the Microsoft Visual C++ Runtime Library.
14114These include locking(), setmode(), get_osfhandle(), set_osfhandle(), and
14115console I/O functions like kbhit(), getch() and putch().
14116
14117- The -u option not only sets the standard I/O streams to unbuffered
14118status, but also sets them in binary mode. (This can also be done
14119using msvcrt.setmode(), by the way.)
14120
14121- The, sys.prefix and sys.exec_prefix variables point to the directory
14122where Python is installed, or to the top of the source tree, if it was run
14123from there.
14124
14125- The various os.path modules (posixpath, ntpath, macpath) now support
14126passing more than two arguments to the join() function, so
14127os.path.join(a, b, c) is the same as os.path.join(a, os.path.join(b,
14128c)).
14129
14130- The ntpath module (normally used as os.path) supports ~ to $HOME
14131expansion in expanduser().
14132
14133- The freeze tool now works on Windows.
14134
14135- See also the Tkinter category for a sad note on
14136_tkinter.createfilehandler().
14137
14138- The truncate() method for file objects now works on Windows.
14139
14140- Py_Initialize() is no longer called when the DLL is loaded. You
14141must call it yourself.
14142
14143- The time module's clock() function now has good precision through
14144the use of the Win32 API QueryPerformanceCounter().
14145
14146- Mark Hammond will release Python 1.5 versions of PythonWin and his
14147other Windows specific code: the win32api extensions, COM/ActiveX
14148support, and the MFC interface.
14149
14150
14151Mac
14152---
14153
14154- As always, the Macintosh port will be done by Jack Jansen. He will
14155make a separate announcement for the Mac specific source code and the
14156binary distribution(s) when these are ready.
14157
14158
14159======================================================================
Guido van Rossuma7925f11994-01-26 10:20:16 +000014160
Guido van Rossumaa253861994-10-06 17:18:57 +000014161
Guido van Rossumc30e95f1996-07-30 18:53:51 +000014162=====================================
Guido van Rossum821a5581997-05-23 04:05:31 +000014163==> Release 1.4 (October 25 1996) <==
14164=====================================
14165
14166(Starting in reverse chronological order:)
14167
14168- Changed disclaimer notice.
14169
14170- Added SHELL=/bin/sh to Misc/Makefile.pre.in -- some Make versions
14171default to the user's login shell.
14172
14173- In Lib/tkinter/Tkinter.py, removed bogus binding of <Delete> in Text
14174widget, and bogus bspace() function.
14175
14176- In Lib/cgi.py, bumped __version__ to 2.0 and restored a truncated
14177paragraph.
14178
14179- Fixed the NT Makefile (PC/vc40.mak) for VC 4.0 to set /MD for all
14180subprojects, and to remove the (broken) experimental NumPy
14181subprojects.
14182
14183- In Lib/py_compile.py, cast mtime to long() so it will work on Mac
14184(where os.stat() returns mtimes as floats.)
14185- Set self.rfile unbuffered (like self.wfile) in SocketServer.py, to
14186fix POST in CGIHTTPServer.py.
14187
14188- Version 2.83 of Misc/python-mode.el for Emacs is included.
14189
14190- In Modules/regexmodule.c, fixed symcomp() to correctly handle a new
14191group starting immediately after a group tag.
14192
14193- In Lib/SocketServer.py, changed the mode for rfile to unbuffered.
14194
14195- In Objects/stringobject.c, fixed the compare function to do the
14196first char comparison in unsigned mode, for consistency with the way
14197other characters are compared by memcmp().
14198
14199- In Lib/tkinter/Tkinter.py, fixed Scale.get() to support floats.
14200
14201- In Lib/urllib.py, fix another case where openedurl wasn't set.
14202
14203(XXX Sorry, the rest is in totally random order. No time to fix it.)
14204
14205- SyntaxError exceptions detected during code generation
14206(e.g. assignment to an expression) now include a line number.
14207
14208- Don't leave trailing / or \ in script directory inserted in front of
14209sys.path.
14210
14211- Added a note to Tools/scripts/classfix.py abouts its historical
14212importance.
14213
14214- Added Misc/Makefile.pre.in, a universal Makefile for extensions
14215built outside the distribution.
14216
14217- Rewritten Misc/faq2html.py, by Ka-Ping Yee.
14218
14219- Install shared modules with mode 555 (needed for performance on some
14220platforms).
14221
14222- Some changes to standard library modules to avoid calling append()
14223with more than one argument -- while supported, this should be
14224outlawed, and I don't want to set a bad example.
14225
14226- bdb.py (and hence pdb.py) supports calling run() with a code object
14227instead of a code string.
14228
14229- Fixed an embarrassing bug cgi.py which prevented correct uploading
14230of binary files from Netscape (which doesn't distinguish between
14231binary and text files). Also added dormant logging support, which
14232makes it easier to debug the cgi module itself.
14233
14234- Added default writer to constructor of NullFormatter class.
14235
14236- Use binary mode for socket.makefile() calls in ftplib.py.
14237
14238- The ihooks module no longer "installs" itself upon import -- this
14239was an experimental feature that helped ironing out some bugs but that
14240slowed down code that imported it without the need to install it
14241(e.g. the rexec module). Also close the file in some cases and add
14242the __file__ attribute to loaded modules.
14243
14244- The test program for mailbox.py is now more useful.
14245
14246- Added getparamnames() to Message class in mimetools.py -- it returns
14247the names of parameters to the content-type header.
14248
14249- Fixed a typo in ni that broke the loop stripping "__." from names.
14250
14251- Fix sys.path[0] for scripts run via pdb.py's new main program.
14252
14253- profile.py can now also run a script, like pdb.
14254
14255- Fix a small bug in pyclbr -- don't add names starting with _ when
14256emulating from ... import *.
14257
14258- Fixed a series of embarrassing typos in rexec's handling of standard
14259I/O redirection. Added some more "safe" built-in modules: cmath,
14260errno, operator.
14261
14262- Fixed embarrassing typo in shelve.py.
14263
14264- Added SliceType and EllipsisType to types.py.
14265
14266- In urllib.py, added handling for error 301 (same as 302); added
14267geturl() method to get the URL after redirection.
14268
14269- Fixed embarrassing typo in xdrlib.py. Also fixed typo in Setup.in
14270for _xdrmodule.c and removed redundant #include from _xdrmodule.c.
14271
14272- Fixed bsddbmodule.c to add binary mode indicator on platforms that
14273have it. This should make it working on Windows NT.
14274
14275- Changed last uses of #ifdef NT to #ifdef MS_WINDOWS or MS_WIN32,
14276whatever applies. Also rationalized some other tests for various MS
14277platforms.
14278
14279- Added the sources for the NT installer script used for Python
142801.4beta3. Not tested with this release, but better than nothing.
14281
14282- A compromise in pickle's defenses against Trojan horses: a
14283user-defined function is now okay where a class is expected. A
14284built-in function is not okay, to prevent pickling something that
14285will execute os.system("rm -f *") when unpickling.
14286
14287- dis.py will print the name of local variables referenced by local
14288load/store/delete instructions.
14289
14290- Improved portability of SimpleHTTPServer module to non-Unix
14291platform.
14292
14293- The thread.h interface adds an extra argument to down_sema(). This
14294only affects other C code that uses thread.c; the Python thread module
14295doesn't use semaphores (which aren't provided on all platforms where
14296Python threads are supported). Note: on NT, this change is not
14297implemented.
14298
14299- Fixed some typos in abstract.h; corrected signature of
14300PyNumber_Coerce, added PyMapping_DelItem. Also fixed a bug in
14301abstract.c's PyObject_CallMethod().
14302
14303- apply(classname, (), {}) now works even if the class has no
14304__init__() method.
14305
14306- Implemented complex remainder and divmod() (these would dump core!).
14307Conversion of complex numbers to int, long int or float now raises an
14308exception, since there is no meaningful way to do it without losing
14309information.
14310
14311- Fixed bug in built-in complex() function which gave the wrong result
14312for two real arguments.
14313
14314- Change the hash algorithm for strings -- the multiplier is now
143151000003 instead of 3, which gives better spread for short strings.
14316
14317- New default path for Windows NT, the registry structure now supports
14318default paths for different install packages. (Mark Hammond -- the
14319next PythonWin release will use this.)
14320
14321- Added more symbols to the python_nt.def file.
14322
14323- When using GNU readline, set rl_readline_name to "python".
14324
14325- The Ellipses built-in name has been renamed to Ellipsis -- this is
14326the correct singular form. Thanks to Ka-Ping Yee, who saved us from
14327eternal embarrassment.
14328
14329- Bumped the PYTHON_API_VERSION to 1006, due to the Ellipses ->
14330Ellipsis name change.
14331
14332- Updated the library reference manual. Added documentation of
14333restricted mode (rexec, Bastion) and the formatter module (for use
14334with the htmllib module). Fixed the documentation of htmllib
14335(finally).
14336
14337- The reference manual is now maintained in FrameMaker.
14338
14339- Upgraded scripts Doc/partparse.py and Doc/texi2html.py.
14340
14341- Slight improvements to Doc/Makefile.
14342
14343- Added fcntl.lockf(). This should be used for Unix file locking
14344instead of the posixfile module; lockf() is more portable.
14345
14346- The getopt module now supports long option names, thanks to Lars
14347Wizenius.
14348
14349- Plenty of changes to Tkinter and Canvas, mostly due to Fred Drake
14350and Nils Fischbeck.
14351
14352- Use more bits of time.time() in whrandom's default seed().
14353
14354- Performance hack for regex module's regs attribute.
14355
14356- Don't close already closed socket in socket module.
14357
14358- Correctly handle separators containing embedded nulls in
14359strop.split, strop.find and strop.rfind. Also added more detail to
14360error message for strop.atoi and friends.
14361
14362- Moved fallback definition for hypot() to Python/hypot.c.
14363
14364- Added fallback definition for strdup, in Python/strdup.c.
14365
14366- Fixed some bugs where a function would return 0 to indicate an error
14367where it should return -1.
14368
14369- Test for error returned by time.localtime(), and rationalized its MS
14370tests.
14371
14372- Added Modules/Setup.local file, which is processed after Setup.
14373
14374- Corrected bug in toplevel Makefile.in -- execution of regen script
14375would not use the right PATH and PYTHONPATH.
14376
14377- Various and sundry NeXT configuration changes (sigh).
14378
14379- Support systems where libreadline needs neither termcap nor curses.
14380
14381- Improved ld_so_aix script and python.exp file (for AIX).
14382
14383- More stringent test for working <stdarg.h> in configure script.
14384
14385- Removed Demo/www subdirectory -- it was totally out of date.
14386
14387- Improved demos and docs for Fred Drake's parser module; fixed one
14388typo in the module itself.
14389
14390
14391=========================================
14392==> Release 1.4beta3 (August 26 1996) <==
14393=========================================
14394
14395
14396(XXX This is less readable that it should. I promise to restructure
14397it for the final 1.4 release.)
14398
14399
14400What's new in 1.4beta3 (since beta2)?
14401-------------------------------------
14402
14403- Name mangling to implement a simple form of class-private variables.
14404A name of the form "__spam" can't easily be used outside the class.
14405(This was added in 1.4beta3, but left out of the 1.4beta3 release
14406message.)
14407
14408- In urllib.urlopen(): HTTP URLs containing user:passwd@host are now
14409handled correctly when using a proxy server.
14410
14411- In ntpath.normpath(): don't truncate to 8+3 format.
14412
14413- In mimetools.choose_boundary(): don't die when getuid() or getpid()
14414aren't defined.
14415
14416- Module urllib: some optimizations to (un)quoting.
14417
14418- New module MimeWriter for writing MIME documents.
14419
14420- More changes to formatter module.
14421
14422- The freeze script works once again and is much more robust (using
14423sys.prefix etc.). It also supports a -o option to specify an
14424output directory.
14425
14426- New module whichdb recognizes dbm, gdbm and bsddb/dbhash files.
14427
14428- The Doc/Makefile targets have been reorganized somewhat to remove the
14429insistence on always generating PostScript.
14430
14431- The texinfo to html filter (Doc/texi2html.py) has been improved somewhat.
14432
14433- "errors.h" has been renamed to "pyerrors.h" to resolve a long-standing
14434name conflict on the Mac.
14435
14436- Linking a module compiled with a different setting for Py_TRACE_REFS now
14437generates a linker error rather than a core dump.
14438
14439- The cgi module has a new convenience function print_exception(), which
14440formats a python exception using HTML. It also fixes a bug in the
14441compatibility code and adds a dubious feature which makes it possible to
14442have two query strings, one in the URL and one in the POST data.
14443
14444- A subtle change in the unpickling of class instances makes it possible
14445to unpickle in restricted execution mode, where the __dict__ attribute is
14446not available (but setattr() is).
14447
14448- Documentation for os.path.splitext() (== posixpath.splitext()) has been
14449cleared up. It splits at the *last* dot.
14450
14451- posixfile locking is now also correctly supported on AIX.
14452
14453- The tempfile module once again honors an initial setting of tmpdir. It
14454now works on Windows, too.
14455
14456- The traceback module has some new functions to extract, format and print
14457the active stack.
14458
14459- Some translation functions in the urllib module have been made a little
14460less sluggish.
14461
14462- The addtag_* methods for Canvas widgets in Tkinter as well as in the
14463separate Canvas class have been fixed so they actually do something
14464meaningful.
14465
14466- A tiny _test() function has been added to Tkinter.py.
14467
14468- A generic Makefile for dynamically loaded modules is provided in the Misc
14469subdirectory (Misc/gMakefile).
14470
14471- A new version of python-mode.el for Emacs is provided. See
14472http://www.python.org/ftp/emacs/pmdetails.html for details. The
14473separate file pyimenu.el is no longer needed, imenu support is folded
14474into python-mode.el.
14475
14476- The configure script can finally correctly find the readline library in a
Walter Dörwaldf0dfc7a2003-10-20 14:01:56 +000014477non-standard location. The LDFLAGS variable is passed on the Makefiles
Guido van Rossum821a5581997-05-23 04:05:31 +000014478from the configure script.
14479
14480- Shared libraries are now installed as programs (i.e. with executable
14481permission). This is required on HP-UX and won't hurt on other systems.
14482
14483- The objc.c module is no longer part of the distribution. Objective-C
14484support may become available as contributed software on the ftp site.
14485
14486- The sybase module is no longer part of the distribution. A much
14487improved sybase module is available as contributed software from the
14488ftp site.
14489
14490- _tkinter is now compatible with Tcl 7.5 / Tk 4.1 patch1 on Windows and
14491Mac (don't use unpatched Tcl/Tk!). The default line in the Setup.in file
14492now links with Tcl 7.5 / Tk 4.1 rather than 7.4/4.0.
14493
14494- In Setup, you can now write "*shared*" instead of "*noconfig*", and you
14495can use *.so and *.sl as shared libraries.
14496
14497- Some more fidgeting for AIX shared libraries.
14498
14499- The mpz module is now compatible with GMP 2.x. (Not tested by me.)
14500(Note -- a complete replacement by Niels Mo"ller, called gpmodule, is
14501available from the contrib directory on the ftp site.)
14502
14503- A warning is written to sys.stderr when a __del__ method raises an
14504exception (formerly, such exceptions were completely ignored).
14505
14506- The configure script now defines HAVE_OLD_CPP if the C preprocessor is
14507incapable of ANSI style token concatenation and stringification.
14508
14509- All source files (except a few platform specific modules) are once again
14510compatible with K&R C compilers as well as ANSI compilers. In particular,
14511ANSI-isms have been removed or made conditional in complexobject.c,
14512getargs.c and operator.c.
14513
14514- The abstract object API has three new functions, PyObject_DelItem,
14515PySequence_DelItem, and PySequence_DelSlice.
14516
14517- The operator module has new functions delitem and delslice, and the
14518functions "or" and "and" are renamed to "or_" and "and_" (since "or" and
14519"and" are reserved words). ("__or__" and "__and__" are unchanged.)
14520
14521- The environment module is no longer supported; putenv() is now a function
14522in posixmodule (also under NT).
14523
14524- Error in filter(<function>, "") has been fixed.
14525
14526- Unrecognized keyword arguments raise TypeError, not KeyError.
14527
14528- Better portability, fewer bugs and memory leaks, fewer compiler warnings,
14529some more documentation.
14530
14531- Bug in float power boundary case (0.0 to the negative integer power)
14532fixed.
14533
14534- The test of negative number to the float power has been moved from the
14535built-in pow() functin to floatobject.c (so complex numbers can yield the
14536correct result).
14537
14538- The bug introduced in beta2 where shared libraries loaded (using
14539dlopen()) from the current directory would fail, has been fixed.
14540
14541- Modules imported as shared libraries now also have a __file__ attribute,
14542giving the filename from which they were loaded. The only modules without
14543a __file__ attribute now are built-in modules.
14544
14545- On the Mac, dynamically loaded modules can end in either ".slb" or
14546".<platform>.slb" where <platform> is either "CFM68K" or "ppc". The ".slb"
14547extension should only be used for "fat" binaries.
14548
14549- C API addition: marshal.c now supports
14550PyMarshal_WriteObjectToString(object).
14551
14552- C API addition: getargs.c now supports
14553PyArg_ParseTupleAndKeywords(args, kwdict, format, kwnames, ...)
14554to parse keyword arguments.
14555
14556- The PC versioning scheme (sys.winver) has changed once again. the
14557version number is now "<digit>.<digit>.<digit>.<apiversion>", where the
14558first three <digit>s are the Python version (e.g. "1.4.0" for Python 1.4,
14559"1.4.1" for Python 1.4.1 -- the beta level is not included) and
14560<apiversion> is the four-digit PYTHON_API_VERSION (currently 1005).
14561
14562- h2py.py accepts whitespace before the # in CPP directives
14563
14564- On Solaris 2.5, it should now be possible to use either Posix threads or
14565Solaris threads (XXX: how do you select which is used???). (Note: the
14566Python pthreads interface doesn't fully support semaphores yet -- anyone
14567care to fix this?)
14568
14569- Thread support should now work on AIX, using either DCE threads or
14570pthreads.
14571
14572- New file Demo/sockets/unicast.py
14573
14574- Working Mac port, with CFM68K support, with Tk 4.1 support (though not
14575both) (XXX)
14576
14577- New project setup for PC port, now compatible with PythonWin, with
14578_tkinter and NumPy support (XXX)
14579
14580- New module site.py (XXX)
14581
14582- New module xdrlib.py and optional support module _xdrmodule.c (XXX)
14583
14584- parser module adapted to new grammar, complete w/ Doc & Demo (XXX)
14585
14586- regen script fixed (XXX)
14587
14588- new machdep subdirectories Lib/{aix3,aix4,next3_3,freebsd2,linux2} (XXX)
14589
14590- testall now also tests math module (XXX)
14591
14592- string.atoi c.s. now raise an exception for an empty input string.
14593
14594- At last, it is no longer necessary to define HAVE_CONFIG_H in order to
14595have config.h included at various places.
14596
14597- Unrecognized keyword arguments now raise TypeError rather than KeyError.
14598
14599- The makesetup script recognizes files with extension .so or .sl as
14600(shared) libraries.
14601
14602- 'access' is no longer a reserved word, and all code related to its
14603implementation is gone (or at least #ifdef'ed out). This should make
14604Python a little speedier too!
14605
14606- Performance enhancements suggested by Sjoerd Mullender. This includes
14607the introduction of two new optional function pointers in type object,
14608getattro and setattro, which are like getattr and setattr but take a
14609string object instead of a C string pointer.
14610
14611- New operations in string module: lstrip(s) and rstrip(s) strip whitespace
14612only on the left or only on the right, A new optional third argument to
14613split() specifies the maximum number of separators honored (so
14614splitfields(s, sep, n) returns a list of at most n+1 elements). (Since
146151.3, splitfields(s, None) is totally equivalent to split(s).)
14616string.capwords() has an optional second argument specifying the
14617separator (which is passed to split()).
14618
14619- regsub.split() has the same addition as string.split(). regsub.splitx(s,
14620sep, maxsep) implements the functionality that was regsub.split(s, 1) in
146211.4beta2 (return a list containing the delimiters as well as the words).
14622
14623- Final touch for AIX loading, rewritten Misc/AIX-NOTES.
14624
14625- In Modules/_tkinter.c, when using Tk 4.1 or higher, use className
14626argument to _tkinter.create() to set Tcl's argv0 variable, so X
14627resources use the right resource class again.
14628
14629- Add #undef fabs to Modules/mathmodule.c for macintosh.
14630
14631- Added some macro renames for AIX in Modules/operator.c.
14632
14633- Removed spurious 'E' from Doc/liberrno.tex.
14634
14635- Got rid of some cruft in Misc/ (dlMakefile, pyimenu.el); added new
14636Misc/gMakefile and new version of Misc/python-mode.el.
14637
14638- Fixed typo in Lib/ntpath.py (islink has "return false" which gives a
14639NameError).
14640
14641- Added missing "from types import *" to Lib/tkinter/Canvas.py.
14642
14643- Added hint about using default args for __init__ to pickle docs.
14644
14645- Corrected typo in Inclide/abstract.h: PySequence_Lenth ->
14646PySequence_Length.
14647
14648- Some improvements to Doc/texi2html.py.
14649
14650- In Python/import.c, Cast unsigned char * in struct _frozen to char *
14651in calls to rds_object().
14652
14653- In doc/ref4.tex, added note about scope of lambda bodies.
14654
14655What's new in 1.4beta2 (since beta1)?
14656-------------------------------------
14657
14658- Portability bug in the md5.h header solved.
14659
14660- The PC build procedure now really works, and sets sys.platform to a
14661meaningful value (a few things were botched in beta 1). Lib/dos_8x3
14662is now a standard part of the distribution (alas).
14663
14664- More improvements to the installation procedure. Typing "make install"
14665now inserts the version number in the pathnames of almost everything
14666installed, and creates the machine dependent modules (FCNTL.py etc.) if not
14667supplied by the distribution. (XXX There's still a problem with the latter
14668because the "regen" script requires that Python is installed. Some manual
14669intervention may still be required.) (This has been fixed in 1.4beta3.)
14670
14671- New modules: errno, operator (XXX).
14672
14673- Changes for use with Numerical Python: builtin function slice() and
14674Ellipses object, and corresponding syntax:
14675
14676 x[lo:hi:stride] == x[slice(lo, hi, stride)]
14677 x[a, ..., z] == x[(a, Ellipses, z)]
14678
Raymond Hettinger565ea5a2004-10-02 11:02:59 +000014679- New documentation for errno and cgi modules.
Guido van Rossum821a5581997-05-23 04:05:31 +000014680
14681- The directory containing the script passed to the interpreter is
14682inserted in from of sys.path; "." is no longer a default path
14683component.
14684
14685- Optional third string argument to string.translate() specifies
14686characters to delete. New function string.maketrans() creates a
14687translation table for translate() or for regex.compile().
14688
14689- Module posix (and hence module os under Unix) now supports putenv().
14690Moreover, module os is enhanced so that if putenv() is supported,
14691assignments to os.environ entries make the appropriate putenv() call.
14692(XXX the putenv() implementation can leak a small amount of memory per
14693call.)
14694
14695- pdb.py can now be invoked from the command line to debug a script:
14696python pdb.py <script> <arg> ...
14697
14698- Much improved parseaddr() in rfc822.
14699
14700- In cgi.py, you can now pass an alternative value for environ to
14701nearly all functions.
14702
14703- You can now assign to instance variables whose name begins and ends
14704with '__'.
14705
14706- New version of Fred Drake's parser module and associates (token,
14707symbol, AST).
14708
14709- New PYTHON_API_VERSION value and .pyc file magic number (again!).
14710
14711- The "complex" internal structure type is now called "Py_complex" to
14712avoid name conflicts.
14713
14714- Numerous small bugs fixed.
14715
14716- Slight pickle speedups.
14717
14718- Some slight speedups suggested by Sjoerd (more coming in 1.4 final).
14719
14720- NeXT portability mods by Bill Bumgarner integrated.
14721
14722- Modules regexmodule.c, bsddbmodule.c and xxmodule.c have been
14723converted to new naming style.
14724
14725
14726What's new in 1.4beta1 (since 1.3)?
14727-----------------------------------
14728
14729- Added sys.platform and sys.exec_platform for Bill Janssen.
14730
14731- Installation has been completely overhauled. "make install" now installs
14732everything, not just the python binary. Installation uses the install-sh
14733script (borrowed from X11) to install each file.
14734
14735- New functions in the posix module: mkfifo, plock, remove (== unlink),
14736and ftruncate. More functions are also available under NT.
14737
14738- New function in the fcntl module: flock.
14739
14740- Shared library support for FreeBSD.
14741
14742- The --with-readline option can now be used without a DIRECTORY argument,
14743for systems where libreadline.* is in one of the standard places. It is
14744also possible for it to be a shared library.
14745
14746- The extension tkinter has been renamed to _tkinter, to avoid confusion
14747with Tkinter.py oncase insensitive file systems. It now supports Tk 4.1 as
14748well as 4.0.
14749
14750- Author's change of address from CWI in Amsterdam, The Netherlands, to
14751CNRI in Reston, VA, USA.
14752
14753- The math.hypot() function is now always available (if it isn't found in
14754the C math library, Python provides its own implementation).
14755
14756- The latex documentation is now compatible with latex2e, thanks to David
14757Ascher.
14758
14759- The expression x**y is now equivalent to pow(x, y).
14760
14761- The indexing expression x[a, b, c] is now equivalent to x[(a, b, c)].
14762
14763- Complex numbers are now supported. Imaginary constants are written with
14764a 'j' or 'J' prefix, general complex numbers can be formed by adding a real
14765part to an imaginary part, like 3+4j. Complex numbers are always stored in
14766floating point form, so this is equivalent to 3.0+4.0j. It is also
14767possible to create complex numbers with the new built-in function
14768complex(re, [im]). For the footprint-conscious, complex number support can
14769be disabled by defining the symbol WITHOUT_COMPLEX.
14770
14771- New built-in function list() is the long-awaited counterpart of tuple().
14772
14773- There's a new "cmath" module which provides the same functions as the
14774"math" library but with complex arguments and results. (There are very
14775good reasons why math.sqrt(-1) still raises an exception -- you have to use
14776cmath.sqrt(-1) to get 1j for an answer.)
14777
14778- The Python.h header file (which is really the same as allobjects.h except
14779it disables support for old style names) now includes several more files,
14780so you have to have fewer #include statements in the average extension.
14781
14782- The NDEBUG symbol is no longer used. Code that used to be dependent on
14783the presence of NDEBUG is now present on the absence of DEBUG. TRACE_REFS
14784and REF_DEBUG have been renamed to Py_TRACE_REFS and Py_REF_DEBUG,
14785respectively. At long last, the source actually compiles and links without
14786errors when this symbol is defined.
14787
14788- Several symbols that didn't follow the new naming scheme have been
14789renamed (usually by adding to rename2.h) to use a Py or _Py prefix. There
14790are no external symbols left without a Py or _Py prefix, not even those
14791defined by sources that were incorporated from elsewhere (regexpr.c,
14792md5c.c). (Macros are a different story...)
14793
14794- There are now typedefs for the structures defined in config.c and
14795frozen.c.
14796
14797- New PYTHON_API_VERSION value and .pyc file magic number.
14798
14799- New module Bastion. (XXX)
14800
14801- Improved performance of StringIO module.
14802
14803- UserList module now supports + and * operators.
14804
14805- The binhex and binascii modules now actually work.
14806
14807- The cgi module has been almost totally rewritten and documented.
14808It now supports file upload and a new data type to handle forms more
14809flexibly.
14810
14811- The formatter module (for use with htmllib) has been overhauled (again).
14812
14813- The ftplib module now supports passive mode and has doc strings.
14814
14815- In (ideally) all places where binary files are read or written, the file
14816is now correctly opened in binary mode ('rb' or 'wb') so the code will work
14817on Mac or PC.
14818
14819- Dummy versions of os.path.expandvars() and expanduser() are now provided
14820on non-Unix platforms.
14821
14822- Module urllib now has two new functions url2pathname and pathname2url
14823which turn local filenames into "file:..." URLs using the same rules as
14824Netscape (why be different). it also supports urlretrieve() with a
14825pathname parameter, and honors the proxy environment variables (http_proxy
14826etc.). The URL parsing has been improved somewhat, too.
14827
14828- Micro improvements to urlparse. Added urlparse.urldefrag() which
14829removes a trailing ``#fragment'' if any.
14830
14831- The mailbox module now supports MH style message delimiters as well.
14832
14833- The mhlib module contains some new functionality: setcontext() to set the
14834current folder and parsesequence() to parse a sequence as commonly passed
14835to MH commands (e.g. 1-10 or last:5).
14836
14837- New module mimify for conversion to and from MIME format of email
14838messages.
14839
14840- Module ni now automatically installs itself when first imported -- this
14841is against the normal rule that modules should define classes and functions
14842but not invoke them, but appears more useful in the case that two
14843different, independent modules want to use ni's features.
14844
14845- Some small performance enhancements in module pickle.
14846
14847- Small interface change to the profile.run*() family of functions -- more
14848sensible handling of return values.
14849
14850- The officially registered Mac creator for Python files is 'Pyth'. This
14851replaces 'PYTH' which was used before but never registered.
14852
14853- Added regsub.capwords(). (XXX)
14854
14855- Added string.capwords(), string.capitalize() and string.translate().
14856(XXX)
14857
14858- Fixed an interface bug in the rexec module: it was impossible to pass a
14859hooks instance to the RExec class. rexec now also supports the dynamic
14860loading of modules from shared libraries. Some other interfaces have been
14861added too.
14862
14863- Module rfc822 now caches the headers in a dictionary for more efficient
14864lookup.
14865
14866- The sgmllib module now understands a limited number of SGML "shorthands"
14867like <A/.../ for <A>...</A>. (It's not clear that this was a good idea...)
14868
14869- The tempfile module actually tries a number of different places to find a
14870usable temporary directory. (This was prompted by certain Linux
14871installations that appear to be missing a /usr/tmp directory.) [A bug in
14872the implementation that would ignore a pre-existing tmpdir global has been
14873fixed in beta3.]
14874
14875- Much improved and enhanved FileDialog module for Tkinter.
14876
14877- Many small changes to Tkinter, to bring it more in line with Tk 4.0 (as
14878well as Tk 4.1).
14879
14880- New socket interfaces include ntohs(), ntohl(), htons(), htonl(), and
14881s.dup(). Sockets now work correctly on Windows. On Windows, the built-in
14882extension is called _socket and a wrapper module win/socket.py provides
14883"makefile()" and "dup()" functionality. On Windows, the select module
14884works only with socket objects.
14885
14886- Bugs in bsddb module fixed (e.g. missing default argument values).
14887
14888- The curses extension now includes <ncurses.h> when available.
14889
14890- The gdbm module now supports opening databases in "fast" mode by
14891specifying 'f' as the second character or the mode string.
14892
14893- new variables sys.prefix and sys.exec_prefix pass corresponding
14894configuration options / Makefile variables to the Python programmer.
14895
14896- The ``new'' module now supports creating new user-defined classes as well
14897as instances thereof.
14898
14899- The soundex module now sports get_soundex() to get the soundex value for an
14900arbitrary string (formerly it would only do soundex-based string
14901comparison) as well as doc strings.
14902
14903- New object type "cobject" to safely wrap void pointers for passing them
14904between various extension modules.
14905
14906- More efficient computation of float**smallint.
14907
14908- The mysterious bug whereby "x.x" (two occurrences of the same
14909one-character name) typed from the commandline would sometimes fail
14910mysteriously.
14911
14912- The initialization of the readline function can now be invoked by a C
14913extension through PyOS_ReadlineInit().
14914
14915- There's now an externally visible pointer PyImport_FrozenModules which
14916can be changed by an embedding application.
14917
14918- The argument parsing functions now support a new format character 'D' to
14919specify complex numbers.
14920
14921- Various memory leaks plugged and bugs fixed.
14922
14923- Improved support for posix threads (now that real implementations are
14924beginning to apepar). Still no fully functioning semaphores.
14925
14926- Some various and sundry improvements and new entries in the Tools
14927directory.
14928
14929
14930=====================================
Guido van Rossumc30e95f1996-07-30 18:53:51 +000014931==> Release 1.3 (13 October 1995) <==
14932=====================================
14933
14934Major change
14935============
14936
14937Two words: Keyword Arguments. See the first section of Chapter 12 of
14938the Tutorial.
14939
14940(The rest of this file is textually the same as the remaining sections
14941of that chapter.)
14942
14943
14944Changes to the WWW and Internet tools
14945=====================================
14946
14947The "htmllib" module has been rewritten in an incompatible fashion.
14948The new version is considerably more complete (HTML 2.0 except forms,
14949but including all ISO-8859-1 entity definitions), and easy to use.
14950Small changes to "sgmllib" have also been made, to better match the
14951tokenization of HTML as recognized by other web tools.
14952
14953A new module "formatter" has been added, for use with the new
14954"htmllib" module.
14955
14956The "urllib"and "httplib" modules have been changed somewhat to allow
14957overriding unknown URL types and to support authentication. They now
14958use "mimetools.Message" instead of "rfc822.Message" to parse headers.
14959The "endrequest()" method has been removed from the HTTP class since
14960it breaks the interaction with some servers.
14961
14962The "rfc822.Message" class has been changed to allow a flag to be
14963passed in that says that the file is unseekable.
14964
14965The "ftplib" module has been fixed to be (hopefully) more robust on
14966Linux.
14967
14968Several new operations that are optionally supported by servers have
14969been added to "nntplib": "xover", "xgtitle", "xpath" and "date".
14970
14971Other Language Changes
14972======================
14973
14974The "raise" statement now takes an optional argument which specifies
14975the traceback to be used when printing the exception's stack trace.
14976This must be a traceback object, such as found in "sys.exc_traceback".
14977When omitted or given as "None", the old behavior (to generate a stack
14978trace entry for the current stack frame) is used.
14979
14980The tokenizer is now more tolerant of alien whitespace. Control-L in
14981the leading whitespace of a line resets the column number to zero,
14982while Control-R just before the end of the line is ignored.
14983
14984Changes to Built-in Operations
14985==============================
14986
14987For file objects, "f.read(0)" and "f.readline(0)" now return an empty
14988string rather than reading an unlimited number of bytes. For the
14989latter, omit the argument altogether or pass a negative value.
14990
14991A new system variable, "sys.platform", has been added. It specifies
14992the current platform, e.g. "sunos5" or "linux1".
14993
14994The built-in functions "input()" and "raw_input()" now use the GNU
14995readline library when it has been configured (formerly, only
14996interactive input to the interpreter itself was read using GNU
14997readline). The GNU readline library provides elaborate line editing
14998and history. The Python debugger ("pdb") is the first beneficiary of
14999this change.
15000
15001Two new built-in functions, "globals()" and "locals()", provide access
15002to dictionaries containming current global and local variables,
15003respectively. (These augment rather than replace "vars()", which
15004returns the current local variables when called without an argument,
15005and a module's global variables when called with an argument of type
15006module.)
15007
15008The built-in function "compile()" now takes a third possible value for
15009the kind of code to be compiled: specifying "'single'" generates code
15010for a single interactive statement, which prints the output of
15011expression statements that evaluate to something else than "None".
15012
15013Library Changes
15014===============
15015
15016There are new module "ni" and "ihooks" that support importing modules
15017with hierarchical names such as "A.B.C". This is enabled by writing
15018"import ni; ni.ni()" at the very top of the main program. These
15019modules are amply documented in the Python source.
15020
15021The module "rexec" has been rewritten (incompatibly) to define a class
15022and to use "ihooks".
15023
15024The "string.split()" and "string.splitfields()" functions are now the
15025same function (the presence or absence of the second argument
15026determines which operation is invoked); similar for "string.join()"
15027and "string.joinfields()".
15028
15029The "Tkinter" module and its helper "Dialog" have been revamped to use
15030keyword arguments. Tk 4.0 is now the standard. A new module
15031"FileDialog" has been added which implements standard file selection
15032dialogs.
15033
15034The optional built-in modules "dbm" and "gdbm" are more coordinated
15035--- their "open()" functions now take the same values for their "flag"
15036argument, and the "flag" and "mode" argument have default values (to
15037open the database for reading only, and to create the database with
15038mode "0666" minuse the umask, respectively). The memory leaks have
15039finally been fixed.
15040
15041A new dbm-like module, "bsddb", has been added, which uses the BSD DB
15042package's hash method.
15043
15044A portable (though slow) dbm-clone, implemented in Python, has been
15045added for systems where none of the above is provided. It is aptly
15046dubbed "dumbdbm".
15047
15048The module "anydbm" provides a unified interface to "bsddb", "gdbm",
15049"dbm", and "dumbdbm", choosing the first one available.
15050
15051A new extension module, "binascii", provides a variety of operations
15052for conversion of text-encoded binary data.
15053
15054There are three new or rewritten companion modules implemented in
15055Python that can encode and decode the most common such formats: "uu"
15056(uuencode), "base64" and "binhex".
15057
15058A module to handle the MIME encoding quoted-printable has also been
15059added: "quopri".
15060
15061The parser module (which provides an interface to the Python parser's
15062abstract syntax trees) has been rewritten (incompatibly) by Fred
15063Drake. It now lets you change the parse tree and compile the result!
15064
15065The \code{syslog} module has been upgraded and documented.
15066
15067Other Changes
15068=============
15069
15070The dynamic module loader recognizes the fact that different filenames
15071point to the same shared library and loads the library only once, so
15072you can have a single shared library that defines multiple modules.
15073(SunOS / SVR4 style shared libraries only.)
15074
15075Jim Fulton's ``abstract object interface'' has been incorporated into
15076the run-time API. For more detailes, read the files
15077"Include/abstract.h" and "Objects/abstract.c".
15078
15079The Macintosh version is much more robust now.
15080
15081Numerous things I have forgotten or that are so obscure no-one will
15082notice them anyway :-)
15083
15084
Guido van Rossumf456b6d1995-01-04 19:20:37 +000015085===================================
Guido van Rossumd462f3d1995-10-09 21:30:37 +000015086==> Release 1.2 (13 April 1995) <==
15087===================================
15088
15089- Changes to Misc/python-mode.el:
15090 - Wrapping and indentation within triple quote strings should work
15091 properly now.
15092 - `Standard' bug reporting mechanism (use C-c C-b)
15093 - py-mark-block was moved to C-c C-m
15094 - C-c C-v shows you the python-mode version
15095 - a basic python-font-lock-keywords has been added for Emacs 19
15096 font-lock colorizations.
15097 - proper interaction with pending-del and del-sel modes.
15098 - New py-electric-colon (:) command for improved outdenting. Also
15099 py-indent-line (TAB) should handle outdented lines better.
15100 - New commands py-outdent-left (C-c C-l) and py-indent-right (C-c C-r)
15101
15102- The Library Reference has been restructured, and many new and
15103existing modules are now documented, in particular the debugger and
15104the profiler, as well as the persistency and the WWW/Internet support
15105modules.
15106
15107- All known bugs have been fixed. For example the pow(2,2,3L) bug on
15108Linux has been fixed. Also the re-entrancy problems with __del__ have
15109been fixed.
15110
15111- All known memory leaks have been fixed.
15112
15113- Phase 2 of the Great Renaming has been executed. The header files
15114now use the new names (PyObject instead of object, etc.). The linker
15115also sees the new names. Most source files still use the old names,
15116by virtue of the rename2.h header file. If you include Python.h, you
15117only see the new names. Dynamically linked modules have to be
15118recompiled. (Phase 3, fixing the rest of the sources, will be
15119executed gradually with the release later versions.)
15120
15121- The hooks for implementing "safe-python" (better called "restricted
15122execution") are in place. Specifically, the import statement is
15123implemented by calling the built-in function __import__, and the
15124built-in names used in a particular scope are taken from the
15125dictionary __builtins__ in that scope's global dictionary. See also
15126the new (unsupported, undocumented) module rexec.py.
15127
15128- The import statement now supports the syntax "import a.b.c" and
15129"from a.b.c import name". No officially supported implementation
15130exists, but one can be prototyped by replacing the built-in __import__
15131function. A proposal by Ken Manheimer is provided as newimp.py.
15132
15133- All machinery used by the import statement (or the built-in
15134__import__ function) is now exposed through the new built-in module
15135"imp" (see the library reference manual). All dynamic loading
15136machinery is moved to the new file importdl.c.
15137
15138- Persistent storage is supported through the use of the modules
15139"pickle" and "shelve" (implemented in Python). There's also a "copy"
15140module implementing deepcopy and normal (shallow) copy operations.
15141See the library reference manual.
15142
15143- Documentation strings for many objects types are accessible through
15144the __doc__ attribute. Modules, classes and functions support special
15145syntax to initialize the __doc__ attribute: if the first statement
15146consists of just a string literal, that string literal becomes the
15147value of the __doc__ attribute. The default __doc__ attribute is
15148None. Documentation strings are also supported for built-in
15149functions, types and modules; however this feature hasn't been widely
15150used yet. See the 'new' module for an example. (Basically, the type
15151object's tp_doc field contains the doc string for the type, and the
151524th member of the methodlist structure contains the doc string for the
15153method.)
15154
15155- The __coerce__ and __cmp__ methods for user-defined classes once
15156again work as expected. As an example, there's a new standard class
15157Complex in the library.
15158
15159- The functions posix.popen() and posix.fdopen() now have an optional
15160third argument to specify the buffer size, and default their second
15161(mode) argument to 'r' -- in analogy to the builtin open() function.
15162The same applies to posixfile.open() and the socket method makefile().
15163
15164- The thread.exit_thread() function now raises SystemExit so that
15165'finally' clauses are honored and a memory leak is plugged.
15166
15167- Improved X11 and Motif support, by Sjoerd Mullender. This extension
15168is being maintained and distributed separately.
15169
15170- Improved support for the Apple Macintosh, in part by Jack Jansen,
15171e.g. interfaces to (a few) resource mananger functions, get/set file
15172type and creator, gestalt, sound manager, speech manager, MacTCP, comm
15173toolbox, and the think C console library. This is being maintained
15174and distributed separately.
15175
15176- Improved version for Windows NT, by Mark Hammond. This is being
15177maintained and distributed separately.
15178
15179- Used autoconf 2.0 to generate the configure script. Adapted
15180configure.in to use the new features in autoconf 2.0.
15181
15182- It now builds on the NeXT without intervention, even on the 3.3
15183Sparc pre-release.
15184
15185- Characters passed to isspace() and friends are masked to nonnegative
15186values.
15187
15188- Correctly compute pow(-3.0, 3).
15189
15190- Fix portability problems with getopt (configure now checks for a
15191non-GNU getopt).
15192
15193- Don't add frozenmain.o to libPython.a.
15194
15195- Exceptions can now be classes. ALl built-in exceptions are still
15196string objects, but this will change in the future.
15197
15198- The socket module exports a long list of socket related symbols.
15199(More built-in modules will export their symbolic constants instead of
15200relying on a separately generated Python module.)
15201
15202- When a module object is deleted, it clears out its own dictionary.
15203This fixes a circularity in the references between functions and
15204their global dictionary.
15205
15206- Changed the error handling by [new]getargs() e.g. for "O&".
15207
15208- Dynamic loading of modules using shared libraries is supported for
15209several new platforms.
15210
15211- Support "O&", "[...]" and "{...}" in mkvalue().
15212
15213- Extension to findmethod(): findmethodinchain() (where a chain is a
15214linked list of methodlist arrays). The calling interface for
15215findmethod() has changed: it now gets a pointer to the (static!)
15216methodlist structure rather than just to the function name -- this
15217saves copying flags etc. into the (short-lived) method object.
15218
15219- The callable() function is now public.
15220
15221- Object types can define a few new operations by setting function
15222pointers in the type object structure: tp_call defines how an object
15223is called, and tp_str defines how an object's str() is computed.
15224
15225
15226===================================
Guido van Rossumf456b6d1995-01-04 19:20:37 +000015227==> Release 1.1.1 (10 Nov 1994) <==
15228===================================
15229
15230This is a pure bugfix release again. See the ChangeLog file for details.
15231
15232One exception: a few new features were added to tkinter.
15233
15234
15235=================================
15236==> Release 1.1 (11 Oct 1994) <==
15237=================================
15238
15239This release adds several new features, improved configuration and
15240portability, and fixes more bugs than I can list here (including some
15241memory leaks).
15242
15243The source compiles and runs out of the box on more platforms than
15244ever -- including Windows NT. Makefiles or projects for a variety of
15245non-UNIX platforms are provided.
15246
15247APOLOGY: some new features are badly documented or not at all. I had
15248the choice -- postpone the new release indefinitely, or release it
15249now, with working code but some undocumented areas. The problem with
15250postponing the release is that people continue to suffer from existing
15251bugs, and send me patches based on the previous release -- which I
15252can't apply directly because my own source has changed. Also, some
15253new modules (like signal) have been ready for release for quite some
15254time, and people are anxiously waiting for them. In the case of
15255signal, the interface is simple enough to figure out without
15256documentation (if you're anxious enough :-). In this case it was not
15257simple to release the module on its own, since it relies on many small
15258patches elsewhere in the source.
15259
15260For most new Python modules, the source code contains comments that
15261explain how to use them. Documentation for the Tk interface, written
15262by Matt Conway, is available as tkinter-doc.tar.gz from the Python
15263home and mirror ftp sites (see Misc/FAQ for ftp addresses). For the
15264new operator overloading facilities, have a look at Demo/classes:
15265Complex.py and Rat.py show how to implement a numeric type without and
15266with __coerce__ method. Also have a look at the end of the Tutorial
15267document (Doc/tut.tex). If you're still confused: use the newsgroup
15268or mailing list.
15269
15270
15271New language features:
15272
15273 - More flexible operator overloading for user-defined classes
15274 (INCOMPATIBLE WITH PREVIOUS VERSIONS!) See end of tutorial.
15275
15276 - Classes can define methods named __getattr__, __setattr__ and
15277 __delattr__ to trap attribute accesses. See end of tutorial.
15278
15279 - Classes can define method __call__ so instances can be called
15280 directly. See end of tutorial.
15281
15282
15283New support facilities:
15284
15285 - The Makefiles (for the base interpreter as well as for extensions)
15286 now support creating dynamically loadable modules if the platform
15287 supports shared libraries.
15288
15289 - Passing the interpreter a .pyc file as script argument will execute
15290 the code in that file. (On the Mac such files can be double-clicked!)
15291
15292 - New Freeze script, to create independently distributable "binaries"
15293 of Python programs -- look in Demo/freeze
15294
15295 - Improved h2py script (in Demo/scripts) follows #includes and
15296 supports macros with one argument
15297
15298 - New module compileall generates .pyc files for all modules in a
15299 directory (tree) without also executing them
15300
15301 - Threads should work on more platforms
15302
15303
15304New built-in modules:
15305
15306 - tkinter (support for Tcl's Tk widget set) is now part of the base
15307 distribution
15308
15309 - signal allows catching or ignoring UNIX signals (unfortunately still
15310 undocumented -- any taker?)
15311
15312 - termios provides portable access to POSIX tty settings
15313
15314 - curses provides an interface to the System V curses library
15315
15316 - syslog provides an interface to the (BSD?) syslog daemon
15317
15318 - 'new' provides interfaces to create new built-in object types
15319 (e.g. modules and functions)
15320
15321 - sybase provides an interface to SYBASE database
15322
15323
15324New/obsolete built-in methods:
15325
15326 - callable(x) tests whether x can be called
15327
15328 - sockets now have a setblocking() method
15329
15330 - sockets no longer have an allowbroadcast() method
15331
15332 - socket methods send() and sendto() return byte count
15333
15334
15335New standard library modules:
15336
15337 - types.py defines standard names for built-in types, e.g. StringType
15338
15339 - urlparse.py parses URLs according to the latest Internet draft
15340
15341 - uu.py does uuencode/uudecode (not the fastest in the world, but
15342 quicker than installing uuencode on a non-UNIX machine :-)
15343
15344 - New, faster and more powerful profile module.py
15345
15346 - mhlib.py provides interface to MH folders and messages
15347
15348
15349New facilities for extension writers (unfortunately still
15350undocumented):
15351
15352 - newgetargs() supports optional arguments and improved error messages
15353
15354 - O!, O& O? formats for getargs allow more versatile type checking of
15355 non-standard types
15356
15357 - can register pending asynchronous callback, to be called the next
15358 time the Python VM begins a new instruction (Py_AddPendingCall)
15359
15360 - can register cleanup routines to be called when Python exits
15361 (Py_AtExit)
15362
15363 - makesetup script understands C++ files in Setup file (use file.C
15364 or file.cc)
15365
15366 - Make variable OPT is passed on to sub-Makefiles
15367
15368 - An init<module>() routine may signal an error by not entering
15369 the module in the module table and raising an exception instead
15370
15371 - For long module names, instead of foobarbletchmodule.c you can
15372 use foobarbletch.c
15373
15374 - getintvalue() and getfloatvalue() try to convert any object
15375 instead of requiring an "intobject" or "floatobject"
15376
15377 - All the [new]getargs() formats that retrieve an integer value
15378 will now also work if a float is passed
15379
15380 - C function listtuple() converts list to tuple, fast
15381
15382 - You should now call sigcheck() instead of intrcheck();
15383 sigcheck() also sets an exception when it returns nonzero
15384
15385
Guido van Rossumaa253861994-10-06 17:18:57 +000015386====================================
15387==> Release 1.0.3 (14 July 1994) <==
15388====================================
15389
15390This release consists entirely of bug fixes to the C sources; see the
15391head of ../ChangeLog for a complete list. Most important bugs fixed:
15392
15393- Sometimes the format operator (string%expr) would drop the last
15394character of the format string
15395
15396- Tokenizer looped when last line did not end in \n
15397
15398- Bug when triple-quoted string ended in quote plus newline
15399
15400- Typo in socketmodule (listen) (== instead of =)
15401
15402- typing vars() at the >>> prompt would cause recursive output
15403
15404
15405==================================
15406==> Release 1.0.2 (4 May 1994) <==
15407==================================
15408
15409Overview of the most visible changes. Bug fixes are not listed. See
15410also ChangeLog.
15411
15412Tokens
15413------
15414
15415* String literals follow Standard C rules: they may be continued on
15416the next line using a backslash; adjacent literals are concatenated
15417at compile time.
15418
15419* A new kind of string literals, surrounded by triple quotes (""" or
15420'''), can be continued on the next line without a backslash.
15421
15422Syntax
15423------
15424
15425* Function arguments may have a default value, e.g. def f(a, b=1);
15426defaults are evaluated at function definition time. This also applies
15427to lambda.
15428
15429* The try-except statement has an optional else clause, which is
15430executed when no exception occurs in the try clause.
15431
15432Interpreter
15433-----------
15434
15435* The result of a statement-level expression is no longer printed,
15436except_ for expressions entered interactively. Consequently, the -k
15437command line option is gone.
15438
15439* The result of the last printed interactive expression is assigned to
15440the variable '_'.
15441
15442* Access to implicit global variables has been speeded up by removing
15443an always-failing dictionary lookup in the dictionary of local
15444variables (mod suggested by Steve Makewski and Tim Peters).
15445
15446* There is a new command line option, -u, to force stdout and stderr
15447to be unbuffered.
15448
15449* Incorporated Steve Majewski's mods to import.c for dynamic loading
15450under AIX.
15451
15452* Fewer chances of dumping core when trying to reload or re-import
15453static built-in, dynamically loaded built-in, or frozen modules.
15454
15455* Loops over sequences now don't ask for the sequence's length when
15456they start, but try to access items 0, 1, 2, and so on until they hit
15457an IndexError. This makes it possible to create classes that generate
15458infinite or indefinite sequences a la Steve Majewski. This affects
15459for loops, the (not) in operator, and the built-in functions filter(),
15460map(), max(), min(), reduce().
15461
15462Changed Built-in operations
15463---------------------------
15464
15465* The '%' operator on strings (printf-style formatting) supports a new
15466feature (adapted from a patch by Donald Beaudry) to allow
15467'%(<key>)<format>' % {...} to take values from a dictionary by name
15468instead of from a tuple by position (see also the new function
15469vars()).
15470
15471* The '%s' formatting operator is changed to accept any type and
15472convert it to a string using str().
15473
15474* Dictionaries with more than 20,000 entries can now be created
15475(thanks to Steve Kirsch).
15476
15477New Built-in Functions
15478----------------------
15479
15480* vars() returns a dictionary containing the local variables; vars(m)
15481returns a dictionary containing the variables of module m. Note:
15482dir(x) is now equivalent to vars(x).keys().
15483
15484Changed Built-in Functions
15485--------------------------
15486
15487* open() has an optional third argument to specify the buffer size: 0
15488for unbuffered, 1 for line buffered, >1 for explicit buffer size, <0
15489for default.
15490
15491* open()'s second argument is now optional; it defaults to "r".
15492
15493* apply() now checks that its second argument is indeed a tuple.
15494
15495New Built-in Modules
15496--------------------
15497
15498Changed Built-in Modules
15499------------------------
15500
15501The thread module no longer supports exit_prog().
15502
15503New Python Modules
15504------------------
15505
15506* Module addpack contains a standard interface to modify sys.path to
15507find optional packages (groups of related modules).
15508
15509* Module urllib contains a number of functions to access
15510World-Wide-Web files specified by their URL.
15511
15512* Module httplib implements the client side of the HTTP protocol used
15513by World-Wide-Web servers.
15514
15515* Module gopherlib implements the client side of the Gopher protocol.
15516
15517* Module mailbox (by Jack Jansen) contains a parser for UNIX and MMDF
15518style mailbox files.
15519
15520* Module random contains various random distributions, e.g. gauss().
15521
15522* Module lockfile locks and unlocks open files using fcntl (inspired
15523by a similar module by Andy Bensky).
15524
15525* Module ntpath (by Jaap Vermeulen) implements path operations for
15526Windows/NT.
15527
15528* Module test_thread (in Lib/test) contains a small test set for the
15529thread module.
15530
15531Changed Python Modules
15532----------------------
15533
15534* The string module's expandvars() function is now documented and is
15535implemented in Python (using regular expressions) instead of forking
15536off a shell process.
15537
15538* Module rfc822 now supports accessing the header fields using the
15539mapping/dictionary interface, e.g. h['subject'].
15540
15541* Module pdb now makes it possible to set a break on a function
15542(syntax: break <expression>, where <expression> yields a function
15543object).
15544
15545Changed Demos
15546-------------
15547
15548* The Demo/scripts/freeze.py script is working again (thanks to Jaap
15549Vermeulen).
15550
15551New Demos
15552---------
15553
15554* Demo/threads/Generator.py is a proposed interface for restartable
15555functions a la Tim Peters.
15556
15557* Demo/scripts/newslist.py, by Quentin Stafford-Fraser, generates a
15558directory full of HTML pages which between them contain links to all
15559the newsgroups available on your server.
15560
15561* Demo/dns contains a DNS (Domain Name Server) client.
15562
15563* Demo/lutz contains miscellaneous demos by Mark Lutz (e.g. psh.py, a
15564nice enhanced Python shell!!!).
15565
15566* Demo/turing contains a Turing machine by Amrit Prem.
15567
15568Documentation
15569-------------
15570
15571* Documented new language features mentioned above (but not all new
15572modules).
15573
15574* Added a chapter to the Tutorial describing recent additions to
15575Python.
15576
15577* Clarified some sentences in the reference manual,
15578e.g. break/continue, local/global scope, slice assignment.
15579
15580Source Structure
15581----------------
15582
15583* Moved Include/tokenizer.h to Parser/tokenizer.h.
15584
15585* Added Python/getopt.c for systems that don't have it.
15586
15587Emacs mode
15588----------
15589
15590* Indentation of continuated lines is done more intelligently;
15591consequently the variable py-continuation-offset is gone.
15592
Guido van Rossumf2eac992000-09-04 17:24:24 +000015593
Guido van Rossumaa253861994-10-06 17:18:57 +000015594========================================
15595==> Release 1.0.1 (15 February 1994) <==
15596========================================
15597
15598* Many portability fixes should make it painless to build Python on
15599several new platforms, e.g. NeXT, SEQUENT, WATCOM, DOS, and Windows.
15600
15601* Fixed test for <stdarg.h> -- this broke on some platforms.
15602
15603* Fixed test for shared library dynalic loading -- this broke on SunOS
156044.x using the GNU loader.
15605
15606* Changed order and number of SVR4 networking libraries (it is now
15607-lsocket -linet -lnsl, if these libraries exist).
15608
15609* Installing the build intermediate stages with "make libainstall" now
15610also installs config.c.in, Setup and makesetup, which are used by the
15611new Extensions mechanism.
15612
15613* Improved README file contains more hints and new troubleshooting
15614section.
15615
15616* The built-in module strop now defines fast versions of three more
15617functions of the standard string module: atoi(), atol() and atof().
15618The strop versions of atoi() and atol() support an optional second
15619argument to specify the base (default 10). NOTE: you don't have to
15620explicitly import strop to use the faster versions -- the string
15621module contains code to let versions from stop override the default
15622versions.
15623
15624* There is now a working Lib/dospath.py for those who use Python under
15625DOS (or Windows). Thanks, Jaap!
15626
15627* There is now a working Modules/dosmodule.c for DOS (or Windows)
15628system calls.
15629
15630* Lib.os.py has been reorganized (making it ready for more operating
15631systems).
15632
15633* Lib/ospath.py is now obsolete (use os.path instead).
15634
15635* Many fixes to the tutorial to make it match Python 1.0. Thanks,
15636Tim!
15637
15638* Fixed Doc/Makefile, Doc/README and various scripts there.
15639
15640* Added missing description of fdopen to Doc/libposix.tex.
15641
15642* Made cleanup() global, for the benefit of embedded applications.
15643
15644* Added parsing of addresses and dates to Lib/rfc822.py.
15645
15646* Small fixes to Lib/aifc.py, Lib/sunau.py, Lib/tzparse.py to make
15647them usable at all.
15648
15649* New module Lib/wave.py reads RIFF (*.wav) audio files.
15650
15651* Module Lib/filewin.py moved to Lib/stdwin/filewin.py where it
15652belongs.
15653
15654* New options and comments for Modules/makesetup (used by new
15655Extension mechanism).
15656
15657* Misc/HYPE contains text of announcement of 1.0.0 in comp.lang.misc
15658and elsewhere.
15659
15660* Fixed coredump in filter(None, 'abcdefg').
15661
15662
15663=======================================
15664==> Release 1.0.0 (26 January 1994) <==
15665=======================================
15666
15667As is traditional, so many things have changed that I can't pretend to
15668be complete in these release notes, but I'll try anyway :-)
15669
15670Note that the very last section is labeled "remaining bugs".
15671
15672
15673Source organization and build process
15674-------------------------------------
15675
15676* The sources have finally been split: instead of a single src
15677subdirectory there are now separate directories Include, Parser,
15678Grammar, Objects, Python and Modules. Other directories also start
15679with a capital letter: Misc, Doc, Lib, Demo.
15680
15681* A few extensions (notably Amoeba and X support) have been moved to a
15682separate subtree Extensions, which is no longer in the core
15683distribution, but separately ftp'able as extensions.tar.Z. (The
15684distribution contains a placeholder Ext-dummy with a description of
15685the Extensions subtree as well as the most recent versions of the
15686scripts used there.)
15687
15688* A few large specialized demos (SGI video and www) have been
15689moved to a separate subdirectory Demo2, which is no longer in the core
15690distribution, but separately ftp'able as demo2.tar.Z.
15691
15692* Parts of the standard library have been moved to subdirectories:
15693there are now standard subdirectories stdwin, test, sgi and sun4.
15694
15695* The configuration process has radically changed: I now use GNU
15696autoconf. This makes it much easier to build on new Unix flavors, as
15697well as fully supporting VPATH (if your Make has it). The scripts
15698Configure.py and Addmodule.sh are no longer needed. Many source files
15699have been adapted in order to work with the symbols that the configure
15700script generated by autoconf defines (or not); the resulting source is
15701much more portable to different C compilers and operating systems,
15702even non Unix systems (a Mac port was done in an afternoon). See the
15703toplevel README file for a description of the new build process.
15704
15705* GNU readline (a slightly newer version) is now a subdirectory of the
15706Python toplevel. It is still not automatically configured (being
15707totally autoconf-unaware :-). One problem has been solved: typing
15708Control-C to a readline prompt will now work. The distribution no
15709longer contains a "super-level" directory (above the python toplevel
15710directory), and dl, dl-dld and GNU dld are no longer part of the
15711Python distribution (you can still ftp them from
15712ftp.cwi.nl:/pub/dynload).
15713
15714* The DOS functions have been taken out of posixmodule.c and moved
15715into a separate file dosmodule.c.
15716
15717* There's now a separate file version.c which contains nothing but
15718the version number.
15719
15720* The actual main program is now contained in config.c (unless NO_MAIN
15721is defined); pythonmain.c now contains a function realmain() which is
15722called from config.c's main().
15723
15724* All files needed to use the built-in module md5 are now contained in
15725the distribution. The module has been cleaned up considerably.
15726
15727
15728Documentation
15729-------------
15730
15731* The library manual has been split into many more small latex files,
15732so it is easier to edit Doc/lib.tex file to create a custom library
15733manual, describing only those modules supported on your system. (This
15734is not automated though.)
15735
15736* A fourth manual has been added, titled "Extending and Embedding the
15737Python Interpreter" (Doc/ext.tex), which collects information about
15738the interpreter which was previously spread over several files in the
15739misc subdirectory.
15740
15741* The entire documentation is now also available on-line for those who
15742have a WWW browser (e.g. NCSA Mosaic). Point your browser to the URL
15743"http://www.cwi.nl/~guido/Python.html".
15744
15745
15746Syntax
15747------
15748
15749* Strings may now be enclosed in double quotes as well as in single
15750quotes. There is no difference in interpretation. The repr() of
15751string objects will use double quotes if the string contains a single
15752quote and no double quotes. Thanks to Amrit Prem for these changes!
15753
15754* There is a new keyword 'exec'. This replaces the exec() built-in
15755function. If a function contains an exec statement, local variable
15756optimization is not performed for that particular function, thus
15757making assignment to local variables in exec statements less
15758confusing. (As a consequence, os.exec and python.exec have been
15759renamed to execv.)
15760
15761* There is a new keyword 'lambda'. An expression of the form
15762
15763 lambda <parameters> : <expression>
15764
15765yields an anonymous function. This is really only syntactic sugar;
15766you can just as well define a local function using
15767
15768 def some_temporary_name(<parameters>): return <expression>
15769
15770Lambda expressions are particularly useful in combination with map(),
15771filter() and reduce(), described below. Thanks to Amrit Prem for
15772submitting this code (as well as map(), filter(), reduce() and
15773xrange())!
15774
15775
15776Built-in functions
15777------------------
15778
15779* The built-in module containing the built-in functions is called
15780__builtin__ instead of builtin.
15781
15782* New built-in functions map(), filter() and reduce() perform standard
15783functional programming operations (though not lazily):
15784
15785- map(f, seq) returns a new sequence whose items are the items from
15786seq with f() applied to them.
15787
15788- filter(f, seq) returns a subsequence of seq consisting of those
15789items for which f() is true.
15790
15791- reduce(f, seq, initial) returns a value computed as follows:
15792 acc = initial
15793 for item in seq: acc = f(acc, item)
15794 return acc
15795
15796* New function xrange() creates a "range object". Its arguments are
15797the same as those of range(), and when used in a for loop a range
15798objects also behaves identical. The advantage of xrange() over
15799range() is that its representation (if the range contains many
15800elements) is much more compact than that of range(). The disadvantage
15801is that the result cannot be used to initialize a list object or for
15802the "Python idiom" [RED, GREEN, BLUE] = range(3). On some modern
15803architectures, benchmarks have shown that "for i in range(...): ..."
15804actually executes *faster* than "for i in xrange(...): ...", but on
15805memory starved machines like PCs running DOS range(100000) may be just
15806too big to be represented at all...
15807
15808* Built-in function exec() has been replaced by the exec statement --
15809see above.
15810
15811
15812The interpreter
15813---------------
15814
15815* Syntax errors are now not printed to stderr by the parser, but
15816rather the offending line and other relevant information are packed up
15817in the SyntaxError exception argument. When the main loop catches a
15818SyntaxError exception it will print the error in the same format as
15819previously, but at the proper position in the stack traceback.
15820
15821* You can now set a maximum to the number of traceback entries
15822printed by assigning to sys.tracebacklimit. The default is 1000.
15823
15824* The version number in .pyc files has changed yet again.
15825
15826* It is now possible to have a .pyc file without a corresponding .py
15827file. (Warning: this may break existing installations if you have an
15828old .pyc file lingering around somewhere on your module search path
15829without a corresponding .py file, when there is a .py file for a
15830module of the same name further down the path -- the new interpreter
15831will find the first .pyc file and complain about it, while the old
15832interpreter would ignore it and use the .py file further down.)
15833
15834* The list sys.builtin_module_names is now sorted and also contains
15835the names of a few hardwired built-in modules (sys, __main__ and
15836__builtin__).
15837
15838* A module can now find its own name by accessing the global variable
15839__name__. Assigning to this variable essentially renames the module
15840(it should also be stored under a different key in sys.modules).
15841A neat hack follows from this: a module that wants to execute a main
15842program when called as a script no longer needs to compare
15843sys.argv[0]; it can simply do "if __name__ == '__main__': main()".
15844
15845* When an object is printed by the print statement, its implementation
15846of str() is used. This means that classes can define __str__(self) to
15847direct how their instances are printed. This is different from
15848__repr__(self), which should define an unambigous string
15849representation of the instance. (If __str__() is not defined, it
15850defaults to __repr__().)
15851
15852* Functions and code objects can now be compared meaningfully.
15853
15854* On systems supporting SunOS or SVR4 style shared libraries, dynamic
15855loading of modules using shared libraries is automatically configured.
15856Thanks to Bill Jansen and Denis Severson for contributing this change!
15857
15858
15859Built-in objects
15860----------------
15861
15862* File objects have acquired a new method writelines() which is the
15863reverse of readlines(). (It does not actually write lines, just a
15864list of strings, but the symmetry makes the choice of name OK.)
15865
15866
15867Built-in modules
15868----------------
15869
15870* Socket objects no longer support the avail() method. Use the select
15871module instead, or use this function to replace it:
15872
15873 def avail(f):
15874 import select
15875 return f in select.select([f], [], [], 0)[0]
15876
15877* Initialization of stdwin is done differently. It actually modifies
15878sys.argv (taking out the options the X version of stdwin recognizes)
15879the first time it is imported.
15880
15881* A new built-in module parser provides a rudimentary interface to the
15882python parser. Corresponding standard library modules token and symbol
15883defines the numeric values of tokens and non-terminal symbols.
15884
15885* The posix module has aquired new functions setuid(), setgid(),
15886execve(), and exec() has been renamed to execv().
15887
15888* The array module is extended with 8-byte object swaps, the 'i'
15889format character, and a reverse() method. The read() and write()
15890methods are renamed to fromfile() and tofile().
15891
15892* The rotor module has freed of portability bugs. This introduces a
15893backward compatibility problem: strings encoded with the old rotor
15894module can't be decoded by the new version.
15895
15896* For select.select(), a timeout (4th) argument of None means the same
15897as leaving the timeout argument out.
15898
15899* Module strop (and hence standard library module string) has aquired
15900a new function: rindex(). Thanks to Amrit Prem!
15901
15902* Module regex defines a new function symcomp() which uses an extended
15903regular expression syntax: parenthesized subexpressions may be labeled
15904using the form "\(<labelname>...\)", and the group() method can return
15905sub-expressions by name. Thanks to Tracy Tims for these changes!
15906
15907* Multiple threads are now supported on Solaris 2. Thanks to Sjoerd
15908Mullender!
15909
15910
15911Standard library modules
15912------------------------
15913
15914* The library is now split in several subdirectories: all stuff using
15915stdwin is in Lib/stdwin, all SGI specific (or SGI Indigo or GL) stuff
15916is in Lib/sgi, all Sun Sparc specific stuff is in Lib/sun4, and all
15917test modules are in Lib/test. The default module search path will
15918include all relevant subdirectories by default.
15919
15920* Module os now knows about trying to import dos. It defines
15921functions execl(), execle(), execlp() and execvp().
15922
15923* New module dospath (should be attacked by a DOS hacker though).
15924
15925* All modules defining classes now define __init__() constructors
15926instead of init() methods. THIS IS AN INCOMPATIBLE CHANGE!
15927
15928* Some minor changes and bugfixes module ftplib (mostly Steve
15929Majewski's suggestions); the debug() method is renamed to
15930set_debuglevel().
15931
15932* Some new test modules (not run automatically by testall though):
15933test_audioop, test_md5, test_rgbimg, test_select.
15934
15935* Module string now defines rindex() and rfind() in analogy of index()
15936and find(). It also defines atof() and atol() (and corresponding
15937exceptions) in analogy to atoi().
15938
15939* Added help() functions to modules profile and pdb.
15940
15941* The wdb debugger (now in Lib/stdwin) now shows class or instance
15942variables on a double click. Thanks to Sjoerd Mullender!
15943
15944* The (undocumented) module lambda has gone -- you couldn't import it
15945any more, and it was basically more a demo than a library module...
15946
15947
15948Multimedia extensions
15949---------------------
15950
15951* The optional built-in modules audioop and imageop are now standard
15952parts of the interpreter. Thanks to Sjoerd Mullender and Jack Jansen
15953for contributing this code!
15954
15955* There's a new operation in audioop: minmax().
15956
15957* There's a new built-in module called rgbimg which supports portable
15958efficient reading of SGI RCG image files. Thanks also to Paul
15959Haeberli for the original code! (Who will contribute a GIF reader?)
15960
15961* The module aifc is gone -- you should now always use aifc, which has
15962received a facelift.
15963
15964* There's a new module sunau., for reading Sun (and NeXT) audio files.
15965
15966* There's a new module audiodev which provides a uniform interface to
15967(SGI Indigo and Sun Sparc) audio hardware.
15968
15969* There's a new module sndhdr which recognizes various sound files by
15970looking in their header and checking for various magic words.
15971
15972
15973Optimizations
15974-------------
15975
15976* Most optimizations below can be configured by compile-time flags.
15977Thanks to Sjoerd Mullender for submitting these optimizations!
15978
15979* Small integers (default -1..99) are shared -- i.e. if two different
15980functions compute the same value it is possible (but not
15981guaranteed!!!) that they return the same *object*. Python programs
15982can detect this but should *never* rely on it.
15983
15984* Empty tuples (which all compare equal) are shared in the same
15985manner.
15986
15987* Tuples of size up to 20 (default) are put in separate free lists
15988when deallocated.
15989
15990* There is a compile-time option to cache a string's hash function,
15991but this appeared to have a negligeable effect, and as it costs 4
15992bytes per string it is disabled by default.
15993
15994
15995Embedding Python
15996----------------
15997
15998* The initialization interface has been simplified somewhat. You now
15999only call "initall()" to initialize the interpreter.
16000
16001* The previously announced renaming of externally visible identifiers
16002has not been carried out. It will happen in a later release. Sorry.
16003
16004
16005Miscellaneous bugs that have been fixed
16006---------------------------------------
16007
16008* All known portability bugs.
16009
16010* Version 0.9.9 dumped core in <listobject>.sort() which has been
16011fixed. Thanks to Jaap Vermeulen for fixing this and posting the fix
16012on the mailing list while I was away!
16013
16014* Core dump on a format string ending in '%', e.g. in the expression
16015'%' % None.
16016
16017* The array module yielded a bogus result for concatenation (a+b would
16018yield a+a).
16019
16020* Some serious memory leaks in strop.split() and strop.splitfields().
16021
16022* Several problems with the nis module.
16023
16024* Subtle problem when copying a class method from another class
16025through assignment (the method could not be called).
16026
16027
16028Remaining bugs
16029--------------
16030
16031* One problem with 64-bit machines remains -- since .pyc files are
16032portable and use only 4 bytes to represent an integer object, 64-bit
16033integer literals are silently truncated when written into a .pyc file.
16034Work-around: use eval('123456789101112').
16035
16036* The freeze script doesn't work any more. A new and more portable
16037one can probably be cooked up using tricks from Extensions/mkext.py.
16038
16039* The dos support hasn't been tested yet. (Really Soon Now we should
16040have a PC with a working C compiler!)
16041
16042
Guido van Rossuma7925f11994-01-26 10:20:16 +000016043===================================
16044==> Release 0.9.9 (29 Jul 1993) <==
16045===================================
16046
16047I *believe* these are the main user-visible changes in this release,
16048but there may be others. SGI users may scan the {src,lib}/ChangeLog
16049files for improvements of some SGI specific modules, e.g. aifc and
16050cl. Developers of extension modules should also read src/ChangeLog.
16051
16052
16053Naming of C symbols used by the Python interpreter
16054--------------------------------------------------
16055
16056* This is the last release using the current naming conventions. New
16057naming conventions are explained in the file misc/NAMING.
16058Summarizing, all externally visible symbols get (at least) a "Py"
16059prefix, and most functions are renamed to the standard form
16060PyModule_FunctionName.
16061
16062* Writers of extensions are urged to start using the new naming
16063conventions. The next release will use the new naming conventions
16064throughout (it will also have a different source directory
16065structure).
16066
16067* As a result of the preliminary work for the great renaming, many
16068functions that were accidentally global have been made static.
16069
16070
16071BETA X11 support
16072----------------
16073
16074* There are now modules interfacing to the X11 Toolkit Intrinsics, the
16075Athena widgets, and the Motif 1.1 widget set. These are not yet
16076documented except through the examples and README file in the demo/x11
16077directory. It is expected that this interface will be replaced by a
16078more powerful and correct one in the future, which may or may not be
16079backward compatible. In other words, this part of the code is at most
16080BETA level software! (Note: the rest of Python is rock solid as ever!)
16081
16082* I understand that the above may be a bit of a disappointment,
16083however my current schedule does not allow me to change this situation
16084before putting the release out of the door. By releasing it
16085undocumented and buggy, at least some of the (working!) demo programs,
16086like itr (my Internet Talk Radio browser) become available to a larger
16087audience.
16088
16089* There are also modules interfacing to SGI's "Glx" widget (a GL
16090window wrapped in a widget) and to NCSA's "HTML" widget (which can
16091format HyperText Markup Language, the document format used by the
16092World Wide Web).
16093
16094* I've experienced some problems when building the X11 support. In
16095particular, the Xm and Xaw widget sets don't go together, and it
16096appears that using X11R5 is better than using X11R4. Also the threads
16097module and its link time options may spoil things. My own strategy is
16098to build two Python binaries: one for use with X11 and one without
16099it, which can contain a richer set of built-in modules. Don't even
16100*think* of loading the X11 modules dynamically...
16101
16102
16103Environmental changes
16104---------------------
16105
16106* Compiled files (*.pyc files) created by this Python version are
16107incompatible with those created by the previous version. Both
16108versions detect this and silently create a correct version, but it
16109means that it is not a good idea to use the same library directory for
16110an old and a new interpreter, since they will start to "fight" over
16111the *.pyc files...
16112
16113* When a stack trace is printed, the exception is printed last instead
16114of first. This means that if the beginning of the stack trace
16115scrolled out of your window you can still see what exception caused
16116it.
16117
16118* Sometimes interrupting a Python operation does not work because it
16119hangs in a blocking system call. You can now kill the interpreter by
16120interrupting it three times. The second time you interrupt it, a
16121message will be printed telling you that the third interrupt will kill
16122the interpreter. The "sys.exitfunc" feature still makes limited
16123clean-up possible in this case.
16124
16125
16126Changes to the command line interface
16127-------------------------------------
16128
16129* The python usage message is now much more informative.
16130
16131* New option -i enters interactive mode after executing a script --
16132useful for debugging.
16133
16134* New option -k raises an exception when an expression statement
16135yields a value other than None.
16136
16137* For each option there is now also a corresponding environment
16138variable.
16139
16140
16141Using Python as an embedded language
16142------------------------------------
16143
16144* The distribution now contains (some) documentation on the use of
16145Python as an "embedded language" in other applications, as well as a
16146simple example. See the file misc/EMBEDDING and the directory embed/.
16147
16148
16149Speed improvements
16150------------------
16151
16152* Function local variables are now generally stored in an array and
16153accessed using an integer indexing operation, instead of through a
16154dictionary lookup. (This compensates the somewhat slower dictionary
16155lookup caused by the generalization of the dictionary module.)
16156
16157
16158Changes to the syntax
16159---------------------
16160
16161* Continuation lines can now *sometimes* be written without a
16162backslash: if the continuation is contained within nesting (), [] or
16163{} brackets the \ may be omitted. There's a much improved
16164python-mode.el in the misc directory which knows about this as well.
16165
16166* You can no longer use an empty set of parentheses to define a class
16167without base classes. That is, you no longer write this:
16168
16169 class Foo(): # syntax error
16170 ...
16171
16172You must write this instead:
16173
16174 class Foo:
16175 ...
16176
16177This was already the preferred syntax in release 0.9.8 but many
16178people seemed not to have picked it up. There's a Python script that
16179fixes old code: demo/scripts/classfix.py.
16180
16181* There's a new reserved word: "access". The syntax and semantics are
16182still subject of of research and debate (as well as undocumented), but
16183the parser knows about the keyword so you must not use it as a
16184variable, function, or attribute name.
16185
16186
16187Changes to the semantics of the language proper
16188-----------------------------------------------
16189
16190* The following compatibility hack is removed: if a function was
16191defined with two or more arguments, and called with a single argument
16192that was a tuple with just as many arguments, the items of this tuple
16193would be used as the arguments. This is no longer supported.
16194
16195
16196Changes to the semantics of classes and instances
16197-------------------------------------------------
16198
16199* Class variables are now also accessible as instance variables for
16200reading (assignment creates an instance variable which overrides the
16201class variable of the same name though).
16202
16203* If a class attribute is a user-defined function, a new kind of
16204object is returned: an "unbound method". This contains a pointer to
16205the class and can only be called with a first argument which is a
16206member of that class (or a derived class).
16207
16208* If a class defines a method __init__(self, arg1, ...) then this
16209method is called when a class instance is created by the classname()
16210construct. Arguments passed to classname() are passed to the
16211__init__() method. The __init__() methods of base classes are not
16212automatically called; the derived __init__() method must call these if
16213necessary (this was done so the derived __init__() method can choose
16214the call order and arguments for the base __init__() methods).
16215
16216* If a class defines a method __del__(self) then this method is called
16217when an instance of the class is about to be destroyed. This makes it
16218possible to implement clean-up of external resources attached to the
16219instance. As with __init__(), the __del__() methods of base classes
16220are not automatically called. If __del__ manages to store a reference
16221to the object somewhere, its destruction is postponed; when the object
16222is again about to be destroyed its __del__() method will be called
16223again.
16224
16225* Classes may define a method __hash__(self) to allow their instances
16226to be used as dictionary keys. This must return a 32-bit integer.
16227
16228
16229Minor improvements
16230------------------
16231
16232* Function and class objects now know their name (the name given in
16233the 'def' or 'class' statement that created them).
16234
16235* Class instances now know their class name.
16236
16237
16238Additions to built-in operations
16239--------------------------------
16240
16241* The % operator with a string left argument implements formatting
16242similar to sprintf() in C. The right argument is either a single
16243value or a tuple of values. All features of Standard C sprintf() are
16244supported except %p.
16245
16246* Dictionaries now support almost any key type, instead of just
16247strings. (The key type must be an immutable type or must be a class
16248instance where the class defines a method __hash__(), in order to
16249avoid losing track of keys whose value may change.)
16250
16251* Built-in methods are now compared properly: when comparing x.meth1
16252and y.meth2, if x is equal to y and the methods are defined by the
16253same function, x.meth1 compares equal to y.meth2.
16254
16255
16256Additions to built-in functions
16257-------------------------------
16258
16259* str(x) returns a string version of its argument. If the argument is
16260a string it is returned unchanged, otherwise it returns `x`.
16261
16262* repr(x) returns the same as `x`. (Some users found it easier to
16263have this as a function.)
16264
16265* round(x) returns the floating point number x rounded to an whole
16266number, represented as a floating point number. round(x, n) returns x
16267rounded to n digits.
16268
16269* hasattr(x, name) returns true when x has an attribute with the given
16270name.
16271
16272* hash(x) returns a hash code (32-bit integer) of an arbitrary
16273immutable object's value.
16274
16275* id(x) returns a unique identifier (32-bit integer) of an arbitrary
16276object.
16277
16278* compile() compiles a string to a Python code object.
16279
16280* exec() and eval() now support execution of code objects.
16281
16282
16283Changes to the documented part of the library (standard modules)
16284----------------------------------------------------------------
16285
16286* os.path.normpath() (a.k.a. posixpath.normpath()) has been fixed so
16287the border case '/foo/..' returns '/' instead of ''.
16288
16289* A new function string.find() is added with similar semantics to
16290string.index(); however when it does not find the given substring it
16291returns -1 instead of raising string.index_error.
16292
16293
16294Changes to built-in modules
16295---------------------------
16296
16297* New optional module 'array' implements operations on sequences of
16298integers or floating point numbers of a particular size. This is
16299useful to manipulate large numerical arrays or to read and write
16300binary files consisting of numerical data.
16301
16302* Regular expression objects created by module regex now support a new
16303method named group(), which returns one or more \(...\) groups by number.
16304The number of groups is increased from 10 to 100.
16305
16306* Function compile() in module regex now supports an optional mapping
16307argument; a variable casefold is added to the module which can be used
16308as a standard uppercase to lowercase mapping.
16309
16310* Module time now supports many routines that are defined in the
16311Standard C time interface (<time.h>): gmtime(), localtime(),
16312asctime(), ctime(), mktime(), as well as these variables (taken from
16313System V): timezone, altzone, daylight and tzname. (The corresponding
16314functions in the undocumented module calendar have been removed; the
16315undocumented and unfinished module tzparse is now obsolete and will
16316disappear in a future release.)
16317
16318* Module strop (the fast built-in version of standard module string)
16319now uses C's definition of whitespace instead of fixing it to space,
16320tab and newline; in practice this usually means that vertical tab,
16321form feed and return are now also considered whitespace. It exports
16322the string of characters that are considered whitespace as well as the
16323characters that are considered lowercase or uppercase.
16324
16325* Module sys now defines the variable builtin_module_names, a list of
16326names of modules built into the current interpreter (including not
16327yet imported, but excluding two special modules that always have to be
16328defined -- sys and builtin).
16329
16330* Objects created by module sunaudiodev now also support flush() and
16331close() methods.
16332
16333* Socket objects created by module socket now support an optional
16334flags argument for their methods sendto() and recvfrom().
16335
16336* Module marshal now supports dumping to and loading from strings,
16337through the functions dumps() and loads().
16338
16339* Module stdwin now supports some new functionality. You may have to
16340ftp the latest version: ftp.cwi.nl:/pub/stdwin/stdwinforviews.tar.Z.)
16341
16342
16343Bugs fixed
16344----------
16345
16346* Fixed comparison of negative long integers.
16347
16348* The tokenizer no longer botches input lines longer than BUFSIZ.
16349
16350* Fixed several severe memory leaks in module select.
16351
16352* Fixed memory leaks in modules socket and sv.
16353
16354* Fixed memory leak in divmod() for long integers.
16355
16356* Problems with definition of floatsleep() on Suns fixed.
16357
16358* Many portability bugs fixed (and undoubtedly new ones added :-).
16359
16360
16361Changes to the build procedure
16362------------------------------
16363
16364* The Makefile supports some new targets: "make default" and "make
16365all". Both are by normally equivalent to "make python".
16366
16367* The Makefile no longer uses $> since it's not supported by all
16368versions of Make.
16369
16370* The header files now all contain #ifdef constructs designed to make
16371it safe to include the same header file twice, as well as support for
16372inclusion from C++ programs (automatic extern "C" { ... } added).
16373
16374
16375Freezing Python scripts
16376-----------------------
16377
16378* There is now some support for "freezing" a Python script as a
16379stand-alone executable binary file. See the script
16380demo/scripts/freeze.py. It will require some site-specific tailoring
16381of the script to get this working, but is quite worthwhile if you write
16382Python code for other who may not have built and installed Python.
16383
16384
16385MS-DOS
16386------
16387
16388* A new MS-DOS port has been done, using MSC 6.0 (I believe). Thanks,
16389Marcel van der Peijl! This requires fewer compatibility hacks in
16390posixmodule.c. The executable is not yet available but will be soon
16391(check the mailing list).
16392
16393* The default PYTHONPATH has changed.
16394
16395
16396Changes for developers of extension modules
16397-------------------------------------------
16398
16399* Read src/ChangeLog for full details.
16400
16401
16402SGI specific changes
16403--------------------
16404
16405* Read src/ChangeLog for full details.
16406
Guido van Rossumaa253861994-10-06 17:18:57 +000016407
Guido van Rossuma7925f11994-01-26 10:20:16 +000016408==================================
16409==> Release 0.9.8 (9 Jan 1993) <==
16410==================================
16411
16412I claim no completeness here, but I've tried my best to scan the log
16413files throughout my source tree for interesting bits of news. A more
16414complete account of the changes is to be found in the various
16415ChangeLog files. See also "News for release 0.9.7beta" below if you're
16416still using release 0.9.6, and the file HISTORY if you have an even
16417older release.
16418
16419 --Guido
16420
16421
16422Changes to the language proper
16423------------------------------
16424
16425There's only one big change: the conformance checking for function
16426argument lists (of user-defined functions only) is stricter. Earlier,
16427you could get away with the following:
16428
16429 (a) define a function of one argument and call it with any
16430 number of arguments; if the actual argument count wasn't
16431 one, the function would receive a tuple containing the
16432 arguments arguments (an empty tuple if there were none).
16433
16434 (b) define a function of two arguments, and call it with more
16435 than two arguments; if there were more than two arguments,
16436 the second argument would be passed as a tuple containing
16437 the second and further actual arguments.
16438
16439(Note that an argument (formal or actual) that is a tuple is counted as
16440one; these rules don't apply inside such tuples, only at the top level
16441of the argument list.)
16442
16443Case (a) was needed to accommodate variable-length argument lists;
16444there is now an explicit "varargs" feature (precede the last argument
16445with a '*'). Case (b) was needed for compatibility with old class
16446definitions: up to release 0.9.4 a method with more than one argument
16447had to be declared as "def meth(self, (arg1, arg2, ...)): ...".
16448Version 0.9.6 provide better ways to handle both casees, bot provided
16449backward compatibility; version 0.9.8 retracts the compatibility hacks
16450since they also cause confusing behavior if a function is called with
16451the wrong number of arguments.
16452
16453There's a script that helps converting classes that still rely on (b),
16454provided their methods' first argument is called "self":
16455demo/scripts/methfix.py.
16456
16457If this change breaks lots of code you have developed locally, try
16458#defining COMPAT_HACKS in ceval.c.
16459
16460(There's a third compatibility hack, which is the reverse of (a): if a
16461function is defined with two or more arguments, and called with a
16462single argument that is a tuple with just as many arguments, the items
16463of this tuple will be used as the arguments. Although this can (and
16464should!) be done using the built-in function apply() instead, it isn't
16465withdrawn yet.)
16466
16467
16468One minor change: comparing instance methods works like expected, so
16469that if x is an instance of a user-defined class and has a method m,
16470then (x.m==x.m) yields 1.
16471
16472
16473The following was already present in 0.9.7beta, but not explicitly
16474mentioned in the NEWS file: user-defined classes can now define types
16475that behave in almost allrespects like numbers. See
16476demo/classes/Rat.py for a simple example.
16477
16478
16479Changes to the build process
16480----------------------------
16481
16482The Configure.py script and the Makefile has been made somewhat more
16483bullet-proof, after reports of (minor) trouble on certain platforms.
16484
16485There is now a script to patch Makefile and config.c to add a new
16486optional built-in module: Addmodule.sh. Read the script before using!
16487
16488Useing Addmodule.sh, all optional modules can now be configured at
16489compile time using Configure.py, so there are no modules left that
16490require dynamic loading.
16491
16492The Makefile has been fixed to make it easier to use with the VPATH
16493feature of some Make versions (e.g. SunOS).
16494
16495
16496Changes affecting portability
16497-----------------------------
16498
16499Several minor portability problems have been solved, e.g. "malloc.h"
16500has been renamed to "mymalloc.h", "strdup.c" is no longer used, and
16501the system now tolerates malloc(0) returning 0.
16502
16503For dynamic loading on the SGI, Jack Jansen's dl 1.6 is now
16504distributed with Python. This solves several minor problems, in
16505particular scripts invoked using #! can now use dynamic loading.
16506
16507
16508Changes to the interpreter interface
16509------------------------------------
16510
16511On popular demand, there's finally a "profile" feature for interactive
16512use of the interpreter. If the environment variable $PYTHONSTARTUP is
16513set to the name of an existing file, Python statements in this file
16514are executed when the interpreter is started in interactive mode.
16515
16516There is a new clean-up mechanism, complementing try...finally: if you
16517assign a function object to sys.exitfunc, it will be called when
16518Python exits or receives a SIGTERM or SIGHUP signal.
16519
16520The interpreter is now generally assumed to live in
16521/usr/local/bin/python (as opposed to /usr/local/python). The script
16522demo/scripts/fixps.py will update old scripts in place (you can easily
16523modify it to do other similar changes).
16524
16525Most I/O that uses sys.stdin/stdout/stderr will now use any object
16526assigned to those names as long as the object supports readline() or
16527write() methods.
16528
16529The parser stack has been increased to 500 to accommodate more
16530complicated expressions (7 levels used to be the practical maximum,
16531it's now about 38).
16532
16533The limit on the size of the *run-time* stack has completely been
16534removed -- this means that tuple or list displays can contain any
16535number of elements (formerly more than 50 would crash the
16536interpreter).
16537
16538
16539Changes to existing built-in functions and methods
16540--------------------------------------------------
16541
16542The built-in functions int(), long(), float(), oct() and hex() now
16543also apply to class instalces that define corresponding methods
16544(__int__ etc.).
16545
16546
16547New built-in functions
16548----------------------
16549
16550The new functions str() and repr() convert any object to a string.
16551The function repr(x) is in all respects equivalent to `x` -- some
16552people prefer a function for this. The function str(x) does the same
16553except if x is already a string -- then it returns x unchanged
16554(repr(x) adds quotes and escapes "funny" characters as octal escapes).
16555
16556The new function cmp(x, y) returns -1 if x<y, 0 if x==y, 1 if x>y.
16557
16558
16559Changes to general built-in modules
16560-----------------------------------
16561
16562The time module's functions are more general: time() returns a
16563floating point number and sleep() accepts one. Their accuracies
16564depends on the precision of the system clock. Millisleep is no longer
16565needed (although it still exists for now), but millitimer is still
16566needed since on some systems wall clock time is only available with
16567seconds precision, while a source of more precise time exists that
16568isn't synchronized with the wall clock. (On UNIX systems that support
16569the BSD gettimeofday() function, time.time() is as time.millitimer().)
16570
16571The string representation of a file object now includes an address:
16572'<file 'filename', mode 'r' at #######>' where ###### is a hex number
16573(the object's address) to make it unique.
16574
16575New functions added to posix: nice(), setpgrp(), and if your system
16576supports them: setsid(), setpgid(), tcgetpgrp(), tcsetpgrp().
16577
16578Improvements to the socket module: socket objects have new methods
16579getpeername() and getsockname(), and the {get,set}sockopt methods can
16580now get/set any kind of option using strings built with the new struct
16581module. And there's a new function fromfd() which creates a socket
16582object given a file descriptor (useful for servers started by inetd,
16583which have a socket connected to stdin and stdout).
16584
16585
16586Changes to SGI-specific built-in modules
16587----------------------------------------
16588
16589The FORMS library interface (fl) now requires FORMS 2.1a. Some new
16590functions have been added and some bugs have been fixed.
16591
16592Additions to al (audio library interface): added getname(),
16593getdefault() and getminmax().
16594
16595The gl modules doesn't call "foreground()" when initialized (this
16596caused some problems) like it dit in 0.9.7beta (but not before).
16597There's a new gl function 'gversion() which returns a version string.
16598
16599The interface to sv (Indigo video interface) has totally changed.
16600(Sorry, still no documentation, but see the examples in
16601demo/sgi/{sv,video}.)
16602
16603
16604Changes to standard library modules
16605-----------------------------------
16606
16607Most functions in module string are now much faster: they're actually
16608implemented in C. The module containing the C versions is called
16609"strop" but you should still import "string" since strop doesn't
16610provide all the interfaces defined in string (and strop may be renamed
16611to string when it is complete in a future release).
16612
16613string.index() now accepts an optional third argument giving an index
16614where to start searching in the first argument, so you can find second
16615and further occurrences (this is similar to the regular expression
16616functions in regex).
16617
16618The definition of what string.splitfields(anything, '') should return
16619is changed for the last time: it returns a singleton list containing
16620its whole first argument unchanged. This is compatible with
16621regsub.split() which also ignores empty delimiter matches.
16622
16623posixpath, macpath: added dirname() and normpath() (and basename() to
16624macpath).
16625
16626The mainloop module (for use with stdwin) can now demultiplex input
16627from other sources, as long as they can be polled with select().
16628
16629
16630New built-in modules
16631--------------------
16632
16633Module struct defines functions to pack/unpack values to/from strings
16634representing binary values in native byte order.
16635
16636Module strop implements C versions of many functions from string (see
16637above).
16638
16639Optional module fcntl defines interfaces to fcntl() and ioctl() --
16640UNIX only. (Not yet properly documented -- see however src/fcntl.doc.)
16641
16642Optional module mpz defines an interface to an altaernative long
16643integer implementation, the GNU MPZ library.
16644
16645Optional module md5 uses the GNU MPZ library to calculate MD5
16646signatures of strings.
16647
16648There are also optional new modules specific to SGI machines: imageop
16649defines some simple operations to images represented as strings; sv
16650interfaces to the Indigo video board; cl interfaces to the (yet
16651unreleased) compression library.
16652
16653
16654New standard library modules
16655----------------------------
16656
16657(Unfortunately the following modules are not all documented; read the
16658sources to find out more about them!)
16659
16660autotest: run testall without showing any output unless it differs
16661from the expected output
16662
16663bisect: use bisection to insert or find an item in a sorted list
16664
16665colorsys: defines conversions between various color systems (e.g. RGB
16666<-> YUV)
16667
16668nntplib: a client interface to NNTP servers
16669
16670pipes: utility to construct pipeline from templates, e.g. for
16671conversion from one file format to another using several utilities.
16672
16673regsub: contains three functions that are more or less compatible with
16674awk functions of the same name: sub() and gsub() do string
16675substitution, split() splits a string using a regular expression to
16676define how separators are define.
16677
16678test_types: test operations on the built-in types of Python
16679
16680toaiff: convert various audio file formats to AIFF format
16681
16682tzparse: parse the TZ environment parameter (this may be less general
16683than it could be, let me know if you fix it).
16684
16685(Note that the obsolete module "path" no longer exists.)
16686
16687
16688New SGI-specific library modules
16689--------------------------------
16690
16691CL: constants for use with the built-in compression library interface (cl)
16692
16693Queue: a multi-producer, multi-consumer queue class implemented for
16694use with the built-in thread module
16695
16696SOCKET: constants for use with built-in module socket, e.g. to set/get
16697socket options. This is SGI-specific because the constants to be
16698passed are system-dependent. You can generate a version for your own
16699system by running the script demo/scripts/h2py.py with
16700/usr/include/sys/socket.h as input.
16701
Walter Dörwaldf0dfc7a2003-10-20 14:01:56 +000016702cddb: interface to the database used by the CD player
Guido van Rossuma7925f11994-01-26 10:20:16 +000016703
16704torgb: convert various image file types to rgb format (requires pbmplus)
16705
16706
16707New demos
16708---------
16709
16710There's an experimental interface to define Sun RPC clients and
16711servers in demo/rpc.
16712
16713There's a collection of interfaces to WWW, WAIS and Gopher (both
16714Python classes and program providing a user interface) in demo/www.
16715This includes a program texi2html.py which converts texinfo files to
16716HTML files (the format used hy WWW).
16717
16718The ibrowse demo has moved from demo/stdwin/ibrowse to demo/ibrowse.
16719
16720For SGI systems, there's a whole collection of programs and classes
16721that make use of the Indigo video board in demo/sgi/{sv,video}. This
16722represents a significant amount of work that we're giving away!
16723
16724There are demos "rsa" and "md5test" that exercise the mpz and md5
16725modules, respectively. The rsa demo is a complete implementation of
16726the RSA public-key cryptosystem!
16727
16728A bunch of games and examples submitted by Stoffel Erasmus have been
16729included in demo/stoffel.
16730
16731There are miscellaneous new files in some existing demo
16732subdirectories: classes/bitvec.py, scripts/{fixps,methfix}.py,
16733sgi/al/cmpaf.py, sockets/{mcast,gopher}.py.
16734
16735There are also many minor changes to existing files, but I'm too lazy
16736to run a diff and note the differences -- you can do this yourself if
16737you save the old distribution's demos. One highlight: the
16738stdwin/python.py demo is much improved!
16739
16740
16741Changes to the documentation
16742----------------------------
16743
16744The LaTeX source for the library uses different macros to enable it to
16745be converted to texinfo, and from there to INFO or HTML format so it
16746can be browsed as a hypertext. The net result is that you can now
16747read the Python library documentation in Emacs info mode!
16748
16749
16750Changes to the source code that affect C extension writers
16751----------------------------------------------------------
16752
16753The function strdup() no longer exists (it was used only in one places
16754and is somewhat of a a portability problem sice some systems have the
16755same function in their C library.
16756
16757The functions NEW() and RENEW() allocate one spare byte to guard
16758against a NULL return from malloc(0) being taken for an error, but
16759this should not be relied upon.
16760
16761
16762=========================
16763==> Release 0.9.7beta <==
16764=========================
16765
16766
16767Changes to the language proper
16768------------------------------
16769
16770User-defined classes can now implement operations invoked through
16771special syntax, such as x[i] or `x` by defining methods named
16772__getitem__(self, i) or __repr__(self), etc.
16773
16774
16775Changes to the build process
16776----------------------------
16777
16778Instead of extensive manual editing of the Makefile to select
16779compile-time options, you can now run a Configure.py script.
16780The Makefile as distributed builds a minimal interpreter sufficient to
16781run Configure.py. See also misc/BUILD
16782
16783The Makefile now includes more "utility" targets, e.g. install and
16784tags/TAGS
16785
16786Using the provided strtod.c and strtol.c are now separate options, as
16787on the Sun the provided strtod.c dumps core :-(
16788
16789The regex module is now an option chosen by the Makefile, since some
16790(old) C compilers choke on regexpr.c
16791
16792
16793Changes affecting portability
16794-----------------------------
16795
16796You need STDWIN version 0.9.7 (released 30 June 1992) for the stdwin
16797interface
16798
16799Dynamic loading is now supported for Sun (and other non-COFF systems)
16800throug dld-3.2.3, as well as for SGI (a new version of Jack Jansen's
16801DL is out, 1.4)
16802
16803The system-dependent code for the use of the select() system call is
16804moved to one file: myselect.h
16805
16806Thanks to Jaap Vermeulen, the code should now port cleanly to the
16807SEQUENT
16808
16809
16810Changes to the interpreter interface
16811------------------------------------
16812
16813The interpretation of $PYTHONPATH in the environment is different: it
16814is inserted in front of the default path instead of overriding it
16815
16816
16817Changes to existing built-in functions and methods
16818--------------------------------------------------
16819
16820List objects now support an optional argument to their sort() method,
16821which is a comparison function similar to qsort(3) in C
16822
16823File objects now have a method fileno(), used by the new select module
16824(see below)
16825
16826
16827New built-in function
16828---------------------
16829
16830coerce(x, y): take two numbers and return a tuple containing them
16831both converted to a common type
16832
16833
16834Changes to built-in modules
16835---------------------------
16836
16837sys: fixed core dumps in settrace() and setprofile()
16838
16839socket: added socket methods setsockopt() and getsockopt(); and
16840fileno(), used by the new select module (see below)
16841
16842stdwin: added fileno() == connectionnumber(), in support of new module
16843select (see below)
16844
16845posix: added get{eg,eu,g,u}id(); waitpid() is now a separate function.
16846
16847gl: added qgetfd()
16848
16849fl: added several new functions, fixed several obscure bugs, adapted
16850to FORMS 2.1
16851
16852
16853Changes to standard modules
16854---------------------------
16855
16856posixpath: changed implementation of ismount()
16857
16858string: atoi() no longer mistakes leading zero for octal number
16859
16860...
16861
16862
16863New built-in modules
16864--------------------
16865
16866Modules marked "dynamic only" are not configured at compile time but
16867can be loaded dynamically. You need to turn on the DL or DLD option in
16868the Makefile for support dynamic loading of modules (this requires
16869external code).
16870
16871select: interfaces to the BSD select() system call
16872
16873dbm: interfaces to the (new) dbm library (dynamic only)
16874
16875nis: interfaces to some NIS functions (aka yellow pages)
16876
16877thread: limited form of multiple threads (sgi only)
16878
16879audioop: operations useful for audio programs, e.g. u-LAW and ADPCM
16880coding (dynamic only)
16881
16882cd: interface to Indigo SCSI CDROM player audio library (sgi only)
16883
16884jpeg: read files in JPEG format (dynamic only, sgi only; needs
16885external code)
16886
16887imgfile: read SGI image files (dynamic only, sgi only)
16888
16889sunaudiodev: interface to sun's /dev/audio (dynamic only, sun only)
16890
16891sv: interface to Indigo video library (sgi only)
16892
16893pc: a minimal set of MS-DOS interfaces (MS-DOS only)
16894
16895rotor: encryption, by Lance Ellinghouse (dynamic only)
16896
16897
16898New standard modules
16899--------------------
16900
16901Not all these modules are documented. Read the source:
16902lib/<modulename>.py. Sometimes a file lib/<modulename>.doc contains
16903additional documentation.
16904
16905imghdr: recognizes image file headers
16906
16907sndhdr: recognizes sound file headers
16908
16909profile: print run-time statistics of Python code
16910
16911readcd, cdplayer: companion modules for built-in module cd (sgi only)
16912
16913emacs: interface to Emacs using py-connect.el (see below).
16914
16915SOCKET: symbolic constant definitions for socket options
16916
16917SUNAUDIODEV: symbolic constant definitions for sunaudiodef (sun only)
16918
16919SV: symbolic constat definitions for sv (sgi only)
16920
16921CD: symbolic constat definitions for cd (sgi only)
16922
16923
16924New demos
16925---------
16926
16927scripts/pp.py: execute Python as a filter with a Perl-like command
16928line interface
16929
16930classes/: examples using the new class features
16931
16932threads/: examples using the new thread module
16933
16934sgi/cd/: examples using the new cd module
16935
16936
16937Changes to the documentation
16938----------------------------
16939
16940The last-minute syntax changes of release 0.9.6 are now reflected
16941everywhere in the manuals
16942
16943The reference manual has a new section (3.2) on implementing new kinds
16944of numbers, sequences or mappings with user classes
16945
16946Classes are now treated extensively in the tutorial (chapter 9)
16947
16948Slightly restructured the system-dependent chapters of the library
16949manual
16950
16951The file misc/EXTENDING incorporates documentation for mkvalue() and
16952a new section on error handling
16953
16954The files misc/CLASSES and misc/ERRORS are no longer necessary
16955
16956The doc/Makefile now creates PostScript files automatically
16957
16958
16959Miscellaneous changes
16960---------------------
16961
16962Incorporated Tim Peters' changes to python-mode.el, it's now version
169631.06
16964
16965A python/Emacs bridge (provided by Terrence M. Brannon) lets a Python
16966program running in an Emacs buffer execute Emacs lisp code. The
16967necessary Python code is in lib/emacs.py. The Emacs code is
16968misc/py-connect.el (it needs some external Emacs lisp code)
16969
16970
16971Changes to the source code that affect C extension writers
16972----------------------------------------------------------
16973
16974New service function mkvalue() to construct a Python object from C
16975values according to a "format" string a la getargs()
16976
16977Most functions from pythonmain.c moved to new pythonrun.c which is
16978in libpython.a. This should make embedded versions of Python easier
16979
16980ceval.h is split in eval.h (which needs compile.h and only declares
16981eval_code) and ceval.h (which doesn't need compile.hand declares the
16982rest)
16983
16984ceval.h defines macros BGN_SAVE / END_SAVE for use with threads (to
16985improve the parallellism of multi-threaded programs by letting other
16986Python code run when a blocking system call or something similar is
16987made)
16988
16989In structmember.[ch], new member types BYTE, CHAR and unsigned
16990variants have been added
16991
16992New file xxmodule.c is a template for new extension modules.
16993
Guido van Rossumaa253861994-10-06 17:18:57 +000016994
Guido van Rossuma7925f11994-01-26 10:20:16 +000016995==================================
Guido van Rossumf2eac992000-09-04 17:24:24 +000016996==> Release 0.9.6 (6 Apr 1992) <==
Guido van Rossuma7925f11994-01-26 10:20:16 +000016997==================================
16998
16999Misc news in 0.9.6:
17000- Restructured the misc subdirectory
17001- Reference manual completed, library manual much extended (with indexes!)
17002- the GNU Readline library is now distributed standard with Python
17003- the script "../demo/scripts/classfix.py" fixes Python modules using old
17004 class syntax
17005- Emacs python-mode.el (was python.el) vastly improved (thanks, Tim!)
17006- Because of the GNU copyleft business I am not using the GNU regular
17007 expression implementation but a free re-implementation by Tatu Ylonen
17008 that recently appeared in comp.sources.misc (Bravo, Tatu!)
17009
17010New features in 0.9.6:
17011- stricter try stmt syntax: cannot mix except and finally clauses on 1 try
17012- New module 'os' supplants modules 'mac' and 'posix' for most cases;
17013 module 'path' is replaced by 'os.path'
17014- os.path.split() return value differs from that of old path.split()
17015- sys.exc_type, sys.exc_value, sys.exc_traceback are set to the exception
17016 currently being handled
17017- sys.last_type, sys.last_value, sys.last_traceback remember last unhandled
17018 exception
17019- New function string.expandtabs() expands tabs in a string
17020- Added times() interface to posix (user & sys time of process & children)
17021- Added uname() interface to posix (returns OS type, hostname, etc.)
17022- New built-in function execfile() is like exec() but from a file
17023- Functions exec() and eval() are less picky about whitespace/newlines
17024- New built-in functions getattr() and setattr() access arbitrary attributes
17025- More generic argument handling in built-in functions (see "./EXTENDING")
17026- Dynamic loading of modules written in C or C++ (see "./DYNLOAD")
17027- Division and modulo for long and plain integers with negative operands
17028 have changed; a/b is now floor(float(a)/float(b)) and a%b is defined
17029 as a-(a/b)*b. So now the outcome of divmod(a,b) is the same as
17030 (a/b, a%b) for integers. For floats, % is also changed, but of course
17031 / is unchanged, and divmod(x,y) does not yield (x/y, x%y)...
17032- A function with explicit variable-length argument list can be declared
17033 like this: def f(*args): ...; or even like this: def f(a, b, *rest): ...
17034- Code tracing and profiling features have been added, and two source
17035 code debuggers are provided in the library (pdb.py, tty-oriented,
17036 and wdb, window-oriented); you can now step through Python programs!
17037 See sys.settrace() and sys.setprofile(), and "../lib/pdb.doc"
17038- '==' is now the only equality operator; "../demo/scripts/eqfix.py" is
17039 a script that fixes old Python modules
17040- Plain integer right shift now uses sign extension
17041- Long integer shift/mask operations now simulate 2's complement
17042 to give more useful results for negative operands
17043- Changed/added range checks for long/plain integer shifts
17044- Options found after "-c command" are now passed to the command in sys.argv
17045 (note subtle incompatiblity with "python -c command -- -options"!)
17046- Module stdwin is better protected against touching objects after they've
17047 been closed; menus can now also be closed explicitly
17048- Stdwin now uses its own exception (stdwin.error)
17049
17050New features in 0.9.5 (released as Macintosh application only, 2 Jan 1992):
17051- dictionary objects can now be compared properly; e.g., {}=={} is true
17052- new exception SystemExit causes termination if not caught;
17053 it is raised by sys.exit() so that 'finally' clauses can clean up,
17054 and it may even be caught. It does work interactively!
17055- new module "regex" implements GNU Emacs style regular expressions;
17056 module "regexp" is rewritten in Python for backward compatibility
17057- formal parameter lists may contain trailing commas
17058
17059Bugs fixed in 0.9.6:
17060- assigning to or deleting a list item with a negative index dumped core
17061- divmod(-10L,5L) returned (-3L, 5L) instead of (-2L, 0L)
17062
17063Bugs fixed in 0.9.5:
17064- masking operations involving negative long integers gave wrong results
17065
17066
17067===================================
Guido van Rossumf2eac992000-09-04 17:24:24 +000017068==> Release 0.9.4 (24 Dec 1991) <==
Guido van Rossuma7925f11994-01-26 10:20:16 +000017069===================================
17070
17071- new function argument handling (see below)
17072- built-in apply(func, args) means func(args[0], args[1], ...)
17073- new, more refined exceptions
17074- new exception string values (NameError = 'NameError' etc.)
17075- better checking for math exceptions
17076- for sequences (string/tuple/list), x[-i] is now equivalent to x[len(x)-i]
17077- fixed list assignment bug: "a[1:1] = a" now works correctly
17078- new class syntax, without extraneous parentheses
17079- new 'global' statement to assign global variables from within a function
17080
17081
17082New class syntax
17083----------------
17084
17085You can now declare a base class as follows:
17086
17087 class B: # Was: class B():
17088 def some_method(self): ...
17089 ...
17090
17091and a derived class thusly:
17092
17093 class D(B): # Was: class D() = B():
17094 def another_method(self, arg): ...
17095
17096Multiple inheritance looks like this:
17097
17098 class M(B, D): # Was: class M() = B(), D():
17099 def this_or_that_method(self, arg): ...
17100
17101The old syntax is still accepted by Python 0.9.4, but will disappear
17102in Python 1.0 (to be posted to comp.sources).
17103
17104
17105New 'global' statement
17106----------------------
17107
17108Every now and then you have a global variable in a module that you
17109want to change from within a function in that module -- say, a count
17110of calls to a function, or an option flag, etc. Until now this was
17111not directly possible. While several kludges are known that
17112circumvent the problem, and often the need for a global variable can
17113be avoided by rewriting the module as a class, this does not always
17114lead to clearer code.
17115
17116The 'global' statement solves this dilemma. Its occurrence in a
17117function body means that, for the duration of that function, the
17118names listed there refer to global variables. For instance:
17119
17120 total = 0.0
17121 count = 0
17122
17123 def add_to_total(amount):
17124 global total, count
17125 total = total + amount
17126 count = count + 1
17127
17128'global' must be repeated in each function where it is needed. The
17129names listed in a 'global' statement must not be used in the function
17130before the statement is reached.
17131
17132Remember that you don't need to use 'global' if you only want to *use*
17133a global variable in a function; nor do you need ot for assignments to
17134parts of global variables (e.g., list or dictionary items or
17135attributes of class instances). This has not changed; in fact
17136assignment to part of a global variable was the standard workaround.
17137
17138
17139New exceptions
17140--------------
17141
17142Several new exceptions have been defined, to distinguish more clearly
17143between different types of errors.
17144
17145name meaning was
17146
17147AttributeError reference to non-existing attribute NameError
17148IOError unexpected I/O error RuntimeError
17149ImportError import of non-existing module or name NameError
17150IndexError invalid string, tuple or list index RuntimeError
17151KeyError key not in dictionary RuntimeError
17152OverflowError numeric overflow RuntimeError
17153SyntaxError invalid syntax RuntimeError
17154ValueError invalid argument value RuntimeError
17155ZeroDivisionError division by zero RuntimeError
17156
17157The string value of each exception is now its name -- this makes it
17158easier to experimentally find out which operations raise which
17159exceptions; e.g.:
17160
17161 >>> KeyboardInterrupt
17162 'KeyboardInterrupt'
17163 >>>
17164
17165
17166New argument passing semantics
17167------------------------------
17168
17169Off-line discussions with Steve Majewski and Daniel LaLiberte have
17170convinced me that Python's parameter mechanism could be changed in a
17171way that made both of them happy (I hope), kept me happy, fixed a
17172number of outstanding problems, and, given some backward compatibility
17173provisions, would only break a very small amount of existing code --
17174probably all mine anyway. In fact I suspect that most Python users
17175will hardly notice the difference. And yet it has cost me at least
17176one sleepless night to decide to make the change...
17177
17178Philosophically, the change is quite radical (to me, anyway): a
17179function is no longer called with either zero or one argument, which
17180is a tuple if there appear to be more arguments. Every function now
17181has an argument list containing 0, 1 or more arguments. This list is
17182always implemented as a tuple, and it is a (run-time) error if a
17183function is called with a different number of arguments than expected.
17184
17185What's the difference? you may ask. The answer is, very little unless
17186you want to write variadic functions -- functions that may be called
17187with a variable number of arguments. Formerly, you could write a
17188function that accepted one or more arguments with little trouble, but
17189writing a function that could be called with either 0 or 1 argument
17190(or more) was next to impossible. This is now a piece of cake: you
17191can simply declare an argument that receives the entire argument
17192tuple, and check its length -- it will be of size 0 if there are no
17193arguments.
17194
17195Another anomaly of the old system was the way multi-argument methods
17196(in classes) had to be declared, e.g.:
17197
17198 class Point():
17199 def init(self, (x, y, color)): ...
17200 def setcolor(self, color): ...
17201 dev moveto(self, (x, y)): ...
17202 def draw(self): ...
17203
17204Using the new scheme there is no need to enclose the method arguments
17205in an extra set of parentheses, so the above class could become:
17206
17207 class Point:
17208 def init(self, x, y, color): ...
17209 def setcolor(self, color): ...
17210 dev moveto(self, x, y): ...
17211 def draw(self): ...
17212
17213That is, the equivalence rule between methods and functions has
17214changed so that now p.moveto(x,y) is equivalent to Point.moveto(p,x,y)
17215while formerly it was equivalent to Point.moveto(p,(x,y)).
17216
17217A special backward compatibility rule makes that the old version also
17218still works: whenever a function with exactly two arguments (at the top
17219level) is called with more than two arguments, the second and further
17220arguments are packed into a tuple and passed as the second argument.
17221This rule is invoked independently of whether the function is actually a
17222method, so there is a slight chance that some erroneous calls of
17223functions expecting two arguments with more than that number of
17224arguments go undetected at first -- when the function tries to use the
17225second argument it may find it is a tuple instead of what was expected.
17226Note that this rule will be removed from future versions of the
17227language; it is a backward compatibility provision *only*.
17228
17229Two other rules and a new built-in function handle conversion between
17230tuples and argument lists:
17231
17232Rule (a): when a function with more than one argument is called with a
17233single argument that is a tuple of the right size, the tuple's items
17234are used as arguments.
17235
17236Rule (b): when a function with exactly one argument receives no
17237arguments or more than one, that one argument will receive a tuple
17238containing the arguments (the tuple will be empty if there were no
17239arguments).
17240
17241
17242A new built-in function, apply(), was added to support functions that
17243need to call other functions with a constructed argument list. The call
17244
17245 apply(function, tuple)
17246
17247is equivalent to
17248
17249 function(tuple[0], tuple[1], ..., tuple[len(tuple)-1])
17250
17251
17252While no new argument syntax was added in this phase, it would now be
17253quite sensible to add explicit syntax to Python for default argument
17254values (as in C++ or Modula-3), or a "rest" argument to receive the
17255remaining arguments of a variable-length argument list.
17256
17257
17258========================================================
17259==> Release 0.9.3 (never made available outside CWI) <==
17260========================================================
17261
17262- string sys.version shows current version (also printed on interactive entry)
17263- more detailed exceptions, e.g., IOError, ZeroDivisionError, etc.
17264- 'global' statement to declare module-global variables assigned in functions.
17265- new class declaration syntax: class C(Base1, Base2, ...): suite
17266 (the old syntax is still accepted -- be sure to convert your classes now!)
17267- C shifting and masking operators: << >> ~ & ^ | (for ints and longs).
17268- C comparison operators: == != (the old = and <> remain valid).
17269- floating point numbers may now start with a period (e.g., .14).
17270- definition of integer division tightened (always truncates towards zero).
17271- new builtins hex(x), oct(x) return hex/octal string from (long) integer.
17272- new list method l.count(x) returns the number of occurrences of x in l.
17273- new SGI module: al (Indigo and 4D/35 audio library).
17274- the FORMS interface (modules fl and FL) now uses FORMS 2.0
17275- module gl: added lrect{read,write}, rectzoom and pixmode;
17276 added (non-GL) functions (un)packrect.
17277- new socket method: s.allowbroadcast(flag).
17278- many objects support __dict__, __methods__ or __members__.
17279- dir() lists anything that has __dict__.
17280- class attributes are no longer read-only.
17281- classes support __bases__, instances support __class__ (and __dict__).
17282- divmod() now also works for floats.
17283- fixed obscure bug in eval('1 ').
17284
17285
17286===================================
17287==> Release 0.9.2 (Autumn 1991) <==
17288===================================
17289
17290Highlights
17291----------
17292
17293- tutorial now (almost) complete; library reference reorganized
17294- new syntax: continue statement; semicolons; dictionary constructors;
17295 restrictions on blank lines in source files removed
17296- dramatically improved module load time through precompiled modules
17297- arbitrary precision integers: compute 2 to the power 1000 and more...
17298- arithmetic operators now accept mixed type operands, e.g., 3.14/4
17299- more operations on list: remove, index, reverse; repetition
17300- improved/new file operations: readlines, seek, tell, flush, ...
17301- process management added to the posix module: fork/exec/wait/kill etc.
17302- BSD socket operations (with example servers and clients!)
17303- many new STDWIN features (color, fonts, polygons, ...)
17304- new SGI modules: font manager and FORMS library interface
17305
17306
17307Extended list of changes in 0.9.2
17308---------------------------------
17309
17310Here is a summary of the most important user-visible changes in 0.9.2,
17311in somewhat arbitrary order. Changes in later versions are listed in
17312the "highlights" section above.
17313
17314
173151. Changes to the interpreter proper
17316
17317- Simple statements can now be separated by semicolons.
17318 If you write "if t: s1; s2", both s1 and s2 are executed
17319 conditionally.
17320- The 'continue' statement was added, with semantics as in C.
17321- Dictionary displays are now allowed on input: {key: value, ...}.
17322- Blank lines and lines bearing only a comment no longer need to
17323 be indented properly. (A completely empty line still ends a multi-
17324 line statement interactively.)
17325- Mixed arithmetic is supported, 1 compares equal to 1.0, etc.
17326- Option "-c command" to execute statements from the command line
17327- Compiled versions of modules are cached in ".pyc" files, giving a
17328 dramatic improvement of start-up time
17329- Other, smaller speed improvements, e.g., extracting characters from
17330 strings, looking up single-character keys, and looking up global
17331 variables
17332- Interrupting a print operation raises KeyboardInterrupt instead of
17333 only cancelling the print operation
17334- Fixed various portability problems (it now passes gcc with only
17335 warnings -- more Standard C compatibility will be provided in later
17336 versions)
17337- Source is prepared for porting to MS-DOS
17338- Numeric constants are now checked for overflow (this requires
17339 standard-conforming strtol() and strtod() functions; a correct
17340 strtol() implementation is provided, but the strtod() provided
17341 relies on atof() for everything, including error checking
17342
17343
173442. Changes to the built-in types, functions and modules
17345
17346- New module socket: interface to BSD socket primitives
17347- New modules pwd and grp: access the UNIX password and group databases
17348- (SGI only:) New module "fm" interfaces to the SGI IRIX Font Manager
17349- (SGI only:) New module "fl" interfaces to Mark Overmars' FORMS library
17350- New numeric type: long integer, for unlimited precision
17351 - integer constants suffixed with 'L' or 'l' are long integers
17352 - new built-in function long(x) converts int or float to long
17353 - int() and float() now also convert from long integers
17354- New built-in function:
17355 - pow(x, y) returns x to the power y
17356- New operation and methods for lists:
17357 - l*n returns a new list consisting of n concatenated copies of l
17358 - l.remove(x) removes the first occurrence of the value x from l
17359 - l.index(x) returns the index of the first occurrence of x in l
17360 - l.reverse() reverses l in place
17361- New operation for tuples:
17362 - t*n returns a tuple consisting of n concatenated copies of t
17363- Improved file handling:
17364 - f.readline() no longer restricts the line length, is faster,
17365 and isn't confused by null bytes; same for raw_input()
17366 - f.read() without arguments reads the entire (rest of the) file
17367 - mixing of print and sys.stdout.write() has different effect
17368- New methods for files:
17369 - f.readlines() returns a list containing the lines of the file,
17370 as read with f.readline()
17371 - f.flush(), f.tell(), f.seek() call their stdio counterparts
17372 - f.isatty() tests for "tty-ness"
17373- New posix functions:
17374 - _exit(), exec(), fork(), getpid(), getppid(), kill(), wait()
17375 - popen() returns a file object connected to a pipe
17376 - utime() replaces utimes() (the latter is not a POSIX name)
17377- New stdwin features, including:
17378 - font handling
17379 - color drawing
17380 - scroll bars made optional
17381 - polygons
17382 - filled and xor shapes
17383 - text editing objects now have a 'settext' method
17384
17385
173863. Changes to the standard library
17387
17388- Name change: the functions path.cat and macpath.cat are now called
17389 path.join and macpath.join
17390- Added new modules: formatter, mutex, persist, sched, mainloop
17391- Added some modules and functionality to the "widget set" (which is
17392 still under development, so please bear with me):
17393 DirList, FormSplit, TextEdit, WindowSched
17394- Fixed module testall to work non-interactively
17395- Module string:
17396 - added functions join() and joinfields()
17397 - fixed center() to work correct and make it "transitive"
17398- Obsolete modules were removed: util, minmax
17399- Some modules were moved to the demo directory
17400
17401
174024. Changes to the demonstration programs
17403
17404- Added new useful scipts: byteyears, eptags, fact, from, lfact,
17405 objgraph, pdeps, pi, primes, ptags, which
17406- Added a bunch of socket demos
17407- Doubled the speed of ptags
17408- Added new stdwin demos: microedit, miniedit
17409- Added a windowing interface to the Python interpreter: python (most
17410 useful on the Mac)
17411- Added a browser for Emacs info files: demo/stdwin/ibrowse
17412 (yes, I plan to put all STDWIN and Python documentation in texinfo
17413 form in the future)
17414
17415
174165. Other changes to the distribution
17417
17418- An Emacs Lisp file "python.el" is provided to facilitate editing
17419 Python programs in GNU Emacs (slightly improved since posted to
17420 gnu.emacs.sources)
17421- Some info on writing an extension in C is provided
17422- Some info on building Python on non-UNIX platforms is provided
17423
17424
17425=====================================
17426==> Release 0.9.1 (February 1991) <==
17427=====================================
17428
17429- Micro changes only
17430- Added file "patchlevel.h"
17431
17432
17433=====================================
17434==> Release 0.9.0 (February 1991) <==
17435=====================================
17436
17437Original posting to alt.sources.