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