blob: d4cc9e9f340177faf000b3015771649c4c48a2db [file] [log] [blame]
Guido van Rossumf0b69f01997-08-15 02:50:47 +00001
2
3
4New since 1.5a2
5---------------
6
7The following items are only relevant if you previously used Python
81.5a2:
9
10- The strftime test should now succeed on Windows and Mac platforms,
11too. It still fails on some Linux platforms; I believe that this is a
12problem in the C library on those platforms.
13
14
15
16What's new in this release?
17---------------------------
18
19I haven't kept track closely, so here are just a few highlights. For
20the final release, I will go through all my RCS logs and distill a
21complete list. Note that the biggest unfinished project is
22documentation.
23
24XXX To be expanded:
25
26- Tools/webchecker
27
28- Lee Busby's SIGFPE mods and modules fpectl, fpetest
29
30- formatter.*Writer.flush
31
32- dis.{cmp_op, hascompare}
33
34- ftplib: FTP.ntransfercmd, Netrc, parse150
35
36- httplib.HTTP_VERSIONS_ACCEPTED
37
38- new module keyword
39
40- imghdr recognizes bmp, png
41
42- mhlib, parsesequence improved
43
44- mimify base64 support
45
46- new.function revived
47
48- popen2.popen3 added
49
50- new module pprint
51
52- cgi.FieldStorage: __len__ added
53
54New exceptions:
55 FloatingPointError
56Deleted exception:
57 ConflictError
58
59> audioop.ratecv
60
61> posix.O_APPEND
62> posix.O_CREAT
63> posix.O_DSYNC
64> posix.O_EXCL
65> posix.O_NDELAY
66> posix.O_NOCTTY
67> posix.O_NONBLOCK
68> posix.O_RDONLY
69> posix.O_RDWR
70> posix.O_RSYNC
71> posix.O_SYNC
72> posix.O_TRUNC
73> posix.O_WRONLY
74 posix.O_TEXT
75 posix.O_BINARY
76(also in os, of course)
77
78> regex.get_syntax
79
80> socket.getprotobyname
81
82> strop.replace
83Also string.replace
84
85- Jack's buffer interface!
86 - supported by regex module!
87
88- improved dir() semantics
89
90- posix.error, nt.error renamed to os.error
91
92- rfc822 getdate_tz and parsedate_tz
93
94- shelve.*.sync
95
96- shutil improved interface
97
98- socket.getprotobynameo
99
100- _xdrmodule is gone (in favor of structmodule)
101
102- xdrlib.Unpacker.get_buffer
103
104- much improved structmodule
105
106- Tkinter upgraded (as always)
107
108- new al module for SGI
109
110- file object readinto methods
111
112- tktrace???
113
114Obsolete: cgensupport.[ch] are now in Modules and only linked with glmodule.c.
115
116- much faster file.read() and readlines() on windows
117
118======================================================================
119
120- PyObject_Compare() can now raise an exception. Check with
121PyErr_Occurred(). The comparison function in an object type may also
122raise an exception.
123
124- The slice interface uses an upper bound of INT_MAX when no explicit
125upper bound is given (e.x. for a[1:]). It used to ask the object for
126its length and do the calculations.
127
128- I've completed the Grand Renaming, with the help of Roger Masse and
129Barry Warsaw. Many other unrelated code reorganizations have also
130been carried out.
131
132- As far as I can tell, neither gcc -Wall nor the Microsoft compiler
133emits a single warning any more when compiling Python.
134
135- It's much faster (almost twice for pystone.py -- see Tools/scripts.)
136
137- Unless I hear a lot of protest, private variables with leading
138double underscore are now a permanent feature of the language. I
139can't label them "experimental" forever.
140
141- New extension modules cStringIO.c and cPickle.c, written by Jim
142Fulton and other folks at Digital Creations. These are much more
143efficient than their Python counterparts StringIO.py and pickle.py,
144but don't support subclassing. cPickle.c clocks up to 1000 times
145faster than pickle.py. The pickle.py module has been updated to make
146it compatible with the new binary format that cPickle.c produces (by
147default it produces the old all-ASCII format compatible with the old
148pickle.py, still much faster than pickle.py; it can read both
149formats). A new helper module, copy_reg.py, is provided to register
150extensions to the pickling code. (These are now identical to the
151release 0.3 from Digital Creations.)
152
153- New (still experimental) Perl-style regular expression module,
154re.py, which uses a new interface for matching as well as a new
155syntax; the new interface avoids the thread-unsafety of the regex
156interface. This comes with a helper extension reopmodule.c and vastly
157rewritten regexpr.c. Most work on this was done by Jeffrey Ollie, Tim
158Peters, and Andrew Kuchling. See the documentation libre.tex. In
1591.5, the old regex module is still fully supported; in the future, it
160will become obsolete.
161
162- New string literal syntax for "raw strings". Prefixing a string
163literal with the letter r (or R) disables all escape processing in the
164string; for example, r'\n' is a two-character string consisting of a
165backslash followed by the letter n. This combines with all forms of
166string quotes. An embedded quote prefixed with a backslash does not
167terminate the string, but the backslash is still included in the
168string; for example, r'\'' is a two-character string consisting of a
169backslash and a quote. Raw strings are also affectionately known as
170Robin strings, after their inventor, Robin Friedrich.
171
172- New project files for Developer Studio (Visual C++) 5.0 for Windows
173NT (the old VC++ 4.2 Makefile is also still supported, but will
174eventually be withdrawn due to its bulkiness).
175
176- New extension module zlibmodule.c, interfacing to the free zlib
177library (gzip compatible compression). There's also a module gzip.py
178which provides a higher level interface. Written by Andrew Kuchling
179and Jeremy Hylton.
180
181- New tool: faqwiz -- the CGI script that is used to maintain the
182Python FAQ (http://grail.cnri.reston.va.us/cgi-bin/faqw.py). In
183Tools/faqwiz.
184
185- New tool: webchecker -- a simple extensible web robot that, when
186aimed at a web server, checks that server for dead links. Available
187are a command line utility as well as a Tkinter based GUI version. In
188Tools/webchecker. A simplified version of this program is dissected
189in my article in O'Reilly's WWW Journal, the issue on Scripting
190Languages (Vol 2, No 2); Scripting the Web with Python (pp 97-120).
191Includes a parser for robots.txt files by Skip Montanaro.
192
193- New small tools: cvsfiles.py (prints a list of all files under CVS
194in a particular directory tree), treesync.py (a rather Guido-specific
195script to synchronize two source trees, one on Windows NT, the other
196one on Unix under CVS but accessible from the NT box), and logmerge.py
197(sort a collection of RCS or CVS logs by date). In Tools/scripts.
198
199- The freeze script now also works under Windows (NT). Another
200feature allows the -p option to be pointed at the Python source tree
201instead of the installation prefix. This was loosely based on part of
202xfreeze by Sam Rushing and Bill Tutt.
203
204- A new regression test suite is provided, which tests most of the
205standard and built-in modules. The regression test is run by invoking
206the script Lib/test/regrtest.py. Barry Warsaw wrote the test harnass;
207he and Roger Masse contributed most of the new tests.
208
209- New standard dialog modules for Tkinter: tkColorChooser.py,
210tkCommonDialog.py, tkMessageBox.py, tkFileDialog.py, tkSimpleDialog.py
211These interface with the new Tk dialog scripts. Contributed by
212Fredrik Lundh.
213
214- Tkinter.py: when the first Tk object is destroyed, it sets the
215hiddel global _default_root to None, so that when another Tk object is
216created it becomes the new default root. Other miscellaneous
217changes and fixes.
218
219- Many new pieces of library documentation were contributed, mostly by
220Andrew Kuchling. Even cmath is now documented! There's also a
221chapter of the library manual, "libundoc.tex", which provides a
222listing of all undocumented modules, plus their status (e.g. internal,
223obsolete, or in need of documentation). Also contributions by Sue
224Williams, Skip Montanaro, and some module authors who succumbed to
225pressure to document their own contributed modules :-). Note that
226printing the documentation now kills fewer trees -- the margins have
227been reduced.
228
229- I have started documenting the Python/C API. Unfortunately this
230project hasn't been completed yet. It will be complete before the
231final release of Python 1.5, though.
232
233- The mimify.py module now has documentation, and includes functions
234to handle the funny encoding you sometimes see in mail headers.
235
236- The default module search path is now much saner. Both on Unix and
237Windows, it is essentially derived from the path to the executable
238($PYTHONHOME can be used to override). The value of $PYTHONPATH on
239Windows is now inserted in front of the default path, like in Unix
240(instead of overriding the default path).
241
242- Support for Win32S (the 32-bit Windows API under Windows 3.1) is
243basically withdrawn. If it works for you, you're lucky.
244
245- On Win32 platforms (Windows NT and 95), there's a new extension
246module, msvcrt.c, which provides various low-level operations defined
247in the Microsoft Visual C++ Runtime Library. These include locking(),
248setmode(), get_osfhandle(), set_osfhandle(), and console I/O functions
249like kbhit(), getch() and putch().
250
251- The way GNU readline is configured is totally different. The
252--with-readline configure option is gone. It is now an extension
253module, which may be loaded dynamically. You must enable it (and
254specify the correct linraries to link with) in the Modules/Setup file.
255Importing the module installs some hooks which enable command line
256editing. When the interpreter shell is invoked interactively, it
257attempts to import the readline module; when this fails, the default
258input mechanism is used. The hook variables are PyOS_InputHook and
259PyOS_ReadlineFunctionPointer. (Code contributed by Lee Busby, with
260ideas from William Magro.)
261
262- New Unix extension module resource.c, by Jeremy Hylton, provides
263access to getrlimit(), getrusage(), setrusage(), getpagesize(), and
264related symbolic constants.
265
266- Support for multiple independent interpreters. See Doc/api.tex,
267functions Py_NewInterpreter() and Py_EndInterpreter(). Since the
268documentation is incomplete, also see the new Demo/pysvr example
269(which shows how to use these in a threaded application) and the
270source code.
271
272- There is now a Py_Finalize() function which "de-initializes"
273Python. It is possible to completely restart the interpreter
274repeatedly by calling Py_Finalize() followed by Py_Initialize(). A
275change of functionality in Py_Initialize() means that it is now a
276fatal error to call it while the interpreter is already initialized.
277The old, half-hearted Py_Cleanup() routine is gone. Use of Py_Exit()
278is deprecated (it is nothing more than Py_Finalize() followed by
279exit()).
280
281- There are no known memory leaks. While Py_Finalize() doesn't free
282*all* allocated memory (some of it is hard to track down), repeated
283calls to Py_Finalize() and Py_Initialize() do not create unaccessible
284heap blocks.
285
286- New function sys.exc_info() returns the tuple (sys.exc_type,
287sys.exc_value, sys.exc_traceback) in a thread-safe way.
288
289- The semantics of try-except have changed subtly so that calling a
290function in an exception handler that itself raises and catches an
291exception no longer overwrites the sys.exc_* variables. This also
292alleviates the problem that objects referenced in a stack frame that
293caught an exception are kept alive until another exception is caught
294-- the sys.exc_* variables are restored to their previous value when
295returning from a function that caught an exception.
296
297- There is now explicit per-thread state. (Inspired by, but not the
298same as, Greg Stein's free threading patches.)
299
300- There is now better support for threading C applications. There are
301now explicit APIs to manipulate the interpreter lock. Read the source
302or the Demo/pysvr example; the new functions are
303PyEval_{Acquire,Release}{Lock,Thread}().
304
305- New wrappers around malloc() and friends: Py_Malloc() etc. call
306malloc() and call PyErr_NoMemory() when it fails; PyMem_Malloc() call
307just malloc(). Use of these wrappers could be essential if multiple
308memory allocators exist (e.g. when using certain DLL setups under
309Windows). (Idea by Jim Fulton.)
310
311- Numerous source cleanups.
312
313- There's a simple assert statement, and a new exception
314AssertionError, and a built-in variable __debug__. For example,
315``assert foo > 0'' is equivalent to ``if __debug__ and not foo > 0:
316raise AssertionError''. Sorry, the text of the asserted condition is
317not available; it would be too generate code for this. However, the
318text is displayed as part of the traceback! There's also a -O option
319to the interpreter that squeezes SET_LINENO instructions, assert
320statements and ``if __debug__'' code; it uses and produces .pyo files
321instead of .pyc files. In the future it should be possible to write
322external bytecode optimizers that create better optimized .pyo files.
323
324- New build procedure: a single library, libpython1.5.a, is now built,
325which contains absolutely everything except for a one-line main()
326program (which calls Py_Main(argc, argv) to start the interpreter
327shell). This makes life much simpler for applications that need to
328embed Python. The serial number of the build is now included in the
329version string (sys.version).
330
331- New module keyword.py exports knowledge about Python's built-in
332keywords. (New version by Ka-Ping Yee.)
333
334- New examples (Demo/extend) that show how to use the generic
335extension makefile (Misc/Makefile.pre.in).
336
337- New module pprint.py (with documentation) which supports
338pretty-printing of lists, tuples, & dictionaries recursively. By Fred
339Drake.
340
341- New module code.py. The function code.compile_command() can
342determine whether an interactively entered command is complete or not,
343distinguishing incomplete from invalid input.
344
345- Module codehack.py is now completely obsolete.
346
347- Revamped module tokenize.py is much more accurate and has an
348interface that makes it a breeze to write code to colorize Python
349source code. Contributed by Ka-Ping Yee.
350
351- As always, the Macintosh port was done by Jack Jansen. See his
352separate announcement for the Mac specific source code and the binary
353distribution(s).
354
355- A set of patches from Lee Busby has been integrated that make it
356possible to catch floating point exceptions. Use the configure option
357--with-fpectl to enable the patches; the extension modules fpectl and
358fpetest provide control to enable/disable and test the feature,
359respectively.
360
361- New extension puremodule.c, by Barry Warsaw, which interfaces to the
362Purify(TM) C API. See also the file Misc/PURIFY.README. It is also
363possible to enable Purify by simply setting the PURIFY Makefile
364variable in the Modules/Setup file.
365
366- The struct extension module has several new features to control byte
367order and word size. It supports reading and writing IEEE floats even
368on platforms where this is not the native format.
369
370- There is now a library module xdr.py which can read and write the
371XDR data format as used by Sun RPC, for example. It uses the struct
372module.
373
374- Tools/scripts/h2py.py now supports C++ comments.
375
376- The pystone.py script is upgraded to version 1.1; there was a bug in
377version 1.0 (distributed with Python 1.4) that leaked memory. Also,
378in 1.1, the LOOPS variable is incremented to 10000.
379
380- New C API PyImport_Import() which uses whatever __import__() hook
381that is installed for the current execution environment. By Jim
382Fulton.
383
384- The _tkinter.c extension module has been revamped. It now support
385Tk versions 4.1 through 8.0; support for 4.0 has been dropped. It
386works well under Windows and Mac (with the latest Tk ports to those
387platforms). It also supports threading -- it is safe for one
388(Python-created) thread to be blocked in _tkinter.mainloop() while
389other threads modify widgets. (To make the changes visible, those
390threads must use update_idletasks()method.) Unfortunately, on Windows
391and Mac, Tk 8.0 no longer supports CreateFileHandler, so
392_tkinter.createfilehandler is not available on those platforms. I
393will have to rethink how to interface with Tcl's lower-level event
394mechanism, or with its channels (which are like Python's file-like
395objects).
396
397- New "buffer" interface. Certain objects (e.g. strings, arrays) now
398support the "buffer" protocol. Buffer objects are acceptable whenever
399formerly a string was required for a write operation; mutable buffer
400objects can be the target of a read operation using the
401f.readinto(buffer). Contribution bty Jack Jansen. (Needs
402documentation.)
403
404- In ihooks.py, ModuleLoader.load_module() now closes the file under
405all circumstances.
406
407- The tempfile.py module has a new class, TemporaryFile, which creates
408an open temporary file that will be deleted automatically when
409closed. This works on Windows and MacOS as well as on Unix. (Jim
410Fulton.)
411
412- Changes to the cgi.py module: Most imports are now done at the
413top of the module, which provides a speedup when using ni (Jim
414Fulton). The problem with file upload to a Windows platform is solved
415by using the new tempfile.TemporaryFile class; temporary files are now
416always opened in binary mode (Jim Fulton). The cgi.escape() function
417now takes an optional flag argument that quotes '"' to '"'. It
418is now possible to invoke cgi.py from a command line script, to test
419cgi scripts more easily outside an http server. There's an optional
420limit to the size of uploads to POST (Skip Montanaro). Added a
421'strict_parsing' option to all parsing functions (Jim Fulton). The
422function parse_qs() now uses urllib.unquote() on the name as well as
423the value of fields (Clarence Gardner).
424
425- String interning: dictionary lookups are faster when the lookup
426string object is the same object as the key in the dictionary, not
427just a string with the same value. This is done by having a pool of
428"interned" strings. Most names generated by the interpreter are now
429automatically interned, and there's a new built-in function intern(s)
430that returns the interned version of a string. Interned strings are
431not a different object type, and interning is totally optional, but by
432interning most keys a speedup of about 15% was obtained for the
433pystone benchmark.
434
435- httplib.py: the socket object is no longer closed; all HTTP/1.*
436versions are now treated the same; and it is now thread-safe (by not
437using the regex module).
438
439- BaseHTTPModule.py: treat all HTTP/1.* versions the same.
440
441- The popen2.py module is now rewritten using a class, which makes
442access to the standard error stream and the process id of the
443subprocess possible.
444
445- The support for shared libraries under AIX is now simpler and more
446robust. Thanks to Vladimir Marangozov for revamping his own patches!
447
448- When a module is deleted, its globals are now deleted in two phases.
449In the first phase, all variables whose name begins with exactly one
450underscore are replaced by None; in the second phase, all variables
451are deleted. This makes it possible to have global objects whose
452destructors depend on other globals. The deletion order within each
453phase is still random.
454
455- The Modules/makesetup script now reads a file Setup.local as well as
456a file Setup. Most changes to the Setup script can be done by editing
457Setup.local instead, which makes it easier to carry a particular setup
458over from one release to the next.
459
460- It is no longer an error for a function to be called without a
461global variable __builtins__ -- an empty directory will be provided
462by default.
463
464- Some speedup by using separate free lists for method objects (both
465the C and the Python variety) and for floating point numbers.
466
467- Big speedup by allocating frame objects with a single malloc() call.
468The Python/C API for frames is changed (you shouldn't be using this
469anyway).
470
471- It is now possible for an extension module's init function to fail
472non-fatally, by calling one of the PyErr_* functions and returning.
473
474- The PyInt_AS_LONG() and PyFloat_AS_DOUBLE() macros now cast their
475argument to the proper type, like the similar PyString macros already
476did. (Suggestion by Marc-Andre Lemburg.)
477
478- The fcntl extension module now exports the needed symbolic
479constants. (Formerly these were in FCNTL.py which was not available
480or correct for all platforms.)
481
482- Guido's corollary of the Don Beaudry hack: it is now possible to do
483metaprogramming by using an instance as a base class. Not for the
484faint of heart; and undocumented as yet, but basically if a base class
485is an instance, its class will be instantiated to create the new
486class. Jim Fulton will love it -- it also works with instances of his
487"extension classes", since it is triggered by the presence of a
488__class__ attribute on the purported base class.
489
490- Plugged the two-byte memory leak in the tokenizer when reading an
491interactive EOF.
492
493- Added timezone support to the rfc822.py module; also added
494recognition of some non-standard date formats, by Lars Wirzenius.
495
496- mhlib.py: various enhancements, including almost compatible parsing
497of message sequence specifiers without invoking a subprocess. Also
498added a createmessage() method by Lars Wirzenius.
499
500- The StringIO.StringIO class now supports readline(nbytes). (Lars
501Wirzenius.)
502
503- Dictionary objects have several new methods; clear() and copy() have
504the obvious semantics, while update(d) merges the contents of another
505dictionary d into this one, overriding existing keys. BTW, the
506dictionary implementation file is now called dictobject.c rather than
507the confusing mappingobject.c.
508
509- UserDict.py supports the new dictionary methods as well.
510
511- The intrinsic function dir() is much smarter; it looks in __dict__,
512__members__ and __methods__.
513
514- The silly -s command line option and the corresponding
515PYTHONSUPPRESS environment variable and the Py_SuppressPrint global
516flag are gone.
517
518- On Windows, -u not only sets the standard I/O streams to unbuffered
519status, but also sets them in binary mode.
520
521- Some of the Py_Get* function, like Py_GetVersion() (but not yet
522Py_GetPath()) are now declared as returning a const char *. (More
523should follow.)
524
525- Speedup by inlining some common opcodes for common operand types
526(e.g. i+i, i-i, and list[i]). Fredrik Lundh.
527
528- The extension modules dbm, gdbm and bsddb now check that the
529database is still open before making any new calls.
530
531- Various small fixes to the nntplib.py module that I can't bother to
532document in detail.
533
534- There is a cache for results in urlparse.urlparse(); its size limit
535is set to 20 (not 2000 as it was in earlier alphas).
536
537- Small speedup by reordering the method tables of some common
538objects (e.g. list.append is now first).
539
540- The modules base64.py, uu.py and quopri.py can now be used as simple
541command line utilities.
542
543- The binascii extension module is now hopefully fully debugged. (XXX
544Oops -- Fredril Lundh promised me a fix that I never received.)
545
546- The mimetools.py module now uses the available Python modules for
547decoding quoted-printable, uuencode and base64 formats, rather than
548creating a subprocess.
549
550- The python debugger (pdb.py, and its base class bdb.py) now support
551conditional breakpoints. See the docs.
552
553- The configure script now detects whether malloc(0) returns a NULL
554pointer or a valid block (of length zero). This avoids the nonsense
555of always adding one byte to all malloc() arguments on most platforms.
556
557- Improvements for whrandom.py by Tim Peters: use 32-bit arithmetic to
558speed it up, and replace 0 seed values by 1 to avoid degeneration.
559
560- Fix a bug where multiple anonymous tuple arguments would be mixed up
561when using the debugger or profiler (reported by Just van Rossum).
562The simplest example is ``def f((a,b),(c,d)): print a,b,c,d''; this
563would print the wrong value when run under the debugger or profiler.
564
565- Module ftplib.py: added support for parsing a .netrc file. Fred
566Drake.
567
568- urllib.py: the ftp cache is now limited to 10 entries. Added
569quote_plus() method which is like qupte() but also replaces spaces
570with '+', for encoding CGI form arguments. Catch all errors from the
571ftp module. HTTP requests now add the Host: header line. The proxy
572variable names are now mapped to lower case, for Windows.
573
574- The posix module (and hence os.py!) now has doc strings! Thanks to
575Neil Schemenauer.
576
577- shelve.py: use cPickle and cStringIO when available.
578
579- Various modules now export their type object: socket.SocketType,
580array.ArrayType.
581
582- ntpath.py supports ~ to $HOME expansion in expanduser().
583
584- The pthread support now works on most platforms.
585
586- New variable sys.executable points to the executable file for the
587Python interpreter, if known.
588
589- On Windows, sys.prefix and sys.exec_prefix point to the directory
590where Python is installed, or to the top of the source tree, if it was
591run from there.
592
593- The sort() methods for lists no longer uses the C library qsort(); I
594wrote my own quicksort implementation, with help from Tim Peters.
595This solves a bug in dictionary comparisons on some Solaris versions
596when Python is built with threads, and makes sorting lists even
597faster.
598
599- STDWIN is now officially obsolete. Support for it will eventually
600be removed from the distribution.
601
602- The configure script is smarter about C compiler options; e.g. with
603gcc it uses -O2 and -g when possible, and on some other platforms it
604uses -Olimit 1500 to avoid a warning from the optimizer about the main
605loop in ceval.c (which has more than 1000 basic blocks).
606
607- Changed the run-time library to check for exceptions after object
608comparisons. PyObject_Compare() can now return an exception; use
609PyErr_Occurred() to check (there is *no* special return value).
610
611- PyFile_WriteString() and Py_Flushline() now return error indicators
612instead of clearing exceptions. This fixes an obscure bug where using
613these would clear a pending exception, discovered by Just van Rossum.
614
615- Most problems on 64-bit platforms should now be fixed. Andrew
616Kuchling helped. Some uncommon extension modules are still not
617clean (image and audio ops?).
618