1Python History 2-------------- 3 4This file contains the release messages for previous Python releases. 5As you read on you go back to the dark ages of Python's history. 6(Note: news about 2.5c2 and later 2.5 releases is in the Misc/NEWS 7file of the release25-maint branch.) 8 9 10====================================================================== 11 12 13What'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 an 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 built in. 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 built-in 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 an 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 builtins 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 iterating 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 output (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 built in 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 2150What'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 appropriate 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 2545- Patch 1012740: truncate() on a writeable cStringIO now resets the 2546 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 ignoring 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 built-in 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 a 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() built-in 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 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 built-in types, set() and frozenset(). 3167 3168- Added a reversed() built-in function that returns a reverse iterator 3169 over a sequence. 3170 3171- Added a sorted() built-in 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 built-in 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 referring 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 built-in 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 built-in 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 built-in 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 an 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 4753- the platform dependent path related variables sep, altsep, extsep, 4754 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 built-in 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 built-in 5019 module to assure that at least the built-in 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 have 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 built-in 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 built-in 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 built-in 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 built-in 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 specifying 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 built-in 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 built-in 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 built-in 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 6338- os.extsep -- a new variable needed by the RISCOS support. It is the 6339 separator used by extensions, and is '.' on all platforms except 6340 RISCOS, where it is '/'. There is no need to use this variable 6341 unless you have a masochistic desire to port your code to RISCOS. 6342 6343- mimetypes.py has optional support for non-standard, but commonly 6344 found types. guess_type() and guess_extension() now accept an 6345 optional 'strict' flag, defaulting to true, which controls whether 6346 recognize non-standard types or not. A few non-standard types we 6347 know about have been added. Also, when run as a script, there are 6348 new -l and -e options. 6349 6350- statcache is now deprecated. 6351 6352- email.Utils.formatdate() now produces the preferred RFC 2822 style 6353 dates with numeric timezones (it used to produce obsolete dates 6354 hard coded to "GMT" timezone). An optional 'localtime' flag is 6355 added to produce dates in the local timezone, with daylight savings 6356 time properly taken into account. 6357 6358- In pickle and cPickle, instead of masking errors in load() by 6359 transforming them into SystemError, we let the original exception 6360 propagate out. Also, implement support for __safe_for_unpickling__ 6361 in pickle, as it already was supported in cPickle. 6362 6363Tools/Demos 6364----------- 6365 6366Build 6367----- 6368 6369- The dbm module is built using libdb1 if available. The bsddb module 6370 is built with libdb3 if available. 6371 6372- Misc/Makefile.pre.in has been removed by BDFL pronouncement. 6373 6374C API 6375----- 6376 6377- New function PySequence_Fast_GET_SIZE() returns the size of a non- 6378 NULL result from PySequence_Fast(), more quickly than calling 6379 PySequence_Size(). 6380 6381- New argument unpacking function PyArg_UnpackTuple() added. 6382 6383- New functions PyObject_CallFunctionObjArgs() and 6384 PyObject_CallMethodObjArgs() have been added to make it more 6385 convenient and efficient to call functions and methods from C. 6386 6387- PyArg_ParseTupleAndKeywords() no longer masks errors, so it's 6388 possible that this will propagate errors it didn't before. 6389 6390- New function PyObject_CheckReadBuffer(), which returns true if its 6391 argument supports the single-segment readable buffer interface. 6392 6393New platforms 6394------------- 6395 6396- We've finally confirmed that this release builds on HP-UX 11.00, 6397 *with* threads, and passes the test suite. 6398 6399- Thanks to a series of patches from Michael Muller, Python may build 6400 again under OS/2 Visual Age C++. 6401 6402- Updated RISCOS port by Dietmar Schwertberger. 6403 6404Tests 6405----- 6406 6407- Added a test script for the curses module. It isn't run automatically; 6408 regrtest.py must be run with '-u curses' to enable it. 6409 6410Windows 6411------- 6412 6413Mac 6414---- 6415 6416- PythonScript has been moved to unsupported and is slated to be 6417 removed completely in the next release. 6418 6419- It should now be possible to build applets that work on both OS9 and 6420 OSX. 6421 6422- The core is now linked with CoreServices not Carbon; as a side 6423 result, default 8bit encoding on OSX is now ASCII. 6424 6425- Python should now build on OSX 10.1.1 6426 6427 6428What's New in Python 2.2b1? 6429=========================== 6430 6431*Release date: 19-Oct-2001* 6432 6433Type/class unification and new-style classes 6434-------------------------------------------- 6435 6436- New-style classes are now always dynamic (except for built-in and 6437 extension types). There is no longer a performance penalty, and I 6438 no longer see another reason to keep this baggage around. One relic 6439 remains: the __dict__ of a new-style class is a read-only proxy; you 6440 must set the class's attribute to modify it. As a consequence, the 6441 __defined__ attribute of new-style types no longer exists, for lack 6442 of need: there is once again only one __dict__ (although in the 6443 future a __cache__ may be resurrected with a similar function, if I 6444 can prove that it actually speeds things up). 6445 6446- C.__doc__ now works as expected for new-style classes (in 2.2a4 it 6447 always returned None, even when there was a class docstring). 6448 6449- doctest now finds and runs docstrings attached to new-style classes, 6450 class methods, static methods, and properties. 6451 6452Core and builtins 6453----------------- 6454 6455- A very subtle syntactical pitfall in list comprehensions was fixed. 6456 For example: [a+b for a in 'abc', for b in 'def']. The comma in 6457 this example is a mistake. Previously, this would silently let 'a' 6458 iterate over the singleton tuple ('abc',), yielding ['abcd', 'abce', 6459 'abcf'] rather than the intended ['ad', 'ae', 'af', 'bd', 'be', 6460 'bf', 'cd', 'ce', 'cf']. Now, this is flagged as a syntax error. 6461 Note that [a for a in <singleton>] is a convoluted way to say 6462 [<singleton>] anyway, so it's not like any expressiveness is lost. 6463 6464- getattr(obj, name, default) now only catches AttributeError, as 6465 documented, rather than returning the default value for all 6466 exceptions (which could mask bugs in a __getattr__ hook, for 6467 example). 6468 6469- Weak reference objects are now part of the core and offer a C API. 6470 A bug which could allow a core dump when binary operations involved 6471 proxy reference has been fixed. weakref.ReferenceError is now a 6472 built-in exception. 6473 6474- unicode(obj) now behaves more like str(obj), accepting arbitrary 6475 objects, and calling a __unicode__ method if it exists. 6476 unicode(obj, encoding) and unicode(obj, encoding, errors) still 6477 require an 8-bit string or character buffer argument. 6478 6479- isinstance() now allows any object as the first argument and a 6480 class, a type or something with a __bases__ tuple attribute for the 6481 second argument. The second argument may also be a tuple of a 6482 class, type, or something with __bases__, in which case isinstance() 6483 will return true if the first argument is an instance of any of the 6484 things contained in the second argument tuple. E.g. 6485 6486 isinstance(x, (A, B)) 6487 6488 returns true if x is an instance of A or B. 6489 6490Extension modules 6491----------------- 6492 6493- thread.start_new_thread() now returns the thread ID (previously None). 6494 6495- binascii has now two quopri support functions, a2b_qp and b2a_qp. 6496 6497- readline now supports setting the startup_hook and the 6498 pre_event_hook, and adds the add_history() function. 6499 6500- os and posix supports chroot(), setgroups() and unsetenv() where 6501 available. The stat(), fstat(), statvfs() and fstatvfs() functions 6502 now return "pseudo-sequences" -- the various fields can now be 6503 accessed as attributes (e.g. os.stat("/").st_mtime) but for 6504 backwards compatibility they also behave as a fixed-length sequence. 6505 Some platform-specific fields (e.g. st_rdev) are only accessible as 6506 attributes. 6507 6508- time: localtime(), gmtime() and strptime() now return a 6509 pseudo-sequence similar to the os.stat() return value, with 6510 attributes like tm_year etc. 6511 6512- Decompression objects in the zlib module now accept an optional 6513 second parameter to decompress() that specifies the maximum amount 6514 of memory to use for the uncompressed data. 6515 6516- optional SSL support in the socket module now exports OpenSSL 6517 functions RAND_add(), RAND_egd(), and RAND_status(). These calls 6518 are useful on platforms like Solaris where OpenSSL does not 6519 automatically seed its PRNG. Also, the keyfile and certfile 6520 arguments to socket.ssl() are now optional. 6521 6522- posixmodule (and by extension, the os module on POSIX platforms) now 6523 exports O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW. 6524 6525Library 6526------- 6527 6528- doctest now excludes functions and classes not defined by the module 6529 being tested, thanks to Tim Hochberg. 6530 6531- HotShot, a new profiler implemented using a C-based callback, has 6532 been added. This substantially reduces the overhead of profiling, 6533 but it is still quite preliminary. Support modules and 6534 documentation will be added in upcoming releases (before 2.2 final). 6535 6536- profile now produces correct output in situations where an exception 6537 raised in Python is cleared by C code (e.g. hasattr()). This used 6538 to cause wrong output, including spurious claims of recursive 6539 functions and attribution of time spent to the wrong function. 6540 6541 The code and documentation for the derived OldProfile and HotProfile 6542 profiling classes was removed. The code hasn't worked for years (if 6543 you tried to use them, they raised exceptions). OldProfile 6544 intended to reproduce the behavior of the profiler Python used more 6545 than 7 years ago, and isn't interesting anymore. HotProfile intended 6546 to provide a faster profiler (but producing less information), and 6547 that's a worthy goal we intend to meet via a different approach (but 6548 without losing information). 6549 6550- Profile.calibrate() has a new implementation that should deliver 6551 a much better system-specific calibration constant. The constant can 6552 now be specified in an instance constructor, or as a Profile class or 6553 instance variable, instead of by editing profile.py's source code. 6554 Calibration must still be done manually (see the docs for the profile 6555 module). 6556 6557 Note that Profile.calibrate() must be overridden by subclasses. 6558 Improving the accuracy required exploiting detailed knowledge of 6559 profiler internals; the earlier method abstracted away the details 6560 and measured a simplified model instead, but consequently computed 6561 a constant too small by a factor of 2 on some modern machines. 6562 6563- quopri's encode and decode methods take an optional header parameter, 6564 which indicates whether output is intended for the header 'Q' 6565 encoding. 6566 6567- The SocketServer.ThreadingMixIn class now closes the request after 6568 finish_request() returns. (Not when it errors out though.) 6569 6570- The nntplib module's NNTP.body() method has grown a 'file' argument 6571 to allow saving the message body to a file. 6572 6573- The email package has added a class email.Parser.HeaderParser which 6574 only parses headers and does not recurse into the message's body. 6575 Also, the module/class MIMEAudio has been added for representing 6576 audio data (contributed by Anthony Baxter). 6577 6578- ftplib should be able to handle files > 2GB. 6579 6580- ConfigParser.getboolean() now also interprets TRUE, FALSE, YES, NO, 6581 ON, and OFF. 6582 6583- xml.dom.minidom NodeList objects now support the length attribute 6584 and item() method as required by the DOM specifications. 6585 6586Tools/Demos 6587----------- 6588 6589- Demo/dns was removed. It no longer serves any purpose; a package 6590 derived from it is now maintained by Anthony Baxter, see 6591 http://PyDNS.SourceForge.net. 6592 6593- The freeze tool has been made more robust, and two new options have 6594 been added: -X and -E. 6595 6596Build 6597----- 6598 6599- configure will use CXX in LINKCC if CXX is used to build main() and 6600 the system requires to link a C++ main using the C++ compiler. 6601 6602C API 6603----- 6604 6605- The documentation for the tp_compare slot is updated to require that 6606 the return value must be -1, 0, 1; an arbitrary number <0 or >0 is 6607 not correct. This is not yet enforced but will be enforced in 6608 Python 2.3; even later, we may use -2 to indicate errors and +2 for 6609 "NotImplemented". Right now, -1 should be used for an error return. 6610 6611- PyLong_AsLongLong() now accepts int (as well as long) arguments. 6612 Consequently, PyArg_ParseTuple's 'L' code also accepts int (as well 6613 as long) arguments. 6614 6615- PyThread_start_new_thread() now returns a long int giving the thread 6616 ID, if one can be calculated; it returns -1 for error, 0 if no 6617 thread ID is calculated (this is an incompatible change, but only 6618 the thread module used this API). This code has only really been 6619 tested on Linux and Windows; other platforms please beware (and 6620 report any bugs or strange behavior). 6621 6622- PyUnicode_FromEncodedObject() no longer accepts Unicode objects as 6623 input. 6624 6625New platforms 6626------------- 6627 6628Tests 6629----- 6630 6631Windows 6632------- 6633 6634- Installer: If you install IDLE, and don't disable file-extension 6635 registration, a new "Edit with IDLE" context (right-click) menu entry 6636 is created for .py and .pyw files. 6637 6638- The signal module now supports SIGBREAK on Windows, thanks to Steven 6639 Scott. Note that SIGBREAK is unique to Windows. The default SIGBREAK 6640 action remains to call Win32 ExitProcess(). This can be changed via 6641 signal.signal(). For example:: 6642 6643 # Make Ctrl+Break raise KeyboardInterrupt, like Python's default Ctrl+C 6644 # (SIGINT) behavior. 6645 import signal 6646 signal.signal(signal.SIGBREAK, signal.default_int_handler) 6647 6648 try: 6649 while 1: 6650 pass 6651 except KeyboardInterrupt: 6652 # We get here on Ctrl+C or Ctrl+Break now; if we had not changed 6653 # SIGBREAK, only on Ctrl+C (and Ctrl+Break would terminate the 6654 # program without the possibility for any Python-level cleanup). 6655 print "Clean exit" 6656 6657 6658What's New in Python 2.2a4? 6659=========================== 6660 6661*Release date: 28-Sep-2001* 6662 6663Type/class unification and new-style classes 6664-------------------------------------------- 6665 6666- pydoc and inspect are now aware of new-style classes; 6667 e.g. help(list) at the interactive prompt now shows proper 6668 documentation for all operations on list objects. 6669 6670- Applications using Jim Fulton's ExtensionClass module can now safely 6671 be used with Python 2.2. In particular, Zope 2.4.1 now works with 6672 Python 2.2 (as well as with Python 2.1.1). The Demo/metaclass 6673 examples also work again. It is hoped that Gtk and Boost also work 6674 with 2.2a4 and beyond. (If you can confirm this, please write 6675 webmaster@python.org; if there are still problems, please open a bug 6676 report on SourceForge.) 6677 6678- property() now takes 4 keyword arguments: fget, fset, fdel and doc. 6679 These map to read-only attributes 'fget', 'fset', 'fdel', and '__doc__' 6680 in the constructed property object. fget, fset and fdel weren't 6681 discoverable from Python in 2.2a3. __doc__ is new, and allows 6682 associating a docstring with a property. 6683 6684- Comparison overloading is now more completely implemented. For 6685 example, a str subclass instance can properly be compared to a str 6686 instance, and it can properly overload comparison. Ditto for most 6687 other built-in object types. 6688 6689- The repr() of new-style classes has changed; instead of <type 6690 'M.Foo'> a new-style class is now rendered as <class 'M.Foo'>, 6691 *except* for built-in types, which are still rendered as <type 6692 'Foo'> (to avoid upsetting existing code that might parse or 6693 otherwise rely on repr() of certain type objects). 6694 6695- The repr() of new-style objects is now always <Foo object at XXX>; 6696 previously, it was sometimes <Foo instance at XXX>. 6697 6698- For new-style classes, what was previously called __getattr__ is now 6699 called __getattribute__. This method, if defined, is called for 6700 *every* attribute access. A new __getattr__ hook more similar to the 6701 one in classic classes is defined which is called only if regular 6702 attribute access raises AttributeError; to catch *all* attribute 6703 access, you can use __getattribute__ (for new-style classes). If 6704 both are defined, __getattribute__ is called first, and if it raises 6705 AttributeError, __getattr__ is called. 6706 6707- The __class__ attribute of new-style objects can be assigned to. 6708 The new class must have the same C-level object layout as the old 6709 class. 6710 6711- The built-in file type can be subclassed now. In the usual pattern, 6712 "file" is the name of the built-in type, and file() is a new built-in 6713 constructor, with the same signature as the built-in open() function. 6714 file() is now the preferred way to open a file. 6715 6716- Previously, __new__ would only see sequential arguments passed to 6717 the type in a constructor call; __init__ would see both sequential 6718 and keyword arguments. This made no sense whatsoever any more, so 6719 now both __new__ and __init__ see all arguments. 6720 6721- Previously, hash() applied to an instance of a subclass of str or 6722 unicode always returned 0. This has been repaired. 6723 6724- Previously, an operation on an instance of a subclass of an 6725 immutable type (int, long, float, complex, tuple, str, unicode), 6726 where the subtype didn't override the operation (and so the 6727 operation was handled by the built-in type), could return that 6728 instance instead a value of the base type. For example, if s was of 6729 a str subclass type, s[:] returned s as-is. Now it returns a str 6730 with the same value as s. 6731 6732- Provisional support for pickling new-style objects has been added. 6733 6734Core 6735---- 6736 6737- file.writelines() now accepts any iterable object producing strings. 6738 6739- PyUnicode_FromEncodedObject() now works very much like 6740 PyObject_Str(obj) in that it tries to use __str__/tp_str 6741 on the object if the object is not a string or buffer. This 6742 makes unicode() behave like str() when applied to non-string/buffer 6743 objects. 6744 6745- PyFile_WriteObject now passes Unicode objects to the file's write 6746 method. As a result, all file-like objects which may be the target 6747 of a print statement must support Unicode objects, i.e. they must 6748 at least convert them into ASCII strings. 6749 6750- Thread scheduling on Solaris should be improved; it is no longer 6751 necessary to insert a small sleep at the start of a thread in order 6752 to let other runnable threads be scheduled. 6753 6754Library 6755------- 6756 6757- StringIO.StringIO instances and cStringIO.StringIO instances support 6758 read character buffer compatible objects for their .write() methods. 6759 These objects are converted to strings and then handled as such 6760 by the instances. 6761 6762- The "email" package has been added. This is basically a port of the 6763 mimelib package <http://sf.net/projects/mimelib> with API changes 6764 and some implementations updated to use iterators and generators. 6765 6766- difflib.ndiff() and difflib.Differ.compare() are generators now. This 6767 restores the ability of Tools/scripts/ndiff.py to start producing output 6768 before the entire comparison is complete. 6769 6770- StringIO.StringIO instances and cStringIO.StringIO instances support 6771 iteration just like file objects (i.e. their .readline() method is 6772 called for each iteration until it returns an empty string). 6773 6774- The codecs module has grown four new helper APIs to access 6775 built-in codecs: getencoder(), getdecoder(), getreader(), 6776 getwriter(). 6777 6778- SimpleXMLRPCServer: a new module (based upon SimpleHTMLServer) 6779 simplifies writing XML RPC servers. 6780 6781- os.path.realpath(): a new function that returns the absolute pathname 6782 after interpretation of symbolic links. On non-Unix systems, this 6783 is an alias for os.path.abspath(). 6784 6785- operator.indexOf() (PySequence_Index() in the C API) now works with any 6786 iterable object. 6787 6788- smtplib now supports various authentication and security features of 6789 the SMTP protocol through the new login() and starttls() methods. 6790 6791- hmac: a new module implementing keyed hashing for message 6792 authentication. 6793 6794- mimetypes now recognizes more extensions and file types. At the 6795 same time, some mappings not sanctioned by IANA were removed. 6796 6797- The "compiler" package has been brought up to date to the state of 6798 Python 2.2 bytecode generation. It has also been promoted from a 6799 Tool to a standard library package. (Tools/compiler still exists as 6800 a sample driver.) 6801 6802Build 6803----- 6804 6805- Large file support (LFS) is now automatic when the platform supports 6806 it; no more manual configuration tweaks are needed. On Linux, at 6807 least, it's possible to have a system whose C library supports large 6808 files but whose kernel doesn't; in this case, large file support is 6809 still enabled but doesn't do you any good unless you upgrade your 6810 kernel or share your Python executable with another system whose 6811 kernel has large file support. 6812 6813- The configure script now supplies plausible defaults in a 6814 cross-compilation environment. This doesn't mean that the supplied 6815 values are always correct, or that cross-compilation now works 6816 flawlessly -- but it's a first step (and it shuts up most of 6817 autoconf's warnings about AC_TRY_RUN). 6818 6819- The Unix build is now a bit less chatty, courtesy of the parser 6820 generator. The build is completely silent (except for errors) when 6821 using "make -s", thanks to a -q option to setup.py. 6822 6823C API 6824----- 6825 6826- The "structmember" API now supports some new flag bits to deny read 6827 and/or write access to attributes in restricted execution mode. 6828 6829New platforms 6830------------- 6831 6832- Compaq's iPAQ handheld, running the "familiar" Linux distribution 6833 (http://familiar.handhelds.org). 6834 6835Tests 6836----- 6837 6838- The "classic" standard tests, which work by comparing stdout to 6839 an expected-output file under Lib/test/output/, no longer stop at 6840 the first mismatch. Instead the test is run to completion, and a 6841 variant of ndiff-style comparison is used to report all differences. 6842 This is much easier to understand than the previous style of reporting. 6843 6844- The unittest-based standard tests now use regrtest's test_main() 6845 convention, instead of running as a side-effect of merely being 6846 imported. This allows these tests to be run in more natural and 6847 flexible ways as unittests, outside the regrtest framework. 6848 6849- regrtest.py is much better integrated with unittest and doctest now, 6850 especially in regard to reporting errors. 6851 6852Windows 6853------- 6854 6855- Large file support now also works for files > 4GB, on filesystems 6856 that support it (NTFS under Windows 2000). See "What's New in 6857 Python 2.2a3" for more detail. 6858 6859 6860What's New in Python 2.2a3? 6861=========================== 6862 6863*Release Date: 07-Sep-2001* 6864 6865Core 6866---- 6867 6868- Conversion of long to float now raises OverflowError if the long is too 6869 big to represent as a C double. 6870 6871- The 3-argument builtin pow() no longer allows a third non-None argument 6872 if either of the first two arguments is a float, or if both are of 6873 integer types and the second argument is negative (in which latter case 6874 the arguments are converted to float, so this is really the same 6875 restriction). 6876 6877- The builtin dir() now returns more information, and sometimes much 6878 more, generally naming all attributes of an object, and all attributes 6879 reachable from the object via its class, and from its class's base 6880 classes, and so on from them too. Example: in 2.2a2, dir([]) returned 6881 an empty list. In 2.2a3, 6882 6883 >>> dir([]) 6884 ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', 6885 '__eq__', '__ge__', '__getattr__', '__getitem__', '__getslice__', 6886 '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__le__', 6887 '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__repr__', 6888 '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__', 6889 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 6890 'reverse', 'sort'] 6891 6892 dir(module) continues to return only the module's attributes, though. 6893 6894- Overflowing operations on plain ints now return a long int rather 6895 than raising OverflowError. This is a partial implementation of PEP 6896 237. You can use -Wdefault::OverflowWarning to enable a warning for 6897 this situation, and -Werror::OverflowWarning to revert to the old 6898 OverflowError exception. 6899 6900- A new command line option, -Q<arg>, is added to control run-time 6901 warnings for the use of classic division. (See PEP 238.) Possible 6902 values are -Qold, -Qwarn, -Qwarnall, and -Qnew. The default is 6903 -Qold, meaning the / operator has its classic meaning and no 6904 warnings are issued. Using -Qwarn issues a run-time warning about 6905 all uses of classic division for int and long arguments; -Qwarnall 6906 also warns about classic division for float and complex arguments 6907 (for use with fixdiv.py). 6908 [Note: the remainder of this item (preserved below) became 6909 obsolete in 2.2c1 -- -Qnew has global effect in 2.2] :: 6910 6911 Using -Qnew is questionable; it turns on new division by default, but 6912 only in the __main__ module. You can usefully combine -Qwarn or 6913 -Qwarnall and -Qnew: this gives the __main__ module new division, and 6914 warns about classic division everywhere else. 6915 6916- Many built-in types can now be subclassed. This applies to int, 6917 long, float, str, unicode, and tuple. (The types complex, list and 6918 dictionary can also be subclassed; this was introduced earlier.) 6919 Note that restrictions apply when subclassing immutable built-in 6920 types: you can only affect the value of the instance by overloading 6921 __new__. You can add mutable attributes, and the subclass instances 6922 will have a __dict__ attribute, but you cannot change the "value" 6923 (as implemented by the base class) of an immutable subclass instance 6924 once it is created. 6925 6926- The dictionary constructor now takes an optional argument, a 6927 mapping-like object, and initializes the dictionary from its 6928 (key, value) pairs. 6929 6930- A new built-in type, super, has been added. This facilitates making 6931 "cooperative super calls" in a multiple inheritance setting. For an 6932 explanation, see http://www.python.org/2.2/descrintro.html#cooperation 6933 6934- A new built-in type, property, has been added. This enables the 6935 creation of "properties". These are attributes implemented by 6936 getter and setter functions (or only one of these for read-only or 6937 write-only attributes), without the need to override __getattr__. 6938 See http://www.python.org/2.2/descrintro.html#property 6939 6940- The syntax of floating-point and imaginary literals has been 6941 liberalized, to allow leading zeroes. Examples of literals now 6942 legal that were SyntaxErrors before: 6943 6944 00.0 0e3 0100j 07.5 00000000000000000008. 6945 6946- An old tokenizer bug allowed floating point literals with an incomplete 6947 exponent, such as 1e and 3.1e-. Such literals now raise SyntaxError. 6948 6949Library 6950------- 6951 6952- telnetlib includes symbolic names for the options, and support for 6953 setting an option negotiation callback. It also supports processing 6954 of suboptions. 6955 6956- The new C standard no longer requires that math libraries set errno to 6957 ERANGE on overflow. For platform libraries that exploit this new 6958 freedom, Python's overflow-checking was wholly broken. A new overflow- 6959 checking scheme attempts to repair that, but may not be reliable on all 6960 platforms (C doesn't seem to provide anything both useful and portable 6961 in this area anymore). 6962 6963- Asynchronous timeout actions are available through the new class 6964 threading.Timer. 6965 6966- math.log and math.log10 now return sensible results for even huge 6967 long arguments. For example, math.log10(10 ** 10000) ~= 10000.0. 6968 6969- A new function, imp.lock_held(), returns 1 when the import lock is 6970 currently held. See the docs for the imp module. 6971 6972- pickle, cPickle and marshal on 32-bit platforms can now correctly read 6973 dumps containing ints written on platforms where Python ints are 8 bytes. 6974 When read on a box where Python ints are 4 bytes, such values are 6975 converted to Python longs. 6976 6977- In restricted execution mode (using the rexec module), unmarshalling 6978 code objects is no longer allowed. This plugs a security hole. 6979 6980- unittest.TestResult instances no longer store references to tracebacks 6981 generated by test failures. This prevents unexpected dangling references 6982 to objects that should be garbage collected between tests. 6983 6984Tools 6985----- 6986 6987- Tools/scripts/fixdiv.py has been added which can be used to fix 6988 division operators as per PEP 238. 6989 6990Build 6991----- 6992 6993- If you are an adventurous person using Mac OS X you may want to look at 6994 Mac/OSX. There is a Makefile there that will build Python as a real Mac 6995 application, which can be used for experimenting with Carbon or Cocoa. 6996 Discussion of this on pythonmac-sig, please. 6997 6998C API 6999----- 7000 7001- New function PyObject_Dir(obj), like Python __builtin__.dir(obj). 7002 7003- Note that PyLong_AsDouble can fail! This has always been true, but no 7004 callers checked for it. It's more likely to fail now, because overflow 7005 errors are properly detected now. The proper way to check:: 7006 7007 double x = PyLong_AsDouble(some_long_object); 7008 if (x == -1.0 && PyErr_Occurred()) { 7009 /* The conversion failed. */ 7010 } 7011 7012- The GC API has been changed. Extensions that use the old API will still 7013 compile but will not participate in GC. To upgrade an extension 7014 module: 7015 7016 - rename Py_TPFLAGS_GC to PyTPFLAGS_HAVE_GC 7017 7018 - use PyObject_GC_New or PyObject_GC_NewVar to allocate objects and 7019 PyObject_GC_Del to deallocate them 7020 7021 - rename PyObject_GC_Init to PyObject_GC_Track and PyObject_GC_Fini 7022 to PyObject_GC_UnTrack 7023 7024 - remove PyGC_HEAD_SIZE from object size calculations 7025 7026 - remove calls to PyObject_AS_GC and PyObject_FROM_GC 7027 7028- Two new functions: PyString_FromFormat() and PyString_FromFormatV(). 7029 These can be used safely to construct string objects from a 7030 sprintf-style format string (similar to the format string supported 7031 by PyErr_Format()). 7032 7033New platforms 7034------------- 7035 7036- Stephen Hansen contributed patches sufficient to get a clean compile 7037 under Borland C (Windows), but he reports problems running it and ran 7038 out of time to complete the port. Volunteers? Expect a MemoryError 7039 when importing the types module; this is probably shallow, and 7040 causing later failures too. 7041 7042Tests 7043----- 7044 7045Windows 7046------- 7047 7048- Large file support is now enabled on Win32 platforms as well as on 7049 Win64. This means that, for example, you can use f.tell() and f.seek() 7050 to manipulate files larger than 2 gigabytes (provided you have enough 7051 disk space, and are using a Windows filesystem that supports large 7052 partitions). Windows filesystem limits: FAT has a 2GB (gigabyte) 7053 filesize limit, and large file support makes no difference there. 7054 FAT32's limit is 4GB, and files >= 2GB are easier to use from Python now. 7055 NTFS has no practical limit on file size, and files of any size can be 7056 used from Python now. 7057 7058- The w9xpopen hack is now used on Windows NT and 2000 too when COMPSPEC 7059 points to command.com (patch from Brian Quinlan). 7060 7061 7062What's New in Python 2.2a2? 7063=========================== 7064 7065*Release Date: 22-Aug-2001* 7066 7067Build 7068----- 7069 7070- Tim Peters developed a brand new Windows installer using Wise 8.1, 7071 generously donated to us by Wise Solutions. 7072 7073- configure supports a new option --enable-unicode, with the values 7074 ucs2 and ucs4 (new in 2.2a1). With --disable-unicode, the Unicode 7075 type and supporting code is completely removed from the interpreter. 7076 7077- A new configure option --enable-framework builds a Mac OS X framework, 7078 which "make frameworkinstall" will install. This provides a starting 7079 point for more mac-like functionality, join pythonmac-sig@python.org 7080 if you are interested in helping. 7081 7082- The NeXT platform is no longer supported. 7083 7084- The 'new' module is now statically linked. 7085 7086Tools 7087----- 7088 7089- The new Tools/scripts/cleanfuture.py can be used to automatically 7090 edit out obsolete future statements from Python source code. See 7091 the module docstring for details. 7092 7093Tests 7094----- 7095 7096- regrtest.py now knows which tests are expected to be skipped on some 7097 platforms, allowing clearer test result output to be given. regrtest 7098 also has optional --use/-u switch to run normally disabled tests 7099 which require network access or consume significant disk resources. 7100 7101- Several new tests in the standard test suite, with special thanks to 7102 Nick Mathewson. 7103 7104Core 7105---- 7106 7107- The floor division operator // has been added as outlined in PEP 7108 238. The / operator still provides classic division (and will until 7109 Python 3.0) unless "from __future__ import division" is included, in 7110 which case the / operator will provide true division. The operator 7111 module provides truediv() and floordiv() functions. Augmented 7112 assignment variants are included, as are the equivalent overloadable 7113 methods and C API methods. See the PEP for a full discussion: 7114 <http://python.sf.net/peps/pep-0238.html> 7115 7116- Future statements are now effective in simulated interactive shells 7117 (like IDLE). This should "just work" by magic, but read Michael 7118 Hudson's "Future statements in simulated shells" PEP 264 for full 7119 details: <http://python.sf.net/peps/pep-0264.html>. 7120 7121- The type/class unification (PEP 252-253) was integrated into the 7122 trunk and is not so tentative any more (the exact specification of 7123 some features is still tentative). A lot of work has done on fixing 7124 bugs and adding robustness and features (performance still has to 7125 come a long way). 7126 7127- Warnings about a mismatch in the Python API during extension import 7128 now use the Python warning framework (which makes it possible to 7129 write filters for these warnings). 7130 7131- A function's __dict__ (aka func_dict) will now always be a 7132 dictionary. It used to be possible to delete it or set it to None, 7133 but now both actions raise TypeErrors. It is still legal to set it 7134 to a dictionary object. Getting func.__dict__ before any attributes 7135 have been assigned now returns an empty dictionary instead of None. 7136 7137- A new command line option, -E, was added which disables the use of 7138 all environment variables, or at least those that are specifically 7139 significant to Python. Usually those have a name starting with 7140 "PYTHON". This was used to fix a problem where the tests fail if 7141 the user happens to have PYTHONHOME or PYTHONPATH pointing to an 7142 older distribution. 7143 7144Library 7145------- 7146 7147- New class Differ and new functions ndiff() and restore() in difflib.py. 7148 These package the algorithms used by the popular Tools/scripts/ndiff.py, 7149 for programmatic reuse. 7150 7151- New function xml.sax.saxutils.quoteattr(): Quote an XML attribute 7152 value using the minimal quoting required for the value; more 7153 reliable than using xml.sax.saxutils.escape() for attribute values. 7154 7155- Readline completion support for cmd.Cmd was added. 7156 7157- Calling os.tempnam() or os.tmpnam() generate RuntimeWarnings. 7158 7159- Added function threading.BoundedSemaphore() 7160 7161- Added Ka-Ping Yee's cgitb.py module. 7162 7163- The 'new' module now exposes the CO_xxx flags. 7164 7165- The gc module offers the get_referents function. 7166 7167New platforms 7168------------- 7169 7170C API 7171----- 7172 7173- Two new APIs PyOS_snprintf() and PyOS_vsnprintf() were added 7174 which provide a cross-platform implementations for the 7175 relatively new snprintf()/vsnprintf() C lib APIs. In contrast to 7176 the standard sprintf() and vsprintf() C lib APIs, these versions 7177 apply bounds checking on the used buffer which enhances protection 7178 against buffer overruns. 7179 7180- Unicode APIs now use name mangling to assure that mixing interpreters 7181 and extensions using different Unicode widths is rendered next to 7182 impossible. Trying to import an incompatible Unicode-aware extension 7183 will result in an ImportError. Unicode extensions writers must make 7184 sure to check the Unicode width compatibility in their extensions by 7185 using at least one of the mangled Unicode APIs in the extension. 7186 7187- Two new flags METH_NOARGS and METH_O are available in method definition 7188 tables to simplify implementation of methods with no arguments and a 7189 single untyped argument. Calling such methods is more efficient than 7190 calling corresponding METH_VARARGS methods. METH_OLDARGS is now 7191 deprecated. 7192 7193Windows 7194------- 7195 7196- "import module" now compiles module.pyw if it exists and nothing else 7197 relevant is found. 7198 7199 7200What's New in Python 2.2a1? 7201=========================== 7202 7203*Release date: 18-Jul-2001* 7204 7205Core 7206---- 7207 7208- TENTATIVELY, a large amount of code implementing much of what's 7209 described in PEP 252 (Making Types Look More Like Classes) and PEP 7210 253 (Subtyping Built-in Types) was added. This will be released 7211 with Python 2.2a1. Documentation will be provided separately 7212 through http://www.python.org/2.2/. The purpose of releasing this 7213 with Python 2.2a1 is to test backwards compatibility. It is 7214 possible, though not likely, that a decision is made not to release 7215 this code as part of 2.2 final, if any serious backwards 7216 incompatibilities are found during alpha testing that cannot be 7217 repaired. 7218 7219- Generators were added; this is a new way to create an iterator (see 7220 below) using what looks like a simple function containing one or 7221 more 'yield' statements. See PEP 255. Since this adds a new 7222 keyword to the language, this feature must be enabled by including a 7223 future statement: "from __future__ import generators" (see PEP 236). 7224 Generators will become a standard feature in a future release 7225 (probably 2.3). Without this future statement, 'yield' remains an 7226 ordinary identifier, but a warning is issued each time it is used. 7227 (These warnings currently don't conform to the warnings framework of 7228 PEP 230; we intend to fix this in 2.2a2.) 7229 7230- The UTF-16 codec was modified to be more RFC compliant. It will now 7231 only remove BOM characters at the start of the string and then 7232 only if running in native mode (UTF-16-LE and -BE won't remove a 7233 leading BMO character). 7234 7235- Strings now have a new method .decode() to complement the already 7236 existing .encode() method. These two methods provide direct access 7237 to the corresponding decoders and encoders of the registered codecs. 7238 7239 To enhance the usability of the .encode() method, the special 7240 casing of Unicode object return values was dropped (Unicode objects 7241 were auto-magically converted to string using the default encoding). 7242 7243 Both methods will now return whatever the codec in charge of the 7244 requested encoding returns as object, e.g. Unicode codecs will 7245 return Unicode objects when decoding is requested ("äöü".decode("latin-1") 7246 will return u"äöü"). This enables codec writer to create codecs 7247 for various simple to use conversions. 7248 7249 New codecs were added to demonstrate these new features (the .encode() 7250 and .decode() columns indicate the type of the returned objects): 7251 7252 +---------+-----------+-----------+-----------------------------+ 7253 |Name | .encode() | .decode() | Description | 7254 +=========+===========+===========+=============================+ 7255 |uu | string | string | UU codec (e.g. for email) | 7256 +---------+-----------+-----------+-----------------------------+ 7257 |base64 | string | string | base64 codec | 7258 +---------+-----------+-----------+-----------------------------+ 7259 |quopri | string | string | quoted-printable codec | 7260 +---------+-----------+-----------+-----------------------------+ 7261 |zlib | string | string | zlib compression | 7262 +---------+-----------+-----------+-----------------------------+ 7263 |hex | string | string | 2-byte hex codec | 7264 +---------+-----------+-----------+-----------------------------+ 7265 |rot-13 | string | Unicode | ROT-13 Unicode charmap codec| 7266 +---------+-----------+-----------+-----------------------------+ 7267 7268- Some operating systems now support the concept of a default Unicode 7269 encoding for file system operations. Notably, Windows supports 'mbcs' 7270 as the default. The Macintosh will also adopt this concept in the medium 7271 term, although the default encoding for that platform will be other than 7272 'mbcs'. 7273 7274 On operating system that support non-ASCII filenames, it is common for 7275 functions that return filenames (such as os.listdir()) to return Python 7276 string objects pre-encoded using the default file system encoding for 7277 the platform. As this encoding is likely to be different from Python's 7278 default encoding, converting this name to a Unicode object before passing 7279 it back to the Operating System would result in a Unicode error, as Python 7280 would attempt to use its default encoding (generally ASCII) rather than 7281 the default encoding for the file system. 7282 7283 In general, this change simply removes surprises when working with 7284 Unicode and the file system, making these operations work as you expect, 7285 increasing the transparency of Unicode objects in this context. 7286 See [????] for more details, including examples. 7287 7288- Float (and complex) literals in source code were evaluated to full 7289 precision only when running from a .py file; the same code loaded from a 7290 .pyc (or .pyo) file could suffer numeric differences starting at about the 7291 12th significant decimal digit. For example, on a machine with IEEE-754 7292 floating arithmetic, 7293 7294 x = 9007199254740992.0 7295 print long(x) 7296 7297 printed 9007199254740992 if run directly from .py, but 9007199254740000 7298 if from a compiled (.pyc or .pyo) file. This was due to marshal using 7299 str(float) instead of repr(float) when building code objects. marshal 7300 now uses repr(float) instead, which should reproduce floats to full 7301 machine precision (assuming the platform C float<->string I/O conversion 7302 functions are of good quality). 7303 7304 This may cause floating-point results to change in some cases, and 7305 usually for the better, but may also cause numerically unstable 7306 algorithms to break. 7307 7308- The implementation of dicts suffers fewer collisions, which has speed 7309 benefits. However, the order in which dict entries appear in dict.keys(), 7310 dict.values() and dict.items() may differ from previous releases for a 7311 given dict. Nothing is defined about this order, so no program should 7312 rely on it. Nevertheless, it's easy to write test cases that rely on the 7313 order by accident, typically because of printing the str() or repr() of a 7314 dict to an "expected results" file. See Lib/test/test_support.py's new 7315 sortdict(dict) function for a simple way to display a dict in sorted 7316 order. 7317 7318- Many other small changes to dicts were made, resulting in faster 7319 operation along the most common code paths. 7320 7321- Dictionary objects now support the "in" operator: "x in dict" means 7322 the same as dict.has_key(x). 7323 7324- The update() method of dictionaries now accepts generic mapping 7325 objects. Specifically the argument object must support the .keys() 7326 and __getitem__() methods. This allows you to say, for example, 7327 {}.update(UserDict()) 7328 7329- Iterators were added; this is a generalized way of providing values 7330 to a for loop. See PEP 234. There's a new built-in function iter() 7331 to return an iterator. There's a new protocol to get the next value 7332 from an iterator using the next() method (in Python) or the 7333 tp_iternext slot (in C). There's a new protocol to get iterators 7334 using the __iter__() method (in Python) or the tp_iter slot (in C). 7335 Iterating (i.e. a for loop) over a dictionary generates its keys. 7336 Iterating over a file generates its lines. 7337 7338- The following functions were generalized to work nicely with iterator 7339 arguments:: 7340 7341 map(), filter(), reduce(), zip() 7342 list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API) 7343 max(), min() 7344 join() method of strings 7345 extend() method of lists 7346 'x in y' and 'x not in y' (PySequence_Contains() in C API) 7347 operator.countOf() (PySequence_Count() in C API) 7348 right-hand side of assignment statements with multiple targets, such as :: 7349 x, y, z = some_iterable_object_returning_exactly_3_values 7350 7351- Accessing module attributes is significantly faster (for example, 7352 random.random or os.path or yourPythonModule.yourAttribute). 7353 7354- Comparing dictionary objects via == and != is faster, and now works even 7355 if the keys and values don't support comparisons other than ==. 7356 7357- Comparing dictionaries in ways other than == and != is slower: there were 7358 insecurities in the dict comparison implementation that could cause Python 7359 to crash if the element comparison routines for the dict keys and/or 7360 values mutated the dicts. Making the code bulletproof slowed it down. 7361 7362- Collisions in dicts are resolved via a new approach, which can help 7363 dramatically in bad cases. For example, looking up every key in a dict 7364 d with d.keys() == [i << 16 for i in range(20000)] is approximately 500x 7365 faster now. Thanks to Christian Tismer for pointing out the cause and 7366 the nature of an effective cure (last December! better late than never). 7367 7368- repr() is much faster for large containers (dict, list, tuple). 7369 7370 7371Library 7372------- 7373 7374- The constants ascii_letters, ascii_lowercase. and ascii_uppercase 7375 were added to the string module. These a locale-independent 7376 constants, unlike letters, lowercase, and uppercase. These are now 7377 use in appropriate locations in the standard library. 7378 7379- The flags used in dlopen calls can now be configured using 7380 sys.setdlopenflags and queried using sys.getdlopenflags. 7381 7382- Fredrik Lundh's xmlrpclib is now a standard library module. This 7383 provides full client-side XML-RPC support. In addition, 7384 Demo/xmlrpc/ contains two server frameworks (one SocketServer-based, 7385 one asyncore-based). Thanks to Eric Raymond for the documentation. 7386 7387- The xrange() object is simplified: it no longer supports slicing, 7388 repetition, comparisons, efficient 'in' checking, the tolist() 7389 method, or the start, stop and step attributes. See PEP 260. 7390 7391- A new function fnmatch.filter to filter lists of file names was added. 7392 7393- calendar.py uses month and day names based on the current locale. 7394 7395- strop is now *really* obsolete (this was announced before with 1.6), 7396 and issues DeprecationWarning when used (except for the four items 7397 that are still imported into string.py). 7398 7399- Cookie.py now sorts key+value pairs by key in output strings. 7400 7401- pprint.isrecursive(object) didn't correctly identify recursive objects. 7402 Now it does. 7403 7404- pprint functions now much faster for large containers (tuple, list, dict). 7405 7406- New 'q' and 'Q' format codes in the struct module, corresponding to C 7407 types "long long" and "unsigned long long" (on Windows, __int64). In 7408 native mode, these can be used only when the platform C compiler supports 7409 these types (when HAVE_LONG_LONG is #define'd by the Python config 7410 process), and then they inherit the sizes and alignments of the C types. 7411 In standard mode, 'q' and 'Q' are supported on all platforms, and are 7412 8-byte integral types. 7413 7414- The site module installs a new built-in function 'help' that invokes 7415 pydoc.help. It must be invoked as 'help()'; when invoked as 'help', 7416 it displays a message reminding the user to use 'help()' or 7417 'help(object)'. 7418 7419Tests 7420----- 7421 7422- New test_mutants.py runs dict comparisons where the key and value 7423 comparison operators mutate the dicts randomly during comparison. This 7424 rapidly causes Python to crash under earlier releases (not for the faint 7425 of heart: it can also cause Win9x to freeze or reboot!). 7426 7427- New test_pprint.py verifies that pprint.isrecursive() and 7428 pprint.isreadable() return sensible results. Also verifies that simple 7429 cases produce correct output. 7430 7431C API 7432----- 7433 7434- Removed the unused last_is_sticky argument from the internal 7435 _PyTuple_Resize(). If this affects you, you were cheating. 7436 7437What's New in Python 2.1 (final)? 7438================================= 7439 7440We only changed a few things since the last release candidate, all in 7441Python library code: 7442 7443- A bug in the locale module was fixed that affected locales which 7444 define no grouping for numeric formatting. 7445 7446- A few bugs in the weakref module's implementations of weak 7447 dictionaries (WeakValueDictionary and WeakKeyDictionary) were fixed, 7448 and the test suite was updated to check for these bugs. 7449 7450- An old bug in the os.path.walk() function (introduced in Python 7451 2.0!) was fixed: a non-existent file would cause an exception 7452 instead of being ignored. 7453 7454- Fixed a few bugs in the new symtable module found by Neil Norwitz's 7455 PyChecker. 7456 7457 7458What's New in Python 2.1c2? 7459=========================== 7460 7461A flurry of small changes, and one showstopper fixed in the nick of 7462time made it necessary to release another release candidate. The list 7463here is the *complete* list of patches (except version updates): 7464 7465Core 7466 7467- Tim discovered a nasty bug in the dictionary code, caused by 7468 PyDict_Next() calling dict_resize(), and the GC code's use of 7469 PyDict_Next() violating an assumption in dict_items(). This was 7470 fixed with considerable amounts of band-aid, but the net effect is a 7471 saner and more robust implementation. 7472 7473- Made a bunch of symbols static that were accidentally global. 7474 7475Build and Ports 7476 7477- The setup.py script didn't check for a new enough version of zlib 7478 (1.1.3 is needed). Now it does. 7479 7480- Changed "make clean" target to also remove shared libraries. 7481 7482- Added a more general warning about the SGI Irix optimizer to README. 7483 7484Library 7485 7486- Fix a bug in urllib.basejoin("http://host", "../file.html") which 7487 omitted the slash between host and file.html. 7488 7489- The mailbox module's _Mailbox class contained a completely broken 7490 and undocumented seek() method. Ripped it out. 7491 7492- Fixed a bunch of typos in various library modules (urllib2, smtpd, 7493 sgmllib, netrc, chunk) found by Neil Norwitz's PyChecker. 7494 7495- Fixed a few last-minute bugs in unittest. 7496 7497Extensions 7498 7499- Reverted the patch to the OpenSSL code in socketmodule.c to support 7500 RAND_status() and the EGD, and the subsequent patch that tried to 7501 fix it for pre-0.9.5 versions; the problem with the patch is that on 7502 some systems it issues a warning whenever socket is imported, and 7503 that's unacceptable. 7504 7505Tests 7506 7507- Fixed the pickle tests to work with "import test.test_pickle". 7508 7509- Tweaked test_locale.py to actually run the test Windows. 7510 7511- In distutils/archive_util.py, call zipfile.ZipFile() with mode "w", 7512 not "wb" (which is not a valid mode at all). 7513 7514- Fix pstats browser crashes. Import readline if it exists to make 7515 the user interface nicer. 7516 7517- Add "import thread" to the top of test modules that import the 7518 threading module (test_asynchat and test_threadedtempfile). This 7519 prevents test failures caused by a broken threading module resulting 7520 from a previously caught failed import. 7521 7522- Changed test_asynchat.py to set the SO_REUSEADDR option; this was 7523 needed on some platforms (e.g. Solaris 8) when the tests are run 7524 twice in succession. 7525 7526- Skip rather than fail test_sunaudiodev if no audio device is found. 7527 7528 7529What's New in Python 2.1c1? 7530=========================== 7531 7532This list was significantly updated when 2.1c2 was released; the 2.1c1 7533release didn't mention most changes that were actually part of 2.1c1: 7534 7535Legal 7536 7537- Copyright was assigned to the Python Software Foundation (PSF) and a 7538 PSF license (very similar to the CNRI license) was added. 7539 7540- The CNRI copyright notice was updated to include 2001. 7541 7542Core 7543 7544- After a public outcry, assignment to __debug__ is no longer illegal; 7545 instead, a warning is issued. It will become illegal in 2.2. 7546 7547- Fixed a core dump with "%#x" % 0, and changed the semantics so that 7548 "%#x" now always prepends "0x", even if the value is zero. 7549 7550- Fixed some nits in the bytecode compiler. 7551 7552- Fixed core dumps when calling certain kinds of non-functions. 7553 7554- Fixed various core dumps caused by reference count bugs. 7555 7556Build and Ports 7557 7558- Use INSTALL_SCRIPT to install script files. 7559 7560- New port: SCO Unixware 7, by Billy G. Allie. 7561 7562- Updated RISCOS port. 7563 7564- Updated BeOS port and notes. 7565 7566- Various other porting problems resolved. 7567 7568Library 7569 7570- The TERMIOS and SOCKET modules are now truly obsolete and 7571 unnecessary. Their symbols are incorporated in the termios and 7572 socket modules. 7573 7574- Fixed some 64-bit bugs in pickle, cPickle, and struct, and added 7575 better tests for pickling. 7576 7577- threading: make Condition.wait() robust against KeyboardInterrupt. 7578 7579- zipfile: add support to zipfile to support opening an archive 7580 represented by an open file rather than a file name. Fix bug where 7581 the archive was not properly closed. Fixed a bug in this bugfix 7582 where flush() was called for a read-only file. 7583 7584- imputil: added an uninstall() method to the ImportManager. 7585 7586- Canvas: fixed bugs in lower() and tkraise() methods. 7587 7588- SocketServer: API change (added overridable close_request() method) 7589 so that the TCP server can explicitly close the request. 7590 7591- pstats: Eric Raymond added a simple interactive statistics browser, 7592 invoked when the module is run as a script. 7593 7594- locale: fixed a problem in format(). 7595 7596- webbrowser: made it work when the BROWSER environment variable has a 7597 value like "/usr/bin/netscape". Made it auto-detect Konqueror for 7598 KDE 2. Fixed some other nits. 7599 7600- unittest: changes to allow using a different exception than 7601 AssertionError, and added a few more function aliases. Some other 7602 small changes. 7603 7604- urllib, urllib2: fixed redirect problems and a coupleof other nits. 7605 7606- asynchat: fixed a critical bug in asynchat that slipped through the 7607 2.1b2 release. Fixed another rare bug. 7608 7609- Fix some unqualified except: clauses (always a bad code example). 7610 7611XML 7612 7613- pyexpat: new API get_version_string(). 7614 7615- Fixed some minidom bugs. 7616 7617Extensions 7618 7619- Fixed a core dump in _weakref. Removed the weakref.mapping() 7620 function (it adds nothing to the API). 7621 7622- Rationalized the use of header files in the readline module, to make 7623 it compile (albeit with some warnings) with the very recent readline 7624 4.2, without breaking for earlier versions. 7625 7626- Hopefully fixed a buffering problem in linuxaudiodev. 7627 7628- Attempted a fix to make the OpenSSL support in the socket module 7629 work again with pre-0.9.5 versions of OpenSSL. 7630 7631Tests 7632 7633- Added a test case for asynchat and asyncore. 7634 7635- Removed coupling between tests where one test failing could break 7636 another. 7637 7638Tools 7639 7640- Ping added an interactive help browser to pydoc, fixed some nits 7641 in the rest of the pydoc code, and added some features to his 7642 inspect module. 7643 7644- An updated python-mode.el version 4.1 which integrates Ken 7645 Manheimer's pdbtrack.el. This makes debugging Python code via pdb 7646 much nicer in XEmacs and Emacs. When stepping through your program 7647 with pdb, in either the shell window or the *Python* window, the 7648 source file and line will be tracked by an arrow. Very cool! 7649 7650- IDLE: syntax warnings in interactive mode are changed into errors. 7651 7652- Some improvements to Tools/webchecker (ignore some more URL types, 7653 follow some more links). 7654 7655- Brought the Tools/compiler package up to date. 7656 7657 7658What's New in Python 2.1 beta 2? 7659================================ 7660 7661(Unlisted are many fixed bugs, more documentation, etc.) 7662 7663Core language, builtins, and interpreter 7664 7665- The nested scopes work (enabled by "from __future__ import 7666 nested_scopes") is completed; in particular, the future now extends 7667 into code executed through exec, eval() and execfile(), and into the 7668 interactive interpreter. 7669 7670- When calling a base class method (e.g. BaseClass.__init__(self)), 7671 this is now allowed even if self is not strictly spoken a class 7672 instance (e.g. when using metaclasses or the Don Beaudry hook). 7673 7674- Slice objects are now comparable but not hashable; this prevents 7675 dict[:] from being accepted but meaningless. 7676 7677- Complex division is now calculated using less braindead algorithms. 7678 This doesn't change semantics except it's more likely to give useful 7679 results in extreme cases. Complex repr() now uses full precision 7680 like float repr(). 7681 7682- sgmllib.py now calls handle_decl() for simple <!...> declarations. 7683 7684- It is illegal to assign to the name __debug__, which is set when the 7685 interpreter starts. It is effectively a compile-time constant. 7686 7687- A warning will be issued if a global statement for a variable 7688 follows a use or assignment of that variable. 7689 7690Standard library 7691 7692- unittest.py, a unit testing framework by Steve Purcell (PyUNIT, 7693 inspired by JUnit), is now part of the standard library. You now 7694 have a choice of two testing frameworks: unittest requires you to 7695 write testcases as separate code, doctest gathers them from 7696 docstrings. Both approaches have their advantages and 7697 disadvantages. 7698 7699- A new module Tix was added, which wraps the Tix extension library 7700 for Tk. With that module, it is not necessary to statically link 7701 Tix with _tkinter, since Tix will be loaded with Tcl's "package 7702 require" command. See Demo/tix/. 7703 7704- tzparse.py is now obsolete. 7705 7706- In gzip.py, the seek() and tell() methods are removed -- they were 7707 non-functional anyway, and it's better if callers can test for their 7708 existence with hasattr(). 7709 7710Python/C API 7711 7712- PyDict_Next(): it is now safe to call PyDict_SetItem() with a key 7713 that's already in the dictionary during a PyDict_Next() iteration. 7714 This used to fail occasionally when a dictionary resize operation 7715 could be triggered that would rehash all the keys. All other 7716 modifications to the dictionary are still off-limits during a 7717 PyDict_Next() iteration! 7718 7719- New extended APIs related to passing compiler variables around. 7720 7721- New abstract APIs PyObject_IsInstance(), PyObject_IsSubclass() 7722 implement isinstance() and issubclass(). 7723 7724- Py_BuildValue() now has a "D" conversion to create a Python complex 7725 number from a Py_complex C value. 7726 7727- Extensions types which support weak references must now set the 7728 field allocated for the weak reference machinery to NULL themselves; 7729 this is done to avoid the cost of checking each object for having a 7730 weakly referencable type in PyObject_INIT(), since most types are 7731 not weakly referencable. 7732 7733- PyFrame_FastToLocals() and PyFrame_LocalsToFast() copy bindings for 7734 free variables and cell variables to and from the frame's f_locals. 7735 7736- Variants of several functions defined in pythonrun.h have been added 7737 to support the nested_scopes future statement. The variants all end 7738 in Flags and take an extra argument, a PyCompilerFlags *; examples: 7739 PyRun_AnyFileExFlags(), PyRun_InteractiveLoopFlags(). These 7740 variants may be removed in Python 2.2, when nested scopes are 7741 mandatory. 7742 7743Distutils 7744 7745- the sdist command now writes a PKG-INFO file, as described in PEP 241, 7746 into the release tree. 7747 7748- several enhancements to the bdist_wininst command from Thomas Heller 7749 (an uninstaller, more customization of the installer's display) 7750 7751- from Jack Jansen: added Mac-specific code to generate a dialog for 7752 users to specify the command-line (because providing a command-line with 7753 MacPython is awkward). Jack also made various fixes for the Mac 7754 and the Metrowerks compiler. 7755 7756- added 'platforms' and 'keywords' to the set of metadata that can be 7757 specified for a distribution. 7758 7759- applied patches from Jason Tishler to make the compiler class work with 7760 Cygwin. 7761 7762 7763What's New in Python 2.1 beta 1? 7764================================ 7765 7766Core language, builtins, and interpreter 7767 7768- Following an outcry from the community about the amount of code 7769 broken by the nested scopes feature introduced in 2.1a2, we decided 7770 to make this feature optional, and to wait until Python 2.2 (or at 7771 least 6 months) to make it standard. The option can be enabled on a 7772 per-module basis by adding "from __future__ import nested_scopes" at 7773 the beginning of a module (before any other statements, but after 7774 comments and an optional docstring). See PEP 236 (Back to the 7775 __future__) for a description of the __future__ statement. PEP 227 7776 (Statically Nested Scopes) has been updated to reflect this change, 7777 and to clarify the semantics in a number of endcases. 7778 7779- The nested scopes code, when enabled, has been hardened, and most 7780 bugs and memory leaks in it have been fixed. 7781 7782- Compile-time warnings are now generated for a number of conditions 7783 that will break or change in meaning when nested scopes are enabled: 7784 7785 - Using "from...import *" or "exec" without in-clause in a function 7786 scope that also defines a lambda or nested function with one or 7787 more free (non-local) variables. The presence of the import* or 7788 bare exec makes it impossible for the compiler to determine the 7789 exact set of local variables in the outer scope, which makes it 7790 impossible to determine the bindings for free variables in the 7791 inner scope. To avoid the warning about import *, change it into 7792 an import of explicitly name object, or move the import* statement 7793 to the global scope; to avoid the warning about bare exec, use 7794 exec...in... (a good idea anyway -- there's a possibility that 7795 bare exec will be deprecated in the future). 7796 7797 - Use of a global variable in a nested scope with the same name as a 7798 local variable in a surrounding scope. This will change in 7799 meaning with nested scopes: the name in the inner scope will 7800 reference the variable in the outer scope rather than the global 7801 of the same name. To avoid the warning, either rename the outer 7802 variable, or use a global statement in the inner function. 7803 7804- An optional object allocator has been included. This allocator is 7805 optimized for Python objects and should be faster and use less memory 7806 than the standard system allocator. It is not enabled by default 7807 because of possible thread safety problems. The allocator is only 7808 protected by the Python interpreter lock and it is possible that some 7809 extension modules require a thread safe allocator. The object 7810 allocator can be enabled by providing the "--with-pymalloc" option to 7811 configure. 7812 7813Standard library 7814 7815- pyexpat now detects the expat version if expat.h defines it. A 7816 number of additional handlers are provided, which are only available 7817 since expat 1.95. In addition, the methods SetParamEntityParsing and 7818 GetInputContext of Parser objects are available with 1.95.x 7819 only. Parser objects now provide the ordered_attributes and 7820 specified_attributes attributes. A new module expat.model was added, 7821 which offers a number of additional constants if 1.95.x is used. 7822 7823- xml.dom offers the new functions registerDOMImplementation and 7824 getDOMImplementation. 7825 7826- xml.dom.minidom offers a toprettyxml method. A number of DOM 7827 conformance issues have been resolved. In particular, Element now 7828 has a hasAttributes method, and the handling of namespaces was 7829 improved. 7830 7831- Ka-Ping Yee contributed two new modules: inspect.py, a module for 7832 getting information about live Python code, and pydoc.py, a module 7833 for interactively converting docstrings to HTML or text. 7834 Tools/scripts/pydoc, which is now automatically installed into 7835 <prefix>/bin, uses pydoc.py to display documentation; try running 7836 "pydoc -h" for instructions. "pydoc -g" pops up a small GUI that 7837 lets you browse the module docstrings using a web browser. 7838 7839- New library module difflib.py, primarily packaging the SequenceMatcher 7840 class at the heart of the popular ndiff.py file-comparison tool. 7841 7842- doctest.py (a framework for verifying Python code examples in docstrings) 7843 is now part of the std library. 7844 7845Windows changes 7846 7847- A new entry in the Start menu, "Module Docs", runs "pydoc -g" -- a 7848 small GUI that lets you browse the module docstrings using your 7849 default web browser. 7850 7851- Import is now case-sensitive. PEP 235 (Import on Case-Insensitive 7852 Platforms) is implemented. See 7853 7854 http://python.sourceforge.net/peps/pep-0235.html 7855 7856 for full details, especially the "Current Lower-Left Semantics" section. 7857 The new Windows import rules are simpler than before: 7858 7859 A. If the PYTHONCASEOK environment variable exists, same as 7860 before: silently accept the first case-insensitive match of any 7861 kind; raise ImportError if none found. 7862 7863 B. Else search sys.path for the first case-sensitive match; raise 7864 ImportError if none found. 7865 7866 The same rules have been implemented on other platforms with case- 7867 insensitive but case-preserving filesystems too (including Cygwin, and 7868 several flavors of Macintosh operating systems). 7869 7870- winsound module: Under Win9x, winsound.Beep() now attempts to simulate 7871 what it's supposed to do (and does do under NT and 2000) via direct 7872 port manipulation. It's unknown whether this will work on all systems, 7873 but it does work on my Win98SE systems now and was known to be useless on 7874 all Win9x systems before. 7875 7876- Build: Subproject _test (effectively) renamed to _testcapi. 7877 7878New platforms 7879 7880- 2.1 should compile and run out of the box under MacOS X, even using HFS+. 7881 Thanks to Steven Majewski! 7882 7883- 2.1 should compile and run out of the box on Cygwin. Thanks to Jason 7884 Tishler! 7885 7886- 2.1 contains new files and patches for RISCOS, thanks to Dietmar 7887 Schwertberger! See RISCOS/README for more information -- it seems 7888 that because of the bizarre filename conventions on RISCOS, no port 7889 to that platform is easy. 7890 7891 7892What's New in Python 2.1 alpha 2? 7893================================= 7894 7895Core language, builtins, and interpreter 7896 7897- Scopes nest. If a name is used in a function or class, but is not 7898 local, the definition in the nearest enclosing function scope will 7899 be used. One consequence of this change is that lambda statements 7900 could reference variables in the namespaces where the lambda is 7901 defined. In some unusual cases, this change will break code. 7902 7903 In all previous version of Python, names were resolved in exactly 7904 three namespaces -- the local namespace, the global namespace, and 7905 the builtins namespace. According to this old definition, if a 7906 function A is defined within a function B, the names bound in B are 7907 not visible in A. The new rules make names bound in B visible in A, 7908 unless A contains a name binding that hides the binding in B. 7909 7910 Section 4.1 of the reference manual describes the new scoping rules 7911 in detail. The test script in Lib/test/test_scope.py demonstrates 7912 some of the effects of the change. 7913 7914 The new rules will cause existing code to break if it defines nested 7915 functions where an outer function has local variables with the same 7916 name as globals or builtins used by the inner function. Example: 7917 7918 def munge(str): 7919 def helper(x): 7920 return str(x) 7921 if type(str) != type(''): 7922 str = helper(str) 7923 return str.strip() 7924 7925 Under the old rules, the name str in helper() is bound to the 7926 built-in function str(). Under the new rules, it will be bound to 7927 the argument named str and an error will occur when helper() is 7928 called. 7929 7930- The compiler will report a SyntaxError if "from ... import *" occurs 7931 in a function or class scope. The language reference has documented 7932 that this case is illegal, but the compiler never checked for it. 7933 The recent introduction of nested scope makes the meaning of this 7934 form of name binding ambiguous. In a future release, the compiler 7935 may allow this form when there is no possibility of ambiguity. 7936 7937- repr(string) is easier to read, now using hex escapes instead of octal, 7938 and using \t, \n and \r instead of \011, \012 and \015 (respectively): 7939 7940 >>> "\texample \r\n" + chr(0) + chr(255) 7941 '\texample \r\n\x00\xff' # in 2.1 7942 '\011example \015\012\000\377' # in 2.0 7943 7944- Functions are now compared and hashed by identity, not by value, since 7945 the func_code attribute is writable. 7946 7947- Weak references (PEP 205) have been added. This involves a few 7948 changes in the core, an extension module (_weakref), and a Python 7949 module (weakref). The weakref module is the public interface. It 7950 includes support for "explicit" weak references, proxy objects, and 7951 mappings with weakly held values. 7952 7953- A 'continue' statement can now appear in a try block within the body 7954 of a loop. It is still not possible to use continue in a finally 7955 clause. 7956 7957Standard library 7958 7959- mailbox.py now has a new class, PortableUnixMailbox which is 7960 identical to UnixMailbox but uses a more portable scheme for 7961 determining From_ separators. Also, the constructors for all the 7962 classes in this module have a new optional `factory' argument, which 7963 is a callable used when new message classes must be instantiated by 7964 the next() method. 7965 7966- random.py is now self-contained, and offers all the functionality of 7967 the now-deprecated whrandom.py. See the docs for details. random.py 7968 also supports new functions getstate() and setstate(), for saving 7969 and restoring the internal state of the generator; and jumpahead(n), 7970 for quickly forcing the internal state to be the same as if n calls to 7971 random() had been made. The latter is particularly useful for multi- 7972 threaded programs, creating one instance of the random.Random() class for 7973 each thread, then using .jumpahead() to force each instance to use a 7974 non-overlapping segment of the full period. 7975 7976- random.py's seed() function is new. For bit-for-bit compatibility with 7977 prior releases, use the whseed function instead. The new seed function 7978 addresses two problems: (1) The old function couldn't produce more than 7979 about 2**24 distinct internal states; the new one about 2**45 (the best 7980 that can be done in the Wichmann-Hill generator). (2) The old function 7981 sometimes produced identical internal states when passed distinct 7982 integers, and there was no simple way to predict when that would happen; 7983 the new one guarantees to produce distinct internal states for all 7984 arguments in [0, 27814431486576L). 7985 7986- The socket module now supports raw packets on Linux. The socket 7987 family is AF_PACKET. 7988 7989- test_capi.py is a start at running tests of the Python C API. The tests 7990 are implemented by the new Modules/_testmodule.c. 7991 7992- A new extension module, _symtable, provides provisional access to the 7993 internal symbol table used by the Python compiler. A higher-level 7994 interface will be added on top of _symtable in a future release. 7995 7996- Removed the obsolete soundex module. 7997 7998- xml.dom.minidom now uses the standard DOM exceptions. Node supports 7999 the isSameNode method; NamedNodeMap the get method. 8000 8001- xml.sax.expatreader supports the lexical handler property; it 8002 generates comment, startCDATA, and endCDATA events. 8003 8004Windows changes 8005 8006- Build procedure: the zlib project is built in a different way that 8007 ensures the zlib header files used can no longer get out of synch with 8008 the zlib binary used. See PCbuild\readme.txt for details. Your old 8009 zlib-related directories can be deleted; you'll need to download fresh 8010 source for zlib and unpack it into a new directory. 8011 8012- Build: New subproject _test for the benefit of test_capi.py (see above). 8013 8014- Build: New subproject _symtable, for new DLL _symtable.pyd (a nascent 8015 interface to some Python compiler internals). 8016 8017- Build: Subproject ucnhash is gone, since the code was folded into the 8018 unicodedata subproject. 8019 8020What's New in Python 2.1 alpha 1? 8021================================= 8022 8023Core language, builtins, and interpreter 8024 8025- There is a new Unicode companion to the PyObject_Str() API 8026 called PyObject_Unicode(). It behaves in the same way as the 8027 former, but assures that the returned value is a Unicode object 8028 (applying the usual coercion if necessary). 8029 8030- The comparison operators support "rich comparison overloading" (PEP 8031 207). C extension types can provide a rich comparison function in 8032 the new tp_richcompare slot in the type object. The cmp() function 8033 and the C function PyObject_Compare() first try the new rich 8034 comparison operators before trying the old 3-way comparison. There 8035 is also a new C API PyObject_RichCompare() (which also falls back on 8036 the old 3-way comparison, but does not constrain the outcome of the 8037 rich comparison to a Boolean result). 8038 8039 The rich comparison function takes two objects (at least one of 8040 which is guaranteed to have the type that provided the function) and 8041 an integer indicating the opcode, which can be Py_LT, Py_LE, Py_EQ, 8042 Py_NE, Py_GT, Py_GE (for <, <=, ==, !=, >, >=), and returns a Python 8043 object, which may be NotImplemented (in which case the tp_compare 8044 slot function is used as a fallback, if defined). 8045 8046 Classes can overload individual comparison operators by defining one 8047 or more of the methods__lt__, __le__, __eq__, __ne__, __gt__, 8048 __ge__. There are no explicit "reflected argument" versions of 8049 these; instead, __lt__ and __gt__ are each other's reflection, 8050 likewise for__le__ and __ge__; __eq__ and __ne__ are their own 8051 reflection (similar at the C level). No other implications are 8052 made; in particular, Python does not assume that == is the Boolean 8053 inverse of !=, or that < is the Boolean inverse of >=. This makes 8054 it possible to define types with partial orderings. 8055 8056 Classes or types that want to implement (in)equality tests but not 8057 the ordering operators (i.e. unordered types) should implement == 8058 and !=, and raise an error for the ordering operators. 8059 8060 It is possible to define types whose rich comparison results are not 8061 Boolean; e.g. a matrix type might want to return a matrix of bits 8062 for A < B, giving elementwise comparisons. Such types should ensure 8063 that any interpretation of their value in a Boolean context raises 8064 an exception, e.g. by defining __nonzero__ (or the tp_nonzero slot 8065 at the C level) to always raise an exception. 8066 8067- Complex numbers use rich comparisons to define == and != but raise 8068 an exception for <, <=, > and >=. Unfortunately, this also means 8069 that cmp() of two complex numbers raises an exception when the two 8070 numbers differ. Since it is not mathematically meaningful to compare 8071 complex numbers except for equality, I hope that this doesn't break 8072 too much code. 8073 8074- The outcome of comparing non-numeric objects of different types is 8075 not defined by the language, other than that it's arbitrary but 8076 consistent (see the Reference Manual). An implementation detail changed 8077 in 2.1a1 such that None now compares less than any other object. Code 8078 relying on this new behavior (like code that relied on the previous 8079 behavior) does so at its own risk. 8080 8081- Functions and methods now support getting and setting arbitrarily 8082 named attributes (PEP 232). Functions have a new __dict__ 8083 (a.k.a. func_dict) which hold the function attributes. Methods get 8084 and set attributes on their underlying im_func. It is a TypeError 8085 to set an attribute on a bound method. 8086 8087- The xrange() object implementation has been improved so that 8088 xrange(sys.maxint) can be used on 64-bit platforms. There's still a 8089 limitation that in this case len(xrange(sys.maxint)) can't be 8090 calculated, but the common idiom "for i in xrange(sys.maxint)" will 8091 work fine as long as the index i doesn't actually reach 2**31. 8092 (Python uses regular ints for sequence and string indices; fixing 8093 that is much more work.) 8094 8095- Two changes to from...import: 8096 8097 1) "from M import X" now works even if (after loading module M) 8098 sys.modules['M'] is not a real module; it's basically a getattr() 8099 operation with AttributeError exceptions changed into ImportError. 8100 8101 2) "from M import *" now looks for M.__all__ to decide which names to 8102 import; if M.__all__ doesn't exist, it uses M.__dict__.keys() but 8103 filters out names starting with '_' as before. Whether or not 8104 __all__ exists, there's no restriction on the type of M. 8105 8106- File objects have a new method, xreadlines(). This is the fastest 8107 way to iterate over all lines in a file: 8108 8109 for line in file.xreadlines(): 8110 ...do something to line... 8111 8112 See the xreadlines module (mentioned below) for how to do this for 8113 other file-like objects. 8114 8115- Even if you don't use file.xreadlines(), you may expect a speedup on 8116 line-by-line input. The file.readline() method has been optimized 8117 quite a bit in platform-specific ways: on systems (like Linux) that 8118 support flockfile(), getc_unlocked(), and funlockfile(), those are 8119 used by default. On systems (like Windows) without getc_unlocked(), 8120 a complicated (but still thread-safe) method using fgets() is used by 8121 default. 8122 8123 You can force use of the fgets() method by #define'ing 8124 USE_FGETS_IN_GETLINE at build time (it may be faster than 8125 getc_unlocked()). 8126 8127 You can force fgets() not to be used by #define'ing 8128 DONT_USE_FGETS_IN_GETLINE (this is the first thing to try if std test 8129 test_bufio.py fails -- and let us know if it does!). 8130 8131- In addition, the fileinput module, while still slower than the other 8132 methods on most platforms, has been sped up too, by using 8133 file.readlines(sizehint). 8134 8135- Support for run-time warnings has been added, including a new 8136 command line option (-W) to specify the disposition of warnings. 8137 See the description of the warnings module below. 8138 8139- Extensive changes have been made to the coercion code. This mostly 8140 affects extension modules (which can now implement mixed-type 8141 numerical operators without having to use coercion), but 8142 occasionally, in boundary cases the coercion semantics have changed 8143 subtly. Since this was a terrible gray area of the language, this 8144 is considered an improvement. Also note that __rcmp__ is no longer 8145 supported -- instead of calling __rcmp__, __cmp__ is called with 8146 reflected arguments. 8147 8148- In connection with the coercion changes, a new built-in singleton 8149 object, NotImplemented is defined. This can be returned for 8150 operations that wish to indicate they are not implemented for a 8151 particular combination of arguments. From C, this is 8152 Py_NotImplemented. 8153 8154- The interpreter accepts now bytecode files on the command line even 8155 if they do not have a .pyc or .pyo extension. On Linux, after executing 8156 8157import imp,sys,string 8158magic = string.join(["\\x%.2x" % ord(c) for c in imp.get_magic()],"") 8159reg = ':pyc:M::%s::%s:' % (magic, sys.executable) 8160open("/proc/sys/fs/binfmt_misc/register","wb").write(reg) 8161 8162 any byte code file can be used as an executable (i.e. as an argument 8163 to execve(2)). 8164 8165- %[xXo] formats of negative Python longs now produce a sign 8166 character. In 1.6 and earlier, they never produced a sign, 8167 and raised an error if the value of the long was too large 8168 to fit in a Python int. In 2.0, they produced a sign if and 8169 only if too large to fit in an int. This was inconsistent 8170 across platforms (because the size of an int varies across 8171 platforms), and inconsistent with hex() and oct(). Example: 8172 8173 >>> "%x" % -0x42L 8174 '-42' # in 2.1 8175 'ffffffbe' # in 2.0 and before, on 32-bit machines 8176 >>> hex(-0x42L) 8177 '-0x42L' # in all versions of Python 8178 8179 The behavior of %d formats for negative Python longs remains 8180 the same as in 2.0 (although in 1.6 and before, they raised 8181 an error if the long didn't fit in a Python int). 8182 8183 %u formats don't make sense for Python longs, but are allowed 8184 and treated the same as %d in 2.1. In 2.0, a negative long 8185 formatted via %u produced a sign if and only if too large to 8186 fit in an int. In 1.6 and earlier, a negative long formatted 8187 via %u raised an error if it was too big to fit in an int. 8188 8189- Dictionary objects have an odd new method, popitem(). This removes 8190 an arbitrary item from the dictionary and returns it (in the form of 8191 a (key, value) pair). This can be useful for algorithms that use a 8192 dictionary as a bag of "to do" items and repeatedly need to pick one 8193 item. Such algorithms normally end up running in quadratic time; 8194 using popitem() they can usually be made to run in linear time. 8195 8196Standard library 8197 8198- In the time module, the time argument to the functions strftime, 8199 localtime, gmtime, asctime and ctime is now optional, defaulting to 8200 the current time (in the local timezone). 8201 8202- The ftplib module now defaults to passive mode, which is deemed a 8203 more useful default given that clients are often inside firewalls 8204 these days. Note that this could break if ftplib is used to connect 8205 to a *server* that is inside a firewall, from outside; this is 8206 expected to be a very rare situation. To fix that, you can call 8207 ftp.set_pasv(0). 8208 8209- The module site now treats .pth files not only for path configuration, 8210 but also supports extensions to the initialization code: Lines starting 8211 with import are executed. 8212 8213- There's a new module, warnings, which implements a mechanism for 8214 issuing and filtering warnings. There are some new built-in 8215 exceptions that serve as warning categories, and a new command line 8216 option, -W, to control warnings (e.g. -Wi ignores all warnings, -We 8217 turns warnings into errors). warnings.warn(message[, category]) 8218 issues a warning message; this can also be called from C as 8219 PyErr_Warn(category, message). 8220 8221- A new module xreadlines was added. This exports a single factory 8222 function, xreadlines(). The intention is that this code is the 8223 absolutely fastest way to iterate over all lines in an open 8224 file(-like) object: 8225 8226 import xreadlines 8227 for line in xreadlines.xreadlines(file): 8228 ...do something to line... 8229 8230 This is equivalent to the previous the speed record holder using 8231 file.readlines(sizehint). Note that if file is a real file object 8232 (as opposed to a file-like object), this is equivalent: 8233 8234 for line in file.xreadlines(): 8235 ...do something to line... 8236 8237- The bisect module has new functions bisect_left, insort_left, 8238 bisect_right and insort_right. The old names bisect and insort 8239 are now aliases for bisect_right and insort_right. XXX_right 8240 and XXX_left methods differ in what happens when the new element 8241 compares equal to one or more elements already in the list: the 8242 XXX_left methods insert to the left, the XXX_right methods to the 8243 right. Code that doesn't care where equal elements end up should 8244 continue to use the old, short names ("bisect" and "insort"). 8245 8246- The new curses.panel module wraps the panel library that forms part 8247 of SYSV curses and ncurses. Contributed by Thomas Gellekum. 8248 8249- The SocketServer module now sets the allow_reuse_address flag by 8250 default in the TCPServer class. 8251 8252- A new function, sys._getframe(), returns the stack frame pointer of 8253 the caller. This is intended only as a building block for 8254 higher-level mechanisms such as string interpolation. 8255 8256- The pyexpat module supports a number of new handlers, which are 8257 available only in expat 1.2. If invocation of a callback fails, it 8258 will report an additional frame in the traceback. Parser objects 8259 participate now in garbage collection. If expat reports an unknown 8260 encoding, pyexpat will try to use a Python codec; that works only 8261 for single-byte charsets. The parser type objects is exposed as 8262 XMLParserObject. 8263 8264- xml.dom now offers standard definitions for symbolic node type and 8265 exception code constants, and a hierarchy of DOM exceptions. minidom 8266 was adjusted to use them. 8267 8268- The conformance of xml.dom.minidom to the DOM specification was 8269 improved. It detects a number of additional error cases; the 8270 previous/next relationship works even when the tree is modified; 8271 Node supports the normalize() method; NamedNodeMap, DocumentType and 8272 DOMImplementation classes were added; Element supports the 8273 hasAttribute and hasAttributeNS methods; and Text supports the splitText 8274 method. 8275 8276Build issues 8277 8278- For Unix (and Unix-compatible) builds, configuration and building of 8279 extension modules is now greatly automated. Rather than having to 8280 edit the Modules/Setup file to indicate which modules should be 8281 built and where their include files and libraries are, a 8282 distutils-based setup.py script now takes care of building most 8283 extension modules. All extension modules built this way are built 8284 as shared libraries. Only a few modules that must be linked 8285 statically are still listed in the Setup file; you won't need to 8286 edit their configuration. 8287 8288- Python should now build out of the box on Cygwin. If it doesn't, 8289 mail to Jason Tishler (jlt63 at users.sourceforge.net). 8290 8291- Python now always uses its own (renamed) implementation of getopt() 8292 -- there's too much variation among C library getopt() 8293 implementations. 8294 8295- C++ compilers are better supported; the CXX macro is always set to a 8296 C++ compiler if one is found. 8297 8298Windows changes 8299 8300- select module: By default under Windows, a select() call 8301 can specify no more than 64 sockets. Python now boosts 8302 this Microsoft default to 512. If you need even more than 8303 that, see the MS docs (you'll need to #define FD_SETSIZE 8304 and recompile Python from source). 8305 8306- Support for Windows 3.1, DOS and OS/2 is gone. The Lib/dos-8x3 8307 subdirectory is no more! 8308 8309 8310What's New in Python 2.0? 8311========================= 8312 8313Below is a list of all relevant changes since release 1.6. Older 8314changes are in the file HISTORY. If you are making the jump directly 8315from Python 1.5.2 to 2.0, make sure to read the section for 1.6 in the 8316HISTORY file! Many important changes listed there. 8317 8318Alternatively, a good overview of the changes between 1.5.2 and 2.0 is 8319the document "What's New in Python 2.0" by Kuchling and Moshe Zadka: 8320http://www.amk.ca/python/2.0/. 8321 8322--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/) 8323 8324====================================================================== 8325 8326What's new in 2.0 (since release candidate 1)? 8327============================================== 8328 8329Standard library 8330 8331- The copy_reg module was modified to clarify its intended use: to 8332 register pickle support for extension types, not for classes. 8333 pickle() will raise a TypeError if it is passed a class. 8334 8335- Fixed a bug in gettext's "normalize and expand" code that prevented 8336 it from finding an existing .mo file. 8337 8338- Restored support for HTTP/0.9 servers in httplib. 8339 8340- The math module was changed to stop raising OverflowError in case of 8341 underflow, and return 0 instead in underflow cases. Whether Python 8342 used to raise OverflowError in case of underflow was platform- 8343 dependent (it did when the platform math library set errno to ERANGE 8344 on underflow). 8345 8346- Fixed a bug in StringIO that occurred when the file position was not 8347 at the end of the file and write() was called with enough data to 8348 extend past the end of the file. 8349 8350- Fixed a bug that caused Tkinter error messages to get lost on 8351 Windows. The bug was fixed by replacing direct use of 8352 interp->result with Tcl_GetStringResult(interp). 8353 8354- Fixed bug in urllib2 that caused it to fail when it received an HTTP 8355 redirect response. 8356 8357- Several changes were made to distutils: Some debugging code was 8358 removed from util. Fixed the installer used when an external zip 8359 program (like WinZip) is not found; the source code for this 8360 installer is in Misc/distutils. check_lib() was modified to behave 8361 more like AC_CHECK_LIB by add other_libraries() as a parameter. The 8362 test for whether installed modules are on sys.path was changed to 8363 use both normcase() and normpath(). 8364 8365- Several minor bugs were fixed in the xml package (the minidom, 8366 pulldom, expatreader, and saxutils modules). 8367 8368- The regression test driver (regrtest.py) behavior when invoked with 8369 -l changed: It now reports a count of objects that are recognized as 8370 garbage but not freed by the garbage collector. 8371 8372- The regression test for the math module was changed to test 8373 exceptional behavior when the test is run in verbose mode. Python 8374 cannot yet guarantee consistent exception behavior across platforms, 8375 so the exception part of test_math is run only in verbose mode, and 8376 may fail on your platform. 8377 8378Internals 8379 8380- PyOS_CheckStack() has been disabled on Win64, where it caused 8381 test_sre to fail. 8382 8383Build issues 8384 8385- Changed compiler flags, so that gcc is always invoked with -Wall and 8386 -Wstrict-prototypes. Users compiling Python with GCC should see 8387 exactly one warning, except if they have passed configure the 8388 --with-pydebug flag. The expected warning is for getopt() in 8389 Modules/main.c. This warning will be fixed for Python 2.1. 8390 8391- Fixed configure to add -threads argument during linking on OSF1. 8392 8393Tools and other miscellany 8394 8395- The compiler in Tools/compiler was updated to support the new 8396 language features introduced in 2.0: extended print statement, list 8397 comprehensions, and augmented assignments. The new compiler should 8398 also be backwards compatible with Python 1.5.2; the compiler will 8399 always generate code for the version of the interpreter it runs 8400 under. 8401 8402What's new in 2.0 release candidate 1 (since beta 2)? 8403===================================================== 8404 8405What is release candidate 1? 8406 8407We believe that release candidate 1 will fix all known bugs that we 8408intend to fix for the 2.0 final release. This release should be a bit 8409more stable than the previous betas. We would like to see even more 8410widespread testing before the final release, so we are producing this 8411release candidate. The final release will be exactly the same unless 8412any show-stopping (or brown bag) bugs are found by testers of the 8413release candidate. 8414 8415All the changes since the last beta release are bug fixes or changes 8416to support building Python for specific platforms. 8417 8418Core language, builtins, and interpreter 8419 8420- A bug that caused crashes when __coerce__ was used with augmented 8421 assignment, e.g. +=, was fixed. 8422 8423- Raise ZeroDivisionError when raising zero to a negative number, 8424 e.g. 0.0 ** -2.0. Note that math.pow is unrelated to the built-in 8425 power operator and the result of math.pow(0.0, -2.0) will vary by 8426 platform. On Linux, it raises a ValueError. 8427 8428- A bug in Unicode string interpolation was fixed that occasionally 8429 caused errors with formats including "%%". For example, the 8430 following expression "%% %s" % u"abc" no longer raises a TypeError. 8431 8432- Compilation of deeply nested expressions raises MemoryError instead 8433 of SyntaxError, e.g. eval("[" * 50 + "]" * 50). 8434 8435- In 2.0b2 on Windows, the interpreter wrote .pyc files in text mode, 8436 rendering them useless. They are now written in binary mode again. 8437 8438Standard library 8439 8440- Keyword arguments are now accepted for most pattern and match object 8441 methods in SRE, the standard regular expression engine. 8442 8443- In SRE, fixed error with negative lookahead and lookbehind that 8444 manifested itself as a runtime error in patterns like "(?<!abc)(def)". 8445 8446- Several bugs in the Unicode handling and error handling in _tkinter 8447 were fixed. 8448 8449- Fix memory management errors in Merge() and Tkapp_Call() routines. 8450 8451- Several changes were made to cStringIO to make it compatible with 8452 the file-like object interface and with StringIO. If operations are 8453 performed on a closed object, an exception is raised. The truncate 8454 method now accepts a position argument and readline accepts a size 8455 argument. 8456 8457- There were many changes made to the linuxaudiodev module and its 8458 test suite; as a result, a short, unexpected audio sample should now 8459 play when the regression test is run. 8460 8461 Note that this module is named poorly, because it should work 8462 correctly on any platform that supports the Open Sound System 8463 (OSS). 8464 8465 The module now raises exceptions when errors occur instead of 8466 crashing. It also defines the AFMT_A_LAW format (logarithmic A-law 8467 audio) and defines a getptr() method that calls the 8468 SNDCTL_DSP_GETxPTR ioctl defined in the OSS Programmer's Guide. 8469 8470- The library_version attribute, introduced in an earlier beta, was 8471 removed because it can not be supported with early versions of the C 8472 readline library, which provides no way to determine the version at 8473 compile-time. 8474 8475- The binascii module is now enabled on Win64. 8476 8477- tokenize.py no longer suffers "recursion depth" errors when parsing 8478 programs with very long string literals. 8479 8480Internals 8481 8482- Fixed several buffer overflow vulnerabilities in calculate_path(), 8483 which is called when the interpreter starts up to determine where 8484 the standard library is installed. These vulnerabilities affect all 8485 previous versions of Python and can be exploited by setting very 8486 long values for PYTHONHOME or argv[0]. The risk is greatest for a 8487 setuid Python script, although use of the wrapper in 8488 Misc/setuid-prog.c will eliminate the vulnerability. 8489 8490- Fixed garbage collection bugs in instance creation that were 8491 triggered when errors occurred during initialization. The solution, 8492 applied in cPickle and in PyInstance_New(), is to call 8493 PyObject_GC_Init() after the initialization of the object's 8494 container attributes is complete. 8495 8496- pyexpat adds definitions of PyModule_AddStringConstant and 8497 PyModule_AddObject if the Python version is less than 2.0, which 8498 provides compatibility with PyXML on Python 1.5.2. 8499 8500- If the platform has a bogus definition for LONG_BIT (the number of 8501 bits in a long), an error will be reported at compile time. 8502 8503- Fix bugs in _PyTuple_Resize() which caused hard-to-interpret garbage 8504 collection crashes and possibly other, unreported crashes. 8505 8506- Fixed a memory leak in _PyUnicode_Fini(). 8507 8508Build issues 8509 8510- configure now accepts a --with-suffix option that specifies the 8511 executable suffix. This is useful for builds on Cygwin and Mac OS 8512 X, for example. 8513 8514- The mmap.PAGESIZE constant is now initialized using sysconf when 8515 possible, which eliminates a dependency on -lucb for Reliant UNIX. 8516 8517- The md5 file should now compile on all platforms. 8518 8519- The select module now compiles on platforms that do not define 8520 POLLRDNORM and related constants. 8521 8522- Darwin (Mac OS X): Initial support for static builds on this 8523 platform. 8524 8525- BeOS: A number of changes were made to the build and installation 8526 process. ar-fake now operates on a directory of object files. 8527 dl_export.h is gone, and its macros now appear on the mwcc command 8528 line during build on PPC BeOS. 8529 8530- Platform directory in lib/python2.0 is "plat-beos5" (or 8531 "plat-beos4", if building on BeOS 4.5), rather than "plat-beos". 8532 8533- Cygwin: Support for shared libraries, Tkinter, and sockets. 8534 8535- SunOS 4.1.4_JL: Fix test for directory existence in configure. 8536 8537Tools and other miscellany 8538 8539- Removed debugging prints from main used with freeze. 8540 8541- IDLE auto-indent no longer crashes when it encounters Unicode 8542 characters. 8543 8544What's new in 2.0 beta 2 (since beta 1)? 8545======================================== 8546 8547Core language, builtins, and interpreter 8548 8549- Add support for unbounded ints in %d,i,u,x,X,o formats; for example 8550 "%d" % 2L**64 == "18446744073709551616". 8551 8552- Add -h and -V command line options to print the usage message and 8553 Python version number and exit immediately. 8554 8555- eval() and exec accept Unicode objects as code parameters. 8556 8557- getattr() and setattr() now also accept Unicode objects for the 8558 attribute name, which are converted to strings using the default 8559 encoding before lookup. 8560 8561- Multiplication on string and Unicode now does proper bounds 8562 checking; e.g. 'a' * 65536 * 65536 will raise ValueError, "repeated 8563 string is too long." 8564 8565- Better error message when continue is found in try statement in a 8566 loop. 8567 8568 8569Standard library and extensions 8570 8571- socket module: the OpenSSL code now adds support for RAND_status() 8572 and EGD (Entropy Gathering Device). 8573 8574- array: reverse() method of array now works. buffer_info() now does 8575 argument checking; it still takes no arguments. 8576 8577- asyncore/asynchat: Included most recent version from Sam Rushing. 8578 8579- cgi: Accept '&' or ';' as separator characters when parsing form data. 8580 8581- CGIHTTPServer: Now works on Windows (and perhaps even Mac). 8582 8583- ConfigParser: When reading the file, options spelled in upper case 8584 letters are now correctly converted to lowercase. 8585 8586- copy: Copy Unicode objects atomically. 8587 8588- cPickle: Fail gracefully when copy_reg can't be imported. 8589 8590- cStringIO: Implemented readlines() method. 8591 8592- dbm: Add get() and setdefault() methods to dbm object. Add constant 8593 `library' to module that names the library used. Added doc strings 8594 and method names to error messages. Uses configure to determine 8595 which ndbm.h file to include; Berkeley DB's nbdm and GDBM's ndbm is 8596 now available options. 8597 8598- distutils: Update to version 0.9.3. 8599 8600- dl: Add several dl.RTLD_ constants. 8601 8602- fpectl: Now supported on FreeBSD. 8603 8604- gc: Add DEBUG_SAVEALL option. When enabled all garbage objects 8605 found by the collector will be saved in gc.garbage. This is useful 8606 for debugging a program that creates reference cycles. 8607 8608- httplib: Three changes: Restore support for set_debuglevel feature 8609 of HTTP class. Do not close socket on zero-length response. Do not 8610 crash when server sends invalid content-length header. 8611 8612- mailbox: Mailbox class conforms better to qmail specifications. 8613 8614- marshal: When reading a short, sign-extend on platforms where shorts 8615 are bigger than 16 bits. When reading a long, repair the unportable 8616 sign extension that was being done for 64-bit machines. (It assumed 8617 that signed right shift sign-extends.) 8618 8619- operator: Add contains(), invert(), __invert__() as aliases for 8620 __contains__(), inv(), and __inv__() respectively. 8621 8622- os: Add support for popen2() and popen3() on all platforms where 8623 fork() exists. (popen4() is still in the works.) 8624 8625- os: (Windows only:) Add startfile() function that acts like double- 8626 clicking on a file in Explorer (or passing the file name to the 8627 DOS "start" command). 8628 8629- os.path: (Windows, DOS:) Treat trailing colon correctly in 8630 os.path.join. os.path.join("a:", "b") yields "a:b". 8631 8632- pickle: Now raises ValueError when an invalid pickle that contains 8633 a non-string repr where a string repr was expected. This behavior 8634 matches cPickle. 8635 8636- posixfile: Remove broken __del__() method. 8637 8638- py_compile: support CR+LF line terminators in source file. 8639 8640- readline: Does not immediately exit when ^C is hit when readline and 8641 threads are configured. Adds definition of rl_library_version. (The 8642 latter addition requires GNU readline 2.2 or later.) 8643 8644- rfc822: Domain literals returned by AddrlistClass method 8645 getdomainliteral() are now properly wrapped in brackets. 8646 8647- site: sys.setdefaultencoding() should only be called in case the 8648 standard default encoding ("ascii") is changed. This saves quite a 8649 few cycles during startup since the first call to 8650 setdefaultencoding() will initialize the codec registry and the 8651 encodings package. 8652 8653- socket: Support for size hint in readlines() method of object returned 8654 by makefile(). 8655 8656- sre: Added experimental expand() method to match objects. Does not 8657 use buffer interface on Unicode strings. Does not hang if group id 8658 is followed by whitespace. 8659 8660- StringIO: Size hint in readlines() is now supported as documented. 8661 8662- struct: Check ranges for bytes and shorts. 8663 8664- urllib: Improved handling of win32 proxy settings. Fixed quote and 8665 quote_plus functions so that the always encode a comma. 8666 8667- Tkinter: Image objects are now guaranteed to have unique ids. Set 8668 event.delta to zero if Tk version doesn't support mousewheel. 8669 Removed some debugging prints. 8670 8671- UserList: now implements __contains__(). 8672 8673- webbrowser: On Windows, use os.startfile() instead of os.popen(), 8674 which works around a bug in Norton AntiVirus 2000 that leads directly 8675 to a Blue Screen freeze. 8676 8677- xml: New version detection code allows PyXML to override standard 8678 XML package if PyXML version is greater than 0.6.1. 8679 8680- xml.dom: DOM level 1 support for basic XML. Includes xml.dom.minidom 8681 (conventional DOM), and xml.dom.pulldom, which allows building the DOM 8682 tree only for nodes which are sufficiently interesting to a specific 8683 application. Does not provide the HTML-specific extensions. Still 8684 undocumented. 8685 8686- xml.sax: SAX 2 support for Python, including all the handler 8687 interfaces needed to process XML 1.0 compliant XML. Some 8688 documentation is already available. 8689 8690- pyexpat: Renamed to xml.parsers.expat since this is part of the new, 8691 packagized XML support. 8692 8693 8694C API 8695 8696- Add three new convenience functions for module initialization -- 8697 PyModule_AddObject(), PyModule_AddIntConstant(), and 8698 PyModule_AddStringConstant(). 8699 8700- Cleaned up definition of NULL in C source code; all definitions were 8701 removed and add #error to Python.h if NULL isn't defined after 8702 #include of stdio.h. 8703 8704- Py_PROTO() macros that were removed in 2.0b1 have been restored for 8705 backwards compatibility (at the source level) with old extensions. 8706 8707- A wrapper API was added for signal() and sigaction(). Instead of 8708 either function, always use PyOS_getsig() to get a signal handler 8709 and PyOS_setsig() to set one. A new convenience typedef 8710 PyOS_sighandler_t is defined for the type of signal handlers. 8711 8712- Add PyString_AsStringAndSize() function that provides access to the 8713 internal data buffer and size of a string object -- or the default 8714 encoded version of a Unicode object. 8715 8716- PyString_Size() and PyString_AsString() accept Unicode objects. 8717 8718- The standard header <limits.h> is now included by Python.h (if it 8719 exists). INT_MAX and LONG_MAX will always be defined, even if 8720 <limits.h> is not available. 8721 8722- PyFloat_FromString takes a second argument, pend, that was 8723 effectively useless. It is now officially useless but preserved for 8724 backwards compatibility. If the pend argument is not NULL, *pend is 8725 set to NULL. 8726 8727- PyObject_GetAttr() and PyObject_SetAttr() now accept Unicode objects 8728 for the attribute name. See note on getattr() above. 8729 8730- A few bug fixes to argument processing for Unicode. 8731 PyArg_ParseTupleAndKeywords() now accepts "es#" and "es". 8732 PyArg_Parse() special cases "s#" for Unicode objects; it returns a 8733 pointer to the default encoded string data instead of to the raw 8734 UTF-16. 8735 8736- Py_BuildValue accepts B format (for bgen-generated code). 8737 8738 8739Internals 8740 8741- On Unix, fix code for finding Python installation directory so that 8742 it works when argv[0] is a relative path. 8743 8744- Added a true unicode_internal_encode() function and fixed the 8745 unicode_internal_decode function() to support Unicode objects directly 8746 rather than by generating a copy of the object. 8747 8748- Several of the internal Unicode tables are much smaller now, and 8749 the source code should be much friendlier to weaker compilers. 8750 8751- In the garbage collector: Fixed bug in collection of tuples. Fixed 8752 bug that caused some instances to be removed from the container set 8753 while they were still live. Fixed parsing in gc.set_debug() for 8754 platforms where sizeof(long) > sizeof(int). 8755 8756- Fixed refcount problem in instance deallocation that only occurred 8757 when Py_REF_DEBUG was defined and Py_TRACE_REFS was not. 8758 8759- On Windows, getpythonregpath is now protected against null data in 8760 registry key. 8761 8762- On Unix, create .pyc/.pyo files with O_EXCL flag to avoid a race 8763 condition. 8764 8765 8766Build and platform-specific issues 8767 8768- Better support of GNU Pth via --with-pth configure option. 8769 8770- Python/C API now properly exposed to dynamically-loaded extension 8771 modules on Reliant UNIX. 8772 8773- Changes for the benefit of SunOS 4.1.4 (really!). mmapmodule.c: 8774 Don't define MS_SYNC to be zero when it is undefined. Added missing 8775 prototypes in posixmodule.c. 8776 8777- Improved support for HP-UX build. Threads should now be correctly 8778 configured (on HP-UX 10.20 and 11.00). 8779 8780- Fix largefile support on older NetBSD systems and OpenBSD by adding 8781 define for TELL64. 8782 8783 8784Tools and other miscellany 8785 8786- ftpmirror: Call to main() is wrapped in if __name__ == "__main__". 8787 8788- freeze: The modulefinder now works with 2.0 opcodes. 8789 8790- IDLE: 8791 Move hackery of sys.argv until after the Tk instance has been 8792 created, which allows the application-specific Tkinter 8793 initialization to be executed if present; also pass an explicit 8794 className parameter to the Tk() constructor. 8795 8796 8797What's new in 2.0 beta 1? 8798========================= 8799 8800Source Incompatibilities 8801------------------------ 8802 8803None. Note that 1.6 introduced several incompatibilities with 1.5.2, 8804such as single-argument append(), connect() and bind(), and changes to 8805str(long) and repr(float). 8806 8807 8808Binary Incompatibilities 8809------------------------ 8810 8811- Third party extensions built for Python 1.5.x or 1.6 cannot be used 8812with Python 2.0; these extensions will have to be rebuilt for Python 88132.0. 8814 8815- On Windows, attempting to import a third party extension built for 8816Python 1.5.x or 1.6 results in an immediate crash; there's not much we 8817can do about this. Check your PYTHONPATH environment variable! 8818 8819- Python bytecode files (*.pyc and *.pyo) are not compatible between 8820releases. 8821 8822 8823Overview of Changes Since 1.6 8824----------------------------- 8825 8826There are many new modules (including brand new XML support through 8827the xml package, and i18n support through the gettext module); a list 8828of all new modules is included below. Lots of bugs have been fixed. 8829 8830The process for making major new changes to the language has changed 8831since Python 1.6. Enhancements must now be documented by a Python 8832Enhancement Proposal (PEP) before they can be accepted. 8833 8834There are several important syntax enhancements, described in more 8835detail below: 8836 8837 - Augmented assignment, e.g. x += 1 8838 8839 - List comprehensions, e.g. [x**2 for x in range(10)] 8840 8841 - Extended import statement, e.g. import Module as Name 8842 8843 - Extended print statement, e.g. print >> file, "Hello" 8844 8845Other important changes: 8846 8847 - Optional collection of cyclical garbage 8848 8849Python Enhancement Proposal (PEP) 8850--------------------------------- 8851 8852PEP stands for Python Enhancement Proposal. A PEP is a design 8853document providing information to the Python community, or describing 8854a new feature for Python. The PEP should provide a concise technical 8855specification of the feature and a rationale for the feature. 8856 8857We intend PEPs to be the primary mechanisms for proposing new 8858features, for collecting community input on an issue, and for 8859documenting the design decisions that have gone into Python. The PEP 8860author is responsible for building consensus within the community and 8861documenting dissenting opinions. 8862 8863The PEPs are available at http://python.sourceforge.net/peps/. 8864 8865Augmented Assignment 8866-------------------- 8867 8868This must have been the most-requested feature of the past years! 8869Eleven new assignment operators were added: 8870 8871 += -= *= /= %= **= <<= >>= &= ^= |= 8872 8873For example, 8874 8875 A += B 8876 8877is similar to 8878 8879 A = A + B 8880 8881except that A is evaluated only once (relevant when A is something 8882like dict[index].attr). 8883 8884However, if A is a mutable object, A may be modified in place. Thus, 8885if A is a number or a string, A += B has the same effect as A = A+B 8886(except A is only evaluated once); but if a is a list, A += B has the 8887same effect as A.extend(B)! 8888 8889Classes and built-in object types can override the new operators in 8890order to implement the in-place behavior; the not-in-place behavior is 8891used automatically as a fallback when an object doesn't implement the 8892in-place behavior. For classes, the method name is derived from the 8893method name for the corresponding not-in-place operator by inserting 8894an 'i' in front of the name, e.g. __iadd__ implements in-place 8895__add__. 8896 8897Augmented assignment was implemented by Thomas Wouters. 8898 8899 8900List Comprehensions 8901------------------- 8902 8903This is a flexible new notation for lists whose elements are computed 8904from another list (or lists). The simplest form is: 8905 8906 [<expression> for <variable> in <sequence>] 8907 8908For example, [i**2 for i in range(4)] yields the list [0, 1, 4, 9]. 8909This is more efficient than a for loop with a list.append() call. 8910 8911You can also add a condition: 8912 8913 [<expression> for <variable> in <sequence> if <condition>] 8914 8915For example, [w for w in words if w == w.lower()] would yield the list 8916of words that contain no uppercase characters. This is more efficient 8917than a for loop with an if statement and a list.append() call. 8918 8919You can also have nested for loops and more than one 'if' clause. For 8920example, here's a function that flattens a sequence of sequences:: 8921 8922 def flatten(seq): 8923 return [x for subseq in seq for x in subseq] 8924 8925 flatten([[0], [1,2,3], [4,5], [6,7,8,9], []]) 8926 8927This prints 8928 8929 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 8930 8931List comprehensions originated as a patch set from Greg Ewing; Skip 8932Montanaro and Thomas Wouters also contributed. Described by PEP 202. 8933 8934 8935Extended Import Statement 8936------------------------- 8937 8938Many people have asked for a way to import a module under a different 8939name. This can be accomplished like this: 8940 8941 import foo 8942 bar = foo 8943 del foo 8944 8945but this common idiom gets old quickly. A simple extension of the 8946import statement now allows this to be written as follows: 8947 8948 import foo as bar 8949 8950There's also a variant for 'from ... import': 8951 8952 from foo import bar as spam 8953 8954This also works with packages; e.g. you can write this: 8955 8956 import test.regrtest as regrtest 8957 8958Note that 'as' is not a new keyword -- it is recognized only in this 8959context (this is only possible because the syntax for the import 8960statement doesn't involve expressions). 8961 8962Implemented by Thomas Wouters. Described by PEP 221. 8963 8964 8965Extended Print Statement 8966------------------------ 8967 8968Easily the most controversial new feature, this extension to the print 8969statement adds an option to make the output go to a different file 8970than the default sys.stdout. 8971 8972For example, to write an error message to sys.stderr, you can now 8973write: 8974 8975 print >> sys.stderr, "Error: bad dog!" 8976 8977As a special feature, if the expression used to indicate the file 8978evaluates to None, the current value of sys.stdout is used. Thus: 8979 8980 print >> None, "Hello world" 8981 8982is equivalent to 8983 8984 print "Hello world" 8985 8986Design and implementation by Barry Warsaw. Described by PEP 214. 8987 8988 8989Optional Collection of Cyclical Garbage 8990--------------------------------------- 8991 8992Python is now equipped with a garbage collector that can hunt down 8993cyclical references between Python objects. It's no replacement for 8994reference counting; in fact, it depends on the reference counts being 8995correct, and decides that a set of objects belong to a cycle if all 8996their reference counts can be accounted for from their references to 8997each other. This devious scheme was first proposed by Eric Tiedemann, 8998and brought to implementation by Neil Schemenauer. 8999 9000There's a module "gc" that lets you control some parameters of the 9001garbage collection. There's also an option to the configure script 9002that lets you enable or disable the garbage collection. In 2.0b1, 9003it's on by default, so that we (hopefully) can collect decent user 9004experience with this new feature. There are some questions about its 9005performance. If it proves to be too much of a problem, we'll turn it 9006off by default in the final 2.0 release. 9007 9008 9009Smaller Changes 9010--------------- 9011 9012A new function zip() was added. zip(seq1, seq2, ...) is equivalent to 9013map(None, seq1, seq2, ...) when the sequences have the same length; 9014i.e. zip([1,2,3], [10,20,30]) returns [(1,10), (2,20), (3,30)]. When 9015the lists are not all the same length, the shortest list wins: 9016zip([1,2,3], [10,20]) returns [(1,10), (2,20)]. See PEP 201. 9017 9018sys.version_info is a tuple (major, minor, micro, level, serial). 9019 9020Dictionaries have an odd new method, setdefault(key, default). 9021dict.setdefault(key, default) returns dict[key] if it exists; if not, 9022it sets dict[key] to default and returns that value. Thus: 9023 9024 dict.setdefault(key, []).append(item) 9025 9026does the same work as this common idiom: 9027 9028 if not dict.has_key(key): 9029 dict[key] = [] 9030 dict[key].append(item) 9031 9032There are two new variants of SyntaxError that are raised for 9033indentation-related errors: IndentationError and TabError. 9034 9035Changed \x to consume exactly two hex digits; see PEP 223. Added \U 9036escape that consumes exactly eight hex digits. 9037 9038The limits on the size of expressions and file in Python source code 9039have been raised from 2**16 to 2**32. Previous versions of Python 9040were limited because the maximum argument size the Python VM accepted 9041was 2**16. This limited the size of object constructor expressions, 9042e.g. [1,2,3] or {'a':1, 'b':2}, and the size of source files. This 9043limit was raised thanks to a patch by Charles Waldman that effectively 9044fixes the problem. It is now much more likely that you will be 9045limited by available memory than by an arbitrary limit in Python. 9046 9047The interpreter's maximum recursion depth can be modified by Python 9048programs using sys.getrecursionlimit and sys.setrecursionlimit. This 9049limit is the maximum number of recursive calls that can be made by 9050Python code. The limit exists to prevent infinite recursion from 9051overflowing the C stack and causing a core dump. The default value is 90521000. The maximum safe value for a particular platform can be found 9053by running Tools/scripts/find_recursionlimit.py. 9054 9055New Modules and Packages 9056------------------------ 9057 9058atexit - for registering functions to be called when Python exits. 9059 9060imputil - Greg Stein's alternative API for writing custom import 9061hooks. 9062 9063pyexpat - an interface to the Expat XML parser, contributed by Paul 9064Prescod. 9065 9066xml - a new package with XML support code organized (so far) in three 9067subpackages: xml.dom, xml.sax, and xml.parsers. Describing these 9068would fill a volume. There's a special feature whereby a 9069user-installed package named _xmlplus overrides the standard 9070xmlpackage; this is intended to give the XML SIG a hook to distribute 9071backwards-compatible updates to the standard xml package. 9072 9073webbrowser - a platform-independent API to launch a web browser. 9074 9075 9076Changed Modules 9077--------------- 9078 9079array -- new methods for array objects: count, extend, index, pop, and 9080remove 9081 9082binascii -- new functions b2a_hex and a2b_hex that convert between 9083binary data and its hex representation 9084 9085calendar -- Many new functions that support features including control 9086over which day of the week is the first day, returning strings instead 9087of printing them. Also new symbolic constants for days of week, 9088e.g. MONDAY, ..., SUNDAY. 9089 9090cgi -- FieldStorage objects have a getvalue method that works like a 9091dictionary's get method and returns the value attribute of the object. 9092 9093ConfigParser -- The parser object has new methods has_option, 9094remove_section, remove_option, set, and write. They allow the module 9095to be used for writing config files as well as reading them. 9096 9097ftplib -- ntransfercmd(), transfercmd(), and retrbinary() all now 9098optionally support the RFC 959 REST command. 9099 9100gzip -- readline and readlines now accept optional size arguments 9101 9102httplib -- New interfaces and support for HTTP/1.1 by Greg Stein. See 9103the module doc strings for details. 9104 9105locale -- implement getdefaultlocale for Win32 and Macintosh 9106 9107marshal -- no longer dumps core when marshaling deeply nested or 9108recursive data structures 9109 9110os -- new functions isatty, seteuid, setegid, setreuid, setregid 9111 9112os/popen2 -- popen2/popen3/popen4 support under Windows. popen2/popen3 9113support under Unix. 9114 9115os/pty -- support for openpty and forkpty 9116 9117os.path -- fix semantics of os.path.commonprefix 9118 9119smtplib -- support for sending very long messages 9120 9121socket -- new function getfqdn() 9122 9123readline -- new functions to read, write and truncate history files. 9124The readline section of the library reference manual contains an 9125example. 9126 9127select -- add interface to poll system call 9128 9129shutil -- new copyfileobj function 9130 9131SimpleHTTPServer, CGIHTTPServer -- Fix problems with buffering in the 9132HTTP server. 9133 9134Tkinter -- optimization of function flatten 9135 9136urllib -- scans environment variables for proxy configuration, 9137e.g. http_proxy. 9138 9139whichdb -- recognizes dumbdbm format 9140 9141 9142Obsolete Modules 9143---------------- 9144 9145None. However note that 1.6 made a whole slew of modules obsolete: 9146stdwin, soundex, cml, cmpcache, dircache, dump, find, grep, packmail, 9147poly, zmod, strop, util, whatsound. 9148 9149 9150Changed, New, Obsolete Tools 9151---------------------------- 9152 9153None. 9154 9155 9156C-level Changes 9157--------------- 9158 9159Several cleanup jobs were carried out throughout the source code. 9160 9161All C code was converted to ANSI C; we got rid of all uses of the 9162Py_PROTO() macro, which makes the header files a lot more readable. 9163 9164Most of the portability hacks were moved to a new header file, 9165pyport.h; several other new header files were added and some old 9166header files were removed, in an attempt to create a more rational set 9167of header files. (Few of these ever need to be included explicitly; 9168they are all included by Python.h.) 9169 9170Trent Mick ensured portability to 64-bit platforms, under both Linux 9171and Win64, especially for the new Intel Itanium processor. Mick also 9172added large file support for Linux64 and Win64. 9173 9174The C APIs to return an object's size have been update to consistently 9175use the form PyXXX_Size, e.g. PySequence_Size and PyDict_Size. In 9176previous versions, the abstract interfaces used PyXXX_Length and the 9177concrete interfaces used PyXXX_Size. The old names, 9178e.g. PyObject_Length, are still available for backwards compatibility 9179at the API level, but are deprecated. 9180 9181The PyOS_CheckStack function has been implemented on Windows by 9182Fredrik Lundh. It prevents Python from failing with a stack overflow 9183on Windows. 9184 9185The GC changes resulted in creation of two new slots on object, 9186tp_traverse and tp_clear. The augmented assignment changes result in 9187the creation of a new slot for each in-place operator. 9188 9189The GC API creates new requirements for container types implemented in 9190C extension modules. See Include/objimpl.h for details. 9191 9192PyErr_Format has been updated to automatically calculate the size of 9193the buffer needed to hold the formatted result string. This change 9194prevents crashes caused by programmer error. 9195 9196New C API calls: PyObject_AsFileDescriptor, PyErr_WriteUnraisable. 9197 9198PyRun_AnyFileEx, PyRun_SimpleFileEx, PyRun_FileEx -- New functions 9199that are the same as their non-Ex counterparts except they take an 9200extra flag argument that tells them to close the file when done. 9201 9202XXX There were other API changes that should be fleshed out here. 9203 9204 9205Windows Changes 9206--------------- 9207 9208New popen2/popen3/peopen4 in os module (see Changed Modules above). 9209 9210os.popen is much more usable on Windows 95 and 98. See Microsoft 9211Knowledge Base article Q150956. The Win9x workaround described there 9212is implemented by the new w9xpopen.exe helper in the root of your 9213Python installation. Note that Python uses this internally; it is not 9214a standalone program. 9215 9216Administrator privileges are no longer required to install Python 9217on Windows NT or Windows 2000. If you have administrator privileges, 9218Python's registry info will be written under HKEY_LOCAL_MACHINE. 9219Otherwise the installer backs off to writing Python's registry info 9220under HKEY_CURRENT_USER. The latter is sufficient for all "normal" 9221uses of Python, but will prevent some advanced uses from working 9222(for example, running a Python script as an NT service, or possibly 9223from CGI). 9224 9225[This was new in 1.6] The installer no longer runs a separate Tcl/Tk 9226installer; instead, it installs the needed Tcl/Tk files directly in the 9227Python directory. If you already have a Tcl/Tk installation, this 9228wastes some disk space (about 4 Megs) but avoids problems with 9229conflicting Tcl/Tk installations, and makes it much easier for Python 9230to ensure that Tcl/Tk can find all its files. 9231 9232[This was new in 1.6] The Windows installer now installs by default in 9233\Python20\ on the default volume, instead of \Program Files\Python-2.0\. 9234 9235 9236Updates to the changes between 1.5.2 and 1.6 9237-------------------------------------------- 9238 9239The 1.6 NEWS file can't be changed after the release is done, so here 9240is some late-breaking news: 9241 9242New APIs in locale.py: normalize(), getdefaultlocale(), resetlocale(), 9243and changes to getlocale() and setlocale(). 9244 9245The new module is now enabled per default. 9246 9247It is not true that the encodings codecs cannot be used for normal 9248strings: the string.encode() (which is also present on 8-bit strings 9249!) allows using them for 8-bit strings too, e.g. to convert files from 9250cp1252 (Windows) to latin-1 or vice-versa. 9251 9252Japanese codecs are available from Tamito KAJIYAMA: 9253http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/python/ 9254 9255 9256====================================================================== 9257 9258 9259======================================= 9260==> Release 1.6 (September 5, 2000) <== 9261======================================= 9262 9263What's new in release 1.6? 9264========================== 9265 9266Below is a list of all relevant changes since release 1.5.2. 9267 9268 9269Source Incompatibilities 9270------------------------ 9271 9272Several small incompatible library changes may trip you up: 9273 9274 - The append() method for lists can no longer be invoked with more 9275 than one argument. This used to append a single tuple made out of 9276 all arguments, but was undocumented. To append a tuple, use 9277 e.g. l.append((a, b, c)). 9278 9279 - The connect(), connect_ex() and bind() methods for sockets require 9280 exactly one argument. Previously, you could call s.connect(host, 9281 port), but this was undocumented. You must now write 9282 s.connect((host, port)). 9283 9284 - The str() and repr() functions are now different more often. For 9285 long integers, str() no longer appends a 'L'. Thus, str(1L) == '1', 9286 which used to be '1L'; repr(1L) is unchanged and still returns '1L'. 9287 For floats, repr() now gives 17 digits of precision, to ensure no 9288 precision is lost (on all current hardware). 9289 9290 - The -X option is gone. Built-in exceptions are now always 9291 classes. Many more library modules also have been converted to 9292 class-based exceptions. 9293 9294 9295Binary Incompatibilities 9296------------------------ 9297 9298- Third party extensions built for Python 1.5.x cannot be used with 9299Python 1.6; these extensions will have to be rebuilt for Python 1.6. 9300 9301- On Windows, attempting to import a third party extension built for 9302Python 1.5.x results in an immediate crash; there's not much we can do 9303about this. Check your PYTHONPATH environment variable! 9304 9305 9306Overview of Changes since 1.5.2 9307------------------------------- 9308 9309For this overview, I have borrowed from the document "What's New in 9310Python 2.0" by Andrew Kuchling and Moshe Zadka: 9311http://www.amk.ca/python/2.0/ . 9312 9313There are lots of new modules and lots of bugs have been fixed. A 9314list of all new modules is included below. 9315 9316Probably the most pervasive change is the addition of Unicode support. 9317We've added a new fundamental datatype, the Unicode string, a new 9318built-in function unicode(), a numerous C APIs to deal with Unicode 9319and encodings. See the file Misc/unicode.txt for details, or 9320http://starship.python.net/crew/lemburg/unicode-proposal.txt. 9321 9322Two other big changes, related to the Unicode support, are the 9323addition of string methods and (yet another) new regular expression 9324engine. 9325 9326 - String methods mean that you can now say s.lower() etc. instead of 9327 importing the string module and saying string.lower(s) etc. One 9328 peculiarity is that the equivalent of string.join(sequence, 9329 delimiter) is delimiter.join(sequence). Use " ".join(sequence) for 9330 the effect of string.join(sequence); to make this more readable, try 9331 space=" " first. Note that the maxsplit argument defaults in 9332 split() and replace() have changed from 0 to -1. 9333 9334 - The new regular expression engine, SRE by Fredrik Lundh, is fully 9335 backwards compatible with the old engine, and is in fact invoked 9336 using the same interface (the "re" module). You can explicitly 9337 invoke the old engine by import pre, or the SRE engine by importing 9338 sre. SRE is faster than pre, and supports Unicode (which was the 9339 main reason to put effort in yet another new regular expression 9340 engine -- this is at least the fourth!). 9341 9342 9343Other Changes 9344------------- 9345 9346Other changes that won't break code but are nice to know about: 9347 9348Deleting objects is now safe even for deeply nested data structures. 9349 9350Long/int unifications: long integers can be used in seek() calls, as 9351slice indexes. 9352 9353String formatting (s % args) has a new formatting option, '%r', which 9354acts like '%s' but inserts repr(arg) instead of str(arg). (Not yet in 9355alpha 1.) 9356 9357Greg Ward's "distutils" package is included: this will make 9358installing, building and distributing third party packages much 9359simpler. 9360 9361There's now special syntax that you can use instead of the apply() 9362function. f(*args, **kwds) is equivalent to apply(f, args, kwds). 9363You can also use variations f(a1, a2, *args, **kwds) and you can leave 9364one or the other out: f(*args), f(**kwds). 9365 9366The built-ins int() and long() take an optional second argument to 9367indicate the conversion base -- of course only if the first argument 9368is a string. This makes string.atoi() and string.atol() obsolete. 9369(string.atof() was already obsolete). 9370 9371When a local variable is known to the compiler but undefined when 9372used, a new exception UnboundLocalError is raised. This is a class 9373derived from NameError so code catching NameError should still work. 9374The purpose is to provide better diagnostics in the following example: 9375 x = 1 9376 def f(): 9377 print x 9378 x = x+1 9379This used to raise a NameError on the print statement, which confused 9380even experienced Python programmers (especially if there are several 9381hundreds of lines of code between the reference and the assignment to 9382x :-). 9383 9384You can now override the 'in' operator by defining a __contains__ 9385method. Note that it has its arguments backwards: x in a causes 9386a.__contains__(x) to be called. That's why the name isn't __in__. 9387 9388The exception AttributeError will have a more friendly error message, 9389e.g.: <code>'Spam' instance has no attribute 'eggs'</code>. This may 9390<b>break code</b> that expects the message to be exactly the attribute 9391name. 9392 9393 9394New Modules in 1.6 9395------------------ 9396 9397UserString - base class for deriving from the string type. 9398 9399distutils - tools for distributing Python modules. 9400 9401robotparser - parse a robots.txt file, for writing web spiders. 9402(Moved from Tools/webchecker/.) 9403 9404linuxaudiodev - audio for Linux. 9405 9406mmap - treat a file as a memory buffer. (Windows and Unix.) 9407 9408sre - regular expressions (fast, supports unicode). Currently, this 9409code is very rough. Eventually, the re module will be reimplemented 9410using sre (without changes to the re API). 9411 9412filecmp - supersedes the old cmp.py and dircmp.py modules. 9413 9414tabnanny - check Python sources for tab-width dependance. (Moved from 9415Tools/scripts/.) 9416 9417urllib2 - new and improved but incompatible version of urllib (still 9418experimental). 9419 9420zipfile - read and write zip archives. 9421 9422codecs - support for Unicode encoders/decoders. 9423 9424unicodedata - provides access to the Unicode 3.0 database. 9425 9426_winreg - Windows registry access. 9427 9428encodings - package which provides a large set of standard codecs -- 9429currently only for the new Unicode support. It has a drop-in extension 9430mechanism which allows you to add new codecs by simply copying them 9431into the encodings package directory. Asian codec support will 9432probably be made available as separate distribution package built upon 9433this technique and the new distutils package. 9434 9435 9436Changed Modules 9437--------------- 9438 9439readline, ConfigParser, cgi, calendar, posix, readline, xmllib, aifc, 9440chunk, wave, random, shelve, nntplib - minor enhancements. 9441 9442socket, httplib, urllib - optional OpenSSL support (Unix only). 9443 9444_tkinter - support for 8.0 up to 8.3. Support for versions older than 94458.0 has been dropped. 9446 9447string - most of this module is deprecated now that strings have 9448methods. This no longer uses the built-in strop module, but takes 9449advantage of the new string methods to provide transparent support for 9450both Unicode and ordinary strings. 9451 9452 9453Changes on Windows 9454------------------ 9455 9456The installer no longer runs a separate Tcl/Tk installer; instead, it 9457installs the needed Tcl/Tk files directly in the Python directory. If 9458you already have a Tcl/Tk installation, this wastes some disk space 9459(about 4 Megs) but avoids problems with conflincting Tcl/Tk 9460installations, and makes it much easier for Python to ensure that 9461Tcl/Tk can find all its files. Note: the alpha installers don't 9462include the documentation. 9463 9464The Windows installer now installs by default in \Python16\ on the 9465default volume, instead of \Program Files\Python-1.6\. 9466 9467 9468Changed Tools 9469------------- 9470 9471IDLE - complete overhaul. See the <a href="../idle/">IDLE home 9472page</a> for more information. (Python 1.6 alpha 1 will come with 9473IDLE 0.6.) 9474 9475Tools/i18n/pygettext.py - Python equivalent of xgettext(1). A message 9476text extraction tool used for internationalizing applications written 9477in Python. 9478 9479 9480Obsolete Modules 9481---------------- 9482 9483stdwin and everything that uses it. (Get Python 1.5.2 if you need 9484it. :-) 9485 9486soundex. (Skip Montanaro has a version in Python but it won't be 9487included in the Python release.) 9488 9489cmp, cmpcache, dircmp. (Replaced by filecmp.) 9490 9491dump. (Use pickle.) 9492 9493find. (Easily coded using os.walk().) 9494 9495grep. (Not very useful as a library module.) 9496 9497packmail. (No longer has any use.) 9498 9499poly, zmod. (These were poor examples at best.) 9500 9501strop. (No longer needed by the string module.) 9502 9503util. (This functionality was long ago built in elsewhere). 9504 9505whatsound. (Use sndhdr.) 9506 9507 9508Detailed Changes from 1.6b1 to 1.6 9509---------------------------------- 9510 9511- Slight changes to the CNRI license. A copyright notice has been 9512added; the requirement to indicate the nature of modifications now 9513applies when making a derivative work available "to others" instead of 9514just "to the public"; the version and date are updated. The new 9515license has a new handle. 9516 9517- Added the Tools/compiler package. This is a project led by Jeremy 9518Hylton to write the Python bytecode generator in Python. 9519 9520- The function math.rint() is removed. 9521 9522- In Python.h, "#define _GNU_SOURCE 1" was added. 9523 9524- Version 0.9.1 of Greg Ward's distutils is included (instead of 9525version 0.9). 9526 9527- A new version of SRE is included. It is more stable, and more 9528compatible with the old RE module. Non-matching ranges are indicated 9529by -1, not None. (The documentation said None, but the PRE 9530implementation used -1; changing to None would break existing code.) 9531 9532- The winreg module has been renamed to _winreg. (There are plans for 9533a higher-level API called winreg, but this has not yet materialized in 9534a form that is acceptable to the experts.) 9535 9536- The _locale module is enabled by default. 9537 9538- Fixed the configuration line for the _curses module. 9539 9540- A few crashes have been fixed, notably <file>.writelines() with a 9541list containing non-string objects would crash, and there were 9542situations where a lost SyntaxError could dump core. 9543 9544- The <list>.extend() method now accepts an arbitrary sequence 9545argument. 9546 9547- If __str__() or __repr__() returns a Unicode object, this is 9548converted to an 8-bit string. 9549 9550- Unicode string comparisons is no longer aware of UTF-16 9551encoding peculiarities; it's a straight 16-bit compare. 9552 9553- The Windows installer now installs the LICENSE file and no longer 9554registers the Python DLL version in the registry (this is no longer 9555needed). It now uses Tcl/Tk 8.3.2. 9556 9557- A few portability problems have been fixed, in particular a 9558compilation error involving socklen_t. 9559 9560- The PC configuration is slightly friendlier to non-Microsoft 9561compilers. 9562 9563 9564====================================================================== 9565 9566 9567====================================== 9568==> Release 1.5.2 (April 13, 1999) <== 9569====================================== 9570 9571From 1.5.2c1 to 1.5.2 (final) 9572============================= 9573 9574Tue Apr 13 15:44:49 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9575 9576 * PCbuild/python15.wse: Bump version to 1.5.2 (final) 9577 9578 * PCbuild/python15.dsp: Added shamodule.c 9579 9580 * PC/config.c: Added sha module! 9581 9582 * README, Include/patchlevel.h: Prepare for final release. 9583 9584 * Misc/ACKS: 9585 More (Cameron Laird is honorary; the others are 1.5.2c1 testers). 9586 9587 * Python/thread_solaris.h: 9588 While I can't really test this thoroughly, Pat Knight and the Solaris 9589 man pages suggest that the proper thing to do is to add THR_NEW_LWP to 9590 the flags on thr_create(), and that there really isn't a downside, so 9591 I'll do that. 9592 9593 * Misc/ACKS: 9594 Bunch of new names who helped iron out the last wrinkles of 1.5.2. 9595 9596 * PC/python_nt.rc: 9597 Bump the myusterious M$ version number from 1,5,2,1 to 1,5,2,3. 9598 (I can't even display this on NT, maybe Win/98 can?) 9599 9600 * Lib/pstats.py: 9601 Fix mysterious references to jprofile that were in the source since 9602 its creation. I'm assuming these were once valid references to "Jim 9603 Roskind's profile"... 9604 9605 * Lib/Attic/threading_api.py: 9606 Removed; since long subsumed in Doc/lib/libthreading.tex 9607 9608 * Modules/socketmodule.c: 9609 Put back __osf__ support for gethostbyname_r(); the real bug was that 9610 it was being used even without threads. This of course might be an 9611 all-platform problem so now we only use the _r variant when we are 9612 using threads. 9613 9614Mon Apr 12 22:51:20 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9615 9616 * Modules/cPickle.c: 9617 Fix accidentally reversed NULL test in load_mark(). Suggested by 9618 Tamito Kajiyama. (This caused a bug only on platforms where malloc(0) 9619 returns NULL.) 9620 9621 * README: 9622 Add note about popen2 problem on Linux noticed by Pablo Bleyer. 9623 9624 * README: Add note about -D_REENTRANT for HP-UX 10.20. 9625 9626 * Modules/Makefile.pre.in: 'clean' target should remove hassignal. 9627 9628 * PC/Attic/vc40.mak, PC/readme.txt: 9629 Remove all VC++ info (except VC 1.5) from readme.txt; 9630 remove the VC++ 4.0 project file; remove the unused _tkinter extern defs. 9631 9632 * README: Clarify PC build instructions (point to PCbuild). 9633 9634 * Modules/zlibmodule.c: Cast added by Jack Jansen (for Mac port). 9635 9636 * Lib/plat-sunos5/CDIO.py, Lib/plat-linux2/CDROM.py: 9637 Forgot to add this file. CDROM device parameters. 9638 9639 * Lib/gzip.py: Two different changes. 9640 9641 1. Jack Jansen reports that on the Mac, the time may be negative, and 9642 solves this by adding a write32u() function that writes an unsigned 9643 long. 9644 9645 2. On 64-bit platforms the CRC comparison fails; I've fixed this by 9646 casting both values to be compared to "unsigned long" i.e. modulo 9647 0x100000000L. 9648 9649Sat Apr 10 18:42:02 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9650 9651 * PC/Attic/_tkinter.def: No longer needed. 9652 9653 * Misc/ACKS: Correct missed character in Andrew Dalke's name. 9654 9655 * README: Add DEC Ultrix notes (from Donn Cave's email). 9656 9657 * configure: The usual 9658 9659 * configure.in: 9660 Quote a bunch of shell variables used in test, related to long-long. 9661 9662 * Objects/fileobject.c, Modules/shamodule.c, Modules/regexpr.c: 9663 casts for picky compilers. 9664 9665 * Modules/socketmodule.c: 9666 3-arg gethostbyname_r doesn't really work on OSF/1. 9667 9668 * PC/vc15_w31/_.c, PC/vc15_lib/_.c, Tools/pynche/__init__.py: 9669 Avoid totally empty files. 9670 9671Fri Apr 9 14:56:35 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9672 9673 * Tools/scripts/fixps.py: Use re instead of regex. 9674 Don't rewrite the file in place. 9675 (Reported by Andy Dustman.) 9676 9677 * Lib/netrc.py, Lib/shlex.py: Get rid of #! line 9678 9679Thu Apr 8 23:13:37 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9680 9681 * PCbuild/python15.wse: Use the Tcl 8.0.5 installer. 9682 Add a variable %_TCL_% that makes it easier to switch to a different version. 9683 9684 9685====================================================================== 9686 9687 9688From 1.5.2b2 to 1.5.2c1 9689======================= 9690 9691Thu Apr 8 23:13:37 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9692 9693 * PCbuild/python15.wse: 9694 Release 1.5.2c1. Add IDLE and Uninstall to program group. 9695 Don't distribute zlib.dll. Tweak some comments. 9696 9697 * PCbuild/zlib.dsp: Now using static zlib 1.1.3 9698 9699 * 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: 9700 The usual 9701 9702 * Include/patchlevel.h: Release 1.5.2c1 9703 9704 * README: Release 1.5.2c1. 9705 9706 * Misc/NEWS: News for the 1.5.2c1 release. 9707 9708 * Lib/test/test_strftime.py: 9709 On Windows, we suddenly find, strftime() may return "" for an 9710 unsupported format string. (I guess this is because the logic for 9711 deciding whether to reallocate the buffer or not has been improved.) 9712 This caused the test code to crash on result[0]. Fix this by assuming 9713 an empty result also means the format is not supported. 9714 9715 * Demo/tkinter/matt/window-creation-w-location.py: 9716 This demo imported some private code from Matt. Make it cripple along. 9717 9718 * Lib/lib-tk/Tkinter.py: 9719 Delete an accidentally checked-in feature that actually broke more 9720 than was worth it: when deleting a canvas item, it would try to 9721 automatically delete the bindings for that item. Since there's 9722 nothing that says you can't reuse the tag and still have the bindings, 9723 this is not correct. Also, it broke at least one demo 9724 (Demo/tkinter/matt/rubber-band-box-demo-1.py). 9725 9726 * Python/thread_wince.h: Win/CE thread support by Mark Hammond. 9727 9728Wed Apr 7 20:23:17 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9729 9730 * Modules/zlibmodule.c: 9731 Patch by Andrew Kuchling to unflush() (flush() for deflating). 9732 Without this, if inflate() returned Z_BUF_ERROR asking for more output 9733 space, we would report the error; now, we increase the buffer size and 9734 try again, just as for Z_OK. 9735 9736 * Lib/test/test_gzip.py: Use binary mode for all gzip files we open. 9737 9738 * Tools/idle/ChangeLog: New change log. 9739 9740 * Tools/idle/README.txt, Tools/idle/NEWS.txt: New version. 9741 9742 * Python/pythonrun.c: 9743 Alas, get rid of the Win specific hack to ask the user to press Return 9744 before exiting when an error happened. This didn't work right when 9745 Python is invoked from a daemon. 9746 9747 * Tools/idle/idlever.py: Version bump awaiting impending new release. 9748 (Not much has changed :-( ) 9749 9750 * Lib/lib-tk/Tkinter.py: 9751 lower, tkraise/lift hide Misc.lower, Misc.tkraise/lift, 9752 so the preferred name for them is tag_lower, tag_raise 9753 (similar to tag_bind, and similar to the Text widget); 9754 unfortunately can't delete the old ones yet (maybe in 1.6) 9755 9756 * Python/thread.c, Python/strtod.c, Python/mystrtoul.c, Python/import.c, Python/ceval.c: 9757 Changes by Mark Hammond for Windows CE. Mostly of the form 9758 #ifdef DONT_HAVE_header_H ... #endif around #include <header.h>. 9759 9760 * Python/bltinmodule.c: 9761 Remove unused variable from complex_from_string() code. 9762 9763 * Include/patchlevel.h: 9764 Add the possibility of a gamma release (release candidate). 9765 Add '+' to string version number to indicate we're beyond b2 now. 9766 9767 * Modules/posixmodule.c: Add extern decl for fsync() for SunOS 4.x. 9768 9769 * Lib/smtplib.py: Changes by Per Cederquist and The Dragon. 9770 9771 Per writes: 9772 9773 """ 9774 The application where Signum Support uses smtplib needs to be able to 9775 report good error messages to the user when sending email fails. To 9776 help in diagnosing problems it is useful to be able to report the 9777 entire message sent by the server, not only the SMTP error code of the 9778 offending command. 9779 9780 A lot of the functions in sendmail.py unfortunately discards the 9781 message, leaving only the code. The enclosed patch fixes that 9782 problem. 9783 9784 The enclosed patch also introduces a base class for exceptions that 9785 include an SMTP error code and error message, and make the code and 9786 message available on separate attributes, so that surrounding code can 9787 deal with them in whatever way it sees fit. I've also added some 9788 documentation to the exception classes. 9789 9790 The constructor will now raise an exception if it cannot connect to 9791 the SMTP server. 9792 9793 The data() method will raise an SMTPDataError if it doesn't receive 9794 the expected 354 code in the middle of the exchange. 9795 9796 According to section 5.2.10 of RFC 1123 a smtp client must accept "any 9797 text, including no text at all" after the error code. If the response 9798 of a HELO command contains no text self.helo_resp will be set to the 9799 empty string (""). The patch fixes the test in the sendmail() method 9800 so that helo_resp is tested against None; if it has the empty string 9801 as value the sendmail() method would invoke the helo() method again. 9802 9803 The code no longer accepts a -1 reply from the ehlo() method in 9804 sendmail(). 9805 9806 [Text about removing SMTPRecipientsRefused deleted --GvR] 9807 """ 9808 9809 and also: 9810 9811 """ 9812 smtplib.py appends an extra blank line to the outgoing mail if the 9813 `msg' argument to the sendmail method already contains a trailing 9814 newline. This patch should fix the problem. 9815 """ 9816 9817 The Dragon writes: 9818 9819 """ 9820 Mostly I just re-added the SMTPRecipientsRefused exception 9821 (the exeption object now has the appropriate info in it ) [Per had 9822 removed this in his patch --GvR] and tweaked the behavior of the 9823 sendmail method whence it throws the newly added SMTPHeloException (it 9824 was closing the connection, which it shouldn't. whatever catches the 9825 exception should do that. ) 9826 9827 I pondered the change of the return values to tuples all around, 9828 and after some thinking I decided that regularizing the return values was 9829 too much of the Right Thing (tm) to not do. 9830 9831 My one concern is that code expecting an integer & getting a tuple 9832 may fail silently. 9833 9834 (i.e. if it's doing : 9835 9836 x.somemethod() >= 400: 9837 expecting an integer, the expression will always be true if it gets a 9838 tuple instead. ) 9839 9840 However, most smtplib code I've seen only really uses the 9841 sendmail() method, so this wouldn't bother it. Usually code I've seen 9842 that calls the other methods usually only calls helo() and ehlo() for 9843 doing ESMTP, a feature which was not in the smtplib included with 1.5.1, 9844 and thus I would think not much code uses it yet. 9845 """ 9846 9847Tue Apr 6 19:38:18 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9848 9849 * Lib/test/test_ntpath.py: 9850 Fix the tests now that splitdrive() no longer treats UNC paths special. 9851 (Some tests converted to splitunc() tests.) 9852 9853 * Lib/ntpath.py: 9854 Withdraw the UNC support from splitdrive(). Instead, a new function 9855 splitunc() parses UNC paths. The contributor of the UNC parsing in 9856 splitdrive() doesn't like it, but I haven't heard a good reason to 9857 keep it, and it causes some problems. (I think there's a 9858 philosophical problem -- to me, the split*() functions are purely 9859 syntactical, and the fact that \\foo is not a valid path doesn't mean 9860 that it shouldn't be considered an absolute path.) 9861 9862 Also (quite separately, but strangely related to the philosophical 9863 issue above) fix abspath() so that if win32api exists, it doesn't fail 9864 when the path doesn't actually exist -- if GetFullPathName() fails, 9865 fall back on the old strategy (join with getcwd() if necessary, and 9866 then use normpath()). 9867 9868 * configure.in, configure, config.h.in, acconfig.h: 9869 For BeOS PowerPC. Chris Herborth. 9870 9871Mon Apr 5 21:54:14 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9872 9873 * Modules/timemodule.c: 9874 Jonathan Giddy notes, and Chris Lawrence agrees, that some comments on 9875 #else/#endif are wrong, and that #if HAVE_TM_ZONE should be #ifdef. 9876 9877 * Misc/ACKS: 9878 Bunch of new contributors, including 9 who contributed to the Docs, 9879 reported by Fred. 9880 9881Mon Apr 5 18:37:59 1999 Fred Drake <fdrake@eric.cnri.reston.va.us> 9882 9883 * Lib/gzip.py: 9884 Oops, missed mode parameter to open(). 9885 9886 * Lib/gzip.py: 9887 Made the default mode 'rb' instead of 'r', for better cross-platform 9888 support. (Based on comment on the documentation by Bernhard Reiter 9889 <bernhard@csd.uwm.edu>). 9890 9891Fri Apr 2 22:18:25 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9892 9893 * Tools/scripts/dutree.py: 9894 For reasons I dare not explain, this script should always execute 9895 main() when imported (in other words, it is not usable as a module). 9896 9897Thu Apr 1 15:32:30 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9898 9899 * Lib/test/test_cpickle.py: Jonathan Giddy write: 9900 9901 In test_cpickle.py, the module os got imported, but the line to remove 9902 the temp file has gone missing. 9903 9904Tue Mar 30 20:17:31 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9905 9906 * Lib/BaseHTTPServer.py: Per Cederqvist writes: 9907 9908 If you send something like "PUT / HTTP/1.0" to something derived from 9909 BaseHTTPServer that doesn't define do_PUT, you will get a response 9910 that begins like this: 9911 9912 HTTP/1.0 501 Unsupported method ('do_PUT') 9913 Server: SimpleHTTP/0.3 Python/1.5 9914 Date: Tue, 30 Mar 1999 18:53:53 GMT 9915 9916 The server should complain about 'PUT' instead of 'do_PUT'. This 9917 patch should fix the problem. 9918 9919Mon Mar 29 20:33:21 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9920 9921 * Lib/smtplib.py: Patch by Per Cederqvist, who writes: 9922 9923 """ 9924 - It needlessly used the makefile() method for each response that is 9925 read from the SMTP server. 9926 9927 - If the remote SMTP server closes the connection unexpectedly the 9928 code raised an IndexError. It now raises an SMTPServerDisconnected 9929 exception instead. 9930 9931 - The code now checks that all lines in a multiline response actually 9932 contains an error code. 9933 """ 9934 9935 The Dragon approves. 9936 9937Mon Mar 29 20:25:40 1999 Fred Drake <fdrake@eric.cnri.reston.va.us> 9938 9939 * Lib/compileall.py: 9940 When run as a script, report failures in the exit code as well. 9941 Patch largely based on changes by Andrew Dalke, as discussed in the 9942 distutils-sig. 9943 9944Mon Mar 29 20:23:41 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9945 9946 * Lib/urllib.py: 9947 Hack so that if a 302 or 301 redirect contains a relative URL, the 9948 right thing "just happens" (basejoin() with old URL). 9949 9950 * Modules/cPickle.c: 9951 Protection against picling to/from closed (real) file. 9952 The problem was reported by Moshe Zadka. 9953 9954 * Lib/test/test_cpickle.py: 9955 Test protection against picling to/from closed (real) file. 9956 9957 * Modules/timemodule.c: Chris Lawrence writes: 9958 9959 """ 9960 The GNU folks, in their infinite wisdom, have decided not to implement 9961 altzone in libc6; this would not be horrible, except that timezone 9962 (which is implemented) includes the current DST setting (i.e. timezone 9963 for Central is 18000 in summer and 21600 in winter). So Python's 9964 timezone and altzone variables aren't set correctly during DST. 9965 9966 Here's a patch relative to 1.5.2b2 that (a) makes timezone and altzone 9967 show the "right" thing on Linux (by using the tm_gmtoff stuff 9968 available in BSD, which is how the GLIBC manual claims things should 9969 be done) and (b) should cope with the southern hemisphere. In pursuit 9970 of (b), I also took the liberty of renaming the "summer" and "winter" 9971 variables to "july" and "jan". This patch should also make certain 9972 time calculations on Linux actually work right (like the tz-aware 9973 functions in the rfc822 module). 9974 9975 (It's hard to find DST that's currently being used in the southern 9976 hemisphere; I tested using Africa/Windhoek.) 9977 """ 9978 9979 * Lib/test/output/test_gzip: 9980 Jonathan Giddy discovered this file was missing. 9981 9982 * Modules/shamodule.c: 9983 Avoid warnings from AIX compiler. Reported by Vladimir (AIX is my 9984 middlename) Marangozov, patch coded by Greg Stein. 9985 9986 * Tools/idle/ScriptBinding.py, Tools/idle/PyShell.py: 9987 At Tim Peters' recommendation, add a dummy flush() method to PseudoFile. 9988 9989Sun Mar 28 17:55:32 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 9990 9991 * Tools/scripts/ndiff.py: Tim Peters writes: 9992 9993 I should have waited overnight <wink/sigh>. Nothing wrong with the one I 9994 sent, but I couldn't resist going on to add new -r1 / -r2 cmdline options 9995 for recreating the original files from ndiff's output. That's attached, if 9996 you're game! Us Windows guys don't usually have a sed sitting around 9997 <wink>. 9998 9999Sat Mar 27 13:34:01 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10000 10001 * Tools/scripts/ndiff.py: Tim Peters writes: 10002 10003 Attached is a cleaned-up version of ndiff (added useful module 10004 docstring, now echo'ed in case of cmd line mistake); added -q option 10005 to suppress initial file identification lines; + other minor cleanups, 10006 & a slightly faster match engine. 10007 10008Fri Mar 26 22:36:00 1999 Fred Drake <fdrake@eric.cnri.reston.va.us> 10009 10010 * Tools/scripts/dutree.py: 10011 During display, if EPIPE is raised, it's probably because a pager was 10012 killed. Discard the error in that case, but propagate it otherwise. 10013 10014Fri Mar 26 16:20:45 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10015 10016 * Lib/test/output/test_userlist, Lib/test/test_userlist.py: 10017 Test suite for UserList. 10018 10019 * Lib/UserList.py: Use isinstance() where appropriate. 10020 Reformatted with 4-space indent. 10021 10022Fri Mar 26 16:11:40 1999 Barry Warsaw <bwarsaw@eric.cnri.reston.va.us> 10023 10024 * Tools/pynche/PyncheWidget.py: 10025 Helpwin.__init__(): The text widget should get focus. 10026 10027 * Tools/pynche/pyColorChooser.py: 10028 Removed unnecessary import `from PyncheWidget import PyncheWidget' 10029 10030Fri Mar 26 15:32:05 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10031 10032 * Lib/test/output/test_userdict, Lib/test/test_userdict.py: 10033 Test suite for UserDict 10034 10035 * Lib/UserDict.py: Improved a bunch of things. 10036 The constructor now takes an optional dictionary. 10037 Use isinstance() where appropriate. 10038 10039Thu Mar 25 22:38:49 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10040 10041 * Lib/test/output/test_pickle, Lib/test/output/test_cpickle, Lib/test/test_pickle.py, Lib/test/test_cpickle.py: 10042 Basic regr tests for pickle/cPickle 10043 10044 * Lib/pickle.py: 10045 Don't use "exec" in find_class(). It's slow, unnecessary, and (as AMK 10046 points out) it doesn't work in JPython Applets. 10047 10048Thu Mar 25 21:50:27 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us> 10049 10050 * Lib/test/test_gzip.py: 10051 Added a simple test suite for gzip. It simply opens a temp file, 10052 writes a chunk of compressed data, closes it, writes another chunk, and 10053 reads the contents back to verify that they are the same. 10054 10055 * Lib/gzip.py: 10056 Based on a suggestion from bruce@hams.com, make a trivial change to 10057 allow using the 'a' flag as a mode for opening a GzipFile. gzip 10058 files, surprisingly enough, can be concatenated and then decompressed; 10059 the effect is to concatenate the two chunks of data. 10060 10061 If we support it on writing, it should also be supported on reading. 10062 This *wasn't* trivial, and required rearranging the code in the 10063 reading path, particularly the _read() method. 10064 10065 Raise IOError instead of RuntimeError in two cases, 'Not a gzipped file' 10066 and 'Unknown compression method' 10067 10068Thu Mar 25 21:25:01 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10069 10070 * Lib/test/test_b1.py: 10071 Add tests for float() and complex() with string args (Nick/Stephanie 10072 Lockwood). 10073 10074Thu Mar 25 21:21:08 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us> 10075 10076 * Modules/zlibmodule.c: 10077 Add an .unused_data attribute to decompressor objects. If .unused_data 10078 is not an empty string, this means that you have arrived at the 10079 end of the stream of compressed data, and the contents of .unused_data are 10080 whatever follows the compressed stream. 10081 10082Thu Mar 25 21:16:07 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10083 10084 * Python/bltinmodule.c: 10085 Patch by Nick and Stephanie Lockwood to implement complex() with a string 10086 argument. This closes TODO item 2.19. 10087 10088Wed Mar 24 19:09:00 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10089 10090 * Tools/webchecker/wcnew.py: Added Samuel Bayer's new webchecker. 10091 Unfortunately his code breaks wcgui.py in a way that's not easy 10092 to fix. I expect that this is a temporary situation -- 10093 eventually Sam's changes will be merged back in. 10094 (The changes add a -t option to specify exceptions to the -x 10095 option, and explicit checking for #foo style fragment ids.) 10096 10097 * Objects/dictobject.c: 10098 Vladimir Marangozov contributed updated comments. 10099 10100 * Objects/bufferobject.c: Folded long lines. 10101 10102 * Lib/test/output/test_sha, Lib/test/test_sha.py: 10103 Added Jeremy's test code for the sha module. 10104 10105 * Modules/shamodule.c, Modules/Setup.in: 10106 Added Greg Stein and Andrew Kuchling's sha module. 10107 Fix comments about zlib version and URL. 10108 10109 * Lib/test/test_bsddb.py: Remove the temp file when we're done. 10110 10111 * Include/pythread.h: Conform to standard boilerplate. 10112 10113 * configure.in, configure, BeOS/linkmodule, BeOS/ar-fake: 10114 Chris Herborth: the new compiler in R4.1 needs some new options to work... 10115 10116 * Modules/socketmodule.c: 10117 Implement two suggestions by Jonathan Giddy: (1) in AIX, clear the 10118 data struct before calling gethostby{name,addr}_r(); (2) ignore the 10119 3/5/6 args determinations made by the configure script and switch on 10120 platform identifiers instead: 10121 10122 AIX, OSF have 3 args 10123 Sun, SGI have 5 args 10124 Linux has 6 args 10125 10126 On all other platforms, undef HAVE_GETHOSTBYNAME_R altogether. 10127 10128 * Modules/socketmodule.c: 10129 Vladimir Marangozov implements the AIX 3-arg gethostbyname_r code. 10130 10131 * Lib/mailbox.py: 10132 Add readlines() to _Subfile class. Not clear who would need it, but 10133 Chris Lawrence sent me a broken version; this one is a tad simpler and 10134 more conforming to the standard. 10135 10136Tue Mar 23 23:05:34 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us> 10137 10138 * Lib/gzip.py: use struct instead of bit-manipulate in Python 10139 10140Tue Mar 23 19:00:55 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10141 10142 * Modules/Makefile.pre.in: 10143 Add $(EXE) to various occurrences of python so it will work on Cygwin 10144 with egcs (after setting EXE=.exe). Patch by Norman Vine. 10145 10146 * configure, configure.in: 10147 Ack! It never defined HAVE_GETHOSTBYNAME_R so that code was never tested! 10148 10149Mon Mar 22 22:25:39 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10150 10151 * Include/thread.h: 10152 Adding thread.h -- unused but for b/w compatibility. 10153 As requested by Bill Janssen. 10154 10155 * configure.in, configure: 10156 Add code to test for all sorts of gethostbyname_r variants, 10157 donated by David Arnold. 10158 10159 * config.h.in, acconfig.h: 10160 Add symbols for gethostbyname_r variants (sigh). 10161 10162 * Modules/socketmodule.c: Clean up pass for the previous patches. 10163 10164 - Use HAVE_GETHOSTBYNAME_R_6_ARG instead of testing for Linux and 10165 glibc2. 10166 10167 - If gethostbyname takes 3 args, undefine HAVE_GETHOSTBYNAME_R -- 10168 don't know what code should be used. 10169 10170 - New symbol USE_GETHOSTBYNAME_LOCK defined iff the lock should be used. 10171 10172 - Modify the gethostbyaddr() code to also hold on to the lock until 10173 after it is safe to release, overlapping with the Python lock. 10174 10175 (Note: I think that it could in theory be possible that Python code 10176 executed while gethostbyname_lock is held could attempt to reacquire 10177 the lock -- e.g. in a signal handler or destructor. I will simply say 10178 "don't do that then.") 10179 10180 * Modules/socketmodule.c: Jonathan Giddy writes: 10181 10182 Here's a patch to fix the race condition, which wasn't fixed by Rob's 10183 patch. It holds the gethostbyname lock until the results are copied out, 10184 which means that this lock and the Python global lock are held at the same 10185 time. This shouldn't be a problem as long as the gethostbyname lock is 10186 always acquired when the global lock is not held. 10187 10188Mon Mar 22 19:25:30 1999 Andrew Kuchling <akuchlin@eric.cnri.reston.va.us> 10189 10190 * Modules/zlibmodule.c: 10191 Fixed the flush() method of compression objects; the test for 10192 the end of loop was incorrect, and failed when the flushmode != Z_FINISH. 10193 Logic cleaned up and commented. 10194 10195 * Lib/test/test_zlib.py: 10196 Added simple test for the flush() method of compression objects, trying the 10197 different flush values Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH. 10198 10199Mon Mar 22 15:28:08 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10200 10201 * Lib/shlex.py: 10202 Bug reported by Tobias Thelen: missing "self." in assignment target. 10203 10204Fri Mar 19 21:50:11 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10205 10206 * Modules/arraymodule.c: 10207 Use an unsigned cast to avoid a warning in VC++. 10208 10209 * Lib/dospath.py, Lib/ntpath.py: 10210 New code for split() by Tim Peters, behaves more like posixpath.split(). 10211 10212 * Objects/floatobject.c: 10213 Fix a problem with Vladimir's PyFloat_Fini code: clear the free list; if 10214 a block cannot be freed, add its free items back to the free list. 10215 This is necessary to avoid leaking when Python is reinitialized later. 10216 10217 * Objects/intobject.c: 10218 Fix a problem with Vladimir's PyInt_Fini code: clear the free list; if 10219 a block cannot be freed, add its free items back to the free list, and 10220 add its valid ints back to the small_ints array if they are in range. 10221 This is necessary to avoid leaking when Python is reinitialized later. 10222 10223 * Lib/types.py: 10224 Added BufferType, the type returned by the new builtin buffer(). Greg Stein. 10225 10226 * Python/bltinmodule.c: 10227 New builtin buffer() creates a derived read-only buffer from any 10228 object that supports the buffer interface (e.g. strings, arrays). 10229 10230 * Objects/bufferobject.c: 10231 Added check for negative offset for PyBuffer_FromObject and check for 10232 negative size for PyBuffer_FromMemory. Greg Stein. 10233 10234Thu Mar 18 15:10:44 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10235 10236 * Lib/urlparse.py: Sjoerd Mullender writes: 10237 10238 If a filename on Windows starts with \\, it is converted to a URL 10239 which starts with ////. If this URL is passed to urlparse.urlparse 10240 you get a path that starts with // (and an empty netloc). If you pass 10241 the result back to urlparse.urlunparse, you get a URL that starts with 10242 //, which is parsed differently by urlparse.urlparse. The fix is to 10243 add the (empty) netloc with accompanying slashes if the path in 10244 urlunparse starts with //. Do this for all schemes that use a netloc. 10245 10246 * Lib/nturl2path.py: Sjoerd Mullender writes: 10247 10248 Pathnames of files on other hosts in the same domain 10249 (\\host\path\to\file) are not translated correctly to URLs and back. 10250 The URL should be something like file:////host/path/to/file. 10251 Note that a combination of drive letter and remote host is not 10252 possible. 10253 10254Wed Mar 17 22:30:10 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10255 10256 * Lib/urlparse.py: 10257 Delete non-standard-conforming code in urljoin() that would use the 10258 netloc from the base url as the default netloc for the resulting url 10259 even if the schemes differ. 10260 10261 Once upon a time, when the web was wild, this was a valuable hack 10262 because some people had a URL referencing an ftp server colocated with 10263 an http server without having the host in the ftp URL (so they could 10264 replicate it or change the hostname easily). 10265 10266 More recently, after the file: scheme got added back to the list of 10267 schemes that accept a netloc, it turns out that this caused weirdness 10268 when joining an http: URL with a file: URL -- the resulting file: URL 10269 would always inherit the host from the http: URL because the file: 10270 scheme supports a netloc but in practice never has one. 10271 10272 There are two reasons to get rid of the old, once-valuable hack, 10273 instead of removing the file: scheme from the uses_netloc list. One, 10274 the RFC says that file: uses the netloc syntax, and does not endorse 10275 the old hack. Two, neither netscape 4.5 nor IE 4.0 support the old 10276 hack. 10277 10278 * Include/ceval.h, Include/abstract.h: 10279 Add DLL level b/w compat for PySequence_In and PyEval_CallObject 10280 10281Tue Mar 16 21:54:50 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10282 10283 * Lib/lib-tk/Tkinter.py: Bug reported by Jim Robinson: 10284 10285 An attempt to execute grid_slaves with arguments (0,0) results in 10286 *all* of the slaves being returned, not just the slave associated with 10287 row 0, column 0. This is because the test for arguments in the method 10288 does not test to see if row (and column) does not equal None, but 10289 rather just whether is evaluates to non-false. A value of 0 fails 10290 this test. 10291 10292Tue Mar 16 14:17:48 1999 Fred Drake <fdrake@eric.cnri.reston.va.us> 10293 10294 * Modules/cmathmodule.c: 10295 Docstring fix: acosh() returns the hyperbolic arccosine, not the 10296 hyperbolic cosine. Problem report via David Ascher by one of his 10297 students. 10298 10299Mon Mar 15 21:40:59 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10300 10301 * configure.in: 10302 Should test for gethost*by*name_r, not for gethostname_r (which 10303 doesn't exist and doesn't make sense). 10304 10305 * Modules/socketmodule.c: 10306 Patch by Rob Riggs for Linux -- glibc2 has a different argument 10307 converntion for gethostbyname_r() etc. than Solaris! 10308 10309 * Python/thread_pthread.h: Rob Riggs wrote: 10310 10311 """ 10312 Spec says that on success pthread_create returns 0. It does not say 10313 that an error code will be < 0. Linux glibc2 pthread_create() returns 10314 ENOMEM (12) when one exceed process limits. (It looks like it should 10315 return EAGAIN, but that's another story.) 10316 10317 For reference, see: 10318 http://www.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html 10319 """ 10320 10321 [I have a feeling that similar bugs were fixed before; perhaps someone 10322 could check that all error checks no check for != 0?] 10323 10324 * Tools/bgen/bgen/bgenObjectDefinition.py: 10325 New mixin class that defines cmp and hash that use 10326 the ob_itself pointer. This allows (when using the mixin) 10327 different Python objects pointing to the same C object and 10328 behaving well as dictionary keys. 10329 10330 Or so sez Jack Jansen... 10331 10332 * Lib/urllib.py: Yet another patch by Sjoerd Mullender: 10333 10334 Don't convert URLs to URLs using pathname2url. 10335 10336Fri Mar 12 22:15:43 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10337 10338 * Lib/cmd.py: Patch by Michael Scharf. He writes: 10339 10340 The module cmd requires for each do_xxx command a help_xxx 10341 function. I think this is a little old fashioned. 10342 10343 Here is a patch: use the docstring as help if no help_xxx 10344 function can be found. 10345 10346 [I'm tempted to rip out all the help_* functions from pdb, but I'll 10347 resist it. Any takers? --Guido] 10348 10349 * Tools/freeze/freeze.py: Bug submitted by Wayne Knowles, who writes: 10350 10351 Under Windows, python freeze.py -o hello hello.py 10352 creates all the correct files in the hello subdirectory, but the 10353 Makefile has the directory prefix in it for frozen_extensions.c 10354 nmake fails because it tries to locate hello/frozen_extensions.c 10355 10356 (His fix adds a call to os.path.basename() in the appropriate place.) 10357 10358 * Objects/floatobject.c, Objects/intobject.c: 10359 Vladimir has restructured his code somewhat so that the blocks are now 10360 represented by an explicit structure. (There are still too many casts 10361 in the code, but that may be unavoidable.) 10362 10363 Also added code so that with -vv it is very chatty about what it does. 10364 10365 * Demo/zlib/zlibdemo.py, Demo/zlib/minigzip.py: 10366 Change #! line to modern usage; also chmod +x 10367 10368 * Demo/pdist/rrcs, Demo/pdist/rcvs, Demo/pdist/rcsbump: 10369 Change #! line to modern usage 10370 10371 * Lib/nturl2path.py, Lib/urllib.py: From: Sjoerd Mullender 10372 10373 The filename to URL conversion didn't properly quote special 10374 characters. 10375 The URL to filename didn't properly unquote special chatacters. 10376 10377 * Objects/floatobject.c: 10378 OK, try again. Vladimir gave me a fix for the alignment bus error, 10379 so here's his patch again. This time it works (at least on Solaris, 10380 Linux and Irix). 10381 10382Thu Mar 11 23:21:23 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10383 10384 * Tools/idle/PathBrowser.py: 10385 Don't crash when sys.path contains an empty string. 10386 10387 * Tools/idle/PathBrowser.py: 10388 - Don't crash in the case where a superclass is a string instead of a 10389 pyclbr.Class object; this can happen when the superclass is 10390 unrecognizable (to pyclbr), e.g. when module renaming is used. 10391 10392 - Show a watch cursor when calling pyclbr (since it may take a while 10393 recursively parsing imported modules!). 10394 10395Thu Mar 11 16:04:04 1999 Fred Drake <fdrake@eric.cnri.reston.va.us> 10396 10397 * Lib/mimetypes.py: 10398 Added .rdf and .xsl as application/xml types. (.rdf is for the 10399 Resource Description Framework, a metadata encoding, and .xsl is for 10400 the Extensible Stylesheet Language.) 10401 10402Thu Mar 11 13:26:23 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10403 10404 * Lib/test/output/test_popen2, Lib/test/test_popen2.py: 10405 Test for popen2 module, by Chris Tismer. 10406 10407 * Objects/floatobject.c: 10408 Alas, Vladimir's patch caused a bus error (probably double 10409 alignment?), and I didn't test it. Withdrawing it for now. 10410 10411Wed Mar 10 22:55:47 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10412 10413 * Objects/floatobject.c: 10414 Patch by Vladimir Marangoz to allow freeing of the allocated blocks of 10415 floats on finalization. 10416 10417 * Objects/intobject.c: 10418 Patch by Vladimir Marangoz to allow freeing of the allocated blocks of 10419 integers on finalization. 10420 10421 * Tools/idle/EditorWindow.py, Tools/idle/Bindings.py: 10422 Add PathBrowser to File module 10423 10424 * Tools/idle/PathBrowser.py: 10425 "Path browser" - 4 scrolled lists displaying: 10426 directories on sys.path 10427 modules in selected directory 10428 classes in selected module 10429 methods of selected class 10430 10431 Sinlge clicking in a directory, module or class item updates the next 10432 column with info about the selected item. Double clicking in a 10433 module, class or method item opens the file (and selects the clicked 10434 item if it is a class or method). 10435 10436 I guess eventually I should be using a tree widget for this, but the 10437 ones I've seen don't work well enough, so for now I use the old 10438 Smalltalk or NeXT style multi-column hierarchical browser. 10439 10440 * Tools/idle/MultiScrolledLists.py: 10441 New utility: multiple scrolled lists in parallel 10442 10443 * Tools/idle/ScrolledList.py: - White background. 10444 - Display "(None)" (or text of your choosing) when empty. 10445 - Don't set the focus. 10446 10447Tue Mar 9 19:31:21 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10448 10449 * Lib/urllib.py: 10450 open_http also had the 'data is None' test backwards. don't call with the 10451 extra argument if data is None. 10452 10453 * Demo/embed/demo.c: 10454 Call Py_SetProgramName() instead of redefining getprogramname(), 10455 reflecting changes in the runtime around 1.5 or earlier. 10456 10457 * Python/ceval.c: 10458 Always test for an error return (usually NULL or -1) without setting 10459 an exception. 10460 10461 * Modules/timemodule.c: Patch by Chris Herborth for BeOS code. 10462 He writes: 10463 10464 I had an off-by-1000 error in floatsleep(), 10465 and the problem with time.clock() is that it's not implemented properly 10466 on QNX... ANSI says it's supposed to return _CPU_ time used by the 10467 process, but on QNX it returns the amount of real time used... so I was 10468 confused. 10469 10470 * Tools/bgen/bgen/macsupport.py: Small change by Jack Jansen. 10471 Test for self.returntype behaving like OSErr rather than being it. 10472 10473Thu Feb 25 16:14:58 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us> 10474 10475 * Lib/urllib.py: 10476 http_error had the 'data is None' test backwards. don't call with the 10477 extra argument if data is None. 10478 10479 * Lib/urllib.py: change indentation from 8 spaces to 4 spaces 10480 10481 * Lib/urllib.py: pleasing the tabnanny 10482 10483Thu Feb 25 14:26:02 1999 Fred Drake <fdrake@eric.cnri.reston.va.us> 10484 10485 * Lib/colorsys.py: 10486 Oops, one more "x, y, z" to convert... 10487 10488 * Lib/colorsys.py: 10489 Adjusted comment at the top to be less confusing, following Fredrik 10490 Lundh's example. 10491 10492 Converted comment to docstring. 10493 10494Wed Feb 24 18:49:15 1999 Fred Drake <fdrake@eric.cnri.reston.va.us> 10495 10496 * Lib/toaiff.py: 10497 Use sndhdr instead of the obsolete whatsound module. 10498 10499Wed Feb 24 18:42:38 1999 Jeremy Hylton <jhylton@eric.cnri.reston.va.us> 10500 10501 * Lib/urllib.py: 10502 When performing a POST request, i.e. when the second argument to 10503 urlopen is used to specify form data, make sure the second argument is 10504 threaded through all of the http_error_NNN calls. This allows error 10505 handlers like the redirect and authorization handlers to properly 10506 re-start the connection. 10507 10508Wed Feb 24 16:25:17 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10509 10510 * Lib/mhlib.py: Patch by Lars Wirzenius: 10511 10512 o the initial comment is wrong: creating messages is already 10513 implemented 10514 10515 o Message.getbodytext: if the mail or it's part contains an 10516 empty content-transfer-encoding header, the code used to 10517 break; the change below treats an empty encoding value the same 10518 as the other types that do not need decoding 10519 10520 o SubMessage.getbodytext was missing the decode argument; the 10521 change below adds it; I also made it unconditionally return 10522 the raw text if decoding was not desired, because my own 10523 routines needed that (and it was easier than rewriting my 10524 own routines ;-) 10525 10526Wed Feb 24 00:35:43 1999 Barry Warsaw <bwarsaw@eric.cnri.reston.va.us> 10527 10528 * Python/bltinmodule.c (initerrors): 10529 Make sure that the exception tuples ("base-classes" when 10530 string-based exceptions are used) reflect the real class hierarchy, 10531 i.e. that SystemExit derives from Exception not StandardError. 10532 10533 * Lib/exceptions.py: 10534 Document the correct class hierarchy for SystemExit. It is not an 10535 error and so it derives from Exception and not SystemError. The 10536 docstring was incorrect but the implementation was fine. 10537 10538Tue Feb 23 23:07:51 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10539 10540 * Lib/shutil.py: 10541 Add import sys, needed by reference to sys.exc_info() in rmtree(). 10542 Discovered by Mitch Chapman. 10543 10544 * config.h.in: 10545 Now that we don't have AC_CHECK_LIB(m, pow), the HAVE_LIBM symbol 10546 disappears. It wasn't used anywhere anyway... 10547 10548 * Modules/arraymodule.c: 10549 Carefully check for overflow when allocating the memory for fromfile 10550 -- someone tried to pass in sys.maxint and got bitten by the bogus 10551 calculations. 10552 10553 * configure.in: 10554 Get rid of AC_CHECK_LIB(m, pow) since this is taken care of later with 10555 LIBM (from --with-libm=...); this actually broke the customizability 10556 offered by the latter option. Thanks go to Clay Spence for reporting 10557 this. 10558 10559 * Lib/test/test_dl.py: 10560 1. Print the error message (carefully) when a dl.open() fails in verbose mode. 10561 2. When no test case worked, raise ImportError instead of failing. 10562 10563 * Python/bltinmodule.c: 10564 Patch by Tim Peters to improve the range checks for range() and 10565 xrange(), especially for platforms where int and long are different 10566 sizes (so sys.maxint isn't actually the theoretical limit for the 10567 length of a list, but the largest C int is -- sys.maxint is the 10568 largest Python int, which is actually a C long). 10569 10570 * Makefile.in: 10571 1. Augment the DG/UX rule so it doesn't break the BeOS build. 10572 2. Add $(EXE) to various occurrences of python so it will work on 10573 Cygwin with egcs (after setting EXE=.exe). These patches by 10574 Norman Vine. 10575 10576 * Lib/posixfile.py: 10577 According to Jeffrey Honig, bsd/os 2.0 - 4.0 should be added to the 10578 list (of bsd variants that have a different lock structure). 10579 10580 * Lib/test/test_fcntl.py: 10581 According to Jeffrey Honig, bsd/os 4.0 should be added to the list. 10582 10583 * Modules/timemodule.c: 10584 Patch by Tadayoshi Funaba (with some changes) to be smarter about 10585 guessing what happened when strftime() returns 0. Is it buffer 10586 overflow or was the result simply 0 bytes long? (This happens for an 10587 empty format string, or when the format string is a single %Z and the 10588 timezone is unknown.) if the buffer is at least 256 times as long as 10589 the format, assume the latter. 10590 10591Mon Feb 22 19:01:42 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10592 10593 * Lib/urllib.py: 10594 As Des Barry points out, we need to call pathname2url(file) in two 10595 calls to addinfourl() in open_file(). 10596 10597 * Modules/Setup.in: Document *static* -- in two places! 10598 10599 * Modules/timemodule.c: 10600 We don't support leap seconds, so the seconds field of a time 9-tuple 10601 should be in the range [0-59]. Noted by Tadayoshi Funaba. 10602 10603 * Modules/stropmodule.c: 10604 In atoi(), don't use isxdigit() to test whether the last character 10605 converted was a "digit" -- use isalnum(). This test is there only to 10606 guard against "+" or "-" being interpreted as a valid int literal. 10607 Reported by Takahiro Nakayama. 10608 10609 * Lib/os.py: 10610 As Finn Bock points out, _P_WAIT etc. don't have a leading underscore 10611 so they don't need to be treated specially here. 10612 10613Mon Feb 22 15:38:58 1999 Fred Drake <fdrake@eric.cnri.reston.va.us> 10614 10615 * Misc/NEWS: 10616 Typo: "apparentlt" --> "apparently" 10617 10618Mon Feb 22 15:38:46 1999 Guido van Rossum <guido@eric.cnri.reston.va.us> 10619 10620 * Lib/urlparse.py: Steve Clift pointed out that 'file' allows a netloc. 10621 10622 * Modules/posixmodule.c: 10623 The docstring for ttyname(..) claims a second "mode" argument. The 10624 actual code does not allow such an argument. (Finn Bock.) 10625 10626 * Lib/lib-old/poly.py: 10627 Dang. Even though this is obsolete code, somebody found a bug, and I 10628 fix it. Oh well. 10629 10630Thu Feb 18 20:51:50 1999 Fred Drake <fdrake@eric.cnri.reston.va.us> 10631 10632 * Lib/pyclbr.py: 10633 Bow to font-lock at the end of the docstring, since it throws stuff 10634 off. 10635 10636 Make sure the path parameter to readmodule() is a list before adding it 10637 with sys.path, or the addition could fail. 10638 10639 10640====================================================================== 10641 10642 10643From 1.5.2b1 to 1.5.2b2 10644======================= 10645 10646General 10647------- 10648 10649- Many memory leaks fixed. 10650 10651- Many small bugs fixed. 10652 10653- Command line option -OO (or -O -O) suppresses inclusion of doc 10654strings in resulting bytecode. 10655 10656Windows-specific changes 10657------------------------ 10658 10659- New built-in module winsound provides an interface to the Win32 10660PlaySound() call. 10661 10662- Re-enable the audioop module in the config.c file. 10663 10664- On Windows, support spawnv() and associated P_* symbols. 10665 10666- Fixed the conversion of times() return values on Windows. 10667 10668- Removed freeze from the installer -- it doesn't work without the 10669source tree. (See FAQ 8.11.) 10670 10671- On Windows 95/98, the Tkinter module now is smart enough to find 10672Tcl/Tk even when the PATH environment variable hasn't been set -- when 10673the import of _tkinter fails, it searches in a standard locations, 10674patches os.environ["PATH"], and tries again. When it still fails, a 10675clearer error message is produced. This should avoid most 10676installation problems with Tkinter use (e.g. in IDLE). 10677 10678- The -i option doesn't make any calls to set[v]buf() for stdin -- 10679this apparently screwed up _kbhit() and the _tkinter main loop. 10680 10681- The ntpath module (and hence, os.path on Windows) now parses out UNC 10682paths (e.g. \\host\mountpoint\dir\file) as "drive letters", so that 10683splitdrive() will \\host\mountpoint as the drive and \dir\file as the 10684path. ** EXPERIMENTAL ** 10685 10686- Added a hack to the exit code so that if (1) the exit status is 10687nonzero and (2) we think we have our own DOS box (i.e. we're not 10688started from a command line shell), we print a message and wait for 10689the user to hit a key before the DOS box is closed. 10690 10691- Updated the installer to WISE 5.0g. Added a dialog warning about 10692the imminent Tcl installation. Added a dialog to specify the program 10693group name in the start menu. Upgraded the Tcl installer to Tcl 106948.0.4. 10695 10696Changes to intrinsics 10697--------------------- 10698 10699- The repr() or str() of a module object now shows the __file__ 10700attribute (i.e., the file which it was loaded), or the string 10701"(built-in)" if there is no __file__ attribute. 10702 10703- The range() function now avoids overflow during its calculations (if 10704at all possible). 10705 10706- New info string sys.hexversion, which is an integer encoding the 10707version in hexadecimal. In other words, hex(sys.hexversion) == 107080x010502b2 for Python 1.5.2b2. 10709 10710New or improved ports 10711--------------------- 10712 10713- Support for Nextstep descendants (future Mac systems). 10714 10715- Improved BeOS support. 10716 10717- Support dynamic loading of shared libraries on NetBSD platforms that 10718use ELF (i.e., MIPS and Alpha systems). 10719 10720Configuration/build changes 10721--------------------------- 10722 10723- The Lib/test directory is no longer included in the default module 10724search path (sys.path) -- "test" has been a package ever since 1.5. 10725 10726- Now using autoconf 2.13. 10727 10728New library modules 10729------------------- 10730 10731- New library modules asyncore and asynchat: these form Sam Rushing's 10732famous asynchronous socket library. Sam has gracefully allowed me to 10733incorporate these in the standard Python library. 10734 10735- New module statvfs contains indexing constants for [f]statvfs() 10736return tuple. 10737 10738Changes to the library 10739---------------------- 10740 10741- The wave module (platform-independent support for Windows sound 10742files) has been fixed to actually make it work. 10743 10744- The sunau module (platform-independent support for Sun/NeXT sound 10745files) has been fixed to work across platforms. Also, a weird 10746encoding bug in the header of the audio test data file has been 10747corrected. 10748 10749- Fix a bug in the urllib module that occasionally tripped up 10750webchecker and other ftp retrieves. 10751 10752- ConfigParser's get() method now accepts an optional keyword argument 10753(vars) that is substituted on top of the defaults that were setup in 10754__init__. You can now also have recusive references in your 10755configuration file. 10756 10757- Some improvements to the Queue module, including a put_nowait() 10758module and an optional "block" second argument, to get() and put(), 10759defaulting to 1. 10760 10761- The updated xmllib module is once again compatible with the version 10762present in Python 1.5.1 (this was accidentally broken in 1.5.2b1). 10763 10764- The bdb module (base class for the debugger) now supports 10765canonicalizing pathnames used in breakpoints. The derived class must 10766override the new canonical() method for this to work. Also changed 10767clear_break() to the backwards compatible old signature, and added 10768clear_bpbynumber() for the new functionality. 10769 10770- In sgmllib (and hence htmllib), recognize attributes even if they 10771don't have space in front of them. I.e. '<a 10772name="foo"href="bar.html">' will now have two attributes recognized. 10773 10774- In the debugger (pdb), change clear syntax to support three 10775alternatives: clear; clear file:line; clear bpno bpno ... 10776 10777- The os.path module now pretends to be a submodule within the os 10778"package", so you can do things like "from os.path import exists". 10779 10780- The standard exceptions now have doc strings. 10781 10782- In the smtplib module, exceptions are now classes. Also avoid 10783inserting a non-standard space after "TO" in rcpt() command. 10784 10785- The rfc822 module's getaddrlist() method now uses all occurrences of 10786the specified header instead of just the first. Some other bugfixes 10787too (to handle more weird addresses found in a very large test set, 10788and to avoid crashes on certain invalid dates), and a small test 10789module has been added. 10790 10791- Fixed bug in urlparse in the common-case code for HTTP URLs; it 10792would lose the query, fragment, and/or parameter information. 10793 10794- The sndhdr module no longer supports whatraw() -- it depended on a 10795rare extenral program. 10796 10797- The UserList module/class now supports the extend() method, like 10798real list objects. 10799 10800- The uu module now deals better with trailing garbage generated by 10801some broke uuencoders. 10802 10803- The telnet module now has a my_interact() method which uses threads 10804instead of select. The interact() method uses this by default on 10805Windows (where the single-threaded version doesn't work). 10806 10807- Add a class to mailbox.py for dealing with qmail directory 10808mailboxes. The test code was extended to notice these being used as 10809well. 10810 10811Changes to extension modules 10812---------------------------- 10813 10814- Support for the [f]statvfs() system call, where it exists. 10815 10816- Fixed some bugs in cPickle where bad input could cause it to dump 10817core. 10818 10819- Fixed cStringIO to make the writelines() function actually work. 10820 10821- Added strop.expandtabs() so string.expandtabs() is now much faster. 10822 10823- Added fsync() and fdatasync(), if they appear to exist. 10824 10825- Support for "long files" (64-bit seek pointers). 10826 10827- Fixed a bug in the zlib module's flush() function. 10828 10829- Added access() system call. It returns 1 if access granted, 0 if 10830not. 10831 10832- The curses module implements an optional nlines argument to 10833w.scroll(). (It then calls wscrl(win, nlines) instead of scoll(win).) 10834 10835Changes to tools 10836---------------- 10837 10838- Some changes to IDLE; see Tools/idle/NEWS.txt. 10839 10840- Latest version of Misc/python-mode.el included. 10841 10842Changes to Tkinter 10843------------------ 10844 10845- Avoid tracebacks when an image is deleted after its root has been 10846destroyed. 10847 10848Changes to the Python/C API 10849--------------------------- 10850 10851- When parentheses are used in a PyArg_Parse[Tuple]() call, any 10852sequence is now accepted, instead of requiring a tuple. This is in 10853line with the general trend towards accepting arbitrary sequences. 10854 10855- Added PyModule_GetFilename(). 10856 10857- In PyNumber_Power(), remove unneeded and even harmful test for float 10858to the negative power (which is already and better done in 10859floatobject.c). 10860 10861- New version identification symbols; read patchlevel.h for info. The 10862version numbers are now exported by Python.h. 10863 10864- Rolled back the API version change -- it's back to 1007! 10865 10866- The frozenmain.c function calls PyInitFrozenExtensions(). 10867 10868- Added 'N' format character to Py_BuildValue -- like 'O' but doesn't 10869INCREF. 10870 10871 10872====================================================================== 10873 10874 10875From 1.5.2a2 to 1.5.2b1 10876======================= 10877 10878Changes to intrinsics 10879--------------------- 10880 10881- New extension NotImplementedError, derived from RuntimeError. Not 10882used, but recommended use is for "abstract" methods to raise this. 10883 10884- The parser will now spit out a warning or error when -t or -tt is 10885used for parser input coming from a string, too. 10886 10887- The code generator now inserts extra SET_LINENO opcodes when 10888compiling multi-line argument lists. 10889 10890- When comparing bound methods, use identity test on the objects, not 10891equality test. 10892 10893New or improved ports 10894--------------------- 10895 10896- Chris Herborth has redone his BeOS port; it now works on PowerPC 10897(R3/R4) and x86 (R4 only). Threads work too in this port. 10898 10899Renaming 10900-------- 10901 10902- Thanks to Chris Herborth, the thread primitives now have proper Py* 10903names in the source code (they already had those for the linker, 10904through some smart macros; but the source still had the old, un-Py 10905names). 10906 10907Configuration/build changes 10908--------------------------- 10909 10910- Improved support for FreeBSD/3. 10911 10912- Check for pthread_detach instead of pthread_create in libc. 10913 10914- The makesetup script now searches EXECINCLUDEPY before INCLUDEPY. 10915 10916- Misc/Makefile.pre.in now also looks at Setup.thread and Setup.local. 10917Otherwise modules such as thread didn't get incorporated in extensions. 10918 10919New library modules 10920------------------- 10921 10922- shlex.py by Eric Raymond provides a lexical analyzer class for 10923simple shell-like syntaxes. 10924 10925- netrc.py by Eric Raymond provides a parser for .netrc files. (The 10926undocumented Netrc class in ftplib.py is now obsolete.) 10927 10928- codeop.py is a new module that contains the compile_command() 10929function that was previously in code.py. This is so that JPython can 10930provide its own version of this function, while still sharing the 10931higher-level classes in code.py. 10932 10933- turtle.py is a new module for simple turtle graphics. I'm still 10934working on it; let me know if you use this to teach Python to children 10935or other novices without prior programming experience. 10936 10937Obsoleted library modules 10938------------------------- 10939 10940- poly.py and zmod.py have been moved to Lib/lib-old to emphasize 10941their status of obsoleteness. They don't do a particularly good job 10942and don't seem particularly relevant to the Python core. 10943 10944New tools 10945--------- 10946 10947- I've added IDLE: my Integrated DeveLopment Environment for Python. 10948Requires Tcl/Tk (and Tkinter). Works on Windows and Unix (and should 10949work on Macintosh, but I haven't been able to test it there; it does 10950depend on new features in 1.5.2 and perhaps even new features in 109511.5.2b1, especially the new code module). This is very much a work in 10952progress. I'd like to hear how people like it compared to PTUI (or 10953any other IDE they are familiar with). 10954 10955- New tools by Barry Warsaw: 10956 10957 = audiopy: controls the Solaris Audio device 10958 = pynche: The PYthonically Natural Color and Hue Editor 10959 = world: Print mappings between country names and DNS country codes 10960 10961New demos 10962--------- 10963 10964- Demo/scripts/beer.py prints the lyrics to an arithmetic drinking 10965song. 10966 10967- Demo/tkinter/guido/optionmenu.py shows how to do an option menu in 10968Tkinter. (By Fredrik Lundh -- not by me!) 10969 10970Changes to the library 10971---------------------- 10972 10973- compileall.py now avoids recompiling .py files that haven't changed; 10974it adds a -f option to force recompilation. 10975 10976- New version of xmllib.py by Sjoerd Mullender (0.2 with latest 10977patches). 10978 10979- nntplib.py: statparse() no longer lowercases the message-id. 10980 10981- types.py: use type(__stdin__) for FileType. 10982 10983- urllib.py: fix translations for filenames with "funny" characters. 10984Patch by Sjoerd Mullender. Note that if you subclass one of the 10985URLopener classes, and you have copied code from the old urllib.py, 10986your subclass may stop working. A long-term solution is to provide 10987more methods so that you don't have to copy code. 10988 10989- cgi.py: In read_multi, allow a subclass to override the class we 10990instantiate when we create a recursive instance, by setting the class 10991variable 'FieldStorageClass' to the desired class. By default, this 10992is set to None, in which case we use self.__class__ (as before). 10993Also, a patch by Jim Fulton to pass additional arguments to recursive 10994calls to the FieldStorage constructor from its read_multi method. 10995 10996- UserList.py: In __getslice__, use self.__class__ instead of 10997UserList. 10998 10999- In SimpleHTTPServer.py, the server specified in test() should be 11000BaseHTTPServer.HTTPServer, in case the request handler should want to 11001reference the two attributes added by BaseHTTPServer.server_bind. (By 11002Jeff Rush, for Bobo). Also open the file in binary mode, so serving 11003images from a Windows box might actually work. 11004 11005- In CGIHTTPServer.py, the list of acceptable formats is -split- 11006on spaces but -joined- on commas, resulting in double commas 11007in the joined text. (By Jeff Rush.) 11008 11009- SocketServer.py, patch by Jeff Bauer: a minor change to declare two 11010new threaded versions of Unix Server classes, using the ThreadingMixIn 11011class: ThreadingUnixStreamServer, ThreadingUnixDatagramServer. 11012 11013- bdb.py: fix bomb on deleting a temporary breakpoint: there's no 11014method do_delete(); do_clear() was meant. By Greg Ward. 11015 11016- getopt.py: accept a non-list sequence for the long options (request 11017by Jack Jansen). Because it might be a common mistake to pass a 11018single string, this situation is treated separately. Also added 11019docstrings (copied from the library manual) and removed the (now 11020redundant) module comments. 11021 11022- tempfile.py: improvements to avoid security leaks. 11023 11024- code.py: moved compile_command() to new module codeop.py. 11025 11026- pickle.py: support pickle format 1.3 (binary float added). By Jim 11027Fulton. Also get rid of the undocumented obsolete Pickler dump_special 11028method. 11029 11030- uu.py: Move 'import sys' to top of module, as noted by Tim Peters. 11031 11032- imaplib.py: fix problem with some versions of IMAP4 servers that 11033choose to mix the case in their CAPABILITIES response. 11034 11035- cmp.py: use (f1, f2) as cache key instead of f1 + ' ' + f2. Noted 11036by Fredrik Lundh. 11037 11038Changes to extension modules 11039---------------------------- 11040 11041- More doc strings for several modules were contributed by Chris 11042Petrilli: math, cmath, fcntl. 11043 11044- Fixed a bug in zlibmodule.c that could cause core dumps on 11045decompression of rarely occurring input. 11046 11047- cPickle.c: new version from Jim Fulton, with Open Source copyright 11048notice. Also, initialize self->safe_constructors early on to prevent 11049crash in early dealloc. 11050 11051- cStringIO.c: new version from Jim Fulton, with Open Source copyright 11052notice. Also fixed a core dump in cStringIO.c when doing seeks. 11053 11054- mpzmodule.c: fix signed character usage in mpz.mpz(stringobjecty). 11055 11056- readline.c: Bernard Herzog pointed out that rl_parse_and_bind 11057modifies its argument string (bad function!), so we make a temporary 11058copy. 11059 11060- sunaudiodev.c: Barry Warsaw added more smarts to get the device and 11061control pseudo-device, per audio(7I). 11062 11063Changes to tools 11064---------------- 11065 11066- New, improved version of Barry Warsaw's Misc/python-mode.el (editing 11067support for Emacs). 11068 11069- tabnanny.py: added a -q ('quiet') option to tabnanny, which causes 11070only the names of offending files to be printed. 11071 11072- freeze: when printing missing modules, also print the module they 11073were imported from. 11074 11075- untabify.py: patch by Detlef Lannert to implement -t option 11076(set tab size). 11077 11078Changes to Tkinter 11079------------------ 11080 11081- grid_bbox(): support new Tk API: grid bbox ?column row? ?column2 11082row2? 11083 11084- _tkinter.c: RajGopal Srinivasan noted that the latest code (1.5.2a2) 11085doesn't work when running in a non-threaded environment. He added 11086some #ifdefs that fix this. 11087 11088Changes to the Python/C API 11089--------------------------- 11090 11091- Bumped API version number to 1008 -- enough things have changed! 11092 11093- There's a new macro, PyThreadState_GET(), which does the same work 11094as PyThreadState_Get() without the overhead of a function call (it 11095also avoids the error check). The two top calling locations of 11096PyThreadState_Get() have been changed to use this macro. 11097 11098- All symbols intended for export from a DLL or shared library are now 11099marked as such (with the DL_IMPORT() macro) in the header file that 11100declares them. This was needed for the BeOS port, and should also 11101make some other ports easier. The PC port no longer needs the file 11102with exported symbols (PC/python_nt.def). There's also a DL_EXPORT 11103macro which is only used for init methods in extension modules, and 11104for Py_Main(). 11105 11106Invisible changes to internals 11107------------------------------ 11108 11109- Fixed a bug in new_buffersize() in fileobject.c which could 11110return a buffer size that was way too large. 11111 11112- Use PySys_WriteStderr instead of fprintf in most places. 11113 11114- dictobject.c: remove dead code discovered by Vladimir Marangozov. 11115 11116- tupleobject.c: make tuples less hungry -- an extra item was 11117allocated but never used. Tip by Vladimir Marangozov. 11118 11119- mymath.h: Metrowerks PRO4 finally fixes the hypot snafu. (Jack 11120Jansen) 11121 11122- import.c: Jim Fulton fixes a reference count bug in 11123PyEval_GetGlobals. 11124 11125- glmodule.c: check in the changed version after running the stubber 11126again -- this solves the conflict with curses over the 'clear' entry 11127point much nicer. (Jack Jansen had checked in the changes to cstubs 11128eons ago, but I never regenrated glmodule.c :-( ) 11129 11130- frameobject.c: fix reference count bug in PyFrame_New. Vladimir 11131Marangozov. 11132 11133- stropmodule.c: add a missing DECREF in an error exit. Submitted by 11134Jonathan Giddy. 11135 11136 11137====================================================================== 11138 11139 11140From 1.5.2a1 to 1.5.2a2 11141======================= 11142 11143General 11144------- 11145 11146- It is now a syntax error to have a function argument without a 11147default following one with a default. 11148 11149- __file__ is now set to the .py file if it was parsed (it used to 11150always be the .pyc/.pyo file). 11151 11152- Don't exit with a fatal error during initialization when there's a 11153problem with the exceptions.py module. 11154 11155- New environment variable PYTHONOPTIMIZE can be used to set -O. 11156 11157- New version of python-mode.el for Emacs. 11158 11159Miscellaneous fixed bugs 11160------------------------ 11161 11162- No longer print the (confusing) error message about stack underflow 11163while compiling. 11164 11165- Some threading and locking bugs fixed. 11166 11167- When errno is zero, report "Error", not "Success". 11168 11169Documentation 11170------------- 11171 11172- Documentation will be released separately. 11173 11174- Doc strings added to array and md5 modules by Chris Petrilli. 11175 11176Ports and build procedure 11177------------------------- 11178 11179- Stop installing when a move or copy fails. 11180 11181- New version of the OS/2 port code by Jeff Rush. 11182 11183- The makesetup script handles absolute filenames better. 11184 11185- The 'new' module is now enabled by default in the Setup file. 11186 11187- I *think* I've solved the problem with the Linux build blowing up 11188sometimes due to a conflict between sigcheck/intrcheck and 11189signalmodule. 11190 11191Built-in functions 11192------------------ 11193 11194- The second argument to apply() can now be any sequence, not just a 11195tuple. 11196 11197Built-in types 11198-------------- 11199 11200- Lists have a new method: L1.extend(L2) is equivalent to the common 11201idiom L1[len(L1):] = L2. 11202 11203- Better error messages when a sequence is indexed with a non-integer. 11204 11205- Bettter error message when calling a non-callable object (include 11206the type in the message). 11207 11208Python services 11209--------------- 11210 11211- New version of cPickle.c fixes some bugs. 11212 11213- pickle.py: improved instantiation error handling. 11214 11215- code.py: reworked quite a bit. New base class 11216InteractiveInterpreter and derived class InteractiveConsole. Fixed 11217several problems in compile_command(). 11218 11219- py_compile.py: print error message and continue on syntax errors. 11220Also fixed an old bug with the fstat code (it was never used). 11221 11222- pyclbr.py: support submodules of packages. 11223 11224String Services 11225--------------- 11226 11227- StringIO.py: raise the right exception (ValueError) for attempted 11228I/O on closed StringIO objects. 11229 11230- re.py: fixed a bug in subn(), which caused .groups() to fail inside 11231the replacement function called by sub(). 11232 11233- The struct module has a new format 'P': void * in native mode. 11234 11235Generic OS Services 11236------------------- 11237 11238- Module time: Y2K robustness. 2-digit year acceptance depends on 11239value of time.accept2dyear, initialized from env var PYTHONY2K, 11240default 0. Years 00-68 mean 2000-2068, while 69-99 mean 1969-1999 11241(POSIX or X/Open recommendation). 11242 11243- os.path: normpath(".//x") should return "x", not "/x". 11244 11245- getpass.py: fall back on default_getpass() when sys.stdin.fileno() 11246doesn't work. 11247 11248- tempfile.py: regenerate the template after a fork() call. 11249 11250Optional OS Services 11251-------------------- 11252 11253- In the signal module, disable restarting interrupted system calls 11254when we have siginterrupt(). 11255 11256Debugger 11257-------- 11258 11259- No longer set __args__; this feature is no longer supported and can 11260affect the debugged code. 11261 11262- cmd.py, pdb.py and bdb.py have been overhauled by Richard Wolff, who 11263added aliases and some other useful new features, e.g. much better 11264breakpoint support: temporary breakpoint, disabled breakpoints, 11265breakpoints with ignore counts, and conditions; breakpoints can be set 11266on a file before it is loaded. 11267 11268Profiler 11269-------- 11270 11271- Changes so that JPython can use it. Also fix the calibration code 11272so it actually works again 11273. 11274Internet Protocols and Support 11275------------------------------ 11276 11277- imaplib.py: new version from Piers Lauder. 11278 11279- smtplib.py: change sendmail() method to accept a single string or a 11280list or strings as the destination (commom newbie mistake). 11281 11282- poplib.py: LIST with a msg argument fixed. 11283 11284- urlparse.py: some optimizations for common case (http). 11285 11286- urllib.py: support content-length in info() for ftp protocol; 11287support for a progress meter through a third argument to 11288urlretrieve(); commented out gopher test (the test site is dead). 11289 11290Internet Data handling 11291---------------------- 11292 11293- sgmllib.py: support tags with - or . in their name. 11294 11295- mimetypes.py: guess_type() understands 'data' URLs. 11296 11297Restricted Execution 11298-------------------- 11299 11300- The classes rexec.RModuleLoader and rexec.RModuleImporter no 11301longer exist. 11302 11303Tkinter 11304------- 11305 11306- When reporting an exception, store its info in sys.last_*. Also, 11307write all of it to stderr. 11308 11309- Added NS, EW, and NSEW constants, for grid's sticky option. 11310 11311- Fixed last-minute bug in 1.5.2a1 release: need to include "mytime.h". 11312 11313- Make bind variants without a sequence return a tuple of sequences 11314(formerly it returned a string, which wasn't very convenient). 11315 11316- Add image commands to the Text widget (these are new in Tk 8.0). 11317 11318- Added new listbox and canvas methods: {xview,yview}_{scroll,moveto}.) 11319 11320- Improved the thread code (but you still can't call update() from 11321another thread on Windows). 11322 11323- Fixed unnecessary references to _default_root in the new dialog 11324modules. 11325 11326- Miscellaneous problems fixed. 11327 11328 11329Windows General 11330--------------- 11331 11332- Call LoadLibraryEx(..., ..., LOAD_WITH_ALTERED_SEARCH_PATH) to 11333search for dependent dlls in the directory containing the .pyd. 11334 11335- In debugging mode, call DebugBreak() in Py_FatalError(). 11336 11337Windows Installer 11338----------------- 11339 11340- Install zlib.dll in the DLLs directory instead of in the win32 11341system directory, to avoid conflicts with other applications that have 11342their own zlib.dll. 11343 11344Test Suite 11345---------- 11346 11347- test_long.py: new test for long integers, by Tim Peters. 11348 11349- regrtest.py: improved so it can be used for other test suites as 11350well. 11351 11352- test_strftime.py: use re to compare test results, to support legal 11353variants (e.g. on Linux). 11354 11355Tools and Demos 11356--------------- 11357 11358- Four new scripts in Tools/scripts: crlf.py and lfcr.py (to 11359remove/add Windows style '\r\n' line endings), untabify.py (to remove 11360tabs), and rgrep.yp (reverse grep). 11361 11362- Improvements to Tools/freeze/. Each Python module is now written to 11363its own C file. This prevents some compilers or assemblers from 11364blowing up on large frozen programs, and saves recompilation time if 11365only a few modules are changed. Other changes too, e.g. new command 11366line options -x and -i. 11367 11368- Much improved (and smaller!) version of Tools/scripts/mailerdaemon.py. 11369 11370Python/C API 11371------------ 11372 11373- New mechanism to support extensions of the type object while 11374remaining backward compatible with extensions compiled for previous 11375versions of Python 1.5. A flags field indicates presence of certain 11376fields. 11377 11378- Addition to the buffer API to differentiate access to bytes and 113798-bit characters (in anticipation of Unicode characters). 11380 11381- New argument parsing format t# ("text") to indicate 8-bit 11382characters; s# simply means 8-bit bytes, for backwards compatibility. 11383 11384- New object type, bufferobject.c is an example and can be used to 11385create buffers from memory. 11386 11387- Some support for 64-bit longs, including some MS platforms. 11388 11389- Many calls to fprintf(stderr, ...) have been replaced with calls to 11390PySys_WriteStderr(...). 11391 11392- The calling context for PyOS_Readline() has changed: it must now be 11393called with the interpreter lock held! It releases the lock around 11394the call to the function pointed to by PyOS_ReadlineFunctionPointer 11395(default PyOS_StdioReadline()). 11396 11397- New APIs PyLong_FromVoidPtr() and PyLong_AsVoidPtr(). 11398 11399- Renamed header file "thread.h" to "pythread.h". 11400 11401- The code string of code objects may now be anything that supports the 11402buffer API. 11403 11404 11405====================================================================== 11406 11407 11408From 1.5.1 to 1.5.2a1 11409===================== 11410 11411General 11412------- 11413 11414- When searching for the library, a landmark that is a compiled module 11415(string.pyc or string.pyo) is also accepted. 11416 11417- When following symbolic links to the python executable, use a loop 11418so that a symlink to a symlink can work. 11419 11420- Added a hack so that when you type 'quit' or 'exit' at the 11421interpreter, you get a friendly explanation of how to press Ctrl-D (or 11422Ctrl-Z) to exit. 11423 11424- New and improved Misc/python-mode.el (Python mode for Emacs). 11425 11426- Revert a new feature in Unix dynamic loading: for one or two 11427revisions, modules were loaded using the RTLD_GLOBAL flag. It turned 11428out to be a bad idea. 11429 11430Miscellaneous fixed bugs 11431------------------------ 11432 11433- All patches on the patch page have been integrated. (But much more 11434has been done!) 11435 11436- Several memory leaks plugged (e.g. the one for classes with a 11437__getattr__ method). 11438 11439- Removed the only use of calloc(). This triggered an obscure bug on 11440multiprocessor Sparc Solaris 2.6. 11441 11442- Fix a peculiar bug that would allow "import sys.time" to succeed 11443(believing the built-in time module to be a part of the sys package). 11444 11445- Fix a bug in the overflow checking when converting a Python long to 11446a C long (failed to convert -2147483648L, and some other cases). 11447 11448Documentation 11449------------- 11450 11451- Doc strings have been added to many extension modules: __builtin__, 11452errno, select, signal, socket, sys, thread, time. Also to methods of 11453list objects (try [].append.__doc__). A doc string on a type will now 11454automatically be propagated to an instance if the instance has methods 11455that are accessed in the usual way. 11456 11457- The documentation has been expanded and the formatting improved. 11458(Remember that the documentation is now unbundled and has its own 11459release cycle though; see http://www.python.org/doc/.) 11460 11461- Added Misc/Porting -- a mini-FAQ on porting to a new platform. 11462 11463Ports and build procedure 11464------------------------- 11465 11466- The BeOS port is now integrated. Courtesy Chris Herborth. 11467 11468- Symbol files for FreeBSD 2.x and 3.x have been contributed 11469(Lib/plat-freebsd[23]/*). 11470 11471- Support HPUX 10.20 DCE threads. 11472 11473- Finally fixed the configure script so that (on SGI) if -OPT:Olimit=0 11474works, it won't also use -Olimit 1500 (which gives a warning for every 11475file). Also support the SGI_ABI environment variable better. 11476 11477- The makesetup script now understands absolute pathnames ending in .o 11478in the module -- it assumes it's a file for which we have no source. 11479 11480- Other miscellaneous improvements to the configure script and 11481Makefiles. 11482 11483- The test suite now uses a different sound sample. 11484 11485Built-in functions 11486------------------ 11487 11488- Better checks for invalid input to int(), long(), string.atoi(), 11489string.atol(). (Formerly, a sign without digits would be accepted as 11490a legal ways to spell zero.) 11491 11492- Changes to map() and filter() to use the length of a sequence only 11493as a hint -- if an IndexError happens earlier, take that. (Formerly, 11494this was considered an error.) 11495 11496- Experimental feature in getattr(): a third argument can specify a 11497default (instead of raising AttributeError). 11498 11499- Implement round() slightly different, so that for negative ndigits 11500no additional errors happen in the last step. 11501 11502- The open() function now adds the filename to the exception when it 11503fails. 11504 11505Built-in exceptions 11506------------------- 11507 11508- New standard exceptions EnvironmentError and PosixError. 11509EnvironmentError is the base class for IOError and PosixError; 11510PosixError is the same as os.error. All this so that either exception 11511class can be instantiated with a third argument indicating a filename. 11512The built-in function open() and most os/posix functions that take a 11513filename argument now use this. 11514 11515Built-in types 11516-------------- 11517 11518- List objects now have an experimental pop() method; l.pop() returns 11519and removes the last item; l.pop(i) returns and removes the item at 11520i. Also, the sort() method is faster again. Sorting is now also 11521safer: it is impossible for the sorting function to modify the list 11522while the sort is going on (which could cause core dumps). 11523 11524- Changes to comparisons: numbers are now smaller than any other type. 11525This is done to prevent the circularity where [] < 0L < 1 < [] is 11526true. As a side effect, cmp(None, 0) is now positive instead of 11527negative. This *shouldn't* affect any working code, but I've found 11528that the change caused several "sleeping" bugs to become active, so 11529beware! 11530 11531- Instance methods may now have other callable objects than just 11532Python functions as their im_func. Use new.instancemethod() or write 11533your own C code to create them; new.instancemethod() may be called 11534with None for the instance to create an unbound method. 11535 11536- Assignment to __name__, __dict__ or __bases__ of a class object is 11537now allowed (with stringent type checks); also allow assignment to 11538__getattr__ etc. The cached values for __getattr__ etc. are 11539recomputed after such assignments (but not for derived classes :-( ). 11540 11541- Allow assignment to some attributes of function objects: func_code, 11542func_defaults and func_doc / __doc__. (With type checks except for 11543__doc__ / func_doc .) 11544 11545Python services 11546--------------- 11547 11548- New tests (in Lib/test): reperf.py (regular expression benchmark), 11549sortperf.py (list sorting benchmark), test_MimeWriter.py (test case 11550for the MimeWriter module). 11551 11552- Generalized test/regrtest.py so that it is useful for testing other 11553packages. 11554 11555- The ihooks.py module now understands package imports. 11556 11557- In code.py, add a class that subsumes Fredrik Lundh's 11558PythonInterpreter class. The interact() function now uses this. 11559 11560- In rlcompleter.py, in completer(), return None instead of raising an 11561IndexError when there are no more completions left. 11562 11563- Fixed the marshal module to test for certain common kinds of invalid 11564input. (It's still not foolproof!) 11565 11566- In the operator module, add an alias (now the preferred name) 11567"contains" for "sequenceincludes". 11568 11569String Services 11570--------------- 11571 11572- In the string and strop modules, in the replace() function, treat an 11573empty pattern as an error (since it's not clear what was meant!). 11574 11575- Some speedups to re.py, especially the string substitution and split 11576functions. Also added new function/method findall(), to find all 11577occurrences of a given substring. 11578 11579- In cStringIO, add better argument type checking and support the 11580readonly 'closed' attribute (like regular files). 11581 11582- In the struct module, unsigned 1-2 byte sized formats no longer 11583result in long integer values. 11584 11585Miscellaneous services 11586---------------------- 11587 11588- In whrandom.py, added new method and function randrange(), same as 11589choice(range(start, stop, step)) but faster. This addresses the 11590problem that randint() was accidentally defined as taking an inclusive 11591range. Also, randint(a, b) is now redefined as randrange(a, b+1), 11592adding extra range and type checking to its arguments! 11593 11594- Add some semi-thread-safety to random.gauss() (it used to be able to 11595crash when invoked from separate threads; now the worst it can do is 11596give a duplicate result occasionally). 11597 11598- Some restructuring and generalization done to cmd.py. 11599 11600- Major upgrade to ConfigParser.py; converted to using 're', added new 11601exceptions, support underscore in section header and option name. No 11602longer add 'name' option to every section; instead, add '__name__'. 11603 11604- In getpass.py, don't use raw_input() to ask for the password -- we 11605don't want it to show up in the readline history! Also don't catch 11606interrupts (the try-finally already does all necessary cleanup). 11607 11608Generic OS Services 11609------------------- 11610 11611- New functions in os.py: makedirs(), removedirs(), renames(). New 11612variable: linesep (the line separator as found in binary files, 11613i.e. '\n' on Unix, '\r\n' on DOS/Windows, '\r' on Mac. Do *not* use 11614this with files opened in (default) text mode; the line separator used 11615will always be '\n'! 11616 11617- Changes to the 'os.path' submodule of os.py: added getsize(), 11618getmtime(), getatime() -- these fetch the most popular items from the 11619stat return tuple. 11620 11621- In the time module, add strptime(), if it exists. (This parses a 11622time according to a format -- the inverse of strftime().) Also, 11623remove the call to mktime() from strftime() -- it messed up the 11624formatting of some non-local times. 11625 11626- In the socket module, added a new function gethostbyname_ex(). 11627Also, don't use #ifdef to test for some symbols that are enums on some 11628platforms (and should exist everywhere). 11629 11630Optional OS Services 11631-------------------- 11632 11633- Some fixes to gzip.py. In particular, the readlines() method now 11634returns the lines *with* trailing newline characters, like readlines() 11635of regular file objects. Also, it didn't work together with cPickle; 11636fixed that. 11637 11638- In whichdb.py, support byte-swapped dbhash (bsddb) files. 11639 11640- In anydbm.py, look at the type of an existing database to determine 11641which module to use to open it. (The anydbm.error exception is now a 11642tuple.) 11643 11644Unix Services 11645------------- 11646 11647- In the termios module, in tcsetattr(), initialize the structure vy 11648calling tcgetattr(). 11649 11650- Added some of the "wait status inspection" macros as functions to 11651the posix module (and thus to the os module): WEXITSTATUS(), 11652WIFEXITED(), WIFSIGNALED(), WIFSTOPPED(), WSTOPSIG(), WTERMSIG(). 11653 11654- In the syslog module, make the default facility more intuitive 11655(matching the docs). 11656 11657Debugger 11658-------- 11659 11660- In pdb.py, support for setting breaks on files/modules that haven't 11661been loaded yet. 11662 11663Internet Protocols and Support 11664------------------------------ 11665 11666- Changes in urllib.py; sped up unquote() and quote(). Fixed an 11667obscure bug in quote_plus(). Added urlencode(dict) -- convenience 11668function for sending a POST request with urlopen(). Use the getpass 11669module to ask for a password. Rewrote the (test) main program so that 11670when used as a script, it can retrieve one or more URLs to stdout. 11671Use -t to run the self-test. Made the proxy code work again. 11672 11673- In cgi.py, treat "HEAD" the same as "GET", so that CGI scripts don't 11674fail when someone asks for their HEAD. Also, for POST, set the 11675default content-type to application/x-www-form-urlencoded. Also, in 11676FieldStorage.__init__(), when method='GET', always get the query 11677string from environ['QUERY_STRING'] or sys.argv[1] -- ignore an 11678explicitly passed in fp. 11679 11680- The smtplib.py module now supports ESMTP and has improved standard 11681compliance, for picky servers. 11682 11683- Improved imaplib.py. 11684 11685- Fixed UDP support in SocketServer.py (it never worked). 11686 11687- Fixed a small bug in CGIHTTPServer.py. 11688 11689Internet Data handling 11690---------------------- 11691 11692- In rfc822.py, add a new class AddressList. Also support a new 11693overridable method, isheader(). Also add a get() method similar to 11694dictionaries (and make getheader() an alias for it). Also, be smarter 11695about seekable (test whether fp.tell() works) and test for presence of 11696unread() method before trying seeks. 11697 11698- In sgmllib.py, restore the call to report_unbalanced() that was lost 11699long ago. Also some other improvements: handle <? processing 11700instructions >, allow . and - in entity names, and allow \r\n as line 11701separator. 11702 11703- Some restructuring and generalization done to multifile.py; support 11704a 'seekable' flag. 11705 11706Restricted Execution 11707-------------------- 11708 11709- Improvements to rexec.py: package support; support a (minimal) 11710sys.exc_info(). Also made the (test) main program a bit fancier (you 11711can now use it to run arbitrary Python scripts in restricted mode). 11712 11713Tkinter 11714------- 11715 11716- On Unix, Tkinter can now safely be used from a multi-threaded 11717application. (Formerly, no threads would make progress while 11718Tkinter's mainloop() was active, because it didn't release the Python 11719interpreter lock.) Unfortunately, on Windows, threads other than the 11720main thread should not call update() or update_idletasks() because 11721this will deadlock the application. 11722 11723- An interactive interpreter that uses readline and Tkinter no longer 11724uses up all available CPU time. 11725 11726- Even if readline is not used, Tk windows created in an interactive 11727interpreter now get continuously updated. (This even works in Windows 11728as long as you don't hit a key.) 11729 11730- New demos in Demo/tkinter/guido/: brownian.py, redemo.py, switch.py. 11731 11732- No longer register Tcl_finalize() as a low-level exit handler. It 11733may call back into Python, and that's a bad idea. 11734 11735- Allow binding of Tcl commands (given as a string). 11736 11737- Some minor speedups; replace explicitly coded getint() with int() in 11738most places. 11739 11740- In FileDialog.py, remember the directory of the selected file, if 11741given. 11742 11743- Change the names of all methods in the Wm class: they are now 11744wm_title(), etc. The old names (title() etc.) are still defined as 11745aliases. 11746 11747- Add a new method of interpreter objects, interpaddr(). This returns 11748the address of the Tcl interpreter object, as an integer. Not very 11749useful for the Python programmer, but this can be called by another C 11750extension that needs to make calls into the Tcl/Tk C API and needs to 11751get the address of the Tcl interpreter object. A simple cast of the 11752return value to (Tcl_Interp *) will do the trick. 11753 11754Windows General 11755--------------- 11756 11757- Don't insist on proper case for module source files if the filename 11758is all uppercase (e.g. FOO.PY now matches foo; but FOO.py still 11759doesn't). This should address problems with this feature on 11760oldfashioned filesystems (Novell servers?). 11761 11762Windows Library 11763--------------- 11764 11765- os.environ is now all uppercase, but accesses are case insensitive, 11766and the putenv() calls made as a side effect of changing os.environ 11767are case preserving. 11768 11769- Removed samefile(), sameopenfile(), samestat() from os.path (aka 11770ntpath.py) -- these cannot be made to work reliably (at least I 11771wouldn't know how). 11772 11773- Fixed os.pipe() so that it returns file descriptors acceptable to 11774os.read() and os.write() (like it does on Unix), rather than Windows 11775file handles. 11776 11777- Added a table of WSA error codes to socket.py. 11778 11779- In the select module, put the (huge) file descriptor arrays on the 11780heap. 11781 11782- The getpass module now raises KeyboardInterrupt when it sees ^C. 11783 11784- In mailbox.py, fix tell/seek when using files opened in text mode. 11785 11786- In rfc822.py, fix tell/seek when using files opened in text mode. 11787 11788- In the msvcrt extension module, release the interpreter lock for 11789calls that may block: _locking(), _getch(), _getche(). Also fix a 11790bogus error return when open_osfhandle() doesn't have the right 11791argument list. 11792 11793Windows Installer 11794----------------- 11795 11796- The registry key used is now "1.5" instead of "1.5.x" -- so future 11797versions of 1.5 and Mark Hammond's win32all installer don't need to be 11798resynchronized. 11799 11800Windows Tools 11801------------- 11802 11803- Several improvements to freeze specifically for Windows. 11804 11805Windows Build Procedure 11806----------------------- 11807 11808- The VC++ project files and the WISE installer have been moved to the 11809PCbuild subdirectory, so they are distributed in the same subdirectory 11810where they must be used. This avoids confusion. 11811 11812- New project files for Windows 3.1 port by Jim Ahlstrom. 11813 11814- Got rid of the obsolete subdirectory PC/setup_nt/. 11815 11816- The projects now use distinct filenames for the .exe, .dll, .lib and 11817.pyd files built in debug mode (by appending "_d" to the base name, 11818before the extension). This makes it easier to switch between the two 11819and get the right versions. There's a pragma in config.h that directs 11820the linker to include the appropriate .lib file (so python15.lib no 11821longer needs to be explicit in your project). 11822 11823- The installer now installs more files (e.g. config.h). The idea is 11824that you shouldn't need the source distribution if you want build your 11825own extensions in C or C++. 11826 11827Tools and Demos 11828--------------- 11829 11830- New script nm2def.py by Marc-Andre Lemburg, to construct 11831PC/python_nt.def automatically (some hand editing still required). 11832 11833- New tool ndiff.py: Tim Peters' text diffing tool. 11834 11835- Various and sundry improvements to the freeze script. 11836 11837- The script texi2html.py (which was part of the Doc tree but is no 11838longer used there) has been moved to the Tools/scripts subdirectory. 11839 11840- Some generalizations in the webchecker code. There's now a 11841primnitive gui for websucker.py: wsgui.py. (In Tools/webchecker/.) 11842 11843- The ftpmirror.py script now handles symbolic links properly, and 11844also files with multiple spaces in their names. 11845 11846- The 1.5.1 tabnanny.py suffers an assert error if fed a script whose 11847last line is both indented and lacks a newline. This is now fixed. 11848 11849Python/C API 11850------------ 11851 11852- Added missing prototypes for PyEval_CallFunction() and 11853PyEval_CallMethod(). 11854 11855- New macro PyList_SET_ITEM(). 11856 11857- New macros to access object members for PyFunction, PyCFunction 11858objects. 11859 11860- New APIs PyImport_AppendInittab() and PyImport_ExtendInittab() to 11861dynamically add one or many entries to the table of built-in modules. 11862 11863- New macro Py_InitModule3(name, methods, doc) which calls 11864Py_InitModule4() with appropriate arguments. (The -4 variant requires 11865you to pass an obscure version number constant which is always the same.) 11866 11867- New APIs PySys_WriteStdout() and PySys_WriteStderr() to write to 11868sys.stdout or sys.stderr using a printf-like interface. (Used in 11869_tkinter.c, for example.) 11870 11871- New APIs for conversion between Python longs and C 'long long' if 11872your compiler supports it. 11873 11874- PySequence_In() is now called PySequence_Contains(). 11875(PySequence_In() is still supported for b/w compatibility; it is 11876declared obsolete because its argument order is confusing.) 11877 11878- PyDict_GetItem() and PyDict_GetItemString() are changed so that they 11879*never* raise an exception -- (even if the hash() fails, simply clear 11880the error). This was necessary because there is lots of code out 11881there that already assumes this. 11882 11883- Changes to PySequence_Tuple() and PySequence_List() to use the 11884length of a sequence only as a hint -- if an IndexError happens 11885earlier, take that. (Formerly, this was considered an error.) 11886 11887- Reformatted abstract.c to give it a more familiar "look" and fixed 11888many error checking bugs. 11889 11890- Add NULL pointer checks to all calls of a C function through a type 11891object and extensions (e.g. nb_add). 11892 11893- The code that initializes sys.path now calls Py_GetPythonHome() 11894instead of getenv("PYTHONHOME"). This, together with the new API 11895Py_SetPythonHome(), makes it easier for embedding applications to 11896change the notion of Python's "home" directory (where the libraries 11897etc. are sought). 11898 11899- Fixed a very old bug in the parsing of "O?" format specifiers. 11900 11901 11902====================================================================== 11903 11904 11905======================================== 11906==> Release 1.5.1 (October 31, 1998) <== 11907======================================== 11908 11909From 1.5 to 1.5.1 11910================= 11911 11912General 11913------- 11914 11915- The documentation is now unbundled. It has also been extensively 11916modified (mostly to implement a new and more uniform formatting 11917style). We figure that most people will prefer to download one of the 11918preformatted documentation sets (HTML, PostScript or PDF) and that 11919only a minority have a need for the LaTeX or FrameMaker sources. Of 11920course, the unbundled documentation sources still released -- just not 11921in the same archive file, and perhaps not on the same date. 11922 11923- All bugs noted on the errors page (and many unnoted) are fixed. All 11924new bugs take their places. 11925 11926- No longer a core dump when attempting to print (or repr(), or str()) 11927a list or dictionary that contains an instance of itself; instead, the 11928recursive entry is printed as [...] or {...}. See Py_ReprEnter() and 11929Py_ReprLeave() below. Comparisons of such objects still go beserk, 11930since this requires a different kind of fix; fortunately, this is a 11931less common scenario in practice. 11932 11933Syntax change 11934------------- 11935 11936- The raise statement can now be used without arguments, to re-raise 11937a previously set exception. This should be used after catching an 11938exception with an except clause only, either in the except clause or 11939later in the same function. 11940 11941Import and module handling 11942-------------------------- 11943 11944- The implementation of import has changed to use a mutex (when 11945threading is supported). This means that when two threads 11946simultaneously import the same module, the import statements are 11947serialized. Recursive imports are not affected. 11948 11949- Rewrote the finalization code almost completely, to be much more 11950careful with the order in which modules are destroyed. Destructors 11951will now generally be able to reference built-in names such as None 11952without trouble. 11953 11954- Case-insensitive platforms such as Mac and Windows require the case 11955of a module's filename to match the case of the module name as 11956specified in the import statement (see below). 11957 11958- The code for figuring out the default path now distinguishes between 11959files, modules, executable files, and directories. When expecting a 11960module, we also look for the .pyc or .pyo file. 11961 11962Parser/tokenizer changes 11963------------------------ 11964 11965- The tokenizer can now warn you when your source code mixes tabs and 11966spaces for indentation in a manner that depends on how much a tab is 11967worth in spaces. Use "python -t" or "python -v" to enable this 11968option. Use "python -tt" to turn the warnings into errors. (See also 11969tabnanny.py and tabpolice.py below.) 11970 11971- Return unsigned characters from tok_nextc(), so '\377' isn't 11972mistaken for an EOF character. 11973 11974- Fixed two pernicious bugs in the tokenizer that only affected AIX. 11975One was actually a general bug that was triggered by AIX's smaller I/O 11976buffer size. The other was a bug in the AIX optimizer's loop 11977unrolling code; swapping two statements made the problem go away. 11978 11979Tools, demos and miscellaneous files 11980------------------------------------ 11981 11982- There's a new version of Misc/python-mode.el (the Emacs mode for 11983Python) which is much smarter about guessing the indentation style 11984used in a particular file. Lots of other cool features too! 11985 11986- There are two new tools in Tools/scripts: tabnanny.py and 11987tabpolice.py, implementing two different ways of checking whether a 11988file uses indentation in a way that is sensitive to the interpretation 11989of a tab. The preferred module is tabnanny.py (by Tim Peters). 11990 11991- Some new demo programs: 11992 11993 Demo/tkinter/guido/paint.py -- Dave Mitchell 11994 Demo/sockets/unixserver.py -- Piet van Oostrum 11995 11996 11997- Much better freeze support. The freeze script can now freeze 11998hierarchical module names (with a corresponding change to import.c), 11999and has a few extra options (e.g. to suppress freezing specific 12000modules). It also does much more on Windows NT. 12001 12002- Version 1.0 of the faq wizard is included (only very small changes 12003since version 0.9.0). 12004 12005- New feature for the ftpmirror script: when removing local files 12006(i.e., only when -r is used), do a recursive delete. 12007 12008Configuring and building Python 12009------------------------------- 12010 12011- Get rid of the check for -linet -- recent Sequent Dynix systems don't 12012need this any more and apparently it screws up their configuration. 12013 12014- Some changes because gcc on SGI doesn't support '-all'. 12015 12016- Changed the build rules to use $(LIBRARY) instead of 12017 -L.. -lpython$(VERSION) 12018since the latter trips up the SunOS 4.1.x linker (sigh). 12019 12020- Fix the bug where the '# dgux is broken' comment in the Makefile 12021tripped over Make on some platforms. 12022 12023- Changes for AIX: install the python.exp file; properly use 12024$(srcdir); the makexp_aix script now removes C++ entries of the form 12025Class::method. 12026 12027- Deleted some Makefile targets only used by the (long obsolete) 12028gMakefile hacks. 12029 12030Extension modules 12031----------------- 12032 12033- Performance and threading improvements to the socket and bsddb 12034modules, by Christopher Lindblad of Infoseek. 12035 12036- Added operator.__not__ and operator.not_. 12037 12038- In the thread module, when a thread exits due to an unhandled 12039exception, don't store the exception information in sys.last_*; it 12040prevents proper calling of destructors of local variables. 12041 12042- Fixed a number of small bugs in the cPickle module. 12043 12044- Changed find() and rfind() in the strop module so that 12045find("x","",2) returns -1, matching the implementation in string.py. 12046 12047- In the time module, be more careful with the result of ctime(), and 12048test for HAVE_MKTIME before usinmg mktime(). 12049 12050- Doc strings contributed by Mitch Chapman to the termios, pwd, gdbm 12051modules. 12052 12053- Added the LOG_SYSLOG constant to the syslog module, if defined. 12054 12055Standard library modules 12056------------------------ 12057 12058- All standard library modules have been converted to an indentation 12059style using either only tabs or only spaces -- never a mixture -- if 12060they weren't already consistent according to tabnanny. This means 12061that the new -t option (see above) won't complain about standard 12062library modules. 12063 12064- New standard library modules: 12065 12066 threading -- GvR and the thread-sig 12067 Java style thread objects -- USE THIS!!! 12068 12069 getpass -- Piers Lauder 12070 simple utilities to prompt for a password and to 12071 retrieve the current username 12072 12073 imaplib -- Piers Lauder 12074 interface for the IMAP4 protocol 12075 12076 poplib -- David Ascher, Piers Lauder 12077 interface for the POP3 protocol 12078 12079 smtplib -- Dragon De Monsyne 12080 interface for the SMTP protocol 12081 12082- Some obsolete modules moved to a separate directory (Lib/lib-old) 12083which is *not* in the default module search path: 12084 12085 Para 12086 addpack 12087 codehack 12088 fmt 12089 lockfile 12090 newdir 12091 ni 12092 rand 12093 tb 12094 12095- New version of the PCRE code (Perl Compatible Regular Expressions -- 12096the re module and the supporting pcre extension) by Andrew Kuchling. 12097Incompatible new feature in re.sub(): the handling of escapes in the 12098replacement string has changed. 12099 12100- Interface change in the copy module: a __deepcopy__ method is now 12101called with the memo dictionary as an argument. 12102 12103- Feature change in the tokenize module: differentiate between NEWLINE 12104token (an official newline) and NL token (a newline that the grammar 12105ignores). 12106 12107- Several bugfixes to the urllib module. It is now truly thread-safe, 12108and several bugs and a portability problem have been fixed. New 12109features, all due to Sjoerd Mullender: When creating a temporary file, 12110it gives it an appropriate suffix. Support the "data:" URL scheme. 12111The open() method uses the tempcache. 12112 12113- New version of the xmllib module (this time with a test suite!) by 12114Sjoerd Mullender. 12115 12116- Added debugging code to the telnetlib module, to be able to trace 12117the actual traffic. 12118 12119- In the rfc822 module, added support for deleting a header (still no 12120support for adding headers, though). Also fixed a bug where an 12121illegal address would cause a crash in getrouteaddr(), fixed a 12122sign reversal in mktime_tz(), and use the local timezone by default 12123(the latter two due to Bill van Melle). 12124 12125- The normpath() function in the dospath and ntpath modules no longer 12126does case normalization -- for that, use the separate function 12127normcase() (which always existed); normcase() has been sped up and 12128fixed (it was the cause of a crash in Mark Hammond's installer in 12129certain locales). 12130 12131- New command supported by the ftplib module: rmd(); also fixed some 12132minor bugs. 12133 12134- The profile module now uses a different timer function by default -- 12135time.clock() is generally better than os.times(). This makes it work 12136better on Windows NT, too. 12137 12138- The tempfile module now recovers when os.getcwd() raises an 12139exception. 12140 12141- Fixed some bugs in the random module; gauss() was subtly wrong, and 12142vonmisesvariate() should return a full circle. Courtesy Mike Miller, 12143Lambert Meertens (gauss()), and Magnus Kessler (vonmisesvariate()). 12144 12145- Better default seed in the whrandom module, courtesy Andrew Kuchling. 12146 12147- Fix slow close() in shelve module. 12148 12149- The Unix mailbox class in the mailbox module is now more robust when 12150a line begins with the string "From " but is definitely not the start 12151of a new message. The pattern used can be changed by overriding a 12152method or class variable. 12153 12154- Added a rmtree() function to the copy module. 12155 12156- Fixed several typos in the pickle module. Also fixed problems when 12157unpickling in restricted execution environments. 12158 12159- Added docstrings and fixed a typo in the py_compile and compileall 12160modules. At Mark Hammond's repeated request, py_compile now append a 12161newline to the source if it needs one. Both modules support an extra 12162parameter to specify the purported source filename (to be used in 12163error messages). 12164 12165- Some performance tweaks by Jeremy Hylton to the gzip module. 12166 12167- Fixed a bug in the merge order of dictionaries in the ConfigParser 12168module. Courtesy Barry Warsaw. 12169 12170- In the multifile module, support the optional second parameter to 12171seek() when possible. 12172 12173- Several fixes to the gopherlib module by Lars Marius Garshol. Also, 12174urlparse now correctly handles Gopher URLs with query strings. 12175 12176- Fixed a tiny bug in format_exception() in the traceback module. 12177Also rewrite tb_lineno() to be compatible with JPython (and not 12178disturb the current exception!); by Jim Hugunin. 12179 12180- The httplib module is more robust when servers send a short response 12181-- courtesy Tim O'Malley. 12182 12183Tkinter and friends 12184------------------- 12185 12186- Various typos and bugs fixed. 12187 12188- New module Tkdnd implements a drag-and-drop protocol (within one 12189application only). 12190 12191- The event_*() widget methods have been restructured slightly -- they 12192no longer use the default root. 12193 12194- The interfaces for the bind*() and unbind() widget methods have been 12195redesigned; the bind*() methods now return the name of the Tcl command 12196created for the callback, and this can be passed as an optional 12197argument to unbind() in order to delete the command (normally, such 12198commands are automatically unbound when the widget is destroyed, but 12199for some applications this isn't enough). 12200 12201- Variable objects now have trace methods to interface to Tcl's 12202variable tracing facilities. 12203 12204- Image objects now have an optional keyword argument, 'master', to 12205specify a widget (tree) to which they belong. The image_names() and 12206image_types() calls are now also widget methods. 12207 12208- There's a new global call, Tkinter.NoDefaultRoot(), which disables 12209all use of the default root by the Tkinter library. This is useful to 12210debug applications that are in the process of being converted from 12211relying on the default root to explicit specification of the root 12212widget. 12213 12214- The 'exit' command is deleted from the Tcl interpreter, since it 12215provided a loophole by which one could (accidentally) exit the Python 12216interpreter without invoking any cleanup code. 12217 12218- Tcl_Finalize() is now registered as a Python low-level exit handle, 12219so Tcl will be finalized when Python exits. 12220 12221The Python/C API 12222---------------- 12223 12224- New function PyThreadState_GetDict() returns a per-thread dictionary 12225intended for storing thread-local global variables. 12226 12227- New functions Py_ReprEnter() and Py_ReprLeave() use the per-thread 12228dictionary to allow recursive container types to detect recursion in 12229their repr(), str() and print implementations. 12230 12231- New function PyObject_Not(x) calculates (not x) according to Python's 12232standard rules (basically, it negates the outcome PyObject_IsTrue(x). 12233 12234- New function _PyModule_Clear(), which clears a module's dictionary 12235carefully without removing the __builtins__ entry. This is implied 12236when a module object is deallocated (this used to clear the dictionary 12237completely). 12238 12239- New function PyImport_ExecCodeModuleEx(), which extends 12240PyImport_ExecCodeModule() by adding an extra parameter to pass it the 12241true file. 12242 12243- New functions Py_GetPythonHome() and Py_SetPythonHome(), intended to 12244allow embedded applications to force a different value for PYTHONHOME. 12245 12246- New global flag Py_FrozenFlag is set when this is a "frozen" Python 12247binary; it suppresses warnings about not being able to find the 12248standard library directories. 12249 12250- New global flag Py_TabcheckFlag is incremented by the -t option and 12251causes the tokenizer to issue warnings or errors about inconsistent 12252mixing of tabs and spaces for indentation. 12253 12254Miscellaneous minor changes and bug fixes 12255----------------------------------------- 12256 12257- Improved the error message when an attribute of an attribute-less 12258object is requested -- include the name of the attribute and the type 12259of the object in the message. 12260 12261- Sped up int(), long(), float() a bit. 12262 12263- Fixed a bug in list.sort() that would occasionally dump core. 12264 12265- Fixed a bug in PyNumber_Power() that caused numeric arrays to fail 12266when taken tothe real power. 12267 12268- Fixed a number of bugs in the file reading code, at least one of 12269which could cause a core dump on NT, and one of which would 12270occasionally cause file.read() to return less than the full contents 12271of the file. 12272 12273- Performance hack by Vladimir Marangozov for stack frame creation. 12274 12275- Make sure setvbuf() isn't used unless HAVE_SETVBUF is defined. 12276 12277Windows 95/NT 12278------------- 12279 12280- The .lib files are now part of the distribution; they are collected 12281in the subdirectory "libs" of the installation directory. 12282 12283- The extension modules (.pyd files) are now collected in a separate 12284subdirectory of the installation directory named "DLLs". 12285 12286- The case of a module's filename must now match the case of the 12287module name as specified in the import statement. This is an 12288experimental feature -- if it turns out to break in too many 12289situations, it will be removed (or disabled by default) in the future. 12290It can be disabled on a per-case basis by setting the environment 12291variable PYTHONCASEOK (to any value). 12292 12293 12294====================================================================== 12295 12296 12297===================================== 12298==> Release 1.5 (January 3, 1998) <== 12299===================================== 12300 12301 12302From 1.5b2 to 1.5 12303================= 12304 12305- Newly documentated module: BaseHTTPServer.py, thanks to Greg Stein. 12306 12307- Added doc strings to string.py, stropmodule.c, structmodule.c, 12308thanks to Charles Waldman. 12309 12310- Many nits fixed in the manuals, thanks to Fred Drake and many others 12311(especially Rob Hooft and Andrew Kuchling). The HTML version now uses 12312HTML markup instead of inline GIF images for tables; only two images 12313are left (for obsure bits of math). The index of the HTML version has 12314also been much improved. Finally, it is once again possible to 12315generate an Emacs info file from the library manual (but I don't 12316commit to supporting this in future versions). 12317 12318- New module: telnetlib.py (a simple telnet client library). 12319 12320- New tool: Tools/versioncheck/, by Jack Jansen. 12321 12322- Ported zlibmodule.c and bsddbmodule.c to NT; The project file for MS 12323DevStudio 5.0 now includes new subprojects to build the zlib and bsddb 12324extension modules. 12325 12326- Many small changes again to Tkinter.py -- mostly bugfixes and adding 12327missing routines. Thanks to Greg McFarlane for reporting a bunch of 12328problems and proofreading my fixes. 12329 12330- The re module and its documentation are up to date with the latest 12331version released to the string-sig (Dec. 22). 12332 12333- Stop test_grp.py from failing when the /etc/group file is empty 12334(yes, this happens!). 12335 12336- Fix bug in integer conversion (mystrtoul.c) that caused 123374294967296==0 to be true! 12338 12339- The VC++ 4.2 project file should be complete again. 12340 12341- In tempfile.py, use a better template on NT, and add a new optional 12342argument "suffix" with default "" to specify a specific extension for 12343the temporary filename (needed sometimes on NT but perhaps also handy 12344elsewhere). 12345 12346- Fixed some bugs in the FAQ wizard, and converted it to use re 12347instead of regex. 12348 12349- Fixed a mysteriously undetected error in dlmodule.c (it was using a 12350totally bogus routine name to raise an exception). 12351 12352- Fixed bug in import.c which wasn't using the new "dos-8x3" name yet. 12353 12354- Hopefully harmless changes to the build process to support shared 12355libraries on DG/UX. This adds a target to create 12356libpython$(VERSION).so; however this target is *only* for DG/UX. 12357 12358- Fixed a bug in the new format string error checking in getargs.c. 12359 12360- A simple fix for infinite recursion when printing __builtins__: 12361reset '_' to None before printing and set it to the printed variable 12362*after* printing (and only when printing is successful). 12363 12364- Fixed lib-tk/SimpleDialog.py to keep the dialog visible even if the 12365parent window is not (Skip Montanaro). 12366 12367- Fixed the two most annoying problems with ftp URLs in 12368urllib.urlopen(); an empty file now correctly raises an error, and it 12369is no longer required to explicitly close the returned "file" object 12370before opening another ftp URL to the same host and directory. 12371 12372 12373====================================================================== 12374 12375 12376From 1.5b1 to 1.5b2 12377=================== 12378 12379- Fixed a bug in cPickle.c that caused it to crash right away because 12380the version string had a different format. 12381 12382- Changes in pickle.py and cPickle.c: when unpickling an instance of a 12383class that doesn't define the __getinitargs__() method, the __init__() 12384constructor is no longer called. This makes a much larger group of 12385classes picklable by default, but may occasionally change semantics. 12386To force calling __init__() on unpickling, define a __getinitargs__() 12387method. Other changes too, in particular cPickle now handles classes 12388defined in packages correctly. The same change applies to copying 12389instances with copy.py. The cPickle.c changes and some pickle.py 12390changes are courtesy Jim Fulton. 12391 12392- Locale support in he "re" (Perl regular expressions) module. Use 12393the flag re.L (or re.LOCALE) to enable locale-specific matching 12394rules for \w and \b. The in-line syntax for this flag is (?L). 12395 12396- The built-in function isinstance(x, y) now also succeeds when y is 12397a type object and type(x) is y. 12398 12399- repr() and str() of class and instance objects now reflect the 12400package/module in which the class is defined. 12401 12402- Module "ni" has been removed. (If you really need it, it's been 12403renamed to "ni1". Let me know if this causes any problems for you. 12404Package authors are encouraged to write __init__.py files that 12405support both ni and 1.5 package support, so the same version can be 12406used with Python 1.4 as well as 1.5.) 12407 12408- The thread module is now automatically included when threads are 12409configured. (You must remove it from your existing Setup file, 12410since it is now in its own Setup.thread file.) 12411 12412- New command line option "-x" to skip the first line of the script; 12413handy to make executable scripts on non-Unix platforms. 12414 12415- In importdl.c, add the RTLD_GLOBAL to the dlopen() flags. I 12416haven't checked how this affects things, but it should make symbols 12417in one shared library available to the next one. 12418 12419- The Windows installer now installs in the "Program Files" folder on 12420the proper volume by default. 12421 12422- The Windows configuration adds a new main program, "pythonw", and 12423registers a new extension, ".pyw" that invokes this. This is a 12424pstandard Python interpreter that does not pop up a console window; 12425handy for pure Tkinter applications. All output to the original 12426stdout and stderr is lost; reading from the original stdin yields 12427EOF. Also, both python.exe and pythonw.exe now have a pretty icon 12428(a green snake in a box, courtesy Mark Hammond). 12429 12430- Lots of improvements to emacs-mode.el again. See Barry's web page: 12431http://www.python.org/ftp/emacs/pmdetails.html. 12432 12433- Lots of improvements and additions to the library reference manual; 12434many by Fred Drake. 12435 12436- Doc strings for the following modules: rfc822.py, posixpath.py, 12437ntpath.py, httplib.py. Thanks to Mitch Chapman and Charles Waldman. 12438 12439- Some more regression testing. 12440 12441- An optional 4th (maxsplit) argument to strop.replace(). 12442 12443- Fixed handling of maxsplit in string.splitfields(). 12444 12445- Tweaked os.environ so it can be pickled and copied. 12446 12447- The portability problems caused by indented preprocessor commands 12448and C++ style comments should be gone now. 12449 12450- In random.py, added Pareto and Weibull distributions. 12451 12452- The crypt module is now disabled in Modules/Setup.in by default; it 12453is rarely needed and causes errors on some systems where users often 12454don't know how to deal with those. 12455 12456- Some improvements to the _tkinter build line suggested by Case Roole. 12457 12458- A full suite of platform specific files for NetBSD 1.x, submitted by 12459Anders Andersen. 12460 12461- New Solaris specific header STROPTS.py. 12462 12463- Moved a confusing occurrence of *shared* from the comments in 12464Modules/Setup.in (people would enable this one instead of the real 12465one, and get disappointing results). 12466 12467- Changed the default mode for directories to be group-writable when 12468the installation process creates them. 12469 12470- Check for pthread support in "-l_r" for FreeBSD/NetBSD, and support 12471shared libraries for both. 12472 12473- Support FreeBSD and NetBSD in posixfile.py. 12474 12475- Support for the "event" command, new in Tk 4.2. By Case Roole. 12476 12477- Add Tix_SafeInit() support to tkappinit.c. 12478 12479- Various bugs fixed in "re.py" and "pcre.c". 12480 12481- Fixed a bug (broken use of the syntax table) in the old "regexpr.c". 12482 12483- In frozenmain.c, stdin is made unbuffered too when PYTHONUNBUFFERED 12484is set. 12485 12486- Provide default blocksize for retrbinary in ftplib.py (Skip 12487Montanaro). 12488 12489- In NT, pick the username up from different places in user.py (Jeff 12490Bauer). 12491 12492- Patch to urlparse.urljoin() for ".." and "..#1", Marc Lemburg. 12493 12494- Many small improvements to Jeff Rush' OS/2 support. 12495 12496- ospath.py is gone; it's been obsolete for so many years now... 12497 12498- The reference manual is now set up to prepare better HTML (still 12499using webmaker, alas). 12500 12501- Add special handling to /Tools/freeze for Python modules that are 12502imported implicitly by the Python runtime: 'site' and 'exceptions'. 12503 12504- Tools/faqwiz 0.8.3 -- add an option to suppress URL processing 12505inside <PRE>, by "Scott". 12506 12507- Added ConfigParser.py, a generic parser for sectioned configuration 12508files. 12509 12510- In _localemodule.c, LC_MESSAGES is not always defined; put it 12511between #ifdefs. 12512 12513- Typo in resource.c: RUSAGE_CHILDERN -> RUSAGE_CHILDREN. 12514 12515- Demo/scripts/newslist.py: Fix the way the version number is gotten 12516out of the RCS revision. 12517 12518- PyArg_Parse[Tuple] now explicitly check for bad characters at the 12519end of the format string. 12520 12521- Revamped PC/example_nt to support VC++ 5.x. 12522 12523- <listobject>.sort() now uses a modified quicksort by Raymund Galvin, 12524after studying the GNU libg++ quicksort. This should be much faster 12525if there are lots of duplicates, and otherwise at least as good. 12526 12527- Added "uue" as an alias for "uuencode" to mimetools.py. (Hm, the 12528uudecode bug where it complaints about trailing garbage is still there 12529:-( ). 12530 12531- pickle.py requires integers in text mode to be in decimal notation 12532(it used to accept octal and hex, even though it would only generate 12533decimal numbers). 12534 12535- In string.atof(), don't fail when the "re" module is unavailable. 12536Plug the ensuing security leak by supplying an empty __builtins__ 12537directory to eval(). 12538 12539- A bunch of small fixes and improvements to Tkinter.py. 12540 12541- Fixed a buffer overrun in PC/getpathp.c. 12542 12543 12544====================================================================== 12545 12546 12547From 1.5a4 to 1.5b1 12548=================== 12549 12550- The Windows NT/95 installer now includes full HTML of all manuals. 12551It also has a checkbox that lets you decide whether to install the 12552interpreter and library. The WISE installer script for the installer 12553is included in the source tree as PC/python15.wse, and so are the 12554icons used for Python files. The config.c file for the Windows build 12555is now complete with the pcre module. 12556 12557- sys.ps1 and sys.ps2 can now arbitrary objects; their str() is 12558evaluated for the prompt. 12559 12560- The reference manual is brought up to date (more or less -- it still 12561needs work, e.g. in the area of package import). 12562 12563- The icons used by latex2html are now included in the Doc 12564subdirectory (mostly so that tarring up the HTML files can be fully 12565automated). A simple index.html is also added to Doc (it only works 12566after you have successfully run latex2html). 12567 12568- For all you would-be proselytizers out there: a new version of 12569Misc/BLURB describes Python more concisely, and Misc/comparisons 12570compares Python to several other languages. Misc/BLURB.WINDOWS 12571contains a blurb specifically aimed at Windows programmers (by Mark 12572Hammond). 12573 12574- A new version of the Python mode for Emacs is included as 12575Misc/python-mode.el. There are too many new features to list here. 12576See http://www.python.org/ftp/emacs/pmdetails.html for more info. 12577 12578- New module fileinput makes iterating over the lines of a list of 12579files easier. (This still needs some more thinking to make it more 12580extensible.) 12581 12582- There's full OS/2 support, courtesy Jeff Rush. To build the OS/2 12583version, see PC/readme.txt and PC/os2vacpp. This is for IBM's Visual 12584Age C++ compiler. I expect that Jeff will also provide a binary 12585release for this platform. 12586 12587- On Linux, the configure script now uses '-Xlinker -export-dynamic' 12588instead of '-rdynamic' to link the main program so that it exports its 12589symbols to shared libraries it loads dynamically. I hope this doesn't 12590break on older Linux versions; it is needed for mklinux and appears to 12591work on Linux 2.0.30. 12592 12593- Some Tkinter resstructuring: the geometry methods that apply to a 12594master are now properly usable on toplevel master widgets. There's a 12595new (internal) widget class, BaseWidget. New, longer "official" names 12596for the geometry manager methods have been added, 12597e.g. "grid_columnconfigure()" instead of "columnconfigure()". The old 12598shorter names still work, and where there's ambiguity, pack wins over 12599place wins over grid. Also, the bind_class method now returns its 12600value. 12601 12602- New, RFC-822 conformant parsing of email addresses and address lists 12603in the rfc822 module, courtesy Ben Escoto. 12604 12605- New, revamped tkappinit.c with support for popular packages (PIL, 12606TIX, BLT, TOGL). For the last three, you need to execute the Tcl 12607command "load {} Tix" (or Blt, or Togl) to gain access to them. 12608The Modules/Setup line for the _tkinter module has been rewritten 12609using the cool line-breaking feature of most Bourne shells. 12610 12611- New socket method connect_ex() returns the error code from connect() 12612instead of raising an exception on errors; this makes the logic 12613required for asynchronous connects simpler and more efficient. 12614 12615- New "locale" module with (still experimental) interface to the 12616standard C library locale interface, courtesy Martin von Loewis. This 12617does not repeat my mistake in 1.5a4 of always calling 12618setlocale(LC_ALL, ""). In fact, we've pretty much decided that 12619Python's standard numerical formatting operations should always use 12620the conventions for the C locale; the locale module contains utility 12621functions to format numbers according to the user specified locale. 12622(All this is accomplished by an explicit call to setlocale(LC_NUMERIC, 12623"C") after locale-changing calls.) See the library manual. (Alas, the 12624promised changes to the "re" module for locale support have not been 12625materialized yet. If you care, volunteer!) 12626 12627- Memory leak plugged in Py_BuildValue when building a dictionary. 12628 12629- Shared modules can now live inside packages (hierarchical module 12630namespaces). No changes to the shared module itself are needed. 12631 12632- Improved policy for __builtins__: this is a module in __main__ and a 12633dictionary everywhere else. 12634 12635- Python no longer catches SIGHUP and SIGTERM by default. This was 12636impossible to get right in the light of thread contexts. If you want 12637your program to clean up when a signal happens, use the signal module 12638to set up your own signal handler. 12639 12640- New Python/C API PyNumber_CoerceEx() does not return an exception 12641when no coercion is possible. This is used to fix a problem where 12642comparing incompatible numbers for equality would raise an exception 12643rather than return false as in Python 1.4 -- it once again will return 12644false. 12645 12646- The errno module is changed again -- the table of error messages 12647(errorstr) is removed. Instead, you can use os.strerror(). This 12648removes redundance and a potential locale dependency. 12649 12650- New module xmllib, to parse XML files. By Sjoerd Mullender. 12651 12652- New C API PyOS_AfterFork() is called after fork() in posixmodule.c. 12653It resets the signal module's notion of what the current process ID 12654and thread are, so that signal handlers will work after (and across) 12655calls to os.fork(). 12656 12657- Fixed most occurrences of fatal errors due to missing thread state. 12658 12659- For vgrind (a flexible source pretty printer) fans, there's a simple 12660Python definition in Misc/vgrindefs, courtesy Neale Pickett. 12661 12662- Fixed memory leak in exec statement. 12663 12664- The test.pystone module has a new function, pystones(loops=LOOPS), 12665which returns a (benchtime, stones) tuple. The main() function now 12666calls this and prints the report. 12667 12668- Package directories now *require* the presence of an __init__.py (or 12669__init__.pyc) file before they are considered as packages. This is 12670done to prevent accidental subdirectories with common names from 12671overriding modules with the same name. 12672 12673- Fixed some strange exceptions in __del__ methods in library modules 12674(e.g. urllib). This happens because the built-in names are already 12675deleted by the time __del__ is called. The solution (a hack, but it 12676works) is to set some instance variables to 0 instead of None. 12677 12678- The table of built-in module initializers is replaced by a pointer 12679variable. This makes it possible to switch to a different table at 12680run time, e.g. when a collection of modules is loaded from a shared 12681library. (No example code of how to do this is given, but it is 12682possible.) The table is still there of course, its name prefixed with 12683an underscore and used to initialize the pointer. 12684 12685- The warning about a thread still having a frame now only happens in 12686verbose mode. 12687 12688- Change the signal finalization so that it also resets the signal 12689handlers. After this has been called, our signal handlers are no 12690longer active! 12691 12692- New version of tokenize.py (by Ka-Ping Yee) recognizes raw string 12693literals. There's now also a test fort this module. 12694 12695- The copy module now also uses __dict__.update(state) instead of 12696going through individual attribute assignments, for class instances 12697without a __setstate__ method. 12698 12699- New module reconvert translates old-style (regex module) regular 12700expressions to new-style (re module, Perl-style) regular expressions. 12701 12702- Most modules that used to use the regex module now use the re 12703module. The grep module has a new pgrep() function which uses 12704Perl-style regular expressions. 12705 12706- The (very old, backwards compatibility) regexp.py module has been 12707deleted. 12708 12709- Restricted execution (rexec): added the pcre module (support for the 12710re module) to the list of trusted extension modules. 12711 12712- New version of Jim Fulton's CObject object type, adds 12713PyCObject_FromVoidPtrAndDesc() and PyCObject_GetDesc() APIs. 12714 12715- Some patches to Lee Busby's fpectl mods that accidentally didn't 12716make it into 1.5a4. 12717 12718- In the string module, add an optional 4th argument to count(), 12719matching find() etc. 12720 12721- Patch for the nntplib module by Charles Waldman to add optional user 12722and password arguments to NNTP.__init__(), for nntp servers that need 12723them. 12724 12725- The str() function for class objects now returns 12726"modulename.classname" instead of returning the same as repr(). 12727 12728- The parsing of \xXX escapes no longer relies on sscanf(). 12729 12730- The "sharedmodules" subdirectory of the installation is renamed to 12731"lib-dynload". (You may have to edit your Modules/Setup file to fix 12732this in an existing installation!) 12733 12734- Fixed Don Beaudry's mess-up with the OPT test in the configure 12735script. Certain SGI platforms will still issue a warning for each 12736compile; there's not much I can do about this since the compiler's 12737exit status doesn't indicate that I was using an obsolete option. 12738 12739- Fixed Barry's mess-up with {}.get(), and added test cases for it. 12740 12741- Shared libraries didn't quite work under AIX because of the change 12742in status of the GNU readline interface. Fix due to by Vladimir 12743Marangozov. 12744 12745 12746====================================================================== 12747 12748 12749From 1.5a3 to 1.5a4 12750=================== 12751 12752- faqwiz.py: version 0.8; Recognize https:// as URL; <html>...</html> 12753feature; better install instructions; removed faqmain.py (which was an 12754older version). 12755 12756- nntplib.py: Fixed some bugs reported by Lars Wirzenius (to Debian) 12757about the treatment of lines starting with '.'. Added a minimal test 12758function. 12759 12760- struct module: ignore most whitespace in format strings. 12761 12762- urllib.py: close the socket and temp file in URLopener.retrieve() so 12763that multiple retrievals using the same connection work. 12764 12765- All standard exceptions are now classes by default; use -X to make 12766them strings (for backward compatibility only). 12767 12768- There's a new standard exception hierarchy, defined in the standard 12769library module exceptions.py (which you never need to import 12770explicitly). See 12771http://grail.cnri.reston.va.us/python/essays/stdexceptions.html for 12772more info. 12773 12774- Three new C API functions: 12775 12776 - int PyErr_GivenExceptionMatches(obj1, obj2) 12777 12778 Returns 1 if obj1 and obj2 are the same object, or if obj1 is an 12779 instance of type obj2, or of a class derived from obj2 12780 12781 - int PyErr_ExceptionMatches(obj) 12782 12783 Higher level wrapper around PyErr_GivenExceptionMatches() which uses 12784 PyErr_Occurred() as obj1. This will be the more commonly called 12785 function. 12786 12787 - void PyErr_NormalizeException(typeptr, valptr, tbptr) 12788 12789 Normalizes exceptions, and places the normalized values in the 12790 arguments. If type is not a class, this does nothing. If type is a 12791 class, then it makes sure that value is an instance of the class by: 12792 12793 1. if instance is of the type, or a class derived from type, it does 12794 nothing. 12795 12796 2. otherwise it instantiates the class, using the value as an 12797 argument. If value is None, it uses an empty arg tuple, and if 12798 the value is a tuple, it uses just that. 12799 12800- Another new C API function: PyErr_NewException() creates a new 12801exception class derived from Exception; when -X is given, it creates a 12802new string exception. 12803 12804- core interpreter: remove the distinction between tuple and list 12805unpacking; allow an arbitrary sequence on the right hand side of any 12806unpack instruction. (UNPACK_LIST and UNPACK_TUPLE now do the same 12807thing, which should really be called UNPACK_SEQUENCE.) 12808 12809- classes: Allow assignments to an instance's __dict__ or __class__, 12810so you can change ivars (including shared ivars -- shock horror) and 12811change classes dynamically. Also make the check on read-only 12812attributes of classes less draconic -- only the specials names 12813__dict__, __bases__, __name__ and __{get,set,del}attr__ can't be 12814assigned. 12815 12816- Two new built-in functions: issubclass() and isinstance(). Both 12817take classes as their second arguments. The former takes a class as 12818the first argument and returns true iff first is second, or is a 12819subclass of second. The latter takes any object as the first argument 12820and returns true iff first is an instance of the second, or any 12821subclass of second. 12822 12823- configure: Added configuration tests for presence of alarm(), 12824pause(), and getpwent(). 12825 12826- Doc/Makefile: changed latex2html targets. 12827 12828- classes: Reverse the search order for the Don Beaudry hook so that 12829the first class with an applicable hook wins. Makes more sense. 12830 12831- Changed the checks made in Py_Initialize() and Py_Finalize(). It is 12832now legal to call these more than once. The first call to 12833Py_Initialize() initializes, the first call to Py_Finalize() 12834finalizes. There's also a new API, Py_IsInitialized() which checks 12835whether we are already initialized (in case you want to leave things 12836as they were). 12837 12838- Completely disable the declarations for malloc(), realloc() and 12839free(). Any 90's C compiler has these in header files, and the tests 12840to decide whether to suppress the declarations kept failing on some 12841platforms. 12842 12843- *Before* (instead of after) signalmodule.o is added, remove both 12844intrcheck.o and sigcheck.o. This should get rid of warnings in ar or 12845ld on various systems. 12846 12847- Added reop to PC/config.c 12848 12849- configure: Decided to use -Aa -D_HPUX_SOURCE on HP-UX platforms. 12850Removed outdated HP-UX comments from README. Added Cray T3E comments. 12851 12852- Various renames of statically defined functions that had name 12853conflicts on some systems, e.g. strndup (GNU libc), join (Cray), 12854roundup (sys/types.h). 12855 12856- urllib.py: Interpret three slashes in file: URL as local file (for 12857Netscape on Windows/Mac). 12858 12859- copy.py: Make sure the objects returned by __getinitargs__() are 12860kept alive (in the memo) to avoid a certain kind of nasty crash. (Not 12861easily reproducible because it requires a later call to 12862__getinitargs__() to return a tuple that happens to be allocated at 12863the same address.) 12864 12865- Added definition of AR to toplevel Makefile. Renamed @buildno temp 12866file to buildno1. 12867 12868- Moved Include/assert.h to Parser/assert.h, which seems to be the 12869only place where it's needed. 12870 12871- Tweaked the dictionary lookup code again for some more speed 12872(Vladimir Marangozov). 12873 12874- NT build: Changed the way python15.lib is included in the other 12875projects. Per Mark Hammond's suggestion, add it to the extra libs in 12876Settings instead of to the project's source files. 12877 12878- regrtest.py: Change default verbosity so that there are only three 12879levels left: -q, default and -v. In default mode, the name of each 12880test is now printed. -v is the same as the old -vv. -q is more quiet 12881than the old default mode. 12882 12883- Removed the old FAQ from the distribution. You now have to get it 12884from the web! 12885 12886- Removed the PC/make_nt.in file from the distribution; it is no 12887longer needed. 12888 12889- Changed the build sequence so that shared modules are built last. 12890This fixes things for AIX and doesn't hurt elsewhere. 12891 12892- Improved test for GNU MP v1 in mpzmodule.c 12893 12894- fileobject.c: ftell() on Linux discards all buffered data; changed 12895read() code to use lseek() instead to get the same effect 12896 12897- configure.in, configure, importdl.c: NeXT sharedlib fixes 12898 12899- tupleobject.c: PyTuple_SetItem asserts refcnt==1 12900 12901- resource.c: Different strategy regarding whether to declare 12902getrusage() and getpagesize() -- #ifdef doesn't work, Linux has 12903conflicting decls in its headers. Choice: only declare the return 12904type, not the argument prototype, and not on Linux. 12905 12906- importdl.c, configure*: set sharedlib extensions properly for NeXT 12907 12908- configure*, Makefile.in, Modules/Makefile.pre.in: AIX shared libraries 12909fixed; moved addition of PURIFY to LINKCC to configure 12910 12911- reopmodule.c, regexmodule.c, regexpr.c, zlibmodule.c: needed casts 12912added to shup up various compilers. 12913 12914- _tkinter.c: removed buggy mac #ifndef 12915 12916- Doc: various Mac documentation changes, added docs for 'ic' module 12917 12918- PC/make_nt.in: deleted 12919 12920- test_time.py, test_strftime.py: tweaks to catch %Z (which may return 12921"") 12922 12923- test_rotor.py: print b -> print `b` 12924 12925- Tkinter.py: (tagOrId) -> (tagOrId,) 12926 12927- Tkinter.py: the Tk class now also has a configure() method and 12928friends (they have been moved to the Misc class to accomplish this). 12929 12930- dict.get(key[, default]) returns dict[key] if it exists, or default 12931if it doesn't. The default defaults to None. This is quicker for 12932some applications than using either has_key() or try:...except 12933KeyError:.... 12934 12935- Tools/webchecker/: some small changes to webchecker.py; added 12936websucker.py (a simple web site mirroring script). 12937 12938- Dictionary objects now have a get() method (also in UserDict.py). 12939dict.get(key, default) returns dict[key] if it exists and default 12940otherwise; default defaults to None. 12941 12942- Tools/scripts/logmerge.py: print the author, too. 12943 12944- Changes to import: support for "import a.b.c" is now built in. See 12945http://grail.cnri.reston.va.us/python/essays/packages.html 12946for more info. Most important deviations from "ni.py": __init__.py is 12947executed in the package's namespace instead of as a submodule; and 12948there's no support for "__" or "__domain__". Note that "ni.py" is not 12949changed to match this -- it is simply declared obsolete (while at the 12950same time, it is documented...:-( ). 12951Unfortunately, "ihooks.py" has not been upgraded (but see "knee.py" 12952for an example implementation of hierarchical module import written in 12953Python). 12954 12955- More changes to import: the site.py module is now imported by 12956default when Python is initialized; use -S to disable it. The site.py 12957module extends the path with several more directories: site-packages 12958inside the lib/python1.5/ directory, site-python in the lib/ 12959directory, and pathnames mentioned in *.pth files found in either of 12960those directories. See 12961http://grail.cnri.reston.va.us/python/essays/packages.html 12962for more info. 12963 12964- Changes to standard library subdirectory names: those subdirectories 12965that are not packages have been renamed with a hypen in their name, 12966e.g. lib-tk, lib-stdwin, plat-win, plat-linux2, plat-sunos5, dos-8x3. 12967The test suite is now a package -- to run a test, you must now use 12968"import test.test_foo". 12969 12970- A completely new re.py module is provided (thanks to Andrew 12971Kuchling, Tim Peters and Jeffrey Ollie) which uses Philip Hazel's 12972"pcre" re compiler and engine. For a while, the "old" re.py (which 12973was new in 1.5a3!) will be kept around as re1.py. The "old" regex 12974module and underlying parser and engine are still present -- while 12975regex is now officially obsolete, it will probably take several major 12976release cycles before it can be removed. 12977 12978- The posix module now has a strerror() function which translates an 12979error code to a string. 12980 12981- The emacs.py module (which was long obsolete) has been removed. 12982 12983- The universal makefile Misc/Makefile.pre.in now features an 12984"install" target. By default, installed shared libraries go into 12985$exec_prefix/lib/python$VERSION/site-packages/. 12986 12987- The install-sh script is installed with the other configuration 12988specific files (in the config/ subdirectory). 12989 12990- It turns out whatsound.py and sndhdr.py were identical modules. 12991Since there's also an imghdr.py file, I propose to make sndhdr.py the 12992official one. For compatibility, whatsound.py imports * from 12993sndhdr.py. 12994 12995- Class objects have a new attribute, __module__, giving the name of 12996the module in which they were declared. This is useful for pickle and 12997for printing the full name of a class exception. 12998 12999- Many extension modules no longer issue a fatal error when their 13000initialization fails; the importing code now checks whether an error 13001occurred during module initialization, and correctly propagates the 13002exception to the import statement. 13003 13004- Most extension modules now raise class-based exceptions (except when 13005-X is used). 13006 13007- Subtle changes to PyEval_{Save,Restore}Thread(): always swap the 13008thread state -- just don't manipulate the lock if it isn't there. 13009 13010- Fixed a bug in Python/getopt.c that made it do the wrong thing when 13011an option was a single '-'. Thanks to Andrew Kuchling. 13012 13013- New module mimetypes.py will guess a MIME type from a filename's 13014extension. 13015 13016- Windows: the DLL version is now settable via a resource rather than 13017being hardcoded. This can be used for "branding" a binary Python 13018distribution. 13019 13020- urllib.py is now threadsafe -- it now uses re instead of regex, and 13021sys.exc_info() instead of sys.exc_{type,value}. 13022 13023- Many other library modules that used to use 13024sys.exc_{type,value,traceback} are now more thread-safe by virtue of 13025using sys.exc_info(). 13026 13027- The functions in popen2 have an optional buffer size parameter. 13028Also, the command argument can now be either a string (passed to the 13029shell) or a list of arguments (passed directly to execv). 13030 13031- Alas, the thread support for _tkinter released with 1.5a3 didn't 13032work. It's been rewritten. The bad news is that it now requires a 13033modified version of a file in the standard Tcl distribution, which you 13034must compile with a -I option pointing to the standard Tcl source 13035tree. For this reason, the thread support is disabled by default. 13036 13037- The errno extension module adds two tables: errorcode maps errno 13038numbers to errno names (e.g. EINTR), and errorstr maps them to 13039message strings. (The latter is redundant because the new call 13040posix.strerror() now does the same, but alla...) (Marc-Andre Lemburg) 13041 13042- The readline extension module now provides some interfaces to 13043internal readline routines that make it possible to write a completer 13044in Python. An example completer, rlcompleter.py, is provided. 13045 13046 When completing a simple identifier, it completes keywords, 13047 built-ins and globals in __main__; when completing 13048 NAME.NAME..., it evaluates (!) the expression up to the last 13049 dot and completes its attributes. 13050 13051 It's very cool to do "import string" type "string.", hit the 13052 completion key (twice), and see the list of names defined by 13053 the string module! 13054 13055 Tip: to use the tab key as the completion key, call 13056 13057 readline.parse_and_bind("tab: complete") 13058 13059- The traceback.py module has a new function tb_lineno() by Marc-Andre 13060Lemburg which extracts the line number from the linenumber table in 13061the code object. Apparently the traceback object doesn't contain the 13062right linenumber when -O is used. Rather than guessing whether -O is 13063on or off, the module itself uses tb_lineno() unconditionally. 13064 13065- Fixed Demo/tkinter/matt/canvas-moving-or-creating.py: change bind() 13066to tag_bind() so it works again. 13067 13068- The pystone script is now a standard library module. Example use: 13069"import test.pystone; test.pystone.main()". 13070 13071- The import of the readline module in interactive mode is now also 13072attempted when -i is specified. (Yes, I know, giving in to Marc-Andre 13073Lemburg, who asked for this. :-) 13074 13075- rfc822.py: Entirely rewritten parseaddr() function by Sjoerd 13076Mullender, to be closer to the standard. This fixes the getaddr() 13077method. Unfortunately, getaddrlist() is as broken as ever, since it 13078splits on commas without regard for RFC 822 quoting conventions. 13079 13080- pprint.py: correctly emit trailing "," in singleton tuples. 13081 13082- _tkinter.c: export names for its type objects, TkappType and 13083TkttType. 13084 13085- pickle.py: use __module__ when defined; fix a particularly hard to 13086reproduce bug that confuses the memo when temporary objects are 13087returned by custom pickling interfaces; and a semantic change: when 13088unpickling the instance variables of an instance, use 13089inst.__dict__.update(value) instead of a for loop with setattr() over 13090the value.keys(). This is more consistent (the pickling doesn't use 13091getattr() either but pickles inst.__dict__) and avoids problems with 13092instances that have a __setattr__ hook. But it *is* a semantic change 13093(because the setattr hook is no longer used). So beware! 13094 13095- config.h is now installed (at last) in 13096$exec_prefix/include/python1.5/. For most sites, this means that it 13097is actually in $prefix/include/python1.5/, with all the other Python 13098include files, since $prefix and $exec_prefix are the same by 13099default. 13100 13101- The imp module now supports parts of the functionality to implement 13102import of hierarchical module names. It now supports find_module() 13103and load_module() for all types of modules. Docstrings have been 13104added for those functions in the built-in imp module that are still 13105relevant (some old interfaces are obsolete). For a sample 13106implementation of hierarchical module import in Python, see the new 13107library module knee.py. 13108 13109- The % operator on string objects now allows arbitrary nested parens 13110in a %(...)X style format. (Brad Howes) 13111 13112- Reverse the order in which Setup and Setup.local are passed to the 13113makesetup script. This allows variable definitions in Setup.local to 13114override definitions in Setup. (But you'll still have to edit Setup 13115if you want to disable modules that are enabled by default, or if such 13116modules need non-standard options.) 13117 13118- Added PyImport_ImportModuleEx(name, globals, locals, fromlist); this 13119is like PyImport_ImporModule(name) but receives the globals and locals 13120dict and the fromlist arguments as well. (The name is a char*; the 13121others are PyObject*s). 13122 13123- The 'p' format in the struct extension module alloded to above is 13124new in 1.5a4. 13125 13126- The types.py module now uses try-except in a few places to make it 13127more likely that it can be imported in restricted mode. Some type 13128names are undefined in that case, e.g. CodeType (inaccessible), 13129FileType (not always accessible), and TracebackType and FrameType 13130(inaccessible). 13131 13132- In urllib.py: added separate administration of temporary files 13133created y URLopener.retrieve() so cleanup() can properly remove them. 13134The old code removed everything in tempcache which was a bad idea if 13135the user had passed a non-temp file into it. Also, in basejoin(), 13136interpret relative paths starting in "../". This is necessary if the 13137server uses symbolic links. 13138 13139- The Windows build procedure and project files are now based on 13140Microsoft Visual C++ 5.x. The build now takes place in the PCbuild 13141directory. It is much more robust, and properly builds separate Debug 13142and Release versions. (The installer will be added shortly.) 13143 13144- Added casts and changed some return types in regexpr.c to avoid 13145compiler warnings or errors on some platforms. 13146 13147- The AIX build tools for shared libraries now supports VPATH. (Donn 13148Cave) 13149 13150- By default, disable the "portable" multimedia modules audioop, 13151imageop, and rgbimg, since they don't work on 64-bit platforms. 13152 13153- Fixed a nasty bug in cStringIO.c when code was actually using the 13154close() method (the destructors would try to free certain fields a 13155second time). 13156 13157- For those who think they need it, there's a "user.py" module. This 13158is *not* imported by default, but can be imported to run user-specific 13159setup commands, ~/.pythonrc.py. 13160 13161- Various speedups suggested by Fredrik Lundh, Marc-Andre Lemburg, 13162Vladimir Marangozov, and others. 13163 13164- Added os.altsep; this is '/' on DOS/Windows, and None on systems 13165with a sane filename syntax. 13166 13167- os.py: Write out the dynamic OS choice, to avoid exec statements. 13168Adding support for a new OS is now a bit more work, but I bet that 13169'dos' or 'nt' will cover most situations... 13170 13171- The obsolete exception AccessError is now really gone. 13172 13173- Tools/faqwiz/: New installation instructions show how to maintain 13174multiple FAQs. Removed bootstrap script from end of faqwiz.py module. 13175Added instructions to bootstrap script, too. Version bumped to 0.8.1. 13176Added <html>...</html> feature suggested by Skip Montanaro. Added 13177leading text for Roulette, default to 'Hit Reload ...'. Fix typo in 13178default SRCDIR. 13179 13180- Documentation for the relatively new modules "keyword" and "symbol" 13181has been added (to the end of the section on the parser extension 13182module). 13183 13184- In module bisect.py, but functions have two optional argument 'lo' 13185and 'hi' which allow you to specify a subsequence of the array to 13186operate on. 13187 13188- In ftplib.py, changed most methods to return their status (even when 13189it is always "200 OK") rather than swallowing it. 13190 13191- main() now calls setlocale(LC_ALL, ""), if setlocale() and 13192<locale.h> are defined. 13193 13194- Changes to configure.in, the configure script, and both 13195Makefile.pre.in files, to support SGI's SGI_ABI platform selection 13196environment variable. 13197 13198 13199====================================================================== 13200 13201 13202From 1.4 to 1.5a3 13203================= 13204 13205Security 13206-------- 13207 13208- If you are using the setuid script C wrapper (Misc/setuid-prog.c), 13209please use the new version. The old version has a huge security leak. 13210 13211Miscellaneous 13212------------- 13213 13214- Because of various (small) incompatible changes in the Python 13215bytecode interpreter, the magic number for .pyc files has changed 13216again. 13217 13218- The default module search path is now much saner. Both on Unix and 13219Windows, it is essentially derived from the path to the executable 13220(which can be overridden by setting the environment variable 13221$PYTHONHOME). The value of $PYTHONPATH on Windows is now inserted in 13222front of the default path, like in Unix (instead of overriding the 13223default path). On Windows, the directory containing the executable is 13224added to the end of the path. 13225 13226- A new version of python-mode.el for Emacs has been included. Also, 13227a new file ccpy-style.el has been added to configure Emacs cc-mode for 13228the preferred style in Python C sources. 13229 13230- On Unix, when using sys.argv[0] to insert the script directory in 13231front of sys.path, expand a symbolic link. You can now install a 13232program in a private directory and have a symbolic link to it in a 13233public bin directory, and it will put the private directory in the 13234module search path. Note that the symlink is expanded in sys.path[0] 13235but not in sys.argv[0], so you can still tell the name by which you 13236were invoked. 13237 13238- It is now recommended to use ``#!/usr/bin/env python'' instead of 13239``#!/usr/local/bin/python'' at the start of executable scripts, except 13240for CGI scripts. It has been determined that the use of /usr/bin/env 13241is more portable than that of /usr/local/bin/python -- scripts almost 13242never have to be edited when the Python interpreter lives in a 13243non-standard place. Note that this doesn't work for CGI scripts since 13244the python executable often doesn't live in the HTTP server's default 13245search path. 13246 13247- The silly -s command line option and the corresponding 13248PYTHONSUPPRESS environment variable (and the Py_SuppressPrint global 13249flag in the Python/C API) are gone. 13250 13251- Most problems on 64-bit platforms should now be fixed. Andrew 13252Kuchling helped. Some uncommon extension modules are still not 13253clean (image and audio ops?). 13254 13255- Fixed a bug where multiple anonymous tuple arguments would be mixed up 13256when using the debugger or profiler (reported by Just van Rossum). 13257The simplest example is ``def f((a,b),(c,d)): print a,b,c,d''; this 13258would print the wrong value when run under the debugger or profiler. 13259 13260- The hacks that the dictionary implementation used to speed up 13261repeated lookups of the same C string were removed; these were a 13262source of subtle problems and don't seem to serve much of a purpose 13263any longer. 13264 13265- All traces of support for the long dead access statement have been 13266removed from the sources. 13267 13268- Plugged the two-byte memory leak in the tokenizer when reading an 13269interactive EOF. 13270 13271- There's a -O option to the interpreter that removes SET_LINENO 13272instructions and assert statements (see below); it uses and produces 13273.pyo files instead of .pyc files. The speedup is only a few percent 13274in most cases. The line numbers are still available in the .pyo file, 13275as a separate table (which is also available in .pyc files). However, 13276the removal of the SET_LINENO instructions means that the debugger 13277(pdb) can't set breakpoints on lines in -O mode. The traceback module 13278contains a function to extract a line number from the code object 13279referenced in a traceback object. In the future it should be possible 13280to write external bytecode optimizers that create better optimized 13281.pyo files, and there should be more control over optimization; 13282consider the -O option a "teaser". Without -O, the assert statement 13283actually generates code that first checks __debug__; if this variable 13284is false, the assertion is not checked. __debug__ is a built-in 13285variable whose value is initialized to track the -O flag (it's true 13286iff -O is not specified). With -O, no code is generated for assert 13287statements, nor for code of the form ``if __debug__: <something>''. 13288Sorry, no further constant folding happens. 13289 13290 13291Performance 13292----------- 13293 13294- It's much faster (almost twice for pystone.py -- see 13295Tools/scripts). See the entry on string interning below. 13296 13297- Some speedup by using separate free lists for method objects (both 13298the C and the Python variety) and for floating point numbers. 13299 13300- Big speedup by allocating frame objects with a single malloc() call. 13301The Python/C API for frames is changed (you shouldn't be using this 13302anyway). 13303 13304- Significant speedup by inlining some common opcodes for common operand 13305types (e.g. i+i, i-i, and list[i]). Fredrik Lundh. 13306 13307- Small speedup by reordering the method tables of some common 13308objects (e.g. list.append is now first). 13309 13310- Big optimization to the read() method of file objects. A read() 13311without arguments now attempts to use fstat to allocate a buffer of 13312the right size; for pipes and sockets, it will fall back to doubling 13313the buffer size. While that the improvement is real on all systems, 13314it is most dramatic on Windows. 13315 13316 13317Documentation 13318------------- 13319 13320- Many new pieces of library documentation were contributed, mostly by 13321Andrew Kuchling. Even cmath is now documented! There's also a 13322chapter of the library manual, "libundoc.tex", which provides a 13323listing of all undocumented modules, plus their status (e.g. internal, 13324obsolete, or in need of documentation). Also contributions by Sue 13325Williams, Skip Montanaro, and some module authors who succumbed to 13326pressure to document their own contributed modules :-). Note that 13327printing the documentation now kills fewer trees -- the margins have 13328been reduced. 13329 13330- I have started documenting the Python/C API. Unfortunately this project 13331hasn't been completed yet. It will be complete before the final release of 13332Python 1.5, though. At the moment, it's better to read the LaTeX source 13333than to attempt to run it through LaTeX and print the resulting dvi file. 13334 13335- The posix module (and hence os.py) now has doc strings! Thanks to Neil 13336Schemenauer. I received a few other contributions of doc strings. In most 13337other places, doc strings are still wishful thinking... 13338 13339 13340Language changes 13341---------------- 13342 13343- Private variables with leading double underscore are now a permanent 13344feature of the language. (These were experimental in release 1.4. I have 13345favorable experience using them; I can't label them "experimental" 13346forever.) 13347 13348- There's new string literal syntax for "raw strings". Prefixing a string 13349literal with the letter r (or R) disables all escape processing in the 13350string; for example, r'\n' is a two-character string consisting of a 13351backslash followed by the letter n. This combines with all forms of string 13352quotes; it is actually useful for triple quoted doc strings which might 13353contain references to \n or \t. An embedded quote prefixed with a 13354backslash does not terminate the string, but the backslash is still 13355included in the string; for example, r'\'' is a two-character string 13356consisting of a backslash and a quote. (Raw strings are also 13357affectionately known as Robin strings, after their inventor, Robin 13358Friedrich.) 13359 13360- There's a simple assert statement, and a new exception 13361AssertionError. For example, ``assert foo > 0'' is equivalent to ``if 13362not foo > 0: raise AssertionError''. Sorry, the text of the asserted 13363condition is not available; it would be too complicated to generate 13364code for this (since the code is generated from a parse tree). 13365However, the text is displayed as part of the traceback! 13366 13367- The raise statement has a new feature: when using "raise SomeClass, 13368somevalue" where somevalue is not an instance of SomeClass, it 13369instantiates SomeClass(somevalue). In 1.5a4, if somevalue is an 13370instance of a *derived* class of SomeClass, the exception class raised 13371is set to somevalue.__class__, and SomeClass is ignored after that. 13372 13373- Duplicate keyword arguments are now detected at compile time; 13374f(a=1,a=2) is now a syntax error. 13375 13376 13377Changes to built-in features 13378---------------------------- 13379 13380- There's a new exception FloatingPointError (used only by Lee Busby's 13381patches to catch floating point exceptions, at the moment). 13382 13383- The obsolete exception ConflictError (presumably used by the long 13384obsolete access statement) has been deleted. 13385 13386- There's a new function sys.exc_info() which returns the tuple 13387(sys.exc_type, sys.exc_value, sys.exc_traceback) in a thread-safe way. 13388 13389- There's a new variable sys.executable, pointing to the executable file 13390for the Python interpreter. 13391 13392- The sort() methods for lists no longer uses the C library qsort(); I 13393wrote my own quicksort implementation, with lots of help (in the form 13394of a kind of competition) from Tim Peters. This solves a bug in 13395dictionary comparisons on some Solaris versions when Python is built 13396with threads, and makes sorting lists even faster. 13397 13398- The semantics of comparing two dictionaries have changed, to make 13399comparison of unequal dictionaries faster. A shorter dictionary is 13400always considered smaller than a larger dictionary. For dictionaries 13401of the same size, the smallest differing element determines the 13402outcome (which yields the same results as before in this case, without 13403explicit sorting). Thanks to Aaron Watters for suggesting something 13404like this. 13405 13406- The semantics of try-except have changed subtly so that calling a 13407function in an exception handler that itself raises and catches an 13408exception no longer overwrites the sys.exc_* variables. This also 13409alleviates the problem that objects referenced in a stack frame that 13410caught an exception are kept alive until another exception is caught 13411-- the sys.exc_* variables are restored to their previous value when 13412returning from a function that caught an exception. 13413 13414- There's a new "buffer" interface. Certain objects (e.g. strings and 13415arrays) now support the "buffer" protocol. Buffer objects are acceptable 13416whenever formerly a string was required for a write operation; mutable 13417buffer objects can be the target of a read operation using the call 13418f.readinto(buffer). A cool feature is that regular expression matching now 13419also work on array objects. Contribution by Jack Jansen. (Needs 13420documentation.) 13421 13422- String interning: dictionary lookups are faster when the lookup 13423string object is the same object as the key in the dictionary, not 13424just a string with the same value. This is done by having a pool of 13425"interned" strings. Most names generated by the interpreter are now 13426automatically interned, and there's a new built-in function intern(s) 13427that returns the interned version of a string. Interned strings are 13428not a different object type, and interning is totally optional, but by 13429interning most keys a speedup of about 15% was obtained for the 13430pystone benchmark. 13431 13432- Dictionary objects have several new methods; clear() and copy() have 13433the obvious semantics, while update(d) merges the contents of another 13434dictionary d into this one, overriding existing keys. The dictionary 13435implementation file is now called dictobject.c rather than the 13436confusing mappingobject.c. 13437 13438- The intrinsic function dir() is much smarter; it looks in __dict__, 13439__members__ and __methods__. 13440 13441- The intrinsic functions int(), long() and float() can now take a 13442string argument and then do the same thing as string.atoi(), 13443string.atol(), and string.atof(). No second 'base' argument is 13444allowed, and complex() does not take a string (nobody cared enough). 13445 13446- When a module is deleted, its globals are now deleted in two phases. 13447In the first phase, all variables whose name begins with exactly one 13448underscore are replaced by None; in the second phase, all variables 13449are deleted. This makes it possible to have global objects whose 13450destructors depend on other globals. The deletion order within each 13451phase is still random. 13452 13453- It is no longer an error for a function to be called without a 13454global variable __builtins__ -- an empty directory will be provided 13455by default. 13456 13457- Guido's corollary to the "Don Beaudry hook": it is now possible to 13458do metaprogramming by using an instance as a base class. Not for the 13459faint of heart; and undocumented as yet, but basically if a base class 13460is an instance, its class will be instantiated to create the new 13461class. Jim Fulton will love it -- it also works with instances of his 13462"extension classes", since it is triggered by the presence of a 13463__class__ attribute on the purported base class. See 13464Demo/metaclasses/index.html for an explanation and see that directory 13465for examples. 13466 13467- Another change is that the Don Beaudry hook is now invoked when 13468*any* base class is special. (Up to 1.5a3, the *last* special base 13469class is used; in 1.5a4, the more rational choice of the *first* 13470special base class is used.) 13471 13472- New optional parameter to the readlines() method of file objects. 13473This indicates the number of bytes to read (the actual number of bytes 13474read will be somewhat larger due to buffering reading until the end of 13475the line). Some optimizations have also been made to speed it up (but 13476not as much as read()). 13477 13478- Complex numbers no longer have the ".conj" pseudo attribute; use 13479z.conjugate() instead, or complex(z.real, -z.imag). Complex numbers 13480now *do* support the __members__ and __methods__ special attributes. 13481 13482- The complex() function now looks for a __complex__() method on class 13483instances before giving up. 13484 13485- Long integers now support arbitrary shift counts, so you can now 13486write 1L<<1000000, memory permitting. (Python 1.4 reports "outrageous 13487shift count for this.) 13488 13489- The hex() and oct() functions have been changed so that for regular 13490integers, they never emit a minus sign. For example, on a 32-bit 13491machine, oct(-1) now returns '037777777777' and hex(-1) returns 13492'0xffffffff'. While this may seem inconsistent, it is much more 13493useful. (For long integers, a minus sign is used as before, to fit 13494the result in memory :-) 13495 13496- The hash() function computes better hashes for several data types, 13497including strings, floating point numbers, and complex numbers. 13498 13499 13500New extension modules 13501--------------------- 13502 13503- New extension modules cStringIO.c and cPickle.c, written by Jim 13504Fulton and other folks at Digital Creations. These are much more 13505efficient than their Python counterparts StringIO.py and pickle.py, 13506but don't support subclassing. cPickle.c clocks up to 1000 times 13507faster than pickle.py; cStringIO.c's improvement is less dramatic but 13508still significant. 13509 13510- New extension module zlibmodule.c, interfacing to the free zlib 13511library (gzip compatible compression). There's also a module gzip.py 13512which provides a higher level interface. Written by Andrew Kuchling 13513and Jeremy Hylton. 13514 13515- New module readline; see the "miscellaneous" section above. 13516 13517- New Unix extension module resource.c, by Jeremy Hylton, provides 13518access to getrlimit(), getrusage(), setrusage(), getpagesize(), and 13519related symbolic constants. 13520 13521- New extension puremodule.c, by Barry Warsaw, which interfaces to the 13522Purify(TM) C API. See also the file Misc/PURIFY.README. It is also 13523possible to enable Purify by simply setting the PURIFY Makefile 13524variable in the Modules/Setup file. 13525 13526 13527Changes in extension modules 13528---------------------------- 13529 13530- The struct extension module has several new features to control byte 13531order and word size. It supports reading and writing IEEE floats even 13532on platforms where this is not the native format. It uses uppercase 13533format codes for unsigned integers of various sizes (always using 13534Python long ints for 'I' and 'L'), 's' with a size prefix for strings, 13535and 'p' for "Pascal strings" (with a leading length byte, included in 13536the size; blame Hannu Krosing; new in 1.5a4). A prefix '>' forces 13537big-endian data and '<' forces little-endian data; these also select 13538standard data sizes and disable automatic alignment (use pad bytes as 13539needed). 13540 13541- The array module supports uppercase format codes for unsigned data 13542formats (like the struct module). 13543 13544- The fcntl extension module now exports the needed symbolic 13545constants. (Formerly these were in FCNTL.py which was not available 13546or correct for all platforms.) 13547 13548- The extension modules dbm, gdbm and bsddb now check that the 13549database is still open before making any new calls. 13550 13551- The dbhash module is no more. Use bsddb instead. (There's a third 13552party interface for the BSD 2.x code somewhere on the web; support for 13553bsddb will be deprecated.) 13554 13555- The gdbm module now supports a sync() method. 13556 13557- The socket module now has some new functions: getprotobyname(), and 13558the set {ntoh,hton}{s,l}(). 13559 13560- Various modules now export their type object: socket.SocketType, 13561array.ArrayType. 13562 13563- The socket module's accept() method now returns unknown addresses as 13564a tuple rather than raising an exception. (This can happen in 13565promiscuous mode.) Theres' also a new function getprotobyname(). 13566 13567- The pthread support for the thread module now works on most platforms. 13568 13569- STDWIN is now officially obsolete. Support for it will eventually 13570be removed from the distribution. 13571 13572- The binascii extension module is now hopefully fully debugged. 13573(XXX Oops -- Fredrik Lundh promised me a uuencode fix that I never 13574received.) 13575 13576- audioop.c: added a ratecv() function; better handling of overflow in 13577add(). 13578 13579- posixmodule.c: now exports the O_* flags (O_APPEND etc.). On 13580Windows, also O_TEXT and O_BINARY. The 'error' variable (the 13581exception is raises) is renamed -- its string value is now "os.error", 13582so newbies don't believe they have to import posix (or nt) to catch 13583it when they see os.error reported as posix.error. The execve() 13584function now accepts any mapping object for the environment. 13585 13586- A new version of the al (audio library) module for SGI was 13587contributed by Sjoerd Mullender. 13588 13589- The regex module has a new function get_syntax() which retrieves the 13590syntax setting set by set_syntax(). The code was also sanitized, 13591removing worries about unclean error handling. See also below for its 13592successor, re.py. 13593 13594- The "new" module (which creates new objects of various types) once 13595again has a fully functioning new.function() method. Dangerous as 13596ever! Also, new.code() has several new arguments. 13597 13598- A problem has been fixed in the rotor module: on systems with signed 13599characters, rotor-encoded data was not portable when the key contained 136008-bit characters. Also, setkey() now requires its argument rather 13601than having broken code to default it. 13602 13603- The sys.builtin_module_names variable is now a tuple. Another new 13604variables in sys is sys.executable (the full path to the Python 13605binary, if known). 13606 13607- The specs for time.strftime() have undergone some revisions. It 13608appears that not all format characters are supported in the same way 13609on all platforms. Rather than reimplement it, we note these 13610differences in the documentation, and emphasize the shared set of 13611features. There's also a thorough test set (that occasionally finds 13612problems in the C library implementation, e.g. on some Linuxes), 13613thanks to Skip Montanaro. 13614 13615- The nis module seems broken when used with NIS+; unfortunately 13616nobody knows how to fix it. It should still work with old NIS. 13617 13618 13619New library modules 13620------------------- 13621 13622- New (still experimental) Perl-style regular expression module, 13623re.py, which uses a new interface for matching as well as a new 13624syntax; the new interface avoids the thread-unsafety of the regex 13625interface. This comes with a helper extension reopmodule.c and vastly 13626rewritten regexpr.c. Most work on this was done by Jeffrey Ollie, Tim 13627Peters, and Andrew Kuchling. See the documentation libre.tex. In 136281.5, the old regex module is still fully supported; in the future, it 13629will become obsolete. 13630 13631- New module gzip.py; see zlib above. 13632 13633- New module keyword.py exports knowledge about Python's built-in 13634keywords. (New version by Ka-Ping Yee.) 13635 13636- New module pprint.py (with documentation) which supports 13637pretty-printing of lists, tuples, & dictionaries recursively. By Fred 13638Drake. 13639 13640- New module code.py. The function code.compile_command() can 13641determine whether an interactively entered command is complete or not, 13642distinguishing incomplete from invalid input. (XXX Unfortunately, 13643this seems broken at this moment, and I don't have the time to fix 13644it. It's probably better to add an explicit interface to the parser 13645for this.) 13646 13647- There is now a library module xdrlib.py which can read and write the 13648XDR data format as used by Sun RPC, for example. It uses the struct 13649module. 13650 13651 13652Changes in library modules 13653-------------------------- 13654 13655- Module codehack.py is now completely obsolete. 13656 13657- The pickle.py module has been updated to make it compatible with the 13658new binary format that cPickle.c produces. By default it produces the 13659old all-ASCII format compatible with the old pickle.py, still much 13660faster than pickle.py; it will read both formats automatically. A few 13661other updates have been made. 13662 13663- A new helper module, copy_reg.py, is provided to register extensions 13664to the pickling code. 13665 13666- Revamped module tokenize.py is much more accurate and has an 13667interface that makes it a breeze to write code to colorize Python 13668source code. Contributed by Ka-Ping Yee. 13669 13670- In ihooks.py, ModuleLoader.load_module() now closes the file under 13671all circumstances. 13672 13673- The tempfile.py module has a new class, TemporaryFile, which creates 13674an open temporary file that will be deleted automatically when 13675closed. This works on Windows and MacOS as well as on Unix. (Jim 13676Fulton.) 13677 13678- Changes to the cgi.py module: Most imports are now done at the 13679top of the module, which provides a speedup when using ni (Jim 13680Fulton). The problem with file upload to a Windows platform is solved 13681by using the new tempfile.TemporaryFile class; temporary files are now 13682always opened in binary mode (Jim Fulton). The cgi.escape() function 13683now takes an optional flag argument that quotes '"' to '"'. It 13684is now possible to invoke cgi.py from a command line script, to test 13685cgi scripts more easily outside an http server. There's an optional 13686limit to the size of uploads to POST (Skip Montanaro). Added a 13687'strict_parsing' option to all parsing functions (Jim Fulton). The 13688function parse_qs() now uses urllib.unquote() on the name as well as 13689the value of fields (Clarence Gardner). The FieldStorage class now 13690has a __len__() method. 13691 13692- httplib.py: the socket object is no longer closed; all HTTP/1.* 13693responses are now accepted; and it is now thread-safe (by not using 13694the regex module). 13695 13696- BaseHTTPModule.py: treat all HTTP/1.* versions the same. 13697 13698- The popen2.py module is now rewritten using a class, which makes 13699access to the standard error stream and the process id of the 13700subprocess possible. 13701 13702- Added timezone support to the rfc822.py module, in the form of a 13703getdate_tz() method and a parsedate_tz() function; also a mktime_tz(). 13704Also added recognition of some non-standard date formats, by Lars 13705Wirzenius, and RFC 850 dates (Chris Lawrence). 13706 13707- mhlib.py: various enhancements, including almost compatible parsing 13708of message sequence specifiers without invoking a subprocess. Also 13709added a createmessage() method by Lars Wirzenius. 13710 13711- The StringIO.StringIO class now supports readline(nbytes). (Lars 13712Wirzenius.) (Of course, you should be using cStringIO for performance.) 13713 13714- UserDict.py supports the new dictionary methods as well. 13715 13716- Improvements for whrandom.py by Tim Peters: use 32-bit arithmetic to 13717speed it up, and replace 0 seed values by 1 to avoid degeneration. 13718A bug was fixed in the test for invalid arguments. 13719 13720- Module ftplib.py: added support for parsing a .netrc file (Fred 13721Drake). Also added an ntransfercmd() method to the FTP class, which 13722allows access to the expected size of a transfer when available, and a 13723parse150() function to the module which parses the corresponding 150 13724response. 13725 13726- urllib.py: the ftp cache is now limited to 10 entries. Added 13727quote_plus() and unquote_plus() functions which are like quote() and 13728unquote() but also replace spaces with '+' or vice versa, for 13729encoding/decoding CGI form arguments. Catch all errors from the ftp 13730module. HTTP requests now add the Host: header line. The proxy 13731variable names are now mapped to lower case, for Windows. The 13732spliturl() function no longer erroneously throws away all data past 13733the first newline. The basejoin() function now intereprets "../" 13734correctly. I *believe* that the problems with "exception raised in 13735__del__" under certain circumstances have been fixed (mostly by 13736changes elsewher in the interpreter). 13737 13738- In urlparse.py, there is a cache for results in urlparse.urlparse(); 13739its size limit is set to 20. Also, new URL schemes shttp, https, and 13740snews are "supported". 13741 13742- shelve.py: use cPickle and cStringIO when available. Also added 13743a sync() method, which calls the database's sync() method if there is 13744one. 13745 13746- The mimetools.py module now uses the available Python modules for 13747decoding quoted-printable, uuencode and base64 formats, rather than 13748creating a subprocess. 13749 13750- The python debugger (pdb.py, and its base class bdb.py) now support 13751conditional breakpoints. See the docs. 13752 13753- The modules base64.py, uu.py and quopri.py can now be used as simple 13754command line utilities. 13755 13756- Various small fixes to the nntplib.py module that I can't bother to 13757document in detail. 13758 13759- Sjoerd Mullender's mimify.py module now supports base64 encoding and 13760includes functions to handle the funny encoding you sometimes see in mail 13761headers. It is now documented. 13762 13763- mailbox.py: Added BabylMailbox. Improved the way the mailbox is 13764gotten from the environment. 13765 13766- Many more modules now correctly open files in binary mode when this 13767is necessary on non-Unix platforms. 13768 13769- The copying functions in the undocumented module shutil.py are 13770smarter. 13771 13772- The Writer classes in the formatter.py module now have a flush() 13773method. 13774 13775- The sgmllib.py module accepts hyphens and periods in the middle of 13776attribute names. While this is against the SGML standard, there is 13777some HTML out there that uses this... 13778 13779- The interface for the Python bytecode disassembler module, dis.py, 13780has been enhanced quite a bit. There's now one main function, 13781dis.dis(), which takes almost any kind of object (function, module, 13782class, instance, method, code object) and disassembles it; without 13783arguments it disassembles the last frame of the last traceback. The 13784other functions have changed slightly, too. 13785 13786- The imghdr.py module recognizes new image types: BMP, PNG. 13787 13788- The string.py module has a new function replace(str, old, new, 13789[maxsplit]) which does substring replacements. It is actually 13790implemented in C in the strop module. The functions [r]find() an 13791[r]index() have an optional 4th argument indicating the end of the 13792substring to search, alsoo implemented by their strop counterparts. 13793(Remember, never import strop -- import string uses strop when 13794available with zero overhead.) 13795 13796- The string.join() function now accepts any sequence argument, not 13797just lists and tuples. 13798 13799- The string.maketrans() requires its first two arguments to be 13800present. The old version didn't require them, but there's not much 13801point without them, and the documentation suggests that they are 13802required, so we fixed the code to match the documentation. 13803 13804- The regsub.py module has a function clear_cache(), which clears its 13805internal cache of compiled regular expressions. Also, the cache now 13806takes the current syntax setting into account. (However, this module 13807is now obsolete -- use the sub() or subn() functions or methods in the 13808re module.) 13809 13810- The undocumented module Complex.py has been removed, now that Python 13811has built-in complex numbers. A similar module remains as 13812Demo/classes/Complex.py, as an example. 13813 13814 13815Changes to the build process 13816---------------------------- 13817 13818- The way GNU readline is configured is totally different. The 13819--with-readline configure option is gone. It is now an extension 13820module, which may be loaded dynamically. You must enable it (and 13821specify the correct libraries to link with) in the Modules/Setup file. 13822Importing the module installs some hooks which enable command line 13823editing. When the interpreter shell is invoked interactively, it 13824attempts to import the readline module; when this fails, the default 13825input mechanism is used. The hook variables are PyOS_InputHook and 13826PyOS_ReadlineFunctionPointer. (Code contributed by Lee Busby, with 13827ideas from William Magro.) 13828 13829- New build procedure: a single library, libpython1.5.a, is now built, 13830which contains absolutely everything except for a one-line main() 13831program (which calls Py_Main(argc, argv) to start the interpreter 13832shell). This makes life much simpler for applications that need to 13833embed Python. The serial number of the build is now included in the 13834version string (sys.version). 13835 13836- As far as I can tell, neither gcc -Wall nor the Microsoft compiler 13837emits a single warning any more when compiling Python. 13838 13839- A number of new Makefile variables have been added for special 13840situations, e.g. LDLAST is appended to the link command. These are 13841used by editing the Makefile or passing them on the make command 13842line. 13843 13844- A set of patches from Lee Busby has been integrated that make it 13845possible to catch floating point exceptions. Use the configure option 13846--with-fpectl to enable the patches; the extension modules fpectl and 13847fpetest provide control to enable/disable and test the feature, 13848respectively. 13849 13850- The support for shared libraries under AIX is now simpler and more 13851robust. Thanks to Vladimir Marangozov for revamping his own patches! 13852 13853- The Modules/makesetup script now reads a file Setup.local as well as 13854a file Setup. Most changes to the Setup script can be done by editing 13855Setup.local instead, which makes it easier to carry a particular setup 13856over from one release to the next. 13857 13858- The Modules/makesetup script now copies any "include" lines it 13859encounters verbatim into the output Makefile. It also recognizes .cxx 13860and .cpp as C++ source files. 13861 13862- The configure script is smarter about C compiler options; e.g. with 13863gcc it uses -O2 and -g when possible, and on some other platforms it 13864uses -Olimit 1500 to avoid a warning from the optimizer about the main 13865loop in ceval.c (which has more than 1000 basic blocks). 13866 13867- The configure script now detects whether malloc(0) returns a NULL 13868pointer or a valid block (of length zero). This avoids the nonsense 13869of always adding one byte to all malloc() arguments on most platforms. 13870 13871- The configure script has a new option, --with-dec-threads, to enable 13872DEC threads on DEC Alpha platforms. Also, --with-threads is now an 13873alias for --with-thread (this was the Most Common Typo in configure 13874arguments). 13875 13876- Many changes in Doc/Makefile; amongst others, latex2html is now used 13877to generate HTML from all latex documents. 13878 13879 13880Change to the Python/C API 13881-------------------------- 13882 13883- Because some interfaces have changed, the PYTHON_API macro has been 13884bumped. Most extensions built for the old API version will still run, 13885but I can't guarantee this. Python prints a warning message on 13886version mismatches; it dumps core when the version mismatch causes a 13887serious problem :-) 13888 13889- I've completed the Grand Renaming, with the help of Roger Masse and 13890Barry Warsaw. This makes reading or debugging the code much easier. 13891Many other unrelated code reorganizations have also been carried out. 13892The allobjects.h header file is gone; instead, you would have to 13893include Python.h followed by rename2.h. But you're better off running 13894Tools/scripts/fixcid.py -s Misc/RENAME on your source, so you can omit 13895the rename2.h; it will disappear in the next release. 13896 13897- Various and sundry small bugs in the "abstract" interfaces have been 13898fixed. Thanks to all the (involuntary) testers of the Python 1.4 13899version! Some new functions have been added, e.g. PySequence_List(o), 13900equivalent to list(o) in Python. 13901 13902- New API functions PyLong_FromUnsignedLong() and 13903PyLong_AsUnsignedLong(). 13904 13905- The API functions in the file cgensupport.c are no longer 13906supported. This file has been moved to Modules and is only ever 13907compiled when the SGI specific 'gl' module is built. 13908 13909- PyObject_Compare() can now raise an exception. Check with 13910PyErr_Occurred(). The comparison function in an object type may also 13911raise an exception. 13912 13913- The slice interface uses an upper bound of INT_MAX when no explicit 13914upper bound is given (e.x. for a[1:]). It used to ask the object for 13915its length and do the calculations. 13916 13917- Support for multiple independent interpreters. See Doc/api.tex, 13918functions Py_NewInterpreter() and Py_EndInterpreter(). Since the 13919documentation is incomplete, also see the new Demo/pysvr example 13920(which shows how to use these in a threaded application) and the 13921source code. 13922 13923- There is now a Py_Finalize() function which "de-initializes" 13924Python. It is possible to completely restart the interpreter 13925repeatedly by calling Py_Finalize() followed by Py_Initialize(). A 13926change of functionality in Py_Initialize() means that it is now a 13927fatal error to call it while the interpreter is already initialized. 13928The old, half-hearted Py_Cleanup() routine is gone. Use of Py_Exit() 13929is deprecated (it is nothing more than Py_Finalize() followed by 13930exit()). 13931 13932- There are no known memory leaks left. While Py_Finalize() doesn't 13933free *all* allocated memory (some of it is hard to track down), 13934repeated calls to Py_Finalize() and Py_Initialize() do not create 13935unaccessible heap blocks. 13936 13937- There is now explicit per-thread state. (Inspired by, but not the 13938same as, Greg Stein's free threading patches.) 13939 13940- There is now better support for threading C applications. There are 13941now explicit APIs to manipulate the interpreter lock. Read the source 13942or the Demo/pysvr example; the new functions are 13943PyEval_{Acquire,Release}{Lock,Thread}(). 13944 13945- The test macro DEBUG has changed to Py_DEBUG, to avoid interference 13946with other libraries' DEBUG macros. Likewise for any other test 13947macros that didn't yet start with Py_. 13948 13949- New wrappers around malloc() and friends: Py_Malloc() etc. call 13950malloc() and call PyErr_NoMemory() when it fails; PyMem_Malloc() call 13951just malloc(). Use of these wrappers could be essential if multiple 13952memory allocators exist (e.g. when using certain DLL setups under 13953Windows). (Idea by Jim Fulton.) 13954 13955- New C API PyImport_Import() which uses whatever __import__() hook 13956that is installed for the current execution environment. By Jim 13957Fulton. 13958 13959- It is now possible for an extension module's init function to fail 13960non-fatally, by calling one of the PyErr_* functions and returning. 13961 13962- The PyInt_AS_LONG() and PyFloat_AS_DOUBLE() macros now cast their 13963argument to the proper type, like the similar PyString macros already 13964did. (Suggestion by Marc-Andre Lemburg.) Similar for PyList_GET_SIZE 13965and PyList_GET_ITEM. 13966 13967- Some of the Py_Get* function, like Py_GetVersion() (but not yet 13968Py_GetPath()) are now declared as returning a const char *. (More 13969should follow.) 13970 13971- Changed the run-time library to check for exceptions after object 13972comparisons. PyObject_Compare() can now return an exception; use 13973PyErr_Occurred() to check (there is *no* special return value). 13974 13975- PyFile_WriteString() and Py_Flushline() now return error indicators 13976instead of clearing exceptions. This fixes an obscure bug where using 13977these would clear a pending exception, discovered by Just van Rossum. 13978 13979- There's a new function, PyArg_ParseTupleAndKeywords(), which parses 13980an argument list including keyword arguments. Contributed by Geoff 13981Philbrick. 13982 13983- PyArg_GetInt() is gone. 13984 13985- It's no longer necessary to include graminit.h when calling one of 13986the extended parser API functions. The three public grammar start 13987symbols are now in Python.h as Py_single_input, Py_file_input, and 13988Py_eval_input. 13989 13990- The CObject interface has a new function, 13991PyCObject_Import(module, name). It calls PyCObject_AsVoidPtr() 13992on the object referenced by "module.name". 13993 13994 13995Tkinter 13996------- 13997 13998- On popular demand, _tkinter once again installs a hook for readline 13999that processes certain Tk events while waiting for the user to type 14000(using PyOS_InputHook). 14001 14002- A patch by Craig McPheeters plugs the most obnoxious memory leaks, 14003caused by command definitions referencing widget objects beyond their 14004lifetime. 14005 14006- New standard dialog modules: tkColorChooser.py, tkCommonDialog.py, 14007tkMessageBox.py, tkFileDialog.py, tkSimpleDialog.py These interface 14008with the new Tk dialog scripts, and provide more "native platform" 14009style file selection dialog boxes on some platforms. Contributed by 14010Fredrik Lundh. 14011 14012- Tkinter.py: when the first Tk object is destroyed, it sets the 14013hiddel global _default_root to None, so that when another Tk object is 14014created it becomes the new default root. Other miscellaneous 14015changes and fixes. 14016 14017- The Image class now has a configure method. 14018 14019- Added a bunch of new winfo options to Tkinter.py; we should now be 14020up to date with Tk 4.2. The new winfo options supported are: 14021mananger, pointerx, pointerxy, pointery, server, viewable, visualid, 14022visualsavailable. 14023 14024- The broken bind() method on Canvas objects defined in the Canvas.py 14025module has been fixed. The CanvasItem and Group classes now also have 14026an unbind() method. 14027 14028- The problem with Tkinter.py falling back to trying to import 14029"tkinter" when "_tkinter" is not found has been fixed -- it no longer 14030tries "tkinter", ever. This makes diagnosing the problem "_tkinter 14031not configured" much easier and will hopefully reduce the newsgroup 14032traffic on this topic. 14033 14034- The ScrolledText module once again supports the 'cnf' parameter, to 14035be compatible with the examples in Mark Lutz' book (I know, I know, 14036too late...) 14037 14038- The _tkinter.c extension module has been revamped. It now support 14039Tk versions 4.1 through 8.0; support for 4.0 has been dropped. It 14040works well under Windows and Mac (with the latest Tk ports to those 14041platforms). It also supports threading -- it is safe for one 14042(Python-created) thread to be blocked in _tkinter.mainloop() while 14043other threads modify widgets. To make the changes visible, those 14044threads must use update_idletasks()method. (The patch for threading 14045in 1.5a3 was broken; in 1.5a4, it is back in a different version, 14046which requires access to the Tcl sources to get it to work -- hence it 14047is disabled by default.) 14048 14049- A bug in _tkinter.c has been fixed, where Split() with a string 14050containing an unmatched '"' could cause an exception or core dump. 14051 14052- Unfortunately, on Windows and Mac, Tk 8.0 no longer supports 14053CreateFileHandler, so _tkinter.createfilehandler is not available on 14054those platforms when using Tk 8.0 or later. I will have to rethink 14055how to interface with Tcl's lower-level event mechanism, or with its 14056channels (which are like Python's file-like objects). Jack Jansen has 14057provided a fix for the Mac, so createfilehandler *is* actually 14058supported there; maybe I can adapt his fix for Windows. 14059 14060 14061Tools and Demos 14062--------------- 14063 14064- A new regression test suite is provided, which tests most of the 14065standard and built-in modules. The regression test is run by invoking 14066the script Lib/test/regrtest.py. Barry Warsaw wrote the test harnass; 14067he and Roger Masse contributed most of the new tests. 14068 14069- New tool: faqwiz -- the CGI script that is used to maintain the 14070Python FAQ (http://grail.cnri.reston.va.us/cgi-bin/faqw.py). In 14071Tools/faqwiz. 14072 14073- New tool: webchecker -- a simple extensible web robot that, when 14074aimed at a web server, checks that server for dead links. Available 14075are a command line utility as well as a Tkinter based GUI version. In 14076Tools/webchecker. A simplified version of this program is dissected 14077in my article in O'Reilly's WWW Journal, the issue on Scripting 14078Languages (Vol 2, No 2); Scripting the Web with Python (pp 97-120). 14079Includes a parser for robots.txt files by Skip Montanaro. 14080 14081- New small tools: cvsfiles.py (prints a list of all files under CVS 14082n a particular directory tree), treesync.py (a rather Guido-specific 14083script to synchronize two source trees, one on Windows NT, the other 14084one on Unix under CVS but accessible from the NT box), and logmerge.py 14085(sort a collection of RCS or CVS logs by date). In Tools/scripts. 14086 14087- The freeze script now also works under Windows (NT). Another 14088feature allows the -p option to be pointed at the Python source tree 14089instead of the installation prefix. This was loosely based on part of 14090xfreeze by Sam Rushing and Bill Tutt. 14091 14092- New examples (Demo/extend) that show how to use the generic 14093extension makefile (Misc/Makefile.pre.in). 14094 14095- Tools/scripts/h2py.py now supports C++ comments. 14096 14097- Tools/scripts/pystone.py script is upgraded to version 1.1; there 14098was a bug in version 1.0 (distributed with Python 1.4) that leaked 14099memory. Also, in 1.1, the LOOPS variable is incremented to 10000. 14100 14101- Demo/classes/Rat.py completely rewritten by Sjoerd Mullender. 14102 14103 14104Windows (NT and 95) 14105------------------- 14106 14107- New project files for Developer Studio (Visual C++) 5.0 for Windows 14108NT (the old VC++ 4.2 Makefile is also still supported, but will 14109eventually be withdrawn due to its bulkiness). 14110 14111- See the note on the new module search path in the "Miscellaneous" section 14112above. 14113 14114- Support for Win32s (the 32-bit Windows API under Windows 3.1) is 14115basically withdrawn. If it still works for you, you're lucky. 14116 14117- There's a new extension module, msvcrt.c, which provides various 14118low-level operations defined in the Microsoft Visual C++ Runtime Library. 14119These include locking(), setmode(), get_osfhandle(), set_osfhandle(), and 14120console I/O functions like kbhit(), getch() and putch(). 14121 14122- The -u option not only sets the standard I/O streams to unbuffered 14123status, but also sets them in binary mode. (This can also be done 14124using msvcrt.setmode(), by the way.) 14125 14126- The, sys.prefix and sys.exec_prefix variables point to the directory 14127where Python is installed, or to the top of the source tree, if it was run 14128from there. 14129 14130- The various os.path modules (posixpath, ntpath, macpath) now support 14131passing more than two arguments to the join() function, so 14132os.path.join(a, b, c) is the same as os.path.join(a, os.path.join(b, 14133c)). 14134 14135- The ntpath module (normally used as os.path) supports ~ to $HOME 14136expansion in expanduser(). 14137 14138- The freeze tool now works on Windows. 14139 14140- See also the Tkinter category for a sad note on 14141_tkinter.createfilehandler(). 14142 14143- The truncate() method for file objects now works on Windows. 14144 14145- Py_Initialize() is no longer called when the DLL is loaded. You 14146must call it yourself. 14147 14148- The time module's clock() function now has good precision through 14149the use of the Win32 API QueryPerformanceCounter(). 14150 14151- Mark Hammond will release Python 1.5 versions of PythonWin and his 14152other Windows specific code: the win32api extensions, COM/ActiveX 14153support, and the MFC interface. 14154 14155 14156Mac 14157--- 14158 14159- As always, the Macintosh port will be done by Jack Jansen. He will 14160make a separate announcement for the Mac specific source code and the 14161binary distribution(s) when these are ready. 14162 14163 14164====================================================================== 14165 14166 14167===================================== 14168==> Release 1.4 (October 25 1996) <== 14169===================================== 14170 14171(Starting in reverse chronological order:) 14172 14173- Changed disclaimer notice. 14174 14175- Added SHELL=/bin/sh to Misc/Makefile.pre.in -- some Make versions 14176default to the user's login shell. 14177 14178- In Lib/tkinter/Tkinter.py, removed bogus binding of <Delete> in Text 14179widget, and bogus bspace() function. 14180 14181- In Lib/cgi.py, bumped __version__ to 2.0 and restored a truncated 14182paragraph. 14183 14184- Fixed the NT Makefile (PC/vc40.mak) for VC 4.0 to set /MD for all 14185subprojects, and to remove the (broken) experimental NumPy 14186subprojects. 14187 14188- In Lib/py_compile.py, cast mtime to long() so it will work on Mac 14189(where os.stat() returns mtimes as floats.) 14190- Set self.rfile unbuffered (like self.wfile) in SocketServer.py, to 14191fix POST in CGIHTTPServer.py. 14192 14193- Version 2.83 of Misc/python-mode.el for Emacs is included. 14194 14195- In Modules/regexmodule.c, fixed symcomp() to correctly handle a new 14196group starting immediately after a group tag. 14197 14198- In Lib/SocketServer.py, changed the mode for rfile to unbuffered. 14199 14200- In Objects/stringobject.c, fixed the compare function to do the 14201first char comparison in unsigned mode, for consistency with the way 14202other characters are compared by memcmp(). 14203 14204- In Lib/tkinter/Tkinter.py, fixed Scale.get() to support floats. 14205 14206- In Lib/urllib.py, fix another case where openedurl wasn't set. 14207 14208(XXX Sorry, the rest is in totally random order. No time to fix it.) 14209 14210- SyntaxError exceptions detected during code generation 14211(e.g. assignment to an expression) now include a line number. 14212 14213- Don't leave trailing / or \ in script directory inserted in front of 14214sys.path. 14215 14216- Added a note to Tools/scripts/classfix.py abouts its historical 14217importance. 14218 14219- Added Misc/Makefile.pre.in, a universal Makefile for extensions 14220built outside the distribution. 14221 14222- Rewritten Misc/faq2html.py, by Ka-Ping Yee. 14223 14224- Install shared modules with mode 555 (needed for performance on some 14225platforms). 14226 14227- Some changes to standard library modules to avoid calling append() 14228with more than one argument -- while supported, this should be 14229outlawed, and I don't want to set a bad example. 14230 14231- bdb.py (and hence pdb.py) supports calling run() with a code object 14232instead of a code string. 14233 14234- Fixed an embarrassing bug cgi.py which prevented correct uploading 14235of binary files from Netscape (which doesn't distinguish between 14236binary and text files). Also added dormant logging support, which 14237makes it easier to debug the cgi module itself. 14238 14239- Added default writer to constructor of NullFormatter class. 14240 14241- Use binary mode for socket.makefile() calls in ftplib.py. 14242 14243- The ihooks module no longer "installs" itself upon import -- this 14244was an experimental feature that helped ironing out some bugs but that 14245slowed down code that imported it without the need to install it 14246(e.g. the rexec module). Also close the file in some cases and add 14247the __file__ attribute to loaded modules. 14248 14249- The test program for mailbox.py is now more useful. 14250 14251- Added getparamnames() to Message class in mimetools.py -- it returns 14252the names of parameters to the content-type header. 14253 14254- Fixed a typo in ni that broke the loop stripping "__." from names. 14255 14256- Fix sys.path[0] for scripts run via pdb.py's new main program. 14257 14258- profile.py can now also run a script, like pdb. 14259 14260- Fix a small bug in pyclbr -- don't add names starting with _ when 14261emulating from ... import *. 14262 14263- Fixed a series of embarrassing typos in rexec's handling of standard 14264I/O redirection. Added some more "safe" built-in modules: cmath, 14265errno, operator. 14266 14267- Fixed embarrassing typo in shelve.py. 14268 14269- Added SliceType and EllipsisType to types.py. 14270 14271- In urllib.py, added handling for error 301 (same as 302); added 14272geturl() method to get the URL after redirection. 14273 14274- Fixed embarrassing typo in xdrlib.py. Also fixed typo in Setup.in 14275for _xdrmodule.c and removed redundant #include from _xdrmodule.c. 14276 14277- Fixed bsddbmodule.c to add binary mode indicator on platforms that 14278have it. This should make it working on Windows NT. 14279 14280- Changed last uses of #ifdef NT to #ifdef MS_WINDOWS or MS_WIN32, 14281whatever applies. Also rationalized some other tests for various MS 14282platforms. 14283 14284- Added the sources for the NT installer script used for Python 142851.4beta3. Not tested with this release, but better than nothing. 14286 14287- A compromise in pickle's defenses against Trojan horses: a 14288user-defined function is now okay where a class is expected. A 14289built-in function is not okay, to prevent pickling something that 14290will execute os.system("rm -f *") when unpickling. 14291 14292- dis.py will print the name of local variables referenced by local 14293load/store/delete instructions. 14294 14295- Improved portability of SimpleHTTPServer module to non-Unix 14296platform. 14297 14298- The thread.h interface adds an extra argument to down_sema(). This 14299only affects other C code that uses thread.c; the Python thread module 14300doesn't use semaphores (which aren't provided on all platforms where 14301Python threads are supported). Note: on NT, this change is not 14302implemented. 14303 14304- Fixed some typos in abstract.h; corrected signature of 14305PyNumber_Coerce, added PyMapping_DelItem. Also fixed a bug in 14306abstract.c's PyObject_CallMethod(). 14307 14308- apply(classname, (), {}) now works even if the class has no 14309__init__() method. 14310 14311- Implemented complex remainder and divmod() (these would dump core!). 14312Conversion of complex numbers to int, long int or float now raises an 14313exception, since there is no meaningful way to do it without losing 14314information. 14315 14316- Fixed bug in built-in complex() function which gave the wrong result 14317for two real arguments. 14318 14319- Change the hash algorithm for strings -- the multiplier is now 143201000003 instead of 3, which gives better spread for short strings. 14321 14322- New default path for Windows NT, the registry structure now supports 14323default paths for different install packages. (Mark Hammond -- the 14324next PythonWin release will use this.) 14325 14326- Added more symbols to the python_nt.def file. 14327 14328- When using GNU readline, set rl_readline_name to "python". 14329 14330- The Ellipses built-in name has been renamed to Ellipsis -- this is 14331the correct singular form. Thanks to Ka-Ping Yee, who saved us from 14332eternal embarrassment. 14333 14334- Bumped the PYTHON_API_VERSION to 1006, due to the Ellipses -> 14335Ellipsis name change. 14336 14337- Updated the library reference manual. Added documentation of 14338restricted mode (rexec, Bastion) and the formatter module (for use 14339with the htmllib module). Fixed the documentation of htmllib 14340(finally). 14341 14342- The reference manual is now maintained in FrameMaker. 14343 14344- Upgraded scripts Doc/partparse.py and Doc/texi2html.py. 14345 14346- Slight improvements to Doc/Makefile. 14347 14348- Added fcntl.lockf(). This should be used for Unix file locking 14349instead of the posixfile module; lockf() is more portable. 14350 14351- The getopt module now supports long option names, thanks to Lars 14352Wizenius. 14353 14354- Plenty of changes to Tkinter and Canvas, mostly due to Fred Drake 14355and Nils Fischbeck. 14356 14357- Use more bits of time.time() in whrandom's default seed(). 14358 14359- Performance hack for regex module's regs attribute. 14360 14361- Don't close already closed socket in socket module. 14362 14363- Correctly handle separators containing embedded nulls in 14364strop.split, strop.find and strop.rfind. Also added more detail to 14365error message for strop.atoi and friends. 14366 14367- Moved fallback definition for hypot() to Python/hypot.c. 14368 14369- Added fallback definition for strdup, in Python/strdup.c. 14370 14371- Fixed some bugs where a function would return 0 to indicate an error 14372where it should return -1. 14373 14374- Test for error returned by time.localtime(), and rationalized its MS 14375tests. 14376 14377- Added Modules/Setup.local file, which is processed after Setup. 14378 14379- Corrected bug in toplevel Makefile.in -- execution of regen script 14380would not use the right PATH and PYTHONPATH. 14381 14382- Various and sundry NeXT configuration changes (sigh). 14383 14384- Support systems where libreadline needs neither termcap nor curses. 14385 14386- Improved ld_so_aix script and python.exp file (for AIX). 14387 14388- More stringent test for working <stdarg.h> in configure script. 14389 14390- Removed Demo/www subdirectory -- it was totally out of date. 14391 14392- Improved demos and docs for Fred Drake's parser module; fixed one 14393typo in the module itself. 14394 14395 14396========================================= 14397==> Release 1.4beta3 (August 26 1996) <== 14398========================================= 14399 14400 14401(XXX This is less readable that it should. I promise to restructure 14402it for the final 1.4 release.) 14403 14404 14405What's new in 1.4beta3 (since beta2)? 14406------------------------------------- 14407 14408- Name mangling to implement a simple form of class-private variables. 14409A name of the form "__spam" can't easily be used outside the class. 14410(This was added in 1.4beta3, but left out of the 1.4beta3 release 14411message.) 14412 14413- In urllib.urlopen(): HTTP URLs containing user:passwd@host are now 14414handled correctly when using a proxy server. 14415 14416- In ntpath.normpath(): don't truncate to 8+3 format. 14417 14418- In mimetools.choose_boundary(): don't die when getuid() or getpid() 14419aren't defined. 14420 14421- Module urllib: some optimizations to (un)quoting. 14422 14423- New module MimeWriter for writing MIME documents. 14424 14425- More changes to formatter module. 14426 14427- The freeze script works once again and is much more robust (using 14428sys.prefix etc.). It also supports a -o option to specify an 14429output directory. 14430 14431- New module whichdb recognizes dbm, gdbm and bsddb/dbhash files. 14432 14433- The Doc/Makefile targets have been reorganized somewhat to remove the 14434insistence on always generating PostScript. 14435 14436- The texinfo to html filter (Doc/texi2html.py) has been improved somewhat. 14437 14438- "errors.h" has been renamed to "pyerrors.h" to resolve a long-standing 14439name conflict on the Mac. 14440 14441- Linking a module compiled with a different setting for Py_TRACE_REFS now 14442generates a linker error rather than a core dump. 14443 14444- The cgi module has a new convenience function print_exception(), which 14445formats a python exception using HTML. It also fixes a bug in the 14446compatibility code and adds a dubious feature which makes it possible to 14447have two query strings, one in the URL and one in the POST data. 14448 14449- A subtle change in the unpickling of class instances makes it possible 14450to unpickle in restricted execution mode, where the __dict__ attribute is 14451not available (but setattr() is). 14452 14453- Documentation for os.path.splitext() (== posixpath.splitext()) has been 14454cleared up. It splits at the *last* dot. 14455 14456- posixfile locking is now also correctly supported on AIX. 14457 14458- The tempfile module once again honors an initial setting of tmpdir. It 14459now works on Windows, too. 14460 14461- The traceback module has some new functions to extract, format and print 14462the active stack. 14463 14464- Some translation functions in the urllib module have been made a little 14465less sluggish. 14466 14467- The addtag_* methods for Canvas widgets in Tkinter as well as in the 14468separate Canvas class have been fixed so they actually do something 14469meaningful. 14470 14471- A tiny _test() function has been added to Tkinter.py. 14472 14473- A generic Makefile for dynamically loaded modules is provided in the Misc 14474subdirectory (Misc/gMakefile). 14475 14476- A new version of python-mode.el for Emacs is provided. See 14477http://www.python.org/ftp/emacs/pmdetails.html for details. The 14478separate file pyimenu.el is no longer needed, imenu support is folded 14479into python-mode.el. 14480 14481- The configure script can finally correctly find the readline library in a 14482non-standard location. The LDFLAGS variable is passed on the Makefiles 14483from the configure script. 14484 14485- Shared libraries are now installed as programs (i.e. with executable 14486permission). This is required on HP-UX and won't hurt on other systems. 14487 14488- The objc.c module is no longer part of the distribution. Objective-C 14489support may become available as contributed software on the ftp site. 14490 14491- The sybase module is no longer part of the distribution. A much 14492improved sybase module is available as contributed software from the 14493ftp site. 14494 14495- _tkinter is now compatible with Tcl 7.5 / Tk 4.1 patch1 on Windows and 14496Mac (don't use unpatched Tcl/Tk!). The default line in the Setup.in file 14497now links with Tcl 7.5 / Tk 4.1 rather than 7.4/4.0. 14498 14499- In Setup, you can now write "*shared*" instead of "*noconfig*", and you 14500can use *.so and *.sl as shared libraries. 14501 14502- Some more fidgeting for AIX shared libraries. 14503 14504- The mpz module is now compatible with GMP 2.x. (Not tested by me.) 14505(Note -- a complete replacement by Niels Mo"ller, called gpmodule, is 14506available from the contrib directory on the ftp site.) 14507 14508- A warning is written to sys.stderr when a __del__ method raises an 14509exception (formerly, such exceptions were completely ignored). 14510 14511- The configure script now defines HAVE_OLD_CPP if the C preprocessor is 14512incapable of ANSI style token concatenation and stringification. 14513 14514- All source files (except a few platform specific modules) are once again 14515compatible with K&R C compilers as well as ANSI compilers. In particular, 14516ANSI-isms have been removed or made conditional in complexobject.c, 14517getargs.c and operator.c. 14518 14519- The abstract object API has three new functions, PyObject_DelItem, 14520PySequence_DelItem, and PySequence_DelSlice. 14521 14522- The operator module has new functions delitem and delslice, and the 14523functions "or" and "and" are renamed to "or_" and "and_" (since "or" and 14524"and" are reserved words). ("__or__" and "__and__" are unchanged.) 14525 14526- The environment module is no longer supported; putenv() is now a function 14527in posixmodule (also under NT). 14528 14529- Error in filter(<function>, "") has been fixed. 14530 14531- Unrecognized keyword arguments raise TypeError, not KeyError. 14532 14533- Better portability, fewer bugs and memory leaks, fewer compiler warnings, 14534some more documentation. 14535 14536- Bug in float power boundary case (0.0 to the negative integer power) 14537fixed. 14538 14539- The test of negative number to the float power has been moved from the 14540built-in pow() function to floatobject.c (so complex numbers can yield the 14541correct result). 14542 14543- The bug introduced in beta2 where shared libraries loaded (using 14544dlopen()) from the current directory would fail, has been fixed. 14545 14546- Modules imported as shared libraries now also have a __file__ attribute, 14547giving the filename from which they were loaded. The only modules without 14548a __file__ attribute now are built-in modules. 14549 14550- On the Mac, dynamically loaded modules can end in either ".slb" or 14551".<platform>.slb" where <platform> is either "CFM68K" or "ppc". The ".slb" 14552extension should only be used for "fat" binaries. 14553 14554- C API addition: marshal.c now supports 14555PyMarshal_WriteObjectToString(object). 14556 14557- C API addition: getargs.c now supports 14558PyArg_ParseTupleAndKeywords(args, kwdict, format, kwnames, ...) 14559to parse keyword arguments. 14560 14561- The PC versioning scheme (sys.winver) has changed once again. the 14562version number is now "<digit>.<digit>.<digit>.<apiversion>", where the 14563first three <digit>s are the Python version (e.g. "1.4.0" for Python 1.4, 14564"1.4.1" for Python 1.4.1 -- the beta level is not included) and 14565<apiversion> is the four-digit PYTHON_API_VERSION (currently 1005). 14566 14567- h2py.py accepts whitespace before the # in CPP directives 14568 14569- On Solaris 2.5, it should now be possible to use either Posix threads or 14570Solaris threads (XXX: how do you select which is used???). (Note: the 14571Python pthreads interface doesn't fully support semaphores yet -- anyone 14572care to fix this?) 14573 14574- Thread support should now work on AIX, using either DCE threads or 14575pthreads. 14576 14577- New file Demo/sockets/unicast.py 14578 14579- Working Mac port, with CFM68K support, with Tk 4.1 support (though not 14580both) (XXX) 14581 14582- New project setup for PC port, now compatible with PythonWin, with 14583_tkinter and NumPy support (XXX) 14584 14585- New module site.py (XXX) 14586 14587- New module xdrlib.py and optional support module _xdrmodule.c (XXX) 14588 14589- parser module adapted to new grammar, complete w/ Doc & Demo (XXX) 14590 14591- regen script fixed (XXX) 14592 14593- new machdep subdirectories Lib/{aix3,aix4,next3_3,freebsd2,linux2} (XXX) 14594 14595- testall now also tests math module (XXX) 14596 14597- string.atoi c.s. now raise an exception for an empty input string. 14598 14599- At last, it is no longer necessary to define HAVE_CONFIG_H in order to 14600have config.h included at various places. 14601 14602- Unrecognized keyword arguments now raise TypeError rather than KeyError. 14603 14604- The makesetup script recognizes files with extension .so or .sl as 14605(shared) libraries. 14606 14607- 'access' is no longer a reserved word, and all code related to its 14608implementation is gone (or at least #ifdef'ed out). This should make 14609Python a little speedier too! 14610 14611- Performance enhancements suggested by Sjoerd Mullender. This includes 14612the introduction of two new optional function pointers in type object, 14613getattro and setattro, which are like getattr and setattr but take a 14614string object instead of a C string pointer. 14615 14616- New operations in string module: lstrip(s) and rstrip(s) strip whitespace 14617only on the left or only on the right, A new optional third argument to 14618split() specifies the maximum number of separators honored (so 14619splitfields(s, sep, n) returns a list of at most n+1 elements). (Since 146201.3, splitfields(s, None) is totally equivalent to split(s).) 14621string.capwords() has an optional second argument specifying the 14622separator (which is passed to split()). 14623 14624- regsub.split() has the same addition as string.split(). regsub.splitx(s, 14625sep, maxsep) implements the functionality that was regsub.split(s, 1) in 146261.4beta2 (return a list containing the delimiters as well as the words). 14627 14628- Final touch for AIX loading, rewritten Misc/AIX-NOTES. 14629 14630- In Modules/_tkinter.c, when using Tk 4.1 or higher, use className 14631argument to _tkinter.create() to set Tcl's argv0 variable, so X 14632resources use the right resource class again. 14633 14634- Add #undef fabs to Modules/mathmodule.c for macintosh. 14635 14636- Added some macro renames for AIX in Modules/operator.c. 14637 14638- Removed spurious 'E' from Doc/liberrno.tex. 14639 14640- Got rid of some cruft in Misc/ (dlMakefile, pyimenu.el); added new 14641Misc/gMakefile and new version of Misc/python-mode.el. 14642 14643- Fixed typo in Lib/ntpath.py (islink has "return false" which gives a 14644NameError). 14645 14646- Added missing "from types import *" to Lib/tkinter/Canvas.py. 14647 14648- Added hint about using default args for __init__ to pickle docs. 14649 14650- Corrected typo in Inclide/abstract.h: PySequence_Lenth -> 14651PySequence_Length. 14652 14653- Some improvements to Doc/texi2html.py. 14654 14655- In Python/import.c, Cast unsigned char * in struct _frozen to char * 14656in calls to rds_object(). 14657 14658- In doc/ref4.tex, added note about scope of lambda bodies. 14659 14660What's new in 1.4beta2 (since beta1)? 14661------------------------------------- 14662 14663- Portability bug in the md5.h header solved. 14664 14665- The PC build procedure now really works, and sets sys.platform to a 14666meaningful value (a few things were botched in beta 1). Lib/dos_8x3 14667is now a standard part of the distribution (alas). 14668 14669- More improvements to the installation procedure. Typing "make install" 14670now inserts the version number in the pathnames of almost everything 14671installed, and creates the machine dependent modules (FCNTL.py etc.) if not 14672supplied by the distribution. (XXX There's still a problem with the latter 14673because the "regen" script requires that Python is installed. Some manual 14674intervention may still be required.) (This has been fixed in 1.4beta3.) 14675 14676- New modules: errno, operator (XXX). 14677 14678- Changes for use with Numerical Python: built-in function slice() and 14679Ellipses object, and corresponding syntax: 14680 14681 x[lo:hi:stride] == x[slice(lo, hi, stride)] 14682 x[a, ..., z] == x[(a, Ellipses, z)] 14683 14684- New documentation for errno and cgi modules. 14685 14686- The directory containing the script passed to the interpreter is 14687inserted in from of sys.path; "." is no longer a default path 14688component. 14689 14690- Optional third string argument to string.translate() specifies 14691characters to delete. New function string.maketrans() creates a 14692translation table for translate() or for regex.compile(). 14693 14694- Module posix (and hence module os under Unix) now supports putenv(). 14695Moreover, module os is enhanced so that if putenv() is supported, 14696assignments to os.environ entries make the appropriate putenv() call. 14697(XXX the putenv() implementation can leak a small amount of memory per 14698call.) 14699 14700- pdb.py can now be invoked from the command line to debug a script: 14701python pdb.py <script> <arg> ... 14702 14703- Much improved parseaddr() in rfc822. 14704 14705- In cgi.py, you can now pass an alternative value for environ to 14706nearly all functions. 14707 14708- You can now assign to instance variables whose name begins and ends 14709with '__'. 14710 14711- New version of Fred Drake's parser module and associates (token, 14712symbol, AST). 14713 14714- New PYTHON_API_VERSION value and .pyc file magic number (again!). 14715 14716- The "complex" internal structure type is now called "Py_complex" to 14717avoid name conflicts. 14718 14719- Numerous small bugs fixed. 14720 14721- Slight pickle speedups. 14722 14723- Some slight speedups suggested by Sjoerd (more coming in 1.4 final). 14724 14725- NeXT portability mods by Bill Bumgarner integrated. 14726 14727- Modules regexmodule.c, bsddbmodule.c and xxmodule.c have been 14728converted to new naming style. 14729 14730 14731What's new in 1.4beta1 (since 1.3)? 14732----------------------------------- 14733 14734- Added sys.platform and sys.exec_platform for Bill Janssen. 14735 14736- Installation has been completely overhauled. "make install" now installs 14737everything, not just the python binary. Installation uses the install-sh 14738script (borrowed from X11) to install each file. 14739 14740- New functions in the posix module: mkfifo, plock, remove (== unlink), 14741and ftruncate. More functions are also available under NT. 14742 14743- New function in the fcntl module: flock. 14744 14745- Shared library support for FreeBSD. 14746 14747- The --with-readline option can now be used without a DIRECTORY argument, 14748for systems where libreadline.* is in one of the standard places. It is 14749also possible for it to be a shared library. 14750 14751- The extension tkinter has been renamed to _tkinter, to avoid confusion 14752with Tkinter.py oncase insensitive file systems. It now supports Tk 4.1 as 14753well as 4.0. 14754 14755- Author's change of address from CWI in Amsterdam, The Netherlands, to 14756CNRI in Reston, VA, USA. 14757 14758- The math.hypot() function is now always available (if it isn't found in 14759the C math library, Python provides its own implementation). 14760 14761- The latex documentation is now compatible with latex2e, thanks to David 14762Ascher. 14763 14764- The expression x**y is now equivalent to pow(x, y). 14765 14766- The indexing expression x[a, b, c] is now equivalent to x[(a, b, c)]. 14767 14768- Complex numbers are now supported. Imaginary constants are written with 14769a 'j' or 'J' prefix, general complex numbers can be formed by adding a real 14770part to an imaginary part, like 3+4j. Complex numbers are always stored in 14771floating point form, so this is equivalent to 3.0+4.0j. It is also 14772possible to create complex numbers with the new built-in function 14773complex(re, [im]). For the footprint-conscious, complex number support can 14774be disabled by defining the symbol WITHOUT_COMPLEX. 14775 14776- New built-in function list() is the long-awaited counterpart of tuple(). 14777 14778- There's a new "cmath" module which provides the same functions as the 14779"math" library but with complex arguments and results. (There are very 14780good reasons why math.sqrt(-1) still raises an exception -- you have to use 14781cmath.sqrt(-1) to get 1j for an answer.) 14782 14783- The Python.h header file (which is really the same as allobjects.h except 14784it disables support for old style names) now includes several more files, 14785so you have to have fewer #include statements in the average extension. 14786 14787- The NDEBUG symbol is no longer used. Code that used to be dependent on 14788the presence of NDEBUG is now present on the absence of DEBUG. TRACE_REFS 14789and REF_DEBUG have been renamed to Py_TRACE_REFS and Py_REF_DEBUG, 14790respectively. At long last, the source actually compiles and links without 14791errors when this symbol is defined. 14792 14793- Several symbols that didn't follow the new naming scheme have been 14794renamed (usually by adding to rename2.h) to use a Py or _Py prefix. There 14795are no external symbols left without a Py or _Py prefix, not even those 14796defined by sources that were incorporated from elsewhere (regexpr.c, 14797md5c.c). (Macros are a different story...) 14798 14799- There are now typedefs for the structures defined in config.c and 14800frozen.c. 14801 14802- New PYTHON_API_VERSION value and .pyc file magic number. 14803 14804- New module Bastion. (XXX) 14805 14806- Improved performance of StringIO module. 14807 14808- UserList module now supports + and * operators. 14809 14810- The binhex and binascii modules now actually work. 14811 14812- The cgi module has been almost totally rewritten and documented. 14813It now supports file upload and a new data type to handle forms more 14814flexibly. 14815 14816- The formatter module (for use with htmllib) has been overhauled (again). 14817 14818- The ftplib module now supports passive mode and has doc strings. 14819 14820- In (ideally) all places where binary files are read or written, the file 14821is now correctly opened in binary mode ('rb' or 'wb') so the code will work 14822on Mac or PC. 14823 14824- Dummy versions of os.path.expandvars() and expanduser() are now provided 14825on non-Unix platforms. 14826 14827- Module urllib now has two new functions url2pathname and pathname2url 14828which turn local filenames into "file:..." URLs using the same rules as 14829Netscape (why be different). it also supports urlretrieve() with a 14830pathname parameter, and honors the proxy environment variables (http_proxy 14831etc.). The URL parsing has been improved somewhat, too. 14832 14833- Micro improvements to urlparse. Added urlparse.urldefrag() which 14834removes a trailing ``#fragment'' if any. 14835 14836- The mailbox module now supports MH style message delimiters as well. 14837 14838- The mhlib module contains some new functionality: setcontext() to set the 14839current folder and parsesequence() to parse a sequence as commonly passed 14840to MH commands (e.g. 1-10 or last:5). 14841 14842- New module mimify for conversion to and from MIME format of email 14843messages. 14844 14845- Module ni now automatically installs itself when first imported -- this 14846is against the normal rule that modules should define classes and functions 14847but not invoke them, but appears more useful in the case that two 14848different, independent modules want to use ni's features. 14849 14850- Some small performance enhancements in module pickle. 14851 14852- Small interface change to the profile.run*() family of functions -- more 14853sensible handling of return values. 14854 14855- The officially registered Mac creator for Python files is 'Pyth'. This 14856replaces 'PYTH' which was used before but never registered. 14857 14858- Added regsub.capwords(). (XXX) 14859 14860- Added string.capwords(), string.capitalize() and string.translate(). 14861(XXX) 14862 14863- Fixed an interface bug in the rexec module: it was impossible to pass a 14864hooks instance to the RExec class. rexec now also supports the dynamic 14865loading of modules from shared libraries. Some other interfaces have been 14866added too. 14867 14868- Module rfc822 now caches the headers in a dictionary for more efficient 14869lookup. 14870 14871- The sgmllib module now understands a limited number of SGML "shorthands" 14872like <A/.../ for <A>...</A>. (It's not clear that this was a good idea...) 14873 14874- The tempfile module actually tries a number of different places to find a 14875usable temporary directory. (This was prompted by certain Linux 14876installations that appear to be missing a /usr/tmp directory.) [A bug in 14877the implementation that would ignore a pre-existing tmpdir global has been 14878fixed in beta3.] 14879 14880- Much improved and enhanved FileDialog module for Tkinter. 14881 14882- Many small changes to Tkinter, to bring it more in line with Tk 4.0 (as 14883well as Tk 4.1). 14884 14885- New socket interfaces include ntohs(), ntohl(), htons(), htonl(), and 14886s.dup(). Sockets now work correctly on Windows. On Windows, the built-in 14887extension is called _socket and a wrapper module win/socket.py provides 14888"makefile()" and "dup()" functionality. On Windows, the select module 14889works only with socket objects. 14890 14891- Bugs in bsddb module fixed (e.g. missing default argument values). 14892 14893- The curses extension now includes <ncurses.h> when available. 14894 14895- The gdbm module now supports opening databases in "fast" mode by 14896specifying 'f' as the second character or the mode string. 14897 14898- new variables sys.prefix and sys.exec_prefix pass corresponding 14899configuration options / Makefile variables to the Python programmer. 14900 14901- The ``new'' module now supports creating new user-defined classes as well 14902as instances thereof. 14903 14904- The soundex module now sports get_soundex() to get the soundex value for an 14905arbitrary string (formerly it would only do soundex-based string 14906comparison) as well as doc strings. 14907 14908- New object type "cobject" to safely wrap void pointers for passing them 14909between various extension modules. 14910 14911- More efficient computation of float**smallint. 14912 14913- The mysterious bug whereby "x.x" (two occurrences of the same 14914one-character name) typed from the commandline would sometimes fail 14915mysteriously. 14916 14917- The initialization of the readline function can now be invoked by a C 14918extension through PyOS_ReadlineInit(). 14919 14920- There's now an externally visible pointer PyImport_FrozenModules which 14921can be changed by an embedding application. 14922 14923- The argument parsing functions now support a new format character 'D' to 14924specify complex numbers. 14925 14926- Various memory leaks plugged and bugs fixed. 14927 14928- Improved support for posix threads (now that real implementations are 14929beginning to apepar). Still no fully functioning semaphores. 14930 14931- Some various and sundry improvements and new entries in the Tools 14932directory. 14933 14934 14935===================================== 14936==> Release 1.3 (13 October 1995) <== 14937===================================== 14938 14939Major change 14940============ 14941 14942Two words: Keyword Arguments. See the first section of Chapter 12 of 14943the Tutorial. 14944 14945(The rest of this file is textually the same as the remaining sections 14946of that chapter.) 14947 14948 14949Changes to the WWW and Internet tools 14950===================================== 14951 14952The "htmllib" module has been rewritten in an incompatible fashion. 14953The new version is considerably more complete (HTML 2.0 except forms, 14954but including all ISO-8859-1 entity definitions), and easy to use. 14955Small changes to "sgmllib" have also been made, to better match the 14956tokenization of HTML as recognized by other web tools. 14957 14958A new module "formatter" has been added, for use with the new 14959"htmllib" module. 14960 14961The "urllib"and "httplib" modules have been changed somewhat to allow 14962overriding unknown URL types and to support authentication. They now 14963use "mimetools.Message" instead of "rfc822.Message" to parse headers. 14964The "endrequest()" method has been removed from the HTTP class since 14965it breaks the interaction with some servers. 14966 14967The "rfc822.Message" class has been changed to allow a flag to be 14968passed in that says that the file is unseekable. 14969 14970The "ftplib" module has been fixed to be (hopefully) more robust on 14971Linux. 14972 14973Several new operations that are optionally supported by servers have 14974been added to "nntplib": "xover", "xgtitle", "xpath" and "date". 14975 14976Other Language Changes 14977====================== 14978 14979The "raise" statement now takes an optional argument which specifies 14980the traceback to be used when printing the exception's stack trace. 14981This must be a traceback object, such as found in "sys.exc_traceback". 14982When omitted or given as "None", the old behavior (to generate a stack 14983trace entry for the current stack frame) is used. 14984 14985The tokenizer is now more tolerant of alien whitespace. Control-L in 14986the leading whitespace of a line resets the column number to zero, 14987while Control-R just before the end of the line is ignored. 14988 14989Changes to Built-in Operations 14990============================== 14991 14992For file objects, "f.read(0)" and "f.readline(0)" now return an empty 14993string rather than reading an unlimited number of bytes. For the 14994latter, omit the argument altogether or pass a negative value. 14995 14996A new system variable, "sys.platform", has been added. It specifies 14997the current platform, e.g. "sunos5" or "linux1". 14998 14999The built-in functions "input()" and "raw_input()" now use the GNU 15000readline library when it has been configured (formerly, only 15001interactive input to the interpreter itself was read using GNU 15002readline). The GNU readline library provides elaborate line editing 15003and history. The Python debugger ("pdb") is the first beneficiary of 15004this change. 15005 15006Two new built-in functions, "globals()" and "locals()", provide access 15007to dictionaries containming current global and local variables, 15008respectively. (These augment rather than replace "vars()", which 15009returns the current local variables when called without an argument, 15010and a module's global variables when called with an argument of type 15011module.) 15012 15013The built-in function "compile()" now takes a third possible value for 15014the kind of code to be compiled: specifying "'single'" generates code 15015for a single interactive statement, which prints the output of 15016expression statements that evaluate to something else than "None". 15017 15018Library Changes 15019=============== 15020 15021There are new module "ni" and "ihooks" that support importing modules 15022with hierarchical names such as "A.B.C". This is enabled by writing 15023"import ni; ni.ni()" at the very top of the main program. These 15024modules are amply documented in the Python source. 15025 15026The module "rexec" has been rewritten (incompatibly) to define a class 15027and to use "ihooks". 15028 15029The "string.split()" and "string.splitfields()" functions are now the 15030same function (the presence or absence of the second argument 15031determines which operation is invoked); similar for "string.join()" 15032and "string.joinfields()". 15033 15034The "Tkinter" module and its helper "Dialog" have been revamped to use 15035keyword arguments. Tk 4.0 is now the standard. A new module 15036"FileDialog" has been added which implements standard file selection 15037dialogs. 15038 15039The optional built-in modules "dbm" and "gdbm" are more coordinated 15040--- their "open()" functions now take the same values for their "flag" 15041argument, and the "flag" and "mode" argument have default values (to 15042open the database for reading only, and to create the database with 15043mode "0666" minuse the umask, respectively). The memory leaks have 15044finally been fixed. 15045 15046A new dbm-like module, "bsddb", has been added, which uses the BSD DB 15047package's hash method. 15048 15049A portable (though slow) dbm-clone, implemented in Python, has been 15050added for systems where none of the above is provided. It is aptly 15051dubbed "dumbdbm". 15052 15053The module "anydbm" provides a unified interface to "bsddb", "gdbm", 15054"dbm", and "dumbdbm", choosing the first one available. 15055 15056A new extension module, "binascii", provides a variety of operations 15057for conversion of text-encoded binary data. 15058 15059There are three new or rewritten companion modules implemented in 15060Python that can encode and decode the most common such formats: "uu" 15061(uuencode), "base64" and "binhex". 15062 15063A module to handle the MIME encoding quoted-printable has also been 15064added: "quopri". 15065 15066The parser module (which provides an interface to the Python parser's 15067abstract syntax trees) has been rewritten (incompatibly) by Fred 15068Drake. It now lets you change the parse tree and compile the result! 15069 15070The \code{syslog} module has been upgraded and documented. 15071 15072Other Changes 15073============= 15074 15075The dynamic module loader recognizes the fact that different filenames 15076point to the same shared library and loads the library only once, so 15077you can have a single shared library that defines multiple modules. 15078(SunOS / SVR4 style shared libraries only.) 15079 15080Jim Fulton's ``abstract object interface'' has been incorporated into 15081the run-time API. For more detailes, read the files 15082"Include/abstract.h" and "Objects/abstract.c". 15083 15084The Macintosh version is much more robust now. 15085 15086Numerous things I have forgotten or that are so obscure no-one will 15087notice them anyway :-) 15088 15089 15090=================================== 15091==> Release 1.2 (13 April 1995) <== 15092=================================== 15093 15094- Changes to Misc/python-mode.el: 15095 - Wrapping and indentation within triple quote strings should work 15096 properly now. 15097 - `Standard' bug reporting mechanism (use C-c C-b) 15098 - py-mark-block was moved to C-c C-m 15099 - C-c C-v shows you the python-mode version 15100 - a basic python-font-lock-keywords has been added for Emacs 19 15101 font-lock colorizations. 15102 - proper interaction with pending-del and del-sel modes. 15103 - New py-electric-colon (:) command for improved outdenting. Also 15104 py-indent-line (TAB) should handle outdented lines better. 15105 - New commands py-outdent-left (C-c C-l) and py-indent-right (C-c C-r) 15106 15107- The Library Reference has been restructured, and many new and 15108existing modules are now documented, in particular the debugger and 15109the profiler, as well as the persistency and the WWW/Internet support 15110modules. 15111 15112- All known bugs have been fixed. For example the pow(2,2,3L) bug on 15113Linux has been fixed. Also the re-entrancy problems with __del__ have 15114been fixed. 15115 15116- All known memory leaks have been fixed. 15117 15118- Phase 2 of the Great Renaming has been executed. The header files 15119now use the new names (PyObject instead of object, etc.). The linker 15120also sees the new names. Most source files still use the old names, 15121by virtue of the rename2.h header file. If you include Python.h, you 15122only see the new names. Dynamically linked modules have to be 15123recompiled. (Phase 3, fixing the rest of the sources, will be 15124executed gradually with the release later versions.) 15125 15126- The hooks for implementing "safe-python" (better called "restricted 15127execution") are in place. Specifically, the import statement is 15128implemented by calling the built-in function __import__, and the 15129built-in names used in a particular scope are taken from the 15130dictionary __builtins__ in that scope's global dictionary. See also 15131the new (unsupported, undocumented) module rexec.py. 15132 15133- The import statement now supports the syntax "import a.b.c" and 15134"from a.b.c import name". No officially supported implementation 15135exists, but one can be prototyped by replacing the built-in __import__ 15136function. A proposal by Ken Manheimer is provided as newimp.py. 15137 15138- All machinery used by the import statement (or the built-in 15139__import__ function) is now exposed through the new built-in module 15140"imp" (see the library reference manual). All dynamic loading 15141machinery is moved to the new file importdl.c. 15142 15143- Persistent storage is supported through the use of the modules 15144"pickle" and "shelve" (implemented in Python). There's also a "copy" 15145module implementing deepcopy and normal (shallow) copy operations. 15146See the library reference manual. 15147 15148- Documentation strings for many object types are accessible through 15149the __doc__ attribute. Modules, classes and functions support special 15150syntax to initialize the __doc__ attribute: if the first statement 15151consists of just a string literal, that string literal becomes the 15152value of the __doc__ attribute. The default __doc__ attribute is 15153None. Documentation strings are also supported for built-in 15154functions, types and modules; however this feature hasn't been widely 15155used yet. See the 'new' module for an example. (Basically, the type 15156object's tp_doc field contains the doc string for the type, and the 151574th member of the methodlist structure contains the doc string for the 15158method.) 15159 15160- The __coerce__ and __cmp__ methods for user-defined classes once 15161again work as expected. As an example, there's a new standard class 15162Complex in the library. 15163 15164- The functions posix.popen() and posix.fdopen() now have an optional 15165third argument to specify the buffer size, and default their second 15166(mode) argument to 'r' -- in analogy to the built-in open() function. 15167The same applies to posixfile.open() and the socket method makefile(). 15168 15169- The thread.exit_thread() function now raises SystemExit so that 15170'finally' clauses are honored and a memory leak is plugged. 15171 15172- Improved X11 and Motif support, by Sjoerd Mullender. This extension 15173is being maintained and distributed separately. 15174 15175- Improved support for the Apple Macintosh, in part by Jack Jansen, 15176e.g. interfaces to (a few) resource mananger functions, get/set file 15177type and creator, gestalt, sound manager, speech manager, MacTCP, comm 15178toolbox, and the think C console library. This is being maintained 15179and distributed separately. 15180 15181- Improved version for Windows NT, by Mark Hammond. This is being 15182maintained and distributed separately. 15183 15184- Used autoconf 2.0 to generate the configure script. Adapted 15185configure.in to use the new features in autoconf 2.0. 15186 15187- It now builds on the NeXT without intervention, even on the 3.3 15188Sparc pre-release. 15189 15190- Characters passed to isspace() and friends are masked to nonnegative 15191values. 15192 15193- Correctly compute pow(-3.0, 3). 15194 15195- Fix portability problems with getopt (configure now checks for a 15196non-GNU getopt). 15197 15198- Don't add frozenmain.o to libPython.a. 15199 15200- Exceptions can now be classes. ALl built-in exceptions are still 15201string objects, but this will change in the future. 15202 15203- The socket module exports a long list of socket related symbols. 15204(More built-in modules will export their symbolic constants instead of 15205relying on a separately generated Python module.) 15206 15207- When a module object is deleted, it clears out its own dictionary. 15208This fixes a circularity in the references between functions and 15209their global dictionary. 15210 15211- Changed the error handling by [new]getargs() e.g. for "O&". 15212 15213- Dynamic loading of modules using shared libraries is supported for 15214several new platforms. 15215 15216- Support "O&", "[...]" and "{...}" in mkvalue(). 15217 15218- Extension to findmethod(): findmethodinchain() (where a chain is a 15219linked list of methodlist arrays). The calling interface for 15220findmethod() has changed: it now gets a pointer to the (static!) 15221methodlist structure rather than just to the function name -- this 15222saves copying flags etc. into the (short-lived) method object. 15223 15224- The callable() function is now public. 15225 15226- Object types can define a few new operations by setting function 15227pointers in the type object structure: tp_call defines how an object 15228is called, and tp_str defines how an object's str() is computed. 15229 15230 15231=================================== 15232==> Release 1.1.1 (10 Nov 1994) <== 15233=================================== 15234 15235This is a pure bugfix release again. See the ChangeLog file for details. 15236 15237One exception: a few new features were added to tkinter. 15238 15239 15240================================= 15241==> Release 1.1 (11 Oct 1994) <== 15242================================= 15243 15244This release adds several new features, improved configuration and 15245portability, and fixes more bugs than I can list here (including some 15246memory leaks). 15247 15248The source compiles and runs out of the box on more platforms than 15249ever -- including Windows NT. Makefiles or projects for a variety of 15250non-UNIX platforms are provided. 15251 15252APOLOGY: some new features are badly documented or not at all. I had 15253the choice -- postpone the new release indefinitely, or release it 15254now, with working code but some undocumented areas. The problem with 15255postponing the release is that people continue to suffer from existing 15256bugs, and send me patches based on the previous release -- which I 15257can't apply directly because my own source has changed. Also, some 15258new modules (like signal) have been ready for release for quite some 15259time, and people are anxiously waiting for them. In the case of 15260signal, the interface is simple enough to figure out without 15261documentation (if you're anxious enough :-). In this case it was not 15262simple to release the module on its own, since it relies on many small 15263patches elsewhere in the source. 15264 15265For most new Python modules, the source code contains comments that 15266explain how to use them. Documentation for the Tk interface, written 15267by Matt Conway, is available as tkinter-doc.tar.gz from the Python 15268home and mirror ftp sites (see Misc/FAQ for ftp addresses). For the 15269new operator overloading facilities, have a look at Demo/classes: 15270Complex.py and Rat.py show how to implement a numeric type without and 15271with __coerce__ method. Also have a look at the end of the Tutorial 15272document (Doc/tut.tex). If you're still confused: use the newsgroup 15273or mailing list. 15274 15275 15276New language features: 15277 15278 - More flexible operator overloading for user-defined classes 15279 (INCOMPATIBLE WITH PREVIOUS VERSIONS!) See end of tutorial. 15280 15281 - Classes can define methods named __getattr__, __setattr__ and 15282 __delattr__ to trap attribute accesses. See end of tutorial. 15283 15284 - Classes can define method __call__ so instances can be called 15285 directly. See end of tutorial. 15286 15287 15288New support facilities: 15289 15290 - The Makefiles (for the base interpreter as well as for extensions) 15291 now support creating dynamically loadable modules if the platform 15292 supports shared libraries. 15293 15294 - Passing the interpreter a .pyc file as script argument will execute 15295 the code in that file. (On the Mac such files can be double-clicked!) 15296 15297 - New Freeze script, to create independently distributable "binaries" 15298 of Python programs -- look in Demo/freeze 15299 15300 - Improved h2py script (in Demo/scripts) follows #includes and 15301 supports macros with one argument 15302 15303 - New module compileall generates .pyc files for all modules in a 15304 directory (tree) without also executing them 15305 15306 - Threads should work on more platforms 15307 15308 15309New built-in modules: 15310 15311 - tkinter (support for Tcl's Tk widget set) is now part of the base 15312 distribution 15313 15314 - signal allows catching or ignoring UNIX signals (unfortunately still 15315 undocumented -- any taker?) 15316 15317 - termios provides portable access to POSIX tty settings 15318 15319 - curses provides an interface to the System V curses library 15320 15321 - syslog provides an interface to the (BSD?) syslog daemon 15322 15323 - 'new' provides interfaces to create new built-in object types 15324 (e.g. modules and functions) 15325 15326 - sybase provides an interface to SYBASE database 15327 15328 15329New/obsolete built-in methods: 15330 15331 - callable(x) tests whether x can be called 15332 15333 - sockets now have a setblocking() method 15334 15335 - sockets no longer have an allowbroadcast() method 15336 15337 - socket methods send() and sendto() return byte count 15338 15339 15340New standard library modules: 15341 15342 - types.py defines standard names for built-in types, e.g. StringType 15343 15344 - urlparse.py parses URLs according to the latest Internet draft 15345 15346 - uu.py does uuencode/uudecode (not the fastest in the world, but 15347 quicker than installing uuencode on a non-UNIX machine :-) 15348 15349 - New, faster and more powerful profile module.py 15350 15351 - mhlib.py provides interface to MH folders and messages 15352 15353 15354New facilities for extension writers (unfortunately still 15355undocumented): 15356 15357 - newgetargs() supports optional arguments and improved error messages 15358 15359 - O!, O& O? formats for getargs allow more versatile type checking of 15360 non-standard types 15361 15362 - can register pending asynchronous callback, to be called the next 15363 time the Python VM begins a new instruction (Py_AddPendingCall) 15364 15365 - can register cleanup routines to be called when Python exits 15366 (Py_AtExit) 15367 15368 - makesetup script understands C++ files in Setup file (use file.C 15369 or file.cc) 15370 15371 - Make variable OPT is passed on to sub-Makefiles 15372 15373 - An init<module>() routine may signal an error by not entering 15374 the module in the module table and raising an exception instead 15375 15376 - For long module names, instead of foobarbletchmodule.c you can 15377 use foobarbletch.c 15378 15379 - getintvalue() and getfloatvalue() try to convert any object 15380 instead of requiring an "intobject" or "floatobject" 15381 15382 - All the [new]getargs() formats that retrieve an integer value 15383 will now also work if a float is passed 15384 15385 - C function listtuple() converts list to tuple, fast 15386 15387 - You should now call sigcheck() instead of intrcheck(); 15388 sigcheck() also sets an exception when it returns nonzero 15389 15390 15391==================================== 15392==> Release 1.0.3 (14 July 1994) <== 15393==================================== 15394 15395This release consists entirely of bug fixes to the C sources; see the 15396head of ../ChangeLog for a complete list. Most important bugs fixed: 15397 15398- Sometimes the format operator (string%expr) would drop the last 15399character of the format string 15400 15401- Tokenizer looped when last line did not end in \n 15402 15403- Bug when triple-quoted string ended in quote plus newline 15404 15405- Typo in socketmodule (listen) (== instead of =) 15406 15407- typing vars() at the >>> prompt would cause recursive output 15408 15409 15410================================== 15411==> Release 1.0.2 (4 May 1994) <== 15412================================== 15413 15414Overview of the most visible changes. Bug fixes are not listed. See 15415also ChangeLog. 15416 15417Tokens 15418------ 15419 15420* String literals follow Standard C rules: they may be continued on 15421the next line using a backslash; adjacent literals are concatenated 15422at compile time. 15423 15424* A new kind of string literals, surrounded by triple quotes (""" or 15425'''), can be continued on the next line without a backslash. 15426 15427Syntax 15428------ 15429 15430* Function arguments may have a default value, e.g. def f(a, b=1); 15431defaults are evaluated at function definition time. This also applies 15432to lambda. 15433 15434* The try-except statement has an optional else clause, which is 15435executed when no exception occurs in the try clause. 15436 15437Interpreter 15438----------- 15439 15440* The result of a statement-level expression is no longer printed, 15441except_ for expressions entered interactively. Consequently, the -k 15442command line option is gone. 15443 15444* The result of the last printed interactive expression is assigned to 15445the variable '_'. 15446 15447* Access to implicit global variables has been speeded up by removing 15448an always-failing dictionary lookup in the dictionary of local 15449variables (mod suggested by Steve Makewski and Tim Peters). 15450 15451* There is a new command line option, -u, to force stdout and stderr 15452to be unbuffered. 15453 15454* Incorporated Steve Majewski's mods to import.c for dynamic loading 15455under AIX. 15456 15457* Fewer chances of dumping core when trying to reload or re-import 15458static built-in, dynamically loaded built-in, or frozen modules. 15459 15460* Loops over sequences now don't ask for the sequence's length when 15461they start, but try to access items 0, 1, 2, and so on until they hit 15462an IndexError. This makes it possible to create classes that generate 15463infinite or indefinite sequences a la Steve Majewski. This affects 15464for loops, the (not) in operator, and the built-in functions filter(), 15465map(), max(), min(), reduce(). 15466 15467Changed Built-in operations 15468--------------------------- 15469 15470* The '%' operator on strings (printf-style formatting) supports a new 15471feature (adapted from a patch by Donald Beaudry) to allow 15472'%(<key>)<format>' % {...} to take values from a dictionary by name 15473instead of from a tuple by position (see also the new function 15474vars()). 15475 15476* The '%s' formatting operator is changed to accept any type and 15477convert it to a string using str(). 15478 15479* Dictionaries with more than 20,000 entries can now be created 15480(thanks to Steve Kirsch). 15481 15482New Built-in Functions 15483---------------------- 15484 15485* vars() returns a dictionary containing the local variables; vars(m) 15486returns a dictionary containing the variables of module m. Note: 15487dir(x) is now equivalent to vars(x).keys(). 15488 15489Changed Built-in Functions 15490-------------------------- 15491 15492* open() has an optional third argument to specify the buffer size: 0 15493for unbuffered, 1 for line buffered, >1 for explicit buffer size, <0 15494for default. 15495 15496* open()'s second argument is now optional; it defaults to "r". 15497 15498* apply() now checks that its second argument is indeed a tuple. 15499 15500New Built-in Modules 15501-------------------- 15502 15503Changed Built-in Modules 15504------------------------ 15505 15506The thread module no longer supports exit_prog(). 15507 15508New Python Modules 15509------------------ 15510 15511* Module addpack contains a standard interface to modify sys.path to 15512find optional packages (groups of related modules). 15513 15514* Module urllib contains a number of functions to access 15515World-Wide-Web files specified by their URL. 15516 15517* Module httplib implements the client side of the HTTP protocol used 15518by World-Wide-Web servers. 15519 15520* Module gopherlib implements the client side of the Gopher protocol. 15521 15522* Module mailbox (by Jack Jansen) contains a parser for UNIX and MMDF 15523style mailbox files. 15524 15525* Module random contains various random distributions, e.g. gauss(). 15526 15527* Module lockfile locks and unlocks open files using fcntl (inspired 15528by a similar module by Andy Bensky). 15529 15530* Module ntpath (by Jaap Vermeulen) implements path operations for 15531Windows/NT. 15532 15533* Module test_thread (in Lib/test) contains a small test set for the 15534thread module. 15535 15536Changed Python Modules 15537---------------------- 15538 15539* The string module's expandvars() function is now documented and is 15540implemented in Python (using regular expressions) instead of forking 15541off a shell process. 15542 15543* Module rfc822 now supports accessing the header fields using the 15544mapping/dictionary interface, e.g. h['subject']. 15545 15546* Module pdb now makes it possible to set a break on a function 15547(syntax: break <expression>, where <expression> yields a function 15548object). 15549 15550Changed Demos 15551------------- 15552 15553* The Demo/scripts/freeze.py script is working again (thanks to Jaap 15554Vermeulen). 15555 15556New Demos 15557--------- 15558 15559* Demo/threads/Generator.py is a proposed interface for restartable 15560functions a la Tim Peters. 15561 15562* Demo/scripts/newslist.py, by Quentin Stafford-Fraser, generates a 15563directory full of HTML pages which between them contain links to all 15564the newsgroups available on your server. 15565 15566* Demo/dns contains a DNS (Domain Name Server) client. 15567 15568* Demo/lutz contains miscellaneous demos by Mark Lutz (e.g. psh.py, a 15569nice enhanced Python shell!!!). 15570 15571* Demo/turing contains a Turing machine by Amrit Prem. 15572 15573Documentation 15574------------- 15575 15576* Documented new language features mentioned above (but not all new 15577modules). 15578 15579* Added a chapter to the Tutorial describing recent additions to 15580Python. 15581 15582* Clarified some sentences in the reference manual, 15583e.g. break/continue, local/global scope, slice assignment. 15584 15585Source Structure 15586---------------- 15587 15588* Moved Include/tokenizer.h to Parser/tokenizer.h. 15589 15590* Added Python/getopt.c for systems that don't have it. 15591 15592Emacs mode 15593---------- 15594 15595* Indentation of continuated lines is done more intelligently; 15596consequently the variable py-continuation-offset is gone. 15597 15598 15599======================================== 15600==> Release 1.0.1 (15 February 1994) <== 15601======================================== 15602 15603* Many portability fixes should make it painless to build Python on 15604several new platforms, e.g. NeXT, SEQUENT, WATCOM, DOS, and Windows. 15605 15606* Fixed test for <stdarg.h> -- this broke on some platforms. 15607 15608* Fixed test for shared library dynalic loading -- this broke on SunOS 156094.x using the GNU loader. 15610 15611* Changed order and number of SVR4 networking libraries (it is now 15612-lsocket -linet -lnsl, if these libraries exist). 15613 15614* Installing the build intermediate stages with "make libainstall" now 15615also installs config.c.in, Setup and makesetup, which are used by the 15616new Extensions mechanism. 15617 15618* Improved README file contains more hints and new troubleshooting 15619section. 15620 15621* The built-in module strop now defines fast versions of three more 15622functions of the standard string module: atoi(), atol() and atof(). 15623The strop versions of atoi() and atol() support an optional second 15624argument to specify the base (default 10). NOTE: you don't have to 15625explicitly import strop to use the faster versions -- the string 15626module contains code to let versions from stop override the default 15627versions. 15628 15629* There is now a working Lib/dospath.py for those who use Python under 15630DOS (or Windows). Thanks, Jaap! 15631 15632* There is now a working Modules/dosmodule.c for DOS (or Windows) 15633system calls. 15634 15635* Lib.os.py has been reorganized (making it ready for more operating 15636systems). 15637 15638* Lib/ospath.py is now obsolete (use os.path instead). 15639 15640* Many fixes to the tutorial to make it match Python 1.0. Thanks, 15641Tim! 15642 15643* Fixed Doc/Makefile, Doc/README and various scripts there. 15644 15645* Added missing description of fdopen to Doc/libposix.tex. 15646 15647* Made cleanup() global, for the benefit of embedded applications. 15648 15649* Added parsing of addresses and dates to Lib/rfc822.py. 15650 15651* Small fixes to Lib/aifc.py, Lib/sunau.py, Lib/tzparse.py to make 15652them usable at all. 15653 15654* New module Lib/wave.py reads RIFF (*.wav) audio files. 15655 15656* Module Lib/filewin.py moved to Lib/stdwin/filewin.py where it 15657belongs. 15658 15659* New options and comments for Modules/makesetup (used by new 15660Extension mechanism). 15661 15662* Misc/HYPE contains text of announcement of 1.0.0 in comp.lang.misc 15663and elsewhere. 15664 15665* Fixed coredump in filter(None, 'abcdefg'). 15666 15667 15668======================================= 15669==> Release 1.0.0 (26 January 1994) <== 15670======================================= 15671 15672As is traditional, so many things have changed that I can't pretend to 15673be complete in these release notes, but I'll try anyway :-) 15674 15675Note that the very last section is labeled "remaining bugs". 15676 15677 15678Source organization and build process 15679------------------------------------- 15680 15681* The sources have finally been split: instead of a single src 15682subdirectory there are now separate directories Include, Parser, 15683Grammar, Objects, Python and Modules. Other directories also start 15684with a capital letter: Misc, Doc, Lib, Demo. 15685 15686* A few extensions (notably Amoeba and X support) have been moved to a 15687separate subtree Extensions, which is no longer in the core 15688distribution, but separately ftp'able as extensions.tar.Z. (The 15689distribution contains a placeholder Ext-dummy with a description of 15690the Extensions subtree as well as the most recent versions of the 15691scripts used there.) 15692 15693* A few large specialized demos (SGI video and www) have been 15694moved to a separate subdirectory Demo2, which is no longer in the core 15695distribution, but separately ftp'able as demo2.tar.Z. 15696 15697* Parts of the standard library have been moved to subdirectories: 15698there are now standard subdirectories stdwin, test, sgi and sun4. 15699 15700* The configuration process has radically changed: I now use GNU 15701autoconf. This makes it much easier to build on new Unix flavors, as 15702well as fully supporting VPATH (if your Make has it). The scripts 15703Configure.py and Addmodule.sh are no longer needed. Many source files 15704have been adapted in order to work with the symbols that the configure 15705script generated by autoconf defines (or not); the resulting source is 15706much more portable to different C compilers and operating systems, 15707even non Unix systems (a Mac port was done in an afternoon). See the 15708toplevel README file for a description of the new build process. 15709 15710* GNU readline (a slightly newer version) is now a subdirectory of the 15711Python toplevel. It is still not automatically configured (being 15712totally autoconf-unaware :-). One problem has been solved: typing 15713Control-C to a readline prompt will now work. The distribution no 15714longer contains a "super-level" directory (above the python toplevel 15715directory), and dl, dl-dld and GNU dld are no longer part of the 15716Python distribution (you can still ftp them from 15717ftp.cwi.nl:/pub/dynload). 15718 15719* The DOS functions have been taken out of posixmodule.c and moved 15720into a separate file dosmodule.c. 15721 15722* There's now a separate file version.c which contains nothing but 15723the version number. 15724 15725* The actual main program is now contained in config.c (unless NO_MAIN 15726is defined); pythonmain.c now contains a function realmain() which is 15727called from config.c's main(). 15728 15729* All files needed to use the built-in module md5 are now contained in 15730the distribution. The module has been cleaned up considerably. 15731 15732 15733Documentation 15734------------- 15735 15736* The library manual has been split into many more small latex files, 15737so it is easier to edit Doc/lib.tex file to create a custom library 15738manual, describing only those modules supported on your system. (This 15739is not automated though.) 15740 15741* A fourth manual has been added, titled "Extending and Embedding the 15742Python Interpreter" (Doc/ext.tex), which collects information about 15743the interpreter which was previously spread over several files in the 15744misc subdirectory. 15745 15746* The entire documentation is now also available on-line for those who 15747have a WWW browser (e.g. NCSA Mosaic). Point your browser to the URL 15748"http://www.cwi.nl/~guido/Python.html". 15749 15750 15751Syntax 15752------ 15753 15754* Strings may now be enclosed in double quotes as well as in single 15755quotes. There is no difference in interpretation. The repr() of 15756string objects will use double quotes if the string contains a single 15757quote and no double quotes. Thanks to Amrit Prem for these changes! 15758 15759* There is a new keyword 'exec'. This replaces the exec() built-in 15760function. If a function contains an exec statement, local variable 15761optimization is not performed for that particular function, thus 15762making assignment to local variables in exec statements less 15763confusing. (As a consequence, os.exec and python.exec have been 15764renamed to execv.) 15765 15766* There is a new keyword 'lambda'. An expression of the form 15767 15768 lambda <parameters> : <expression> 15769 15770yields an anonymous function. This is really only syntactic sugar; 15771you can just as well define a local function using 15772 15773 def some_temporary_name(<parameters>): return <expression> 15774 15775Lambda expressions are particularly useful in combination with map(), 15776filter() and reduce(), described below. Thanks to Amrit Prem for 15777submitting this code (as well as map(), filter(), reduce() and 15778xrange())! 15779 15780 15781Built-in functions 15782------------------ 15783 15784* The built-in module containing the built-in functions is called 15785__builtin__ instead of builtin. 15786 15787* New built-in functions map(), filter() and reduce() perform standard 15788functional programming operations (though not lazily): 15789 15790- map(f, seq) returns a new sequence whose items are the items from 15791seq with f() applied to them. 15792 15793- filter(f, seq) returns a subsequence of seq consisting of those 15794items for which f() is true. 15795 15796- reduce(f, seq, initial) returns a value computed as follows: 15797 acc = initial 15798 for item in seq: acc = f(acc, item) 15799 return acc 15800 15801* New function xrange() creates a "range object". Its arguments are 15802the same as those of range(), and when used in a for loop a range 15803objects also behaves identical. The advantage of xrange() over 15804range() is that its representation (if the range contains many 15805elements) is much more compact than that of range(). The disadvantage 15806is that the result cannot be used to initialize a list object or for 15807the "Python idiom" [RED, GREEN, BLUE] = range(3). On some modern 15808architectures, benchmarks have shown that "for i in range(...): ..." 15809actually executes *faster* than "for i in xrange(...): ...", but on 15810memory starved machines like PCs running DOS range(100000) may be just 15811too big to be represented at all... 15812 15813* Built-in function exec() has been replaced by the exec statement -- 15814see above. 15815 15816 15817The interpreter 15818--------------- 15819 15820* Syntax errors are now not printed to stderr by the parser, but 15821rather the offending line and other relevant information are packed up 15822in the SyntaxError exception argument. When the main loop catches a 15823SyntaxError exception it will print the error in the same format as 15824previously, but at the proper position in the stack traceback. 15825 15826* You can now set a maximum to the number of traceback entries 15827printed by assigning to sys.tracebacklimit. The default is 1000. 15828 15829* The version number in .pyc files has changed yet again. 15830 15831* It is now possible to have a .pyc file without a corresponding .py 15832file. (Warning: this may break existing installations if you have an 15833old .pyc file lingering around somewhere on your module search path 15834without a corresponding .py file, when there is a .py file for a 15835module of the same name further down the path -- the new interpreter 15836will find the first .pyc file and complain about it, while the old 15837interpreter would ignore it and use the .py file further down.) 15838 15839* The list sys.builtin_module_names is now sorted and also contains 15840the names of a few hardwired built-in modules (sys, __main__ and 15841__builtin__). 15842 15843* A module can now find its own name by accessing the global variable 15844__name__. Assigning to this variable essentially renames the module 15845(it should also be stored under a different key in sys.modules). 15846A neat hack follows from this: a module that wants to execute a main 15847program when called as a script no longer needs to compare 15848sys.argv[0]; it can simply do "if __name__ == '__main__': main()". 15849 15850* When an object is printed by the print statement, its implementation 15851of str() is used. This means that classes can define __str__(self) to 15852direct how their instances are printed. This is different from 15853__repr__(self), which should define an unambigous string 15854representation of the instance. (If __str__() is not defined, it 15855defaults to __repr__().) 15856 15857* Functions and code objects can now be compared meaningfully. 15858 15859* On systems supporting SunOS or SVR4 style shared libraries, dynamic 15860loading of modules using shared libraries is automatically configured. 15861Thanks to Bill Jansen and Denis Severson for contributing this change! 15862 15863 15864Built-in objects 15865---------------- 15866 15867* File objects have acquired a new method writelines() which is the 15868reverse of readlines(). (It does not actually write lines, just a 15869list of strings, but the symmetry makes the choice of name OK.) 15870 15871 15872Built-in modules 15873---------------- 15874 15875* Socket objects no longer support the avail() method. Use the select 15876module instead, or use this function to replace it: 15877 15878 def avail(f): 15879 import select 15880 return f in select.select([f], [], [], 0)[0] 15881 15882* Initialization of stdwin is done differently. It actually modifies 15883sys.argv (taking out the options the X version of stdwin recognizes) 15884the first time it is imported. 15885 15886* A new built-in module parser provides a rudimentary interface to the 15887python parser. Corresponding standard library modules token and symbol 15888defines the numeric values of tokens and non-terminal symbols. 15889 15890* The posix module has acquired new functions setuid(), setgid(), 15891execve(), and exec() has been renamed to execv(). 15892 15893* The array module is extended with 8-byte object swaps, the 'i' 15894format character, and a reverse() method. The read() and write() 15895methods are renamed to fromfile() and tofile(). 15896 15897* The rotor module has freed of portability bugs. This introduces a 15898backward compatibility problem: strings encoded with the old rotor 15899module can't be decoded by the new version. 15900 15901* For select.select(), a timeout (4th) argument of None means the same 15902as leaving the timeout argument out. 15903 15904* Module strop (and hence standard library module string) has acquired 15905a new function: rindex(). Thanks to Amrit Prem! 15906 15907* Module regex defines a new function symcomp() which uses an extended 15908regular expression syntax: parenthesized subexpressions may be labeled 15909using the form "\(<labelname>...\)", and the group() method can return 15910sub-expressions by name. Thanks to Tracy Tims for these changes! 15911 15912* Multiple threads are now supported on Solaris 2. Thanks to Sjoerd 15913Mullender! 15914 15915 15916Standard library modules 15917------------------------ 15918 15919* The library is now split in several subdirectories: all stuff using 15920stdwin is in Lib/stdwin, all SGI specific (or SGI Indigo or GL) stuff 15921is in Lib/sgi, all Sun Sparc specific stuff is in Lib/sun4, and all 15922test modules are in Lib/test. The default module search path will 15923include all relevant subdirectories by default. 15924 15925* Module os now knows about trying to import dos. It defines 15926functions execl(), execle(), execlp() and execvp(). 15927 15928* New module dospath (should be attacked by a DOS hacker though). 15929 15930* All modules defining classes now define __init__() constructors 15931instead of init() methods. THIS IS AN INCOMPATIBLE CHANGE! 15932 15933* Some minor changes and bugfixes module ftplib (mostly Steve 15934Majewski's suggestions); the debug() method is renamed to 15935set_debuglevel(). 15936 15937* Some new test modules (not run automatically by testall though): 15938test_audioop, test_md5, test_rgbimg, test_select. 15939 15940* Module string now defines rindex() and rfind() in analogy of index() 15941and find(). It also defines atof() and atol() (and corresponding 15942exceptions) in analogy to atoi(). 15943 15944* Added help() functions to modules profile and pdb. 15945 15946* The wdb debugger (now in Lib/stdwin) now shows class or instance 15947variables on a double click. Thanks to Sjoerd Mullender! 15948 15949* The (undocumented) module lambda has gone -- you couldn't import it 15950any more, and it was basically more a demo than a library module... 15951 15952 15953Multimedia extensions 15954--------------------- 15955 15956* The optional built-in modules audioop and imageop are now standard 15957parts of the interpreter. Thanks to Sjoerd Mullender and Jack Jansen 15958for contributing this code! 15959 15960* There's a new operation in audioop: minmax(). 15961 15962* There's a new built-in module called rgbimg which supports portable 15963efficient reading of SGI RCG image files. Thanks also to Paul 15964Haeberli for the original code! (Who will contribute a GIF reader?) 15965 15966* The module aifc is gone -- you should now always use aifc, which has 15967received a facelift. 15968 15969* There's a new module sunau., for reading Sun (and NeXT) audio files. 15970 15971* There's a new module audiodev which provides a uniform interface to 15972(SGI Indigo and Sun Sparc) audio hardware. 15973 15974* There's a new module sndhdr which recognizes various sound files by 15975looking in their header and checking for various magic words. 15976 15977 15978Optimizations 15979------------- 15980 15981* Most optimizations below can be configured by compile-time flags. 15982Thanks to Sjoerd Mullender for submitting these optimizations! 15983 15984* Small integers (default -1..99) are shared -- i.e. if two different 15985functions compute the same value it is possible (but not 15986guaranteed!!!) that they return the same *object*. Python programs 15987can detect this but should *never* rely on it. 15988 15989* Empty tuples (which all compare equal) are shared in the same 15990manner. 15991 15992* Tuples of size up to 20 (default) are put in separate free lists 15993when deallocated. 15994 15995* There is a compile-time option to cache a string's hash function, 15996but this appeared to have a negligeable effect, and as it costs 4 15997bytes per string it is disabled by default. 15998 15999 16000Embedding Python 16001---------------- 16002 16003* The initialization interface has been simplified somewhat. You now 16004only call "initall()" to initialize the interpreter. 16005 16006* The previously announced renaming of externally visible identifiers 16007has not been carried out. It will happen in a later release. Sorry. 16008 16009 16010Miscellaneous bugs that have been fixed 16011--------------------------------------- 16012 16013* All known portability bugs. 16014 16015* Version 0.9.9 dumped core in <listobject>.sort() which has been 16016fixed. Thanks to Jaap Vermeulen for fixing this and posting the fix 16017on the mailing list while I was away! 16018 16019* Core dump on a format string ending in '%', e.g. in the expression 16020'%' % None. 16021 16022* The array module yielded a bogus result for concatenation (a+b would 16023yield a+a). 16024 16025* Some serious memory leaks in strop.split() and strop.splitfields(). 16026 16027* Several problems with the nis module. 16028 16029* Subtle problem when copying a class method from another class 16030through assignment (the method could not be called). 16031 16032 16033Remaining bugs 16034-------------- 16035 16036* One problem with 64-bit machines remains -- since .pyc files are 16037portable and use only 4 bytes to represent an integer object, 64-bit 16038integer literals are silently truncated when written into a .pyc file. 16039Work-around: use eval('123456789101112'). 16040 16041* The freeze script doesn't work any more. A new and more portable 16042one can probably be cooked up using tricks from Extensions/mkext.py. 16043 16044* The dos support hasn't been tested yet. (Really Soon Now we should 16045have a PC with a working C compiler!) 16046 16047 16048=================================== 16049==> Release 0.9.9 (29 Jul 1993) <== 16050=================================== 16051 16052I *believe* these are the main user-visible changes in this release, 16053but there may be others. SGI users may scan the {src,lib}/ChangeLog 16054files for improvements of some SGI specific modules, e.g. aifc and 16055cl. Developers of extension modules should also read src/ChangeLog. 16056 16057 16058Naming of C symbols used by the Python interpreter 16059-------------------------------------------------- 16060 16061* This is the last release using the current naming conventions. New 16062naming conventions are explained in the file misc/NAMING. 16063Summarizing, all externally visible symbols get (at least) a "Py" 16064prefix, and most functions are renamed to the standard form 16065PyModule_FunctionName. 16066 16067* Writers of extensions are urged to start using the new naming 16068conventions. The next release will use the new naming conventions 16069throughout (it will also have a different source directory 16070structure). 16071 16072* As a result of the preliminary work for the great renaming, many 16073functions that were accidentally global have been made static. 16074 16075 16076BETA X11 support 16077---------------- 16078 16079* There are now modules interfacing to the X11 Toolkit Intrinsics, the 16080Athena widgets, and the Motif 1.1 widget set. These are not yet 16081documented except through the examples and README file in the demo/x11 16082directory. It is expected that this interface will be replaced by a 16083more powerful and correct one in the future, which may or may not be 16084backward compatible. In other words, this part of the code is at most 16085BETA level software! (Note: the rest of Python is rock solid as ever!) 16086 16087* I understand that the above may be a bit of a disappointment, 16088however my current schedule does not allow me to change this situation 16089before putting the release out of the door. By releasing it 16090undocumented and buggy, at least some of the (working!) demo programs, 16091like itr (my Internet Talk Radio browser) become available to a larger 16092audience. 16093 16094* There are also modules interfacing to SGI's "Glx" widget (a GL 16095window wrapped in a widget) and to NCSA's "HTML" widget (which can 16096format HyperText Markup Language, the document format used by the 16097World Wide Web). 16098 16099* I've experienced some problems when building the X11 support. In 16100particular, the Xm and Xaw widget sets don't go together, and it 16101appears that using X11R5 is better than using X11R4. Also the threads 16102module and its link time options may spoil things. My own strategy is 16103to build two Python binaries: one for use with X11 and one without 16104it, which can contain a richer set of built-in modules. Don't even 16105*think* of loading the X11 modules dynamically... 16106 16107 16108Environmental changes 16109--------------------- 16110 16111* Compiled files (*.pyc files) created by this Python version are 16112incompatible with those created by the previous version. Both 16113versions detect this and silently create a correct version, but it 16114means that it is not a good idea to use the same library directory for 16115an old and a new interpreter, since they will start to "fight" over 16116the *.pyc files... 16117 16118* When a stack trace is printed, the exception is printed last instead 16119of first. This means that if the beginning of the stack trace 16120scrolled out of your window you can still see what exception caused 16121it. 16122 16123* Sometimes interrupting a Python operation does not work because it 16124hangs in a blocking system call. You can now kill the interpreter by 16125interrupting it three times. The second time you interrupt it, a 16126message will be printed telling you that the third interrupt will kill 16127the interpreter. The "sys.exitfunc" feature still makes limited 16128clean-up possible in this case. 16129 16130 16131Changes to the command line interface 16132------------------------------------- 16133 16134* The python usage message is now much more informative. 16135 16136* New option -i enters interactive mode after executing a script -- 16137useful for debugging. 16138 16139* New option -k raises an exception when an expression statement 16140yields a value other than None. 16141 16142* For each option there is now also a corresponding environment 16143variable. 16144 16145 16146Using Python as an embedded language 16147------------------------------------ 16148 16149* The distribution now contains (some) documentation on the use of 16150Python as an "embedded language" in other applications, as well as a 16151simple example. See the file misc/EMBEDDING and the directory embed/. 16152 16153 16154Speed improvements 16155------------------ 16156 16157* Function local variables are now generally stored in an array and 16158accessed using an integer indexing operation, instead of through a 16159dictionary lookup. (This compensates the somewhat slower dictionary 16160lookup caused by the generalization of the dictionary module.) 16161 16162 16163Changes to the syntax 16164--------------------- 16165 16166* Continuation lines can now *sometimes* be written without a 16167backslash: if the continuation is contained within nesting (), [] or 16168{} brackets the \ may be omitted. There's a much improved 16169python-mode.el in the misc directory which knows about this as well. 16170 16171* You can no longer use an empty set of parentheses to define a class 16172without base classes. That is, you no longer write this: 16173 16174 class Foo(): # syntax error 16175 ... 16176 16177You must write this instead: 16178 16179 class Foo: 16180 ... 16181 16182This was already the preferred syntax in release 0.9.8 but many 16183people seemed not to have picked it up. There's a Python script that 16184fixes old code: demo/scripts/classfix.py. 16185 16186* There's a new reserved word: "access". The syntax and semantics are 16187still subject of research and debate (as well as undocumented), but 16188the parser knows about the keyword so you must not use it as a 16189variable, function, or attribute name. 16190 16191 16192Changes to the semantics of the language proper 16193----------------------------------------------- 16194 16195* The following compatibility hack is removed: if a function was 16196defined with two or more arguments, and called with a single argument 16197that was a tuple with just as many arguments, the items of this tuple 16198would be used as the arguments. This is no longer supported. 16199 16200 16201Changes to the semantics of classes and instances 16202------------------------------------------------- 16203 16204* Class variables are now also accessible as instance variables for 16205reading (assignment creates an instance variable which overrides the 16206class variable of the same name though). 16207 16208* If a class attribute is a user-defined function, a new kind of 16209object is returned: an "unbound method". This contains a pointer to 16210the class and can only be called with a first argument which is a 16211member of that class (or a derived class). 16212 16213* If a class defines a method __init__(self, arg1, ...) then this 16214method is called when a class instance is created by the classname() 16215construct. Arguments passed to classname() are passed to the 16216__init__() method. The __init__() methods of base classes are not 16217automatically called; the derived __init__() method must call these if 16218necessary (this was done so the derived __init__() method can choose 16219the call order and arguments for the base __init__() methods). 16220 16221* If a class defines a method __del__(self) then this method is called 16222when an instance of the class is about to be destroyed. This makes it 16223possible to implement clean-up of external resources attached to the 16224instance. As with __init__(), the __del__() methods of base classes 16225are not automatically called. If __del__ manages to store a reference 16226to the object somewhere, its destruction is postponed; when the object 16227is again about to be destroyed its __del__() method will be called 16228again. 16229 16230* Classes may define a method __hash__(self) to allow their instances 16231to be used as dictionary keys. This must return a 32-bit integer. 16232 16233 16234Minor improvements 16235------------------ 16236 16237* Function and class objects now know their name (the name given in 16238the 'def' or 'class' statement that created them). 16239 16240* Class instances now know their class name. 16241 16242 16243Additions to built-in operations 16244-------------------------------- 16245 16246* The % operator with a string left argument implements formatting 16247similar to sprintf() in C. The right argument is either a single 16248value or a tuple of values. All features of Standard C sprintf() are 16249supported except %p. 16250 16251* Dictionaries now support almost any key type, instead of just 16252strings. (The key type must be an immutable type or must be a class 16253instance where the class defines a method __hash__(), in order to 16254avoid losing track of keys whose value may change.) 16255 16256* Built-in methods are now compared properly: when comparing x.meth1 16257and y.meth2, if x is equal to y and the methods are defined by the 16258same function, x.meth1 compares equal to y.meth2. 16259 16260 16261Additions to built-in functions 16262------------------------------- 16263 16264* str(x) returns a string version of its argument. If the argument is 16265a string it is returned unchanged, otherwise it returns `x`. 16266 16267* repr(x) returns the same as `x`. (Some users found it easier to 16268have this as a function.) 16269 16270* round(x) returns the floating point number x rounded to a whole 16271number, represented as a floating point number. round(x, n) returns x 16272rounded to n digits. 16273 16274* hasattr(x, name) returns true when x has an attribute with the given 16275name. 16276 16277* hash(x) returns a hash code (32-bit integer) of an arbitrary 16278immutable object's value. 16279 16280* id(x) returns a unique identifier (32-bit integer) of an arbitrary 16281object. 16282 16283* compile() compiles a string to a Python code object. 16284 16285* exec() and eval() now support execution of code objects. 16286 16287 16288Changes to the documented part of the library (standard modules) 16289---------------------------------------------------------------- 16290 16291* os.path.normpath() (a.k.a. posixpath.normpath()) has been fixed so 16292the border case '/foo/..' returns '/' instead of ''. 16293 16294* A new function string.find() is added with similar semantics to 16295string.index(); however when it does not find the given substring it 16296returns -1 instead of raising string.index_error. 16297 16298 16299Changes to built-in modules 16300--------------------------- 16301 16302* New optional module 'array' implements operations on sequences of 16303integers or floating point numbers of a particular size. This is 16304useful to manipulate large numerical arrays or to read and write 16305binary files consisting of numerical data. 16306 16307* Regular expression objects created by module regex now support a new 16308method named group(), which returns one or more \(...\) groups by number. 16309The number of groups is increased from 10 to 100. 16310 16311* Function compile() in module regex now supports an optional mapping 16312argument; a variable casefold is added to the module which can be used 16313as a standard uppercase to lowercase mapping. 16314 16315* Module time now supports many routines that are defined in the 16316Standard C time interface (<time.h>): gmtime(), localtime(), 16317asctime(), ctime(), mktime(), as well as these variables (taken from 16318System V): timezone, altzone, daylight and tzname. (The corresponding 16319functions in the undocumented module calendar have been removed; the 16320undocumented and unfinished module tzparse is now obsolete and will 16321disappear in a future release.) 16322 16323* Module strop (the fast built-in version of standard module string) 16324now uses C's definition of whitespace instead of fixing it to space, 16325tab and newline; in practice this usually means that vertical tab, 16326form feed and return are now also considered whitespace. It exports 16327the string of characters that are considered whitespace as well as the 16328characters that are considered lowercase or uppercase. 16329 16330* Module sys now defines the variable builtin_module_names, a list of 16331names of modules built into the current interpreter (including not 16332yet imported, but excluding two special modules that always have to be 16333defined -- sys and builtin). 16334 16335* Objects created by module sunaudiodev now also support flush() and 16336close() methods. 16337 16338* Socket objects created by module socket now support an optional 16339flags argument for their methods sendto() and recvfrom(). 16340 16341* Module marshal now supports dumping to and loading from strings, 16342through the functions dumps() and loads(). 16343 16344* Module stdwin now supports some new functionality. You may have to 16345ftp the latest version: ftp.cwi.nl:/pub/stdwin/stdwinforviews.tar.Z.) 16346 16347 16348Bugs fixed 16349---------- 16350 16351* Fixed comparison of negative long integers. 16352 16353* The tokenizer no longer botches input lines longer than BUFSIZ. 16354 16355* Fixed several severe memory leaks in module select. 16356 16357* Fixed memory leaks in modules socket and sv. 16358 16359* Fixed memory leak in divmod() for long integers. 16360 16361* Problems with definition of floatsleep() on Suns fixed. 16362 16363* Many portability bugs fixed (and undoubtedly new ones added :-). 16364 16365 16366Changes to the build procedure 16367------------------------------ 16368 16369* The Makefile supports some new targets: "make default" and "make 16370all". Both are by normally equivalent to "make python". 16371 16372* The Makefile no longer uses $> since it's not supported by all 16373versions of Make. 16374 16375* The header files now all contain #ifdef constructs designed to make 16376it safe to include the same header file twice, as well as support for 16377inclusion from C++ programs (automatic extern "C" { ... } added). 16378 16379 16380Freezing Python scripts 16381----------------------- 16382 16383* There is now some support for "freezing" a Python script as a 16384stand-alone executable binary file. See the script 16385demo/scripts/freeze.py. It will require some site-specific tailoring 16386of the script to get this working, but is quite worthwhile if you write 16387Python code for other who may not have built and installed Python. 16388 16389 16390MS-DOS 16391------ 16392 16393* A new MS-DOS port has been done, using MSC 6.0 (I believe). Thanks, 16394Marcel van der Peijl! This requires fewer compatibility hacks in 16395posixmodule.c. The executable is not yet available but will be soon 16396(check the mailing list). 16397 16398* The default PYTHONPATH has changed. 16399 16400 16401Changes for developers of extension modules 16402------------------------------------------- 16403 16404* Read src/ChangeLog for full details. 16405 16406 16407SGI specific changes 16408-------------------- 16409 16410* Read src/ChangeLog for full details. 16411 16412 16413================================== 16414==> Release 0.9.8 (9 Jan 1993) <== 16415================================== 16416 16417I claim no completeness here, but I've tried my best to scan the log 16418files throughout my source tree for interesting bits of news. A more 16419complete account of the changes is to be found in the various 16420ChangeLog files. See also "News for release 0.9.7beta" below if you're 16421still using release 0.9.6, and the file HISTORY if you have an even 16422older release. 16423 16424 --Guido 16425 16426 16427Changes to the language proper 16428------------------------------ 16429 16430There's only one big change: the conformance checking for function 16431argument lists (of user-defined functions only) is stricter. Earlier, 16432you could get away with the following: 16433 16434 (a) define a function of one argument and call it with any 16435 number of arguments; if the actual argument count wasn't 16436 one, the function would receive a tuple containing the 16437 arguments (an empty tuple if there were none). 16438 16439 (b) define a function of two arguments, and call it with more 16440 than two arguments; if there were more than two arguments, 16441 the second argument would be passed as a tuple containing 16442 the second and further actual arguments. 16443 16444(Note that an argument (formal or actual) that is a tuple is counted as 16445one; these rules don't apply inside such tuples, only at the top level 16446of the argument list.) 16447 16448Case (a) was needed to accommodate variable-length argument lists; 16449there is now an explicit "varargs" feature (precede the last argument 16450with a '*'). Case (b) was needed for compatibility with old class 16451definitions: up to release 0.9.4 a method with more than one argument 16452had to be declared as "def meth(self, (arg1, arg2, ...)): ...". 16453Version 0.9.6 provide better ways to handle both casees, bot provided 16454backward compatibility; version 0.9.8 retracts the compatibility hacks 16455since they also cause confusing behavior if a function is called with 16456the wrong number of arguments. 16457 16458There's a script that helps converting classes that still rely on (b), 16459provided their methods' first argument is called "self": 16460demo/scripts/methfix.py. 16461 16462If this change breaks lots of code you have developed locally, try 16463#defining COMPAT_HACKS in ceval.c. 16464 16465(There's a third compatibility hack, which is the reverse of (a): if a 16466function is defined with two or more arguments, and called with a 16467single argument that is a tuple with just as many arguments, the items 16468of this tuple will be used as the arguments. Although this can (and 16469should!) be done using the built-in function apply() instead, it isn't 16470withdrawn yet.) 16471 16472 16473One minor change: comparing instance methods works like expected, so 16474that if x is an instance of a user-defined class and has a method m, 16475then (x.m==x.m) yields 1. 16476 16477 16478The following was already present in 0.9.7beta, but not explicitly 16479mentioned in the NEWS file: user-defined classes can now define types 16480that behave in almost allrespects like numbers. See 16481demo/classes/Rat.py for a simple example. 16482 16483 16484Changes to the build process 16485---------------------------- 16486 16487The Configure.py script and the Makefile has been made somewhat more 16488bullet-proof, after reports of (minor) trouble on certain platforms. 16489 16490There is now a script to patch Makefile and config.c to add a new 16491optional built-in module: Addmodule.sh. Read the script before using! 16492 16493Using Addmodule.sh, all optional modules can now be configured at 16494compile time using Configure.py, so there are no modules left that 16495require dynamic loading. 16496 16497The Makefile has been fixed to make it easier to use with the VPATH 16498feature of some Make versions (e.g. SunOS). 16499 16500 16501Changes affecting portability 16502----------------------------- 16503 16504Several minor portability problems have been solved, e.g. "malloc.h" 16505has been renamed to "mymalloc.h", "strdup.c" is no longer used, and 16506the system now tolerates malloc(0) returning 0. 16507 16508For dynamic loading on the SGI, Jack Jansen's dl 1.6 is now 16509distributed with Python. This solves several minor problems, in 16510particular scripts invoked using #! can now use dynamic loading. 16511 16512 16513Changes to the interpreter interface 16514------------------------------------ 16515 16516On popular demand, there's finally a "profile" feature for interactive 16517use of the interpreter. If the environment variable $PYTHONSTARTUP is 16518set to the name of an existing file, Python statements in this file 16519are executed when the interpreter is started in interactive mode. 16520 16521There is a new clean-up mechanism, complementing try...finally: if you 16522assign a function object to sys.exitfunc, it will be called when 16523Python exits or receives a SIGTERM or SIGHUP signal. 16524 16525The interpreter is now generally assumed to live in 16526/usr/local/bin/python (as opposed to /usr/local/python). The script 16527demo/scripts/fixps.py will update old scripts in place (you can easily 16528modify it to do other similar changes). 16529 16530Most I/O that uses sys.stdin/stdout/stderr will now use any object 16531assigned to those names as long as the object supports readline() or 16532write() methods. 16533 16534The parser stack has been increased to 500 to accommodate more 16535complicated expressions (7 levels used to be the practical maximum, 16536it's now about 38). 16537 16538The limit on the size of the *run-time* stack has completely been 16539removed -- this means that tuple or list displays can contain any 16540number of elements (formerly more than 50 would crash the 16541interpreter). 16542 16543 16544Changes to existing built-in functions and methods 16545-------------------------------------------------- 16546 16547The built-in functions int(), long(), float(), oct() and hex() now 16548also apply to class instalces that define corresponding methods 16549(__int__ etc.). 16550 16551 16552New built-in functions 16553---------------------- 16554 16555The new functions str() and repr() convert any object to a string. 16556The function repr(x) is in all respects equivalent to `x` -- some 16557people prefer a function for this. The function str(x) does the same 16558except if x is already a string -- then it returns x unchanged 16559(repr(x) adds quotes and escapes "funny" characters as octal escapes). 16560 16561The new function cmp(x, y) returns -1 if x<y, 0 if x==y, 1 if x>y. 16562 16563 16564Changes to general built-in modules 16565----------------------------------- 16566 16567The time module's functions are more general: time() returns a 16568floating point number and sleep() accepts one. Their accuracies 16569depends on the precision of the system clock. Millisleep is no longer 16570needed (although it still exists for now), but millitimer is still 16571needed since on some systems wall clock time is only available with 16572seconds precision, while a source of more precise time exists that 16573isn't synchronized with the wall clock. (On UNIX systems that support 16574the BSD gettimeofday() function, time.time() is as time.millitimer().) 16575 16576The string representation of a file object now includes an address: 16577'<file 'filename', mode 'r' at #######>' where ###### is a hex number 16578(the object's address) to make it unique. 16579 16580New functions added to posix: nice(), setpgrp(), and if your system 16581supports them: setsid(), setpgid(), tcgetpgrp(), tcsetpgrp(). 16582 16583Improvements to the socket module: socket objects have new methods 16584getpeername() and getsockname(), and the {get,set}sockopt methods can 16585now get/set any kind of option using strings built with the new struct 16586module. And there's a new function fromfd() which creates a socket 16587object given a file descriptor (useful for servers started by inetd, 16588which have a socket connected to stdin and stdout). 16589 16590 16591Changes to SGI-specific built-in modules 16592---------------------------------------- 16593 16594The FORMS library interface (fl) now requires FORMS 2.1a. Some new 16595functions have been added and some bugs have been fixed. 16596 16597Additions to al (audio library interface): added getname(), 16598getdefault() and getminmax(). 16599 16600The gl modules doesn't call "foreground()" when initialized (this 16601caused some problems) like it dit in 0.9.7beta (but not before). 16602There's a new gl function 'gversion() which returns a version string. 16603 16604The interface to sv (Indigo video interface) has totally changed. 16605(Sorry, still no documentation, but see the examples in 16606demo/sgi/{sv,video}.) 16607 16608 16609Changes to standard library modules 16610----------------------------------- 16611 16612Most functions in module string are now much faster: they're actually 16613implemented in C. The module containing the C versions is called 16614"strop" but you should still import "string" since strop doesn't 16615provide all the interfaces defined in string (and strop may be renamed 16616to string when it is complete in a future release). 16617 16618string.index() now accepts an optional third argument giving an index 16619where to start searching in the first argument, so you can find second 16620and further occurrences (this is similar to the regular expression 16621functions in regex). 16622 16623The definition of what string.splitfields(anything, '') should return 16624is changed for the last time: it returns a singleton list containing 16625its whole first argument unchanged. This is compatible with 16626regsub.split() which also ignores empty delimiter matches. 16627 16628posixpath, macpath: added dirname() and normpath() (and basename() to 16629macpath). 16630 16631The mainloop module (for use with stdwin) can now demultiplex input 16632from other sources, as long as they can be polled with select(). 16633 16634 16635New built-in modules 16636-------------------- 16637 16638Module struct defines functions to pack/unpack values to/from strings 16639representing binary values in native byte order. 16640 16641Module strop implements C versions of many functions from string (see 16642above). 16643 16644Optional module fcntl defines interfaces to fcntl() and ioctl() -- 16645UNIX only. (Not yet properly documented -- see however src/fcntl.doc.) 16646 16647Optional module mpz defines an interface to an altaernative long 16648integer implementation, the GNU MPZ library. 16649 16650Optional module md5 uses the GNU MPZ library to calculate MD5 16651signatures of strings. 16652 16653There are also optional new modules specific to SGI machines: imageop 16654defines some simple operations to images represented as strings; sv 16655interfaces to the Indigo video board; cl interfaces to the (yet 16656unreleased) compression library. 16657 16658 16659New standard library modules 16660---------------------------- 16661 16662(Unfortunately the following modules are not all documented; read the 16663sources to find out more about them!) 16664 16665autotest: run testall without showing any output unless it differs 16666from the expected output 16667 16668bisect: use bisection to insert or find an item in a sorted list 16669 16670colorsys: defines conversions between various color systems (e.g. RGB 16671<-> YUV) 16672 16673nntplib: a client interface to NNTP servers 16674 16675pipes: utility to construct pipeline from templates, e.g. for 16676conversion from one file format to another using several utilities. 16677 16678regsub: contains three functions that are more or less compatible with 16679awk functions of the same name: sub() and gsub() do string 16680substitution, split() splits a string using a regular expression to 16681define how separators are define. 16682 16683test_types: test operations on the built-in types of Python 16684 16685toaiff: convert various audio file formats to AIFF format 16686 16687tzparse: parse the TZ environment parameter (this may be less general 16688than it could be, let me know if you fix it). 16689 16690(Note that the obsolete module "path" no longer exists.) 16691 16692 16693New SGI-specific library modules 16694-------------------------------- 16695 16696CL: constants for use with the built-in compression library interface (cl) 16697 16698Queue: a multi-producer, multi-consumer queue class implemented for 16699use with the built-in thread module 16700 16701SOCKET: constants for use with built-in module socket, e.g. to set/get 16702socket options. This is SGI-specific because the constants to be 16703passed are system-dependent. You can generate a version for your own 16704system by running the script demo/scripts/h2py.py with 16705/usr/include/sys/socket.h as input. 16706 16707cddb: interface to the database used by the CD player 16708 16709torgb: convert various image file types to rgb format (requires pbmplus) 16710 16711 16712New demos 16713--------- 16714 16715There's an experimental interface to define Sun RPC clients and 16716servers in demo/rpc. 16717 16718There's a collection of interfaces to WWW, WAIS and Gopher (both 16719Python classes and program providing a user interface) in demo/www. 16720This includes a program texi2html.py which converts texinfo files to 16721HTML files (the format used hy WWW). 16722 16723The ibrowse demo has moved from demo/stdwin/ibrowse to demo/ibrowse. 16724 16725For SGI systems, there's a whole collection of programs and classes 16726that make use of the Indigo video board in demo/sgi/{sv,video}. This 16727represents a significant amount of work that we're giving away! 16728 16729There are demos "rsa" and "md5test" that exercise the mpz and md5 16730modules, respectively. The rsa demo is a complete implementation of 16731the RSA public-key cryptosystem! 16732 16733A bunch of games and examples submitted by Stoffel Erasmus have been 16734included in demo/stoffel. 16735 16736There are miscellaneous new files in some existing demo 16737subdirectories: classes/bitvec.py, scripts/{fixps,methfix}.py, 16738sgi/al/cmpaf.py, sockets/{mcast,gopher}.py. 16739 16740There are also many minor changes to existing files, but I'm too lazy 16741to run a diff and note the differences -- you can do this yourself if 16742you save the old distribution's demos. One highlight: the 16743stdwin/python.py demo is much improved! 16744 16745 16746Changes to the documentation 16747---------------------------- 16748 16749The LaTeX source for the library uses different macros to enable it to 16750be converted to texinfo, and from there to INFO or HTML format so it 16751can be browsed as a hypertext. The net result is that you can now 16752read the Python library documentation in Emacs info mode! 16753 16754 16755Changes to the source code that affect C extension writers 16756---------------------------------------------------------- 16757 16758The function strdup() no longer exists (it was used only in one places 16759and is somewhat of a portability problem since some systems have the 16760same function in their C library. 16761 16762The functions NEW() and RENEW() allocate one spare byte to guard 16763against a NULL return from malloc(0) being taken for an error, but 16764this should not be relied upon. 16765 16766 16767========================= 16768==> Release 0.9.7beta <== 16769========================= 16770 16771 16772Changes to the language proper 16773------------------------------ 16774 16775User-defined classes can now implement operations invoked through 16776special syntax, such as x[i] or `x` by defining methods named 16777__getitem__(self, i) or __repr__(self), etc. 16778 16779 16780Changes to the build process 16781---------------------------- 16782 16783Instead of extensive manual editing of the Makefile to select 16784compile-time options, you can now run a Configure.py script. 16785The Makefile as distributed builds a minimal interpreter sufficient to 16786run Configure.py. See also misc/BUILD 16787 16788The Makefile now includes more "utility" targets, e.g. install and 16789tags/TAGS 16790 16791Using the provided strtod.c and strtol.c are now separate options, as 16792on the Sun the provided strtod.c dumps core :-( 16793 16794The regex module is now an option chosen by the Makefile, since some 16795(old) C compilers choke on regexpr.c 16796 16797 16798Changes affecting portability 16799----------------------------- 16800 16801You need STDWIN version 0.9.7 (released 30 June 1992) for the stdwin 16802interface 16803 16804Dynamic loading is now supported for Sun (and other non-COFF systems) 16805throug dld-3.2.3, as well as for SGI (a new version of Jack Jansen's 16806DL is out, 1.4) 16807 16808The system-dependent code for the use of the select() system call is 16809moved to one file: myselect.h 16810 16811Thanks to Jaap Vermeulen, the code should now port cleanly to the 16812SEQUENT 16813 16814 16815Changes to the interpreter interface 16816------------------------------------ 16817 16818The interpretation of $PYTHONPATH in the environment is different: it 16819is inserted in front of the default path instead of overriding it 16820 16821 16822Changes to existing built-in functions and methods 16823-------------------------------------------------- 16824 16825List objects now support an optional argument to their sort() method, 16826which is a comparison function similar to qsort(3) in C 16827 16828File objects now have a method fileno(), used by the new select module 16829(see below) 16830 16831 16832New built-in function 16833--------------------- 16834 16835coerce(x, y): take two numbers and return a tuple containing them 16836both converted to a common type 16837 16838 16839Changes to built-in modules 16840--------------------------- 16841 16842sys: fixed core dumps in settrace() and setprofile() 16843 16844socket: added socket methods setsockopt() and getsockopt(); and 16845fileno(), used by the new select module (see below) 16846 16847stdwin: added fileno() == connectionnumber(), in support of new module 16848select (see below) 16849 16850posix: added get{eg,eu,g,u}id(); waitpid() is now a separate function. 16851 16852gl: added qgetfd() 16853 16854fl: added several new functions, fixed several obscure bugs, adapted 16855to FORMS 2.1 16856 16857 16858Changes to standard modules 16859--------------------------- 16860 16861posixpath: changed implementation of ismount() 16862 16863string: atoi() no longer mistakes leading zero for octal number 16864 16865... 16866 16867 16868New built-in modules 16869-------------------- 16870 16871Modules marked "dynamic only" are not configured at compile time but 16872can be loaded dynamically. You need to turn on the DL or DLD option in 16873the Makefile for support dynamic loading of modules (this requires 16874external code). 16875 16876select: interfaces to the BSD select() system call 16877 16878dbm: interfaces to the (new) dbm library (dynamic only) 16879 16880nis: interfaces to some NIS functions (aka yellow pages) 16881 16882thread: limited form of multiple threads (sgi only) 16883 16884audioop: operations useful for audio programs, e.g. u-LAW and ADPCM 16885coding (dynamic only) 16886 16887cd: interface to Indigo SCSI CDROM player audio library (sgi only) 16888 16889jpeg: read files in JPEG format (dynamic only, sgi only; needs 16890external code) 16891 16892imgfile: read SGI image files (dynamic only, sgi only) 16893 16894sunaudiodev: interface to sun's /dev/audio (dynamic only, sun only) 16895 16896sv: interface to Indigo video library (sgi only) 16897 16898pc: a minimal set of MS-DOS interfaces (MS-DOS only) 16899 16900rotor: encryption, by Lance Ellinghouse (dynamic only) 16901 16902 16903New standard modules 16904-------------------- 16905 16906Not all these modules are documented. Read the source: 16907lib/<modulename>.py. Sometimes a file lib/<modulename>.doc contains 16908additional documentation. 16909 16910imghdr: recognizes image file headers 16911 16912sndhdr: recognizes sound file headers 16913 16914profile: print run-time statistics of Python code 16915 16916readcd, cdplayer: companion modules for built-in module cd (sgi only) 16917 16918emacs: interface to Emacs using py-connect.el (see below). 16919 16920SOCKET: symbolic constant definitions for socket options 16921 16922SUNAUDIODEV: symbolic constant definitions for sunaudiodef (sun only) 16923 16924SV: symbolic constant definitions for sv (sgi only) 16925 16926CD: symbolic constant definitions for cd (sgi only) 16927 16928 16929New demos 16930--------- 16931 16932scripts/pp.py: execute Python as a filter with a Perl-like command 16933line interface 16934 16935classes/: examples using the new class features 16936 16937threads/: examples using the new thread module 16938 16939sgi/cd/: examples using the new cd module 16940 16941 16942Changes to the documentation 16943---------------------------- 16944 16945The last-minute syntax changes of release 0.9.6 are now reflected 16946everywhere in the manuals 16947 16948The reference manual has a new section (3.2) on implementing new kinds 16949of numbers, sequences or mappings with user classes 16950 16951Classes are now treated extensively in the tutorial (chapter 9) 16952 16953Slightly restructured the system-dependent chapters of the library 16954manual 16955 16956The file misc/EXTENDING incorporates documentation for mkvalue() and 16957a new section on error handling 16958 16959The files misc/CLASSES and misc/ERRORS are no longer necessary 16960 16961The doc/Makefile now creates PostScript files automatically 16962 16963 16964Miscellaneous changes 16965--------------------- 16966 16967Incorporated Tim Peters' changes to python-mode.el, it's now version 169681.06 16969 16970A python/Emacs bridge (provided by Terrence M. Brannon) lets a Python 16971program running in an Emacs buffer execute Emacs lisp code. The 16972necessary Python code is in lib/emacs.py. The Emacs code is 16973misc/py-connect.el (it needs some external Emacs lisp code) 16974 16975 16976Changes to the source code that affect C extension writers 16977---------------------------------------------------------- 16978 16979New service function mkvalue() to construct a Python object from C 16980values according to a "format" string a la getargs() 16981 16982Most functions from pythonmain.c moved to new pythonrun.c which is 16983in libpython.a. This should make embedded versions of Python easier 16984 16985ceval.h is split in eval.h (which needs compile.h and only declares 16986eval_code) and ceval.h (which doesn't need compile.hand declares the 16987rest) 16988 16989ceval.h defines macros BGN_SAVE / END_SAVE for use with threads (to 16990improve the parallellism of multi-threaded programs by letting other 16991Python code run when a blocking system call or something similar is 16992made) 16993 16994In structmember.[ch], new member types BYTE, CHAR and unsigned 16995variants have been added 16996 16997New file xxmodule.c is a template for new extension modules. 16998 16999 17000================================== 17001==> Release 0.9.6 (6 Apr 1992) <== 17002================================== 17003 17004Misc news in 0.9.6: 17005- Restructured the misc subdirectory 17006- Reference manual completed, library manual much extended (with indexes!) 17007- the GNU Readline library is now distributed standard with Python 17008- the script "../demo/scripts/classfix.py" fixes Python modules using old 17009 class syntax 17010- Emacs python-mode.el (was python.el) vastly improved (thanks, Tim!) 17011- Because of the GNU copyleft business I am not using the GNU regular 17012 expression implementation but a free re-implementation by Tatu Ylonen 17013 that recently appeared in comp.sources.misc (Bravo, Tatu!) 17014 17015New features in 0.9.6: 17016- stricter try stmt syntax: cannot mix except and finally clauses on 1 try 17017- New module 'os' supplants modules 'mac' and 'posix' for most cases; 17018 module 'path' is replaced by 'os.path' 17019- os.path.split() return value differs from that of old path.split() 17020- sys.exc_type, sys.exc_value, sys.exc_traceback are set to the exception 17021 currently being handled 17022- sys.last_type, sys.last_value, sys.last_traceback remember last unhandled 17023 exception 17024- New function string.expandtabs() expands tabs in a string 17025- Added times() interface to posix (user & sys time of process & children) 17026- Added uname() interface to posix (returns OS type, hostname, etc.) 17027- New built-in function execfile() is like exec() but from a file 17028- Functions exec() and eval() are less picky about whitespace/newlines 17029- New built-in functions getattr() and setattr() access arbitrary attributes 17030- More generic argument handling in built-in functions (see "./EXTENDING") 17031- Dynamic loading of modules written in C or C++ (see "./DYNLOAD") 17032- Division and modulo for long and plain integers with negative operands 17033 have changed; a/b is now floor(float(a)/float(b)) and a%b is defined 17034 as a-(a/b)*b. So now the outcome of divmod(a,b) is the same as 17035 (a/b, a%b) for integers. For floats, % is also changed, but of course 17036 / is unchanged, and divmod(x,y) does not yield (x/y, x%y)... 17037- A function with explicit variable-length argument list can be declared 17038 like this: def f(*args): ...; or even like this: def f(a, b, *rest): ... 17039- Code tracing and profiling features have been added, and two source 17040 code debuggers are provided in the library (pdb.py, tty-oriented, 17041 and wdb, window-oriented); you can now step through Python programs! 17042 See sys.settrace() and sys.setprofile(), and "../lib/pdb.doc" 17043- '==' is now the only equality operator; "../demo/scripts/eqfix.py" is 17044 a script that fixes old Python modules 17045- Plain integer right shift now uses sign extension 17046- Long integer shift/mask operations now simulate 2's complement 17047 to give more useful results for negative operands 17048- Changed/added range checks for long/plain integer shifts 17049- Options found after "-c command" are now passed to the command in sys.argv 17050 (note subtle incompatibility with "python -c command -- -options"!) 17051- Module stdwin is better protected against touching objects after they've 17052 been closed; menus can now also be closed explicitly 17053- Stdwin now uses its own exception (stdwin.error) 17054 17055New features in 0.9.5 (released as Macintosh application only, 2 Jan 1992): 17056- dictionary objects can now be compared properly; e.g., {}=={} is true 17057- new exception SystemExit causes termination if not caught; 17058 it is raised by sys.exit() so that 'finally' clauses can clean up, 17059 and it may even be caught. It does work interactively! 17060- new module "regex" implements GNU Emacs style regular expressions; 17061 module "regexp" is rewritten in Python for backward compatibility 17062- formal parameter lists may contain trailing commas 17063 17064Bugs fixed in 0.9.6: 17065- assigning to or deleting a list item with a negative index dumped core 17066- divmod(-10L,5L) returned (-3L, 5L) instead of (-2L, 0L) 17067 17068Bugs fixed in 0.9.5: 17069- masking operations involving negative long integers gave wrong results 17070 17071 17072=================================== 17073==> Release 0.9.4 (24 Dec 1991) <== 17074=================================== 17075 17076- new function argument handling (see below) 17077- built-in apply(func, args) means func(args[0], args[1], ...) 17078- new, more refined exceptions 17079- new exception string values (NameError = 'NameError' etc.) 17080- better checking for math exceptions 17081- for sequences (string/tuple/list), x[-i] is now equivalent to x[len(x)-i] 17082- fixed list assignment bug: "a[1:1] = a" now works correctly 17083- new class syntax, without extraneous parentheses 17084- new 'global' statement to assign global variables from within a function 17085 17086 17087New class syntax 17088---------------- 17089 17090You can now declare a base class as follows: 17091 17092 class B: # Was: class B(): 17093 def some_method(self): ... 17094 ... 17095 17096and a derived class thusly: 17097 17098 class D(B): # Was: class D() = B(): 17099 def another_method(self, arg): ... 17100 17101Multiple inheritance looks like this: 17102 17103 class M(B, D): # Was: class M() = B(), D(): 17104 def this_or_that_method(self, arg): ... 17105 17106The old syntax is still accepted by Python 0.9.4, but will disappear 17107in Python 1.0 (to be posted to comp.sources). 17108 17109 17110New 'global' statement 17111---------------------- 17112 17113Every now and then you have a global variable in a module that you 17114want to change from within a function in that module -- say, a count 17115of calls to a function, or an option flag, etc. Until now this was 17116not directly possible. While several kludges are known that 17117circumvent the problem, and often the need for a global variable can 17118be avoided by rewriting the module as a class, this does not always 17119lead to clearer code. 17120 17121The 'global' statement solves this dilemma. Its occurrence in a 17122function body means that, for the duration of that function, the 17123names listed there refer to global variables. For instance: 17124 17125 total = 0.0 17126 count = 0 17127 17128 def add_to_total(amount): 17129 global total, count 17130 total = total + amount 17131 count = count + 1 17132 17133'global' must be repeated in each function where it is needed. The 17134names listed in a 'global' statement must not be used in the function 17135before the statement is reached. 17136 17137Remember that you don't need to use 'global' if you only want to *use* 17138a global variable in a function; nor do you need ot for assignments to 17139parts of global variables (e.g., list or dictionary items or 17140attributes of class instances). This has not changed; in fact 17141assignment to part of a global variable was the standard workaround. 17142 17143 17144New exceptions 17145-------------- 17146 17147Several new exceptions have been defined, to distinguish more clearly 17148between different types of errors. 17149 17150name meaning was 17151 17152AttributeError reference to non-existing attribute NameError 17153IOError unexpected I/O error RuntimeError 17154ImportError import of non-existing module or name NameError 17155IndexError invalid string, tuple or list index RuntimeError 17156KeyError key not in dictionary RuntimeError 17157OverflowError numeric overflow RuntimeError 17158SyntaxError invalid syntax RuntimeError 17159ValueError invalid argument value RuntimeError 17160ZeroDivisionError division by zero RuntimeError 17161 17162The string value of each exception is now its name -- this makes it 17163easier to experimentally find out which operations raise which 17164exceptions; e.g.: 17165 17166 >>> KeyboardInterrupt 17167 'KeyboardInterrupt' 17168 >>> 17169 17170 17171New argument passing semantics 17172------------------------------ 17173 17174Off-line discussions with Steve Majewski and Daniel LaLiberte have 17175convinced me that Python's parameter mechanism could be changed in a 17176way that made both of them happy (I hope), kept me happy, fixed a 17177number of outstanding problems, and, given some backward compatibility 17178provisions, would only break a very small amount of existing code -- 17179probably all mine anyway. In fact I suspect that most Python users 17180will hardly notice the difference. And yet it has cost me at least 17181one sleepless night to decide to make the change... 17182 17183Philosophically, the change is quite radical (to me, anyway): a 17184function is no longer called with either zero or one argument, which 17185is a tuple if there appear to be more arguments. Every function now 17186has an argument list containing 0, 1 or more arguments. This list is 17187always implemented as a tuple, and it is a (run-time) error if a 17188function is called with a different number of arguments than expected. 17189 17190What's the difference? you may ask. The answer is, very little unless 17191you want to write variadic functions -- functions that may be called 17192with a variable number of arguments. Formerly, you could write a 17193function that accepted one or more arguments with little trouble, but 17194writing a function that could be called with either 0 or 1 argument 17195(or more) was next to impossible. This is now a piece of cake: you 17196can simply declare an argument that receives the entire argument 17197tuple, and check its length -- it will be of size 0 if there are no 17198arguments. 17199 17200Another anomaly of the old system was the way multi-argument methods 17201(in classes) had to be declared, e.g.: 17202 17203 class Point(): 17204 def init(self, (x, y, color)): ... 17205 def setcolor(self, color): ... 17206 dev moveto(self, (x, y)): ... 17207 def draw(self): ... 17208 17209Using the new scheme there is no need to enclose the method arguments 17210in an extra set of parentheses, so the above class could become: 17211 17212 class Point: 17213 def init(self, x, y, color): ... 17214 def setcolor(self, color): ... 17215 dev moveto(self, x, y): ... 17216 def draw(self): ... 17217 17218That is, the equivalence rule between methods and functions has 17219changed so that now p.moveto(x,y) is equivalent to Point.moveto(p,x,y) 17220while formerly it was equivalent to Point.moveto(p,(x,y)). 17221 17222A special backward compatibility rule makes that the old version also 17223still works: whenever a function with exactly two arguments (at the top 17224level) is called with more than two arguments, the second and further 17225arguments are packed into a tuple and passed as the second argument. 17226This rule is invoked independently of whether the function is actually a 17227method, so there is a slight chance that some erroneous calls of 17228functions expecting two arguments with more than that number of 17229arguments go undetected at first -- when the function tries to use the 17230second argument it may find it is a tuple instead of what was expected. 17231Note that this rule will be removed from future versions of the 17232language; it is a backward compatibility provision *only*. 17233 17234Two other rules and a new built-in function handle conversion between 17235tuples and argument lists: 17236 17237Rule (a): when a function with more than one argument is called with a 17238single argument that is a tuple of the right size, the tuple's items 17239are used as arguments. 17240 17241Rule (b): when a function with exactly one argument receives no 17242arguments or more than one, that one argument will receive a tuple 17243containing the arguments (the tuple will be empty if there were no 17244arguments). 17245 17246 17247A new built-in function, apply(), was added to support functions that 17248need to call other functions with a constructed argument list. The call 17249 17250 apply(function, tuple) 17251 17252is equivalent to 17253 17254 function(tuple[0], tuple[1], ..., tuple[len(tuple)-1]) 17255 17256 17257While no new argument syntax was added in this phase, it would now be 17258quite sensible to add explicit syntax to Python for default argument 17259values (as in C++ or Modula-3), or a "rest" argument to receive the 17260remaining arguments of a variable-length argument list. 17261 17262 17263======================================================== 17264==> Release 0.9.3 (never made available outside CWI) <== 17265======================================================== 17266 17267- string sys.version shows current version (also printed on interactive entry) 17268- more detailed exceptions, e.g., IOError, ZeroDivisionError, etc. 17269- 'global' statement to declare module-global variables assigned in functions. 17270- new class declaration syntax: class C(Base1, Base2, ...): suite 17271 (the old syntax is still accepted -- be sure to convert your classes now!) 17272- C shifting and masking operators: << >> ~ & ^ | (for ints and longs). 17273- C comparison operators: == != (the old = and <> remain valid). 17274- floating point numbers may now start with a period (e.g., .14). 17275- definition of integer division tightened (always truncates towards zero). 17276- new builtins hex(x), oct(x) return hex/octal string from (long) integer. 17277- new list method l.count(x) returns the number of occurrences of x in l. 17278- new SGI module: al (Indigo and 4D/35 audio library). 17279- the FORMS interface (modules fl and FL) now uses FORMS 2.0 17280- module gl: added lrect{read,write}, rectzoom and pixmode; 17281 added (non-GL) functions (un)packrect. 17282- new socket method: s.allowbroadcast(flag). 17283- many objects support __dict__, __methods__ or __members__. 17284- dir() lists anything that has __dict__. 17285- class attributes are no longer read-only. 17286- classes support __bases__, instances support __class__ (and __dict__). 17287- divmod() now also works for floats. 17288- fixed obscure bug in eval('1 '). 17289 17290 17291=================================== 17292==> Release 0.9.2 (Autumn 1991) <== 17293=================================== 17294 17295Highlights 17296---------- 17297 17298- tutorial now (almost) complete; library reference reorganized 17299- new syntax: continue statement; semicolons; dictionary constructors; 17300 restrictions on blank lines in source files removed 17301- dramatically improved module load time through precompiled modules 17302- arbitrary precision integers: compute 2 to the power 1000 and more... 17303- arithmetic operators now accept mixed type operands, e.g., 3.14/4 17304- more operations on list: remove, index, reverse; repetition 17305- improved/new file operations: readlines, seek, tell, flush, ... 17306- process management added to the posix module: fork/exec/wait/kill etc. 17307- BSD socket operations (with example servers and clients!) 17308- many new STDWIN features (color, fonts, polygons, ...) 17309- new SGI modules: font manager and FORMS library interface 17310 17311 17312Extended list of changes in 0.9.2 17313--------------------------------- 17314 17315Here is a summary of the most important user-visible changes in 0.9.2, 17316in somewhat arbitrary order. Changes in later versions are listed in 17317the "highlights" section above. 17318 17319 173201. Changes to the interpreter proper 17321 17322- Simple statements can now be separated by semicolons. 17323 If you write "if t: s1; s2", both s1 and s2 are executed 17324 conditionally. 17325- The 'continue' statement was added, with semantics as in C. 17326- Dictionary displays are now allowed on input: {key: value, ...}. 17327- Blank lines and lines bearing only a comment no longer need to 17328 be indented properly. (A completely empty line still ends a multi- 17329 line statement interactively.) 17330- Mixed arithmetic is supported, 1 compares equal to 1.0, etc. 17331- Option "-c command" to execute statements from the command line 17332- Compiled versions of modules are cached in ".pyc" files, giving a 17333 dramatic improvement of start-up time 17334- Other, smaller speed improvements, e.g., extracting characters from 17335 strings, looking up single-character keys, and looking up global 17336 variables 17337- Interrupting a print operation raises KeyboardInterrupt instead of 17338 only cancelling the print operation 17339- Fixed various portability problems (it now passes gcc with only 17340 warnings -- more Standard C compatibility will be provided in later 17341 versions) 17342- Source is prepared for porting to MS-DOS 17343- Numeric constants are now checked for overflow (this requires 17344 standard-conforming strtol() and strtod() functions; a correct 17345 strtol() implementation is provided, but the strtod() provided 17346 relies on atof() for everything, including error checking 17347 17348 173492. Changes to the built-in types, functions and modules 17350 17351- New module socket: interface to BSD socket primitives 17352- New modules pwd and grp: access the UNIX password and group databases 17353- (SGI only:) New module "fm" interfaces to the SGI IRIX Font Manager 17354- (SGI only:) New module "fl" interfaces to Mark Overmars' FORMS library 17355- New numeric type: long integer, for unlimited precision 17356 - integer constants suffixed with 'L' or 'l' are long integers 17357 - new built-in function long(x) converts int or float to long 17358 - int() and float() now also convert from long integers 17359- New built-in function: 17360 - pow(x, y) returns x to the power y 17361- New operation and methods for lists: 17362 - l*n returns a new list consisting of n concatenated copies of l 17363 - l.remove(x) removes the first occurrence of the value x from l 17364 - l.index(x) returns the index of the first occurrence of x in l 17365 - l.reverse() reverses l in place 17366- New operation for tuples: 17367 - t*n returns a tuple consisting of n concatenated copies of t 17368- Improved file handling: 17369 - f.readline() no longer restricts the line length, is faster, 17370 and isn't confused by null bytes; same for raw_input() 17371 - f.read() without arguments reads the entire (rest of the) file 17372 - mixing of print and sys.stdout.write() has different effect 17373- New methods for files: 17374 - f.readlines() returns a list containing the lines of the file, 17375 as read with f.readline() 17376 - f.flush(), f.tell(), f.seek() call their stdio counterparts 17377 - f.isatty() tests for "tty-ness" 17378- New posix functions: 17379 - _exit(), exec(), fork(), getpid(), getppid(), kill(), wait() 17380 - popen() returns a file object connected to a pipe 17381 - utime() replaces utimes() (the latter is not a POSIX name) 17382- New stdwin features, including: 17383 - font handling 17384 - color drawing 17385 - scroll bars made optional 17386 - polygons 17387 - filled and xor shapes 17388 - text editing objects now have a 'settext' method 17389 17390 173913. Changes to the standard library 17392 17393- Name change: the functions path.cat and macpath.cat are now called 17394 path.join and macpath.join 17395- Added new modules: formatter, mutex, persist, sched, mainloop 17396- Added some modules and functionality to the "widget set" (which is 17397 still under development, so please bear with me): 17398 DirList, FormSplit, TextEdit, WindowSched 17399- Fixed module testall to work non-interactively 17400- Module string: 17401 - added functions join() and joinfields() 17402 - fixed center() to work correct and make it "transitive" 17403- Obsolete modules were removed: util, minmax 17404- Some modules were moved to the demo directory 17405 17406 174074. Changes to the demonstration programs 17408 17409- Added new useful scipts: byteyears, eptags, fact, from, lfact, 17410 objgraph, pdeps, pi, primes, ptags, which 17411- Added a bunch of socket demos 17412- Doubled the speed of ptags 17413- Added new stdwin demos: microedit, miniedit 17414- Added a windowing interface to the Python interpreter: python (most 17415 useful on the Mac) 17416- Added a browser for Emacs info files: demo/stdwin/ibrowse 17417 (yes, I plan to put all STDWIN and Python documentation in texinfo 17418 form in the future) 17419 17420 174215. Other changes to the distribution 17422 17423- An Emacs Lisp file "python.el" is provided to facilitate editing 17424 Python programs in GNU Emacs (slightly improved since posted to 17425 gnu.emacs.sources) 17426- Some info on writing an extension in C is provided 17427- Some info on building Python on non-UNIX platforms is provided 17428 17429 17430===================================== 17431==> Release 0.9.1 (February 1991) <== 17432===================================== 17433 17434- Micro changes only 17435- Added file "patchlevel.h" 17436 17437 17438===================================== 17439==> Release 0.9.0 (February 1991) <== 17440===================================== 17441 17442Original posting to alt.sources. 17443