blob: f1131c48bf2fe1c2ac723a4d47db75a7587ceb28 [file] [log] [blame]
Tim Peters2fe289a2001-03-01 22:19:38 +00001What's New in Python 2.1 beta 1?
2================================
Tim Petersd66595f2001-02-04 03:09:53 +00003
4Core language, builtins, and interpreter
5
Guido van Rossum9d0fbde2001-03-02 14:00:32 +00006- Following an outcry from the community about the amount of code
7 broken by the nested scopes feature introduced in 2.1a2, we decided
8 to make this feature optional, and to wait until Python 2.2 (or at
9 least 6 months) to make it standard. The option can be enabled on a
10 per-module basis by adding "from __future__ import nested_scopes" at
11 the beginning of a module (before any other statements, but after
12 comments and an optional docstring). See PEP 236 (Back to the
13 __future__) for a description of the __future__ statement. PEP 227
14 (Statically Nested Scopes) has been updated to reflect this change,
15 and to clarify the semantics in a number of endcases.
16
17- The nested scopes code, when enabled, has been hardened, and most
18 bugs and memory leaks in it have been fixed.
19
20- Compile-time warnings are now generated for a number of conditions
21 that will break or change in meaning when nested scopes are enabled:
22
23 - Using "from...import *" or "exec" without in-clause in a function
24 scope that also defines a lambda or nested function with one or
25 more free (non-local) variables. The presence of the import* or
26 bare exec makes it impossible for the compiler to determine the
27 exact set of local variables in the outer scope, which makes it
28 impossible to determine the bindings for free variables in the
29 inner scope. To avoid the warning about import *, change it into
30 an import of explicitly name object, or move the import* statement
31 to the global scope; to avoid the warning about bare exec, use
32 exec...in... (a good idea anyway -- there's a possibility that
33 bare exec will be deprecated in the future).
34
35 - Use of a global variable in a nested scope with the same name as a
36 local variable in a surrounding scope. This will change in
37 meaning with nested scopes: the name in the inner scope will
38 reference the variable in the outer scope rather than the global
39 of the same name. To avoid the warning, either rename the outer
40 variable, or use a global statement in the inner function.
41
Neil Schemenauera35c6882001-02-27 04:45:05 +000042- An optional object allocator has been included. This allocator is
43 optimized for Python objects and should be faster and use less memory
44 than the standard system allocator. It is not enabled by default
45 because of possible thread safety problems. The allocator is only
46 protected by the Python interpreter lock and it is possible that some
47 extension modules require a thread safe allocator. The object
48 allocator can be enabled by providing the "--with-pymalloc" option to
49 configure.
50
Tim Petersd66595f2001-02-04 03:09:53 +000051Standard library
52
Martin v. Löwis2a5130e2001-02-27 04:21:58 +000053- pyexpat now detects the expat version if expat.h defines it. A
54 number of additional handlers are provided, which are only available
55 since expat 1.95. In addition, the methods SetParamEntityParsing and
56 GetInputContext of Parser objects are available with 1.95.x
57 only. Parser objects now provide the ordered_attributes and
58 specified_attributes attributes. A new module expat.model was added,
59 which offers a number of additional constants if 1.95.x is used.
60
61- xml.dom offers the new functions registerDOMImplementation and
62 getDOMImplementation.
63
64- xml.dom.minidom offers a toprettyxml method. A number of DOM
65 conformance issues have been resolved. In particular, Element now
66 has an hasAttributes method, and the handling of namespaces was
67 improved.
68
Andrew M. Kuchlingd6a1d792001-02-28 21:05:42 +000069- Ka-Ping Yee contributed two new modules: inspect.py, a module for
70 getting information about live Python code, and pydoc.py, a module
71 for interactively converting docstrings to HTML or text.
72 Tools/scripts/pydoc, which is now automatically installed into
Tim Peters1eff7962001-03-01 02:31:33 +000073 <prefix>/bin, uses pydoc.py to display documentation; try running
Guido van Rossume3955a82001-03-02 14:05:59 +000074 "pydoc -h" for instructions. "pydoc -g" pops up a small GUI that
75 lets you browse the module docstrings using a web browser.
Andrew M. Kuchlingd6a1d792001-02-28 21:05:42 +000076
Tim Peters1eff7962001-03-01 02:31:33 +000077- New library module difflib.py, primarily packaging the SequenceMatcher
78 class at the heart of the popular ndiff.py file-comparison tool.
79
80- doctest.py (a framework for verifying Python code examples in docstrings)
81 is now part of the std library.
82
Tim Petersd66595f2001-02-04 03:09:53 +000083Windows changes
84
Guido van Rossume3955a82001-03-02 14:05:59 +000085- A new entry in the Start menu, "Module Docs", runs "pydoc -g" -- a
86 small GUI that lets you browse the module docstrings using your
87 default web browser.
88
Tim Peters1eff7962001-03-01 02:31:33 +000089- Import is now case-sensitive. PEP 235 (Import on Case-Insensitive
90 Platforms) is implemented. See
91
92 http://python.sourceforge.net/peps/pep-0235.html
93
94 for full details, especially the "Current Lower-Left Semantics" section.
95 The new Windows import rules are simpler than before:
96
97 A. If the PYTHONCASEOK environment variable exists, same as
98 before: silently accept the first case-insensitive match of any
99 kind; raise ImportError if none found.
100
101 B. Else search sys.path for the first case-sensitive match; raise
102 ImportError if none found.
103
104 The same rules have been implented on other platforms with case-
105 insensitive but case-preserving filesystems too (including Cygwin, and
106 several flavors of Macintosh operating systems).
Tim Petersd66595f2001-02-04 03:09:53 +0000107
Tim Peters25a9ce32001-02-19 07:06:36 +0000108- winsound module: Under Win9x, winsound.Beep() now attempts to simulate
109 what it's supposed to do (and does do under NT and 2000) via direct
110 port manipulation. It's unknown whether this will work on all systems,
Tim Peters1eff7962001-03-01 02:31:33 +0000111 but it does work on my Win98SE systems now and was known to be useless on
Tim Peters25a9ce32001-02-19 07:06:36 +0000112 all Win9x systems before.
113
Tim Peters1eff7962001-03-01 02:31:33 +0000114- Build: Subproject _test (effectively) renamed to _testcapi.
115
Tim Peters2fe289a2001-03-01 22:19:38 +0000116New platforms
117
118- 2.1 should compile and run out of the box under MacOS X, even using HFS+.
119 Thanks to Steven Majewski!
120
121- 2.1 should compile and run out of the box on Cygwin. Thanks to Jason
122 Tishler!
123
Guido van Rossum9089b272001-03-02 06:49:50 +0000124- 2.1 contains new files and patches for RISCOS, thanks to Dietmar
125 Schwertberger! See RISCOS/README for more information -- it seems
126 that because of the bizarre filename conventions on RISCOS, no port
127 to that platform is easy. Note that the new variable os.endsep is
128 silently supported in order to make life easier on this platform,
129 but we don't advertise it because it's not worth for most folks to
130 care about RISCOS portability.
131
Tim Peters25a9ce32001-02-19 07:06:36 +0000132
Tim Petersd7b5e882001-01-25 03:36:26 +0000133What's New in Python 2.1 alpha 2?
134=================================
Tim Peters40ead762001-01-27 05:35:26 +0000135
Tim Petersd7b5e882001-01-25 03:36:26 +0000136Core language, builtins, and interpreter
137
Jeremy Hylton4589bd82001-02-01 20:38:45 +0000138- Scopes nest. If a name is used in a function or class, but is not
139 local, the definition in the nearest enclosing function scope will
140 be used. One consequence of this change is that lambda statements
141 could reference variables in the namespaces where the lambda is
142 defined. In some unusual cases, this change will break code.
143
144 In all previous version of Python, names were resolved in exactly
145 three namespaces -- the local namespace, the global namespace, and
Jeremy Hyltond6b1cf92001-02-02 20:06:28 +0000146 the builtin namespace. According to this old definition, if a
Jeremy Hylton4589bd82001-02-01 20:38:45 +0000147 function A is defined within a function B, the names bound in B are
148 not visible in A. The new rules make names bound in B visible in A,
149 unless A contains a name binding that hides the binding in B.
150
151 Section 4.1 of the reference manual describes the new scoping rules
152 in detail. The test script in Lib/test/test_scope.py demonstrates
153 some of the effects of the change.
154
155 The new rules will cause existing code to break if it defines nested
156 functions where an outer function has local variables with the same
157 name as globals or builtins used by the inner function. Example:
158
159 def munge(str):
160 def helper(x):
161 return str(x)
162 if type(str) != type(''):
163 str = helper(str)
164 return str.strip()
165
166 Under the old rules, the name str in helper() is bound to the
167 builtin function str(). Under the new rules, it will be bound to
168 the argument named str and an error will occur when helper() is
169 called.
170
Jeremy Hyltond6b1cf92001-02-02 20:06:28 +0000171- The compiler will report a SyntaxError if "from ... import *" occurs
172 in a function or class scope. The language reference has documented
173 that this case is illegal, but the compiler never checked for it.
174 The recent introduction of nested scope makes the meaning of this
175 form of name binding ambiguous. In a future release, the compiler
176 may allow this form when there is no possibility of ambiguity.
177
Tim Peters40ead762001-01-27 05:35:26 +0000178- repr(string) is easier to read, now using hex escapes instead of octal,
179 and using \t, \n and \r instead of \011, \012 and \015 (respectively):
180
181 >>> "\texample \r\n" + chr(0) + chr(255)
182 '\texample \r\n\x00\xff' # in 2.1
183 '\011example \015\012\000\377' # in 2.0
184
Moshe Zadka6af0ce02001-01-29 06:41:00 +0000185- Functions are now compared and hashed by identity, not by value, since
186 the func_code attribute is writable.
187
Fred Drakefb9d7122001-02-01 20:00:40 +0000188- Weak references (PEP 205) have been added. This involves a few
189 changes in the core, an extension module (_weakref), and a Python
190 module (weakref). The weakref module is the public interface. It
191 includes support for "explicit" weak references, proxy objects, and
192 mappings with weakly held values.
193
Jeremy Hylton0072d5a2001-02-01 22:53:15 +0000194- A 'continue' statement can now appear in a try block within the body
195 of a loop. It is still not possible to use continue in a finally
Tim Peters9ea17ac2001-02-02 05:57:15 +0000196 clause.
Jeremy Hylton0072d5a2001-02-01 22:53:15 +0000197
Tim Petersd7b5e882001-01-25 03:36:26 +0000198Standard library
199
Barry Warsaw30dbd142001-01-31 22:14:01 +0000200- mailbox.py now has a new class, PortableUnixMailbox which is
201 identical to UnixMailbox but uses a more portable scheme for
202 determining From_ separators. Also, the constructors for all the
203 classes in this module have a new optional `factory' argument, which
204 is a callable used when new message classes must be instantiated by
205 the next() method.
206
Tim Petersd7b5e882001-01-25 03:36:26 +0000207- random.py is now self-contained, and offers all the functionality of
208 the now-deprecated whrandom.py. See the docs for details. random.py
209 also supports new functions getstate() and setstate(), for saving
Tim Petersd52269b2001-01-25 06:23:18 +0000210 and restoring the internal state of the generator; and jumpahead(n),
211 for quickly forcing the internal state to be the same as if n calls to
212 random() had been made. The latter is particularly useful for multi-
213 threaded programs, creating one instance of the random.Random() class for
214 each thread, then using .jumpahead() to force each instance to use a
215 non-overlapping segment of the full period.
Tim Petersd7b5e882001-01-25 03:36:26 +0000216
Tim Peters0de88fc2001-02-01 04:59:18 +0000217- random.py's seed() function is new. For bit-for-bit compatibility with
218 prior releases, use the whseed function instead. The new seed function
219 addresses two problems: (1) The old function couldn't produce more than
220 about 2**24 distinct internal states; the new one about 2**45 (the best
221 that can be done in the Wichmann-Hill generator). (2) The old function
222 sometimes produced identical internal states when passed distinct
223 integers, and there was no simple way to predict when that would happen;
224 the new one guarantees to produce distinct internal states for all
225 arguments in [0, 27814431486576L).
226
Jeremy Hylton4c4fda02001-02-02 03:29:24 +0000227- The socket module now supports raw packets on Linux. The socket
228 family is AF_PACKET.
229
Tim Peters9ea17ac2001-02-02 05:57:15 +0000230- test_capi.py is a start at running tests of the Python C API. The tests
231 are implemented by the new Modules/_testmodule.c.
232
Jeremy Hyltond6b1cf92001-02-02 20:06:28 +0000233- A new extension module, _symtable, provides provisional access to the
234 internal symbol table used by the Python compiler. A higher-level
235 interface will be added on top of _symtable in a future release.
236
Andrew M. Kuchlingdebc3522001-02-22 15:53:21 +0000237- Removed the obsolete soundex module.
238
Martin v. Löwis2a5130e2001-02-27 04:21:58 +0000239- xml.dom.minidom now uses the standard DOM exceptions. Node supports
240 the isSameNode method; NamedNodeMap the get method.
241
242- xml.sax.expatreader supports the lexical handler property; it
243 generates comment, startCDATA, and endCDATA events.
244
Tim Petersee826f82001-01-31 19:39:44 +0000245Windows changes
246
247- Build procedure: the zlib project is built in a different way that
248 ensures the zlib header files used can no longer get out of synch with
Tim Peters9ea17ac2001-02-02 05:57:15 +0000249 the zlib binary used. See PCbuild\readme.txt for details. Your old
250 zlib-related directories can be deleted; you'll need to download fresh
251 source for zlib and unpack it into a new directory.
Tim Petersee826f82001-01-31 19:39:44 +0000252
Tim Peters9ea17ac2001-02-02 05:57:15 +0000253- Build: New subproject _test for the benefit of test_capi.py (see above).
254
Tim Petersb16c56f2001-02-02 21:24:51 +0000255- Build: New subproject _symtable, for new DLL _symtable.pyd (a nascent
256 interface to some Python compiler internals).
257
258- Build: Subproject ucnhash is gone, since the code was folded into the
Tim Peters9ea17ac2001-02-02 05:57:15 +0000259 unicodedata subproject.
Tim Petersd7b5e882001-01-25 03:36:26 +0000260
Tim Petersa3a3a032000-11-30 05:22:44 +0000261What's New in Python 2.1 alpha 1?
262=================================
263
264Core language, builtins, and interpreter
265
Marc-André Lemburgebb195b2001-01-20 10:34:52 +0000266- There is a new Unicode companion to the PyObject_Str() API
267 called PyObject_Unicode(). It behaves in the same way as the
268 former, but assures that the returned value is an Unicode object
269 (applying the usual coercion if necessary).
Marc-André Lemburgad7c98e2001-01-17 17:09:53 +0000270
Guido van Rossumf98eda02001-01-17 15:54:45 +0000271- The comparison operators support "rich comparison overloading" (PEP
272 207). C extension types can provide a rich comparison function in
273 the new tp_richcompare slot in the type object. The cmp() function
274 and the C function PyObject_Compare() first try the new rich
275 comparison operators before trying the old 3-way comparison. There
276 is also a new C API PyObject_RichCompare() (which also falls back on
277 the old 3-way comparison, but does not constrain the outcome of the
278 rich comparison to a Boolean result).
279
280 The rich comparison function takes two objects (at least one of
281 which is guaranteed to have the type that provided the function) and
282 an integer indicating the opcode, which can be Py_LT, Py_LE, Py_EQ,
283 Py_NE, Py_GT, Py_GE (for <, <=, ==, !=, >, >=), and returns a Python
284 object, which may be NotImplemented (in which case the tp_compare
285 slot function is used as a fallback, if defined).
286
287 Classes can overload individual comparison operators by defining one
288 or more of the methods__lt__, __le__, __eq__, __ne__, __gt__,
Guido van Rossuma88479f2001-01-18 14:28:08 +0000289 __ge__. There are no explicit "reflected argument" versions of
290 these; instead, __lt__ and __gt__ are each other's reflection,
291 likewise for__le__ and __ge__; __eq__ and __ne__ are their own
292 reflection (similar at the C level). No other implications are
293 made; in particular, Python does not assume that == is the Boolean
294 inverse of !=, or that < is the Boolean inverse of >=. This makes
295 it possible to define types with partial orderings.
Guido van Rossumf98eda02001-01-17 15:54:45 +0000296
297 Classes or types that want to implement (in)equality tests but not
298 the ordering operators (i.e. unordered types) should implement ==
299 and !=, and raise an error for the ordering operators.
300
Guido van Rossuma88479f2001-01-18 14:28:08 +0000301 It is possible to define types whose rich comparison results are not
Guido van Rossumf98eda02001-01-17 15:54:45 +0000302 Boolean; e.g. a matrix type might want to return a matrix of bits
303 for A < B, giving elementwise comparisons. Such types should ensure
304 that any interpretation of their value in a Boolean context raises
305 an exception, e.g. by defining __nonzero__ (or the tp_nonzero slot
306 at the C level) to always raise an exception.
307
Guido van Rossuma88479f2001-01-18 14:28:08 +0000308- Complex numbers use rich comparisons to define == and != but raise
309 an exception for <, <=, > and >=. Unfortunately, this also means
310 that cmp() of two complex numbers raises an exception when the two
311 numbers differ. Since it is not mathematically meaningful to compare
312 complex numbers except for equality, I hope that this doesn't break
313 too much code.
314
Tim Peters3389f192001-02-18 08:48:49 +0000315- The outcome of comparing non-numeric objects of different types is
Tim Peters14495852001-02-18 08:28:33 +0000316 not defined by the language, other than that it's arbitrary but
317 consistent (see the Reference Manual). An implementation detail changed
318 in 2.1a1 such that None now compares less than any other object. Code
319 relying on this new behavior (like code that relied on the previous
320 behavior) does so at its own risk.
321
Barry Warsaw573b5412001-01-15 20:43:18 +0000322- Functions and methods now support getting and setting arbitrarily
323 named attributes (PEP 232). Functions have a new __dict__
324 (a.k.a. func_dict) which hold the function attributes. Methods get
325 and set attributes on their underlying im_func. It is a TypeError
326 to set an attribute on a bound method.
327
Guido van Rossum051e3352001-01-15 19:11:10 +0000328- The xrange() object implementation has been improved so that
329 xrange(sys.maxint) can be used on 64-bit platforms. There's still a
330 limitation that in this case len(xrange(sys.maxint)) can't be
331 calculated, but the common idiom "for i in xrange(sys.maxint)" will
332 work fine as long as the index i doesn't actually reach 2**31.
333 (Python uses regular ints for sequence and string indices; fixing
334 that is much more work.)
335
Guido van Rossum1cc8f832001-01-12 16:25:08 +0000336- Two changes to from...import:
337
Guido van Rossumba381232001-02-03 15:06:40 +0000338 1) "from M import X" now works even if (after loading module M)
339 sys.modules['M'] is not a real module; it's basically a getattr()
340 operation with AttributeError exceptions changed into ImportError.
Guido van Rossum1cc8f832001-01-12 16:25:08 +0000341
342 2) "from M import *" now looks for M.__all__ to decide which names to
343 import; if M.__all__ doesn't exist, it uses M.__dict__.keys() but
344 filters out names starting with '_' as before. Whether or not
345 __all__ exists, there's no restriction on the type of M.
346
Guido van Rossumf61f1662001-01-10 20:13:55 +0000347- File objects have a new method, xreadlines(). This is the fastest
348 way to iterate over all lines in a file:
349
350 for line in file.xreadlines():
351 ...do something to line...
352
353 See the xreadlines module (mentioned below) for how to do this for
354 other file-like objects.
355
356- Even if you don't use file.xreadlines(), you may expect a speedup on
357 line-by-line input. The file.readline() method has been optimized
Tim Petersf29b64d2001-01-15 06:33:19 +0000358 quite a bit in platform-specific ways: on systems (like Linux) that
359 support flockfile(), getc_unlocked(), and funlockfile(), those are
360 used by default. On systems (like Windows) without getc_unlocked(),
361 a complicated (but still thread-safe) method using fgets() is used by
362 default.
363
Tim Petersd52269b2001-01-25 06:23:18 +0000364 You can force use of the fgets() method by #define'ing
365 USE_FGETS_IN_GETLINE at build time (it may be faster than
Tim Petersf29b64d2001-01-15 06:33:19 +0000366 getc_unlocked()).
367
Tim Petersd52269b2001-01-25 06:23:18 +0000368 You can force fgets() not to be used by #define'ing
369 DONT_USE_FGETS_IN_GETLINE (this is the first thing to try if std test
Tim Petersf29b64d2001-01-15 06:33:19 +0000370 test_bufio.py fails -- and let us know if it does!).
371
372- In addition, the fileinput module, while still slower than the other
373 methods on most platforms, has been sped up too, by using
374 file.readlines(sizehint).
Guido van Rossumf61f1662001-01-10 20:13:55 +0000375
376- Support for run-time warnings has been added, including a new
377 command line option (-W) to specify the disposition of warnings.
378 See the description of the warnings module below.
379
380- Extensive changes have been made to the coercion code. This mostly
381 affects extension modules (which can now implement mixed-type
382 numerical operators without having to use coercion), but
383 occasionally, in boundary cases the coercion semantics have changed
384 subtly. Since this was a terrible gray area of the language, this
Guido van Rossumae72d872001-01-11 15:00:14 +0000385 is considered an improvement. Also note that __rcmp__ is no longer
Guido van Rossumf61f1662001-01-10 20:13:55 +0000386 supported -- instead of calling __rcmp__, __cmp__ is called with
Guido van Rossuma88479f2001-01-18 14:28:08 +0000387 reflected arguments.
Guido van Rossumf61f1662001-01-10 20:13:55 +0000388
Guido van Rossumf98eda02001-01-17 15:54:45 +0000389- In connection with the coercion changes, a new built-in singleton
390 object, NotImplemented is defined. This can be returned for
391 operations that wish to indicate they are not implemented for a
392 particular combination of arguments. From C, this is
393 Py_NotImplemented.
394
Martin v. Löwisbe4c0f52001-01-04 20:30:56 +0000395- The interpreter accepts now bytecode files on the command line even
396 if they do not have a .pyc or .pyo extension. On Linux, after executing
397
Martin v. Löwise214baa2001-02-04 22:37:56 +0000398import imp,sys,string
399magic = string.join(["\\x%.2x" % ord(c) for c in imp.get_magic()],"")
400reg = ':pyc:M::%s::%s:' % (magic, sys.executable)
401open("/proc/sys/fs/binfmt_misc/register","wb").write(reg)
Martin v. Löwisbe4c0f52001-01-04 20:30:56 +0000402
403 any byte code file can be used as an executable (i.e. as an argument
404 to execve(2)).
405
Tim Peters9940b802000-12-01 07:59:35 +0000406- %[xXo] formats of negative Python longs now produce a sign
Tim Petersa3a3a032000-11-30 05:22:44 +0000407 character. In 1.6 and earlier, they never produced a sign,
408 and raised an error if the value of the long was too large
409 to fit in a Python int. In 2.0, they produced a sign if and
410 only if too large to fit in an int. This was inconsistent
411 across platforms (because the size of an int varies across
412 platforms), and inconsistent with hex() and oct(). Example:
413
414 >>> "%x" % -0x42L
Tim Peters9940b802000-12-01 07:59:35 +0000415 '-42' # in 2.1
Tim Petersa3a3a032000-11-30 05:22:44 +0000416 'ffffffbe' # in 2.0 and before, on 32-bit machines
417 >>> hex(-0x42L)
418 '-0x42L' # in all versions of Python
419
Tim Peters9940b802000-12-01 07:59:35 +0000420 The behavior of %d formats for negative Python longs remains
421 the same as in 2.0 (although in 1.6 and before, they raised
422 an error if the long didn't fit in a Python int).
423
424 %u formats don't make sense for Python longs, but are allowed
425 and treated the same as %d in 2.1. In 2.0, a negative long
426 formatted via %u produced a sign if and only if too large to
427 fit in an int. In 1.6 and earlier, a negative long formatted
428 via %u raised an error if it was too big to fit in an int.
429
Guido van Rossum3661d392000-12-12 22:10:31 +0000430- Dictionary objects have an odd new method, popitem(). This removes
431 an arbitrary item from the dictionary and returns it (in the form of
432 a (key, value) pair). This can be useful for algorithms that use a
433 dictionary as a bag of "to do" items and repeatedly need to pick one
434 item. Such algorithms normally end up running in quadratic time;
435 using popitem() they can usually be made to run in linear time.
436
Tim Peters36cdad12000-12-29 02:06:45 +0000437Standard library
438
Thomas Woutersfe385252001-01-19 23:16:56 +0000439- In the time module, the time argument to the functions strftime,
440 localtime, gmtime, asctime and ctime is now optional, defaulting to
441 the current time (in the local timezone).
442
Guido van Rossumda91f222001-01-15 16:36:08 +0000443- The ftplib module now defaults to passive mode, which is deemed a
444 more useful default given that clients are often inside firewalls
445 these days. Note that this could break if ftplib is used to connect
446 to a *server* that is inside a firewall, from outside; this is
447 expected to be a very rare situation. To fix that, you can call
448 ftp.set_pasv(0).
449
Martin v. Löwis10a27872001-01-13 09:54:41 +0000450- The module site now treats .pth files not only for path configuration,
451 but also supports extensions to the initialization code: Lines starting
452 with import are executed.
453
Guido van Rossumf61f1662001-01-10 20:13:55 +0000454- There's a new module, warnings, which implements a mechanism for
455 issuing and filtering warnings. There are some new built-in
456 exceptions that serve as warning categories, and a new command line
457 option, -W, to control warnings (e.g. -Wi ignores all warnings, -We
458 turns warnings into errors). warnings.warn(message[, category])
459 issues a warning message; this can also be called from C as
460 PyErr_Warn(category, message).
461
462- A new module xreadlines was added. This exports a single factory
463 function, xreadlines(). The intention is that this code is the
464 absolutely fastest way to iterate over all lines in an open
465 file(-like) object:
466
467 import xreadlines
468 for line in xreadlines.xreadlines(file):
469 ...do something to line...
470
471 This is equivalent to the previous the speed record holder using
472 file.readlines(sizehint). Note that if file is a real file object
473 (as opposed to a file-like object), this is equivalent:
474
475 for line in file.xreadlines():
476 ...do something to line...
477
Tim Peters36cdad12000-12-29 02:06:45 +0000478- The bisect module has new functions bisect_left, insort_left,
479 bisect_right and insort_right. The old names bisect and insort
480 are now aliases for bisect_right and insort_right. XXX_right
481 and XXX_left methods differ in what happens when the new element
482 compares equal to one or more elements already in the list: the
483 XXX_left methods insert to the left, the XXX_right methods to the
Tim Peters742bb6f2001-01-05 08:05:32 +0000484 right. Code that doesn't care where equal elements end up should
485 continue to use the old, short names ("bisect" and "insort").
Tim Peters36cdad12000-12-29 02:06:45 +0000486
Andrew M. Kuchlingf6f3a892001-01-13 14:53:34 +0000487- The new curses.panel module wraps the panel library that forms part
488 of SYSV curses and ncurses. Contributed by Thomas Gellekum.
489
Guido van Rossumf61f1662001-01-10 20:13:55 +0000490- The SocketServer module now sets the allow_reuse_address flag by
491 default in the TCPServer class.
492
493- A new function, sys._getframe(), returns the stack frame pointer of
494 the caller. This is intended only as a building block for
495 higher-level mechanisms such as string interpolation.
496
Martin v. Löwis2a5130e2001-02-27 04:21:58 +0000497- The pyexpat module supports a number of new handlers, which are
498 available only in expat 1.2. If invocation of a callback fails, it
499 will report an additional frame in the traceback. Parser objects
500 participate now in garbage collection. If expat reports an unknown
501 encoding, pyexpat will try to use a Python codec; that works only
502 for single-byte charsets. The parser type objects is exposed as
503 XMLParserObject.
504
505- xml.dom now offers standard definitions for symbolic node type and
506 exception code constants, and a hierarchy of DOM exceptions. minidom
507 was adjusted to use them.
508
509- The conformance of xml.dom.minidom to the DOM specification was
510 improved. It detects a number of additional error cases; the
511 previous/next relationship works even when the tree is modified;
512 Node supports the normalize() method; NamedNodeMap, DocumentType and
513 DOMImplementation classes were added; Element supports the
514 hasAttribute and hasAttributeNS methods; and Text supports the splitText
515 method.
516
Guido van Rossumf61f1662001-01-10 20:13:55 +0000517Build issues
518
Guido van Rossum1e33bdc2001-01-23 03:17:00 +0000519- For Unix (and Unix-compatible) builds, configuration and building of
520 extension modules is now greatly automated. Rather than having to
521 edit the Modules/Setup file to indicate which modules should be
522 built and where their include files and libraries are, a
523 distutils-based setup.py script now takes care of building most
524 extension modules. All extension modules built this way are built
525 as shared libraries. Only a few modules that must be linked
526 statically are still listed in the Setup file; you won't need to
527 edit their configuration.
528
529- Python should now build out of the box on Cygwin. If it doesn't,
530 mail to Jason Tishler (jlt63 at users.sourceforge.net).
Guido van Rossumf61f1662001-01-10 20:13:55 +0000531
532- Python now always uses its own (renamed) implementation of getopt()
533 -- there's too much variation among C library getopt()
534 implementations.
535
536- C++ compilers are better supported; the CXX macro is always set to a
537 C++ compiler if one is found.
Tim Peters36cdad12000-12-29 02:06:45 +0000538
Tim Petersd92dfe02000-12-12 01:18:41 +0000539Windows changes
540
541- select module: By default under Windows, a select() call
542 can specify no more than 64 sockets. Python now boosts
543 this Microsoft default to 512. If you need even more than
544 that, see the MS docs (you'll need to #define FD_SETSIZE
545 and recompile Python from source).
546
Guido van Rossumf61f1662001-01-10 20:13:55 +0000547- Support for Windows 3.1, DOS and OS/2 is gone. The Lib/dos-8x3
548 subdirectory is no more!
549
Tim Petersa3a3a032000-11-30 05:22:44 +0000550
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000551What's New in Python 2.0?
Fred Drake1a640502000-10-16 20:27:25 +0000552=========================
Guido van Rossum61000331997-08-15 04:39:58 +0000553
Guido van Rossum8ed602b2000-09-01 22:34:33 +0000554Below is a list of all relevant changes since release 1.6. Older
Guido van Rossumf2ffce02000-09-05 04:38:34 +0000555changes are in the file HISTORY. If you are making the jump directly
556from Python 1.5.2 to 2.0, make sure to read the section for 1.6 in the
557HISTORY file! Many important changes listed there.
Guido van Rossum61000331997-08-15 04:39:58 +0000558
Guido van Rossumf2ffce02000-09-05 04:38:34 +0000559Alternatively, a good overview of the changes between 1.5.2 and 2.0 is
560the document "What's New in Python 2.0" by Kuchling and Moshe Zadka:
561http://starship.python.net/crew/amk/python/writing/new-python/.
Guido van Rossum1f83cce1997-10-06 21:04:35 +0000562
Guido van Rossumf2ffce02000-09-05 04:38:34 +0000563--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)
Guido van Rossum437cfe81999-04-08 20:17:57 +0000564
565======================================================================
566
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000567What's new in 2.0 (since release candidate 1)?
568==============================================
569
570Standard library
571
572- The copy_reg module was modified to clarify its intended use: to
573 register pickle support for extension types, not for classes.
574 pickle() will raise a TypeError if it is passed a class.
575
576- Fixed a bug in gettext's "normalize and expand" code that prevented
577 it from finding an existing .mo file.
578
579- Restored support for HTTP/0.9 servers in httplib.
580
Tim Peters989b7b92000-10-16 20:24:53 +0000581- The math module was changed to stop raising OverflowError in case of
582 underflow, and return 0 instead in underflow cases. Whether Python
583 used to raise OverflowError in case of underflow was platform-
584 dependent (it did when the platform math library set errno to ERANGE
585 on underflow).
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000586
587- Fixed a bug in StringIO that occurred when the file position was not
588 at the end of the file and write() was called with enough data to
589 extend past the end of the file.
590
591- Fixed a bug that caused Tkinter error messages to get lost on
592 Windows. The bug was fixed by replacing direct use of
593 interp->result with Tcl_GetStringResult(interp).
594
595- Fixed bug in urllib2 that caused it to fail when it received an HTTP
596 redirect response.
597
598- Several changes were made to distutils: Some debugging code was
599 removed from util. Fixed the installer used when an external zip
600 program (like WinZip) is not found; the source code for this
601 installer is in Misc/distutils. check_lib() was modified to behave
602 more like AC_CHECK_LIB by add other_libraries() as a parameter. The
603 test for whether installed modules are on sys.path was changed to
604 use both normcase() and normpath().
605
Jeremy Hyltond867a2c2000-10-16 20:41:38 +0000606- Several minor bugs were fixed in the xml package (the minidom,
607 pulldom, expatreader, and saxutils modules).
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000608
609- The regression test driver (regrtest.py) behavior when invoked with
610 -l changed: It now reports a count of objects that are recognized as
611 garbage but not freed by the garbage collector.
612
Tim Peters989b7b92000-10-16 20:24:53 +0000613- The regression test for the math module was changed to test
614 exceptional behavior when the test is run in verbose mode. Python
615 cannot yet guarantee consistent exception behavior across platforms,
616 so the exception part of test_math is run only in verbose mode, and
617 may fail on your platform.
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000618
619Internals
620
621- PyOS_CheckStack() has been disabled on Win64, where it caused
622 test_sre to fail.
623
624Build issues
625
626- Changed compiler flags, so that gcc is always invoked with -Wall and
627 -Wstrict-prototypes. Users compiling Python with GCC should see
628 exactly one warning, except if they have passed configure the
Tim Peters989b7b92000-10-16 20:24:53 +0000629 --with-pydebug flag. The expected warning is for getopt() in
Tim Petersadfb94f2000-10-16 20:51:33 +0000630 Modules/main.c. This warning will be fixed for Python 2.1.
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000631
Tim Petersa3a3a032000-11-30 05:22:44 +0000632- Fixed configure to add -threads argument during linking on OSF1.
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000633
634Tools and other miscellany
635
636- The compiler in Tools/compiler was updated to support the new
637 language features introduced in 2.0: extended print statement, list
638 comprehensions, and augmented assignments. The new compiler should
639 also be backwards compatible with Python 1.5.2; the compiler will
640 always generate code for the version of the interpreter it runs
Tim Petersa3a3a032000-11-30 05:22:44 +0000641 under.
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000642
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000643What's new in 2.0 release candidate 1 (since beta 2)?
644=====================================================
645
Jeremy Hylton6040aaa2000-10-09 21:27:22 +0000646What is release candidate 1?
647
648We believe that release candidate 1 will fix all known bugs that we
649intend to fix for the 2.0 final release. This release should be a bit
650more stable than the previous betas. We would like to see even more
651widespread testing before the final release, so we are producing this
652release candidate. The final release will be exactly the same unless
653any show-stopping (or brown bag) bugs are found by testers of the
654release candidate.
655
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000656All the changes since the last beta release are bug fixes or changes
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000657to support building Python for specific platforms.
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000658
659Core language, builtins, and interpreter
660
661- A bug that caused crashes when __coerce__ was used with augmented
662 assignment, e.g. +=, was fixed.
663
664- Raise ZeroDivisionError when raising zero to a negative number,
665 e.g. 0.0 ** -2.0. Note that math.pow is unrelated to the builtin
666 power operator and the result of math.pow(0.0, -2.0) will vary by
667 platform. On Linux, it raises a ValueError.
668
669- A bug in Unicode string interpolation was fixed that occasionally
670 caused errors with formats including "%%". For example, the
671 following expression "%% %s" % u"abc" no longer raises a TypeError.
672
673- Compilation of deeply nested expressions raises MemoryError instead
674 of SyntaxError, e.g. eval("[" * 50 + "]" * 50).
675
676- In 2.0b2 on Windows, the interpreter wrote .pyc files in text mode,
677 rendering them useless. They are now written in binary mode again.
678
679Standard library
680
681- Keyword arguments are now accepted for most pattern and match object
682 methods in SRE, the standard regular expression engine.
683
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000684- In SRE, fixed error with negative lookahead and lookbehind that
Jeremy Hylton32e20ff2000-10-09 19:48:11 +0000685 manifested itself as a runtime error in patterns like "(?<!abc)(def)".
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000686
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000687- Several bugs in the Unicode handling and error handling in _tkinter
688 were fixed.
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000689
690- Fix memory management errors in Merge() and Tkapp_Call() routines.
691
692- Several changes were made to cStringIO to make it compatible with
693 the file-like object interface and with StringIO. If operations are
694 performed on a closed object, an exception is raised. The truncate
695 method now accepts a position argument and readline accepts a size
Tim Petersa3a3a032000-11-30 05:22:44 +0000696 argument.
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000697
698- There were many changes made to the linuxaudiodev module and its
699 test suite; as a result, a short, unexpected audio sample should now
Tim Petersa3a3a032000-11-30 05:22:44 +0000700 play when the regression test is run.
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000701
702 Note that this module is named poorly, because it should work
703 correctly on any platform that supports the Open Sound System
Tim Petersa3a3a032000-11-30 05:22:44 +0000704 (OSS).
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000705
706 The module now raises exceptions when errors occur instead of
707 crashing. It also defines the AFMT_A_LAW format (logarithmic A-law
708 audio) and defines a getptr() method that calls the
709 SNDCTL_DSP_GETxPTR ioctl defined in the OSS Programmer's Guide.
710
711- The library_version attribute, introduced in an earlier beta, was
712 removed because it can not be supported with early versions of the C
713 readline library, which provides no way to determine the version at
714 compile-time.
715
716- The binascii module is now enabled on Win64.
717
Tim Peters46446d62000-10-09 21:19:31 +0000718- tokenize.py no longer suffers "recursion depth" errors when parsing
719 programs with very long string literals.
720
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000721Internals
722
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000723- Fixed several buffer overflow vulnerabilities in calculate_path(),
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000724 which is called when the interpreter starts up to determine where
725 the standard library is installed. These vulnerabilities affect all
726 previous versions of Python and can be exploited by setting very
727 long values for PYTHONHOME or argv[0]. The risk is greatest for a
728 setuid Python script, although use of the wrapper in
729 Misc/setuid-prog.c will eliminate the vulnerability.
730
731- Fixed garbage collection bugs in instance creation that were
732 triggered when errors occurred during initialization. The solution,
733 applied in cPickle and in PyInstance_New(), is to call
734 PyObject_GC_Init() after the initialization of the object's
735 container attributes is complete.
736
737- pyexpat adds definitions of PyModule_AddStringConstant and
738 PyModule_AddObject if the Python version is less than 2.0, which
739 provides compatibility with PyXML on Python 1.5.2.
740
741- If the platform has a bogus definition for LONG_BIT (the number of
742 bits in a long), an error will be reported at compile time.
743
744- Fix bugs in _PyTuple_Resize() which caused hard-to-interpret garbage
745 collection crashes and possibly other, unreported crashes.
746
747- Fixed a memory leak in _PyUnicode_Fini().
748
749Build issues
750
751- configure now accepts a --with-suffix option that specifies the
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000752 executable suffix. This is useful for builds on Cygwin and Mac OS
Tim Petersa3a3a032000-11-30 05:22:44 +0000753 X, for example.
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000754
755- The mmap.PAGESIZE constant is now initialized using sysconf when
756 possible, which eliminates a dependency on -lucb for Reliant UNIX.
757
758- The md5 file should now compile on all platforms.
759
760- The select module now compiles on platforms that do not define
761 POLLRDNORM and related constants.
762
763- Darwin (Mac OS X): Initial support for static builds on this
Tim Petersa3a3a032000-11-30 05:22:44 +0000764 platform.
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000765
Jeremy Hylton10921202000-10-09 18:34:12 +0000766- BeOS: A number of changes were made to the build and installation
767 process. ar-fake now operates on a directory of object files.
768 dl_export.h is gone, and its macros now appear on the mwcc command
769 line during build on PPC BeOS.
770
Jeremy Hyltond6e20232000-10-16 20:08:38 +0000771- Platform directory in lib/python2.0 is "plat-beos5" (or
Jeremy Hylton10921202000-10-09 18:34:12 +0000772 "plat-beos4", if building on BeOS 4.5), rather than "plat-beos".
Jeremy Hyltoned9e6442000-10-09 18:26:42 +0000773
774- Cygwin: Support for shared libraries, Tkinter, and sockets.
775
776- SunOS 4.1.4_JL: Fix test for directory existence in configure.
777
778Tools and other miscellany
779
780- Removed debugging prints from main used with freeze.
781
Tim Peters46446d62000-10-09 21:19:31 +0000782- IDLE auto-indent no longer crashes when it encounters Unicode
783 characters.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000784
785What's new in 2.0 beta 2 (since beta 1)?
786========================================
787
788Core language, builtins, and interpreter
789
Tim Peters482c0212000-09-26 06:33:09 +0000790- Add support for unbounded ints in %d,i,u,x,X,o formats; for example
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000791 "%d" % 2L**64 == "18446744073709551616".
Jeremy Hylton1b618592000-09-26 05:32:36 +0000792
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000793- Add -h and -V command line options to print the usage message and
794 Python version number and exit immediately.
795
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +0000796- eval() and exec accept Unicode objects as code parameters.
797
798- getattr() and setattr() now also accept Unicode objects for the
799 attribute name, which are converted to strings using the default
800 encoding before lookup.
801
802- Multiplication on string and Unicode now does proper bounds
803 checking; e.g. 'a' * 65536 * 65536 will raise ValueError, "repeated
804 string is too long."
805
806- Better error message when continue is found in try statement in a
Tim Petersa3a3a032000-11-30 05:22:44 +0000807 loop.
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +0000808
Jeremy Hylton1b618592000-09-26 05:32:36 +0000809
810Standard library and extensions
811
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000812- array: reverse() method of array now works. buffer_info() now does
Jeremy Hylton1b618592000-09-26 05:32:36 +0000813 argument checking; it still takes no arguments.
814
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000815- asyncore/asynchat: Included most recent version from Sam Rushing.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000816
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000817- cgi: Accept '&' or ';' as separator characters when parsing form data.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000818
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000819- CGIHTTPServer: Now works on Windows (and perhaps even Mac).
Jeremy Hylton1b618592000-09-26 05:32:36 +0000820
821- ConfigParser: When reading the file, options spelled in upper case
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000822 letters are now correctly converted to lowercase.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000823
824- copy: Copy Unicode objects atomically.
825
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000826- cPickle: Fail gracefully when copy_reg can't be imported.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000827
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000828- cStringIO: Implemented readlines() method.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000829
Fred Drake67233bc2000-09-26 16:40:27 +0000830- dbm: Add get() and setdefault() methods to dbm object. Add constant
831 `library' to module that names the library used. Added doc strings
832 and method names to error messages. Uses configure to determine
833 which ndbm.h file to include; Berkeley DB's nbdm and GDBM's ndbm is
834 now available options.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000835
836- distutils: Update to version 0.9.3.
837
838- dl: Add several dl.RTLD_ constants.
839
840- fpectl: Now supported on FreeBSD.
841
842- gc: Add DEBUG_SAVEALL option. When enabled all garbage objects
843 found by the collector will be saved in gc.garbage. This is useful
844 for debugging a program that creates reference cycles.
845
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000846- httplib: Three changes: Restore support for set_debuglevel feature
Jeremy Hylton1b618592000-09-26 05:32:36 +0000847 of HTTP class. Do not close socket on zero-length response. Do not
848 crash when server sends invalid content-length header.
849
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000850- mailbox: Mailbox class conforms better to qmail specifications.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000851
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +0000852- marshal: When reading a short, sign-extend on platforms where shorts
853 are bigger than 16 bits. When reading a long, repair the unportable
854 sign extension that was being done for 64-bit machines. (It assumed
855 that signed right shift sign-extends.)
856
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000857- operator: Add contains(), invert(), __invert__() as aliases for
858 __contains__(), inv(), and __inv__() respectively.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000859
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000860- os: Add support for popen2() and popen3() on all platforms where
861 fork() exists. (popen4() is still in the works.)
Jeremy Hylton1b618592000-09-26 05:32:36 +0000862
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000863- os: (Windows only:) Add startfile() function that acts like double-
Tim Peters482c0212000-09-26 06:33:09 +0000864 clicking on a file in Explorer (or passing the file name to the
865 DOS "start" command).
Jeremy Hylton1b618592000-09-26 05:32:36 +0000866
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000867- os.path: (Windows, DOS:) Treat trailing colon correctly in
Tim Peters482c0212000-09-26 06:33:09 +0000868 os.path.join. os.path.join("a:", "b") yields "a:b".
Jeremy Hylton1b618592000-09-26 05:32:36 +0000869
870- pickle: Now raises ValueError when an invalid pickle that contains
871 a non-string repr where a string repr was expected. This behavior
872 matches cPickle.
873
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000874- posixfile: Remove broken __del__() method.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000875
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000876- py_compile: support CR+LF line terminators in source file.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000877
878- readline: Does not immediately exit when ^C is hit when readline and
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +0000879 threads are configured. Adds definition of rl_library_version. (The
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000880 latter addition requires GNU readline 2.2 or later.)
Jeremy Hylton1b618592000-09-26 05:32:36 +0000881
882- rfc822: Domain literals returned by AddrlistClass method
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000883 getdomainliteral() are now properly wrapped in brackets.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000884
885- site: sys.setdefaultencoding() should only be called in case the
Tim Peters482c0212000-09-26 06:33:09 +0000886 standard default encoding ("ascii") is changed. This saves quite a
Jeremy Hylton1b618592000-09-26 05:32:36 +0000887 few cycles during startup since the first call to
888 setdefaultencoding() will initialize the codec registry and the
889 encodings package.
890
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000891- socket: Support for size hint in readlines() method of object returned
892 by makefile().
Jeremy Hylton1b618592000-09-26 05:32:36 +0000893
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000894- sre: Added experimental expand() method to match objects. Does not
Jeremy Hylton625915e2000-10-02 13:43:33 +0000895 use buffer interface on Unicode strings. Does not hang if group id
Jeremy Hylton1b618592000-09-26 05:32:36 +0000896 is followed by whitespace.
897
Tim Petersa3a3a032000-11-30 05:22:44 +0000898- StringIO: Size hint in readlines() is now supported as documented.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000899
900- struct: Check ranges for bytes and shorts.
901
902- urllib: Improved handling of win32 proxy settings. Fixed quote and
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000903 quote_plus functions so that the always encode a comma.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000904
905- Tkinter: Image objects are now guaranteed to have unique ids. Set
906 event.delta to zero if Tk version doesn't support mousewheel.
907 Removed some debugging prints.
908
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000909- UserList: now implements __contains__().
Jeremy Hylton1b618592000-09-26 05:32:36 +0000910
Fred Drake67233bc2000-09-26 16:40:27 +0000911- webbrowser: On Windows, use os.startfile() instead of os.popen(),
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000912 which works around a bug in Norton AntiVirus 2000 that leads directly
913 to a Blue Screen freeze.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000914
915- xml: New version detection code allows PyXML to override standard
916 XML package if PyXML version is greater than 0.6.1.
917
Fred Drake64bb3802000-09-26 16:21:35 +0000918- xml.dom: DOM level 1 support for basic XML. Includes xml.dom.minidom
919 (conventional DOM), and xml.dom.pulldom, which allows building the DOM
920 tree only for nodes which are sufficiently interesting to a specific
921 application. Does not provide the HTML-specific extensions. Still
922 undocumented.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000923
Fred Drake64bb3802000-09-26 16:21:35 +0000924- xml.sax: SAX 2 support for Python, including all the handler
925 interfaces needed to process XML 1.0 compliant XML. Some
926 documentation is already available.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000927
Fred Drake64bb3802000-09-26 16:21:35 +0000928- pyexpat: Renamed to xml.parsers.expat since this is part of the new,
929 packagized XML support.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000930
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000931
Jeremy Hylton1b618592000-09-26 05:32:36 +0000932C API
933
934- Add three new convenience functions for module initialization --
935 PyModule_AddObject(), PyModule_AddIntConstant(), and
936 PyModule_AddStringConstant().
937
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +0000938- Cleaned up definition of NULL in C source code; all definitions were
Jeremy Hylton1b618592000-09-26 05:32:36 +0000939 removed and add #error to Python.h if NULL isn't defined after
940 #include of stdio.h.
941
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000942- Py_PROTO() macros that were removed in 2.0b1 have been restored for
Jeremy Hylton1b618592000-09-26 05:32:36 +0000943 backwards compatibility (at the source level) with old extensions.
944
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000945- A wrapper API was added for signal() and sigaction(). Instead of
946 either function, always use PyOS_getsig() to get a signal handler
947 and PyOS_setsig() to set one. A new convenience typedef
948 PyOS_sighandler_t is defined for the type of signal handlers.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000949
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000950- Add PyString_AsStringAndSize() function that provides access to the
Jeremy Hylton1b618592000-09-26 05:32:36 +0000951 internal data buffer and size of a string object -- or the default
952 encoded version of a Unicode object.
953
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +0000954- PyString_Size() and PyString_AsString() accept Unicode objects.
955
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000956- The standard header <limits.h> is now included by Python.h (if it
Fred Drake64bb3802000-09-26 16:21:35 +0000957 exists). INT_MAX and LONG_MAX will always be defined, even if
958 <limits.h> is not available.
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000959
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +0000960- PyFloat_FromString takes a second argument, pend, that was
961 effectively useless. It is now officially useless but preserved for
962 backwards compatibility. If the pend argument is not NULL, *pend is
963 set to NULL.
964
965- PyObject_GetAttr() and PyObject_SetAttr() now accept Unicode objects
966 for the attribute name. See note on getattr() above.
967
968- A few bug fixes to argument processing for Unicode.
969 PyArg_ParseTupleAndKeywords() now accepts "es#" and "es".
970 PyArg_Parse() special cases "s#" for Unicode objects; it returns a
971 pointer to the default encoded string data instead of to the raw
Tim Petersa3a3a032000-11-30 05:22:44 +0000972 UTF-16.
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +0000973
974- Py_BuildValue accepts B format (for bgen-generated code).
975
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000976
Jeremy Hylton1b618592000-09-26 05:32:36 +0000977Internals
978
979- On Unix, fix code for finding Python installation directory so that
980 it works when argv[0] is a relative path.
981
Andrew M. Kuchlinga1099be2000-12-15 01:16:43 +0000982- Added a true unicode_internal_encode() function and fixed the
Guido van Rossumf62ed9c2000-09-26 11:16:10 +0000983 unicode_internal_decode function() to support Unicode objects directly
Jeremy Hylton1b618592000-09-26 05:32:36 +0000984 rather than by generating a copy of the object.
985
Tim Peters482c0212000-09-26 06:33:09 +0000986- Several of the internal Unicode tables are much smaller now, and
987 the source code should be much friendlier to weaker compilers.
Jeremy Hylton1b618592000-09-26 05:32:36 +0000988
Jeremy Hylton97693b02000-09-26 17:42:51 +0000989- In the garbage collector: Fixed bug in collection of tuples. Fixed
990 bug that caused some instances to be removed from the container set
991 while they were still live. Fixed parsing in gc.set_debug() for
992 platforms where sizeof(long) > sizeof(int).
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +0000993
994- Fixed refcount problem in instance deallocation that only occurred
995 when Py_REF_DEBUG was defined and Py_TRACE_REFS was not.
996
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +0000997- On Windows, getpythonregpath is now protected against null data in
998 registry key.
999
1000- On Unix, create .pyc/.pyo files with O_EXCL flag to avoid a race
Tim Petersa3a3a032000-11-30 05:22:44 +00001001 condition.
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +00001002
Guido van Rossumf62ed9c2000-09-26 11:16:10 +00001003
Jeremy Hylton1b618592000-09-26 05:32:36 +00001004Build and platform-specific issues
1005
1006- Better support of GNU Pth via --with-pth configure option.
1007
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +00001008- Python/C API now properly exposed to dynamically-loaded extension
1009 modules on Reliant UNIX.
Jeremy Hylton1b618592000-09-26 05:32:36 +00001010
1011- Changes for the benefit of SunOS 4.1.4 (really!). mmapmodule.c:
1012 Don't define MS_SYNC to be zero when it is undefined. Added missing
1013 prototypes in posixmodule.c.
1014
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +00001015- Improved support for HP-UX build. Threads should now be correctly
Guido van Rossumf62ed9c2000-09-26 11:16:10 +00001016 configured (on HP-UX 10.20 and 11.00).
Jeremy Hylton1b618592000-09-26 05:32:36 +00001017
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +00001018- Fix largefile support on older NetBSD systems and OpenBSD by adding
1019 define for TELL64.
1020
1021
1022Tools and other miscellany
1023
1024- ftpmirror: Call to main() is wrapped in if __name__ == "__main__".
1025
1026- freeze: The modulefinder now works with 2.0 opcodes.
1027
Tim Petersa3a3a032000-11-30 05:22:44 +00001028- IDLE:
Jeremy Hyltonfa2e2c12000-09-26 16:31:30 +00001029 Move hackery of sys.argv until after the Tk instance has been
1030 created, which allows the application-specific Tkinter
1031 initialization to be executed if present; also pass an explicit
1032 className parameter to the Tk() constructor.
Fred Drake64bb3802000-09-26 16:21:35 +00001033
Jeremy Hylton1b618592000-09-26 05:32:36 +00001034
1035What's new in 2.0 beta 1?
1036=========================
1037
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001038Source Incompatibilities
1039------------------------
1040
1041None. Note that 1.6 introduced several incompatibilities with 1.5.2,
1042such as single-argument append(), connect() and bind(), and changes to
1043str(long) and repr(float).
1044
1045
1046Binary Incompatibilities
1047------------------------
1048
1049- Third party extensions built for Python 1.5.x or 1.6 cannot be used
1050with Python 2.0; these extensions will have to be rebuilt for Python
10512.0.
1052
1053- On Windows, attempting to import a third party extension built for
1054Python 1.5.x or 1.6 results in an immediate crash; there's not much we
1055can do about this. Check your PYTHONPATH environment variable!
1056
1057- Python bytecode files (*.pyc and *.pyo) are not compatible between
1058releases.
1059
1060
1061Overview of Changes Since 1.6
1062-----------------------------
1063
1064There are many new modules (including brand new XML support through
1065the xml package, and i18n support through the gettext module); a list
1066of all new modules is included below. Lots of bugs have been fixed.
1067
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001068The process for making major new changes to the language has changed
1069since Python 1.6. Enhancements must now be documented by a Python
1070Enhancement Proposal (PEP) before they can be accepted.
1071
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001072There are several important syntax enhancements, described in more
1073detail below:
1074
1075 - Augmented assignment, e.g. x += 1
1076
1077 - List comprehensions, e.g. [x**2 for x in range(10)]
1078
1079 - Extended import statement, e.g. import Module as Name
1080
1081 - Extended print statement, e.g. print >> file, "Hello"
1082
1083Other important changes:
1084
1085 - Optional collection of cyclical garbage
1086
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001087Python Enhancement Proposal (PEP)
1088---------------------------------
1089
1090PEP stands for Python Enhancement Proposal. A PEP is a design
1091document providing information to the Python community, or describing
1092a new feature for Python. The PEP should provide a concise technical
1093specification of the feature and a rationale for the feature.
1094
1095We intend PEPs to be the primary mechanisms for proposing new
1096features, for collecting community input on an issue, and for
1097documenting the design decisions that have gone into Python. The PEP
1098author is responsible for building consensus within the community and
1099documenting dissenting opinions.
1100
1101The PEPs are available at http://python.sourceforge.net/peps/.
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001102
1103Augmented Assignment
1104--------------------
1105
1106This must have been the most-requested feature of the past years!
1107Eleven new assignment operators were added:
1108
Guido van Rossume905e952000-09-05 12:42:46 +00001109 += -= *= /= %= **= <<= >>= &= ^= |=
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001110
1111For example,
1112
1113 A += B
1114
1115is similar to
1116
1117 A = A + B
1118
1119except that A is evaluated only once (relevant when A is something
1120like dict[index].attr).
1121
1122However, if A is a mutable object, A may be modified in place. Thus,
1123if A is a number or a string, A += B has the same effect as A = A+B
1124(except A is only evaluated once); but if a is a list, A += B has the
1125same effect as A.extend(B)!
1126
1127Classes and built-in object types can override the new operators in
1128order to implement the in-place behavior; the not-in-place behavior is
1129used automatically as a fallback when an object doesn't implement the
1130in-place behavior. For classes, the method name is derived from the
1131method name for the corresponding not-in-place operator by inserting
1132an 'i' in front of the name, e.g. __iadd__ implements in-place
1133__add__.
1134
1135Augmented assignment was implemented by Thomas Wouters.
1136
1137
1138List Comprehensions
1139-------------------
1140
1141This is a flexible new notation for lists whose elements are computed
1142from another list (or lists). The simplest form is:
1143
1144 [<expression> for <variable> in <sequence>]
1145
Guido van Rossum56db0952000-09-06 23:34:25 +00001146For example, [i**2 for i in range(4)] yields the list [0, 1, 4, 9].
Guido van Rossumf62ed9c2000-09-26 11:16:10 +00001147This is more efficient than a for loop with a list.append() call.
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001148
1149You can also add a condition:
1150
1151 [<expression> for <variable> in <sequence> if <condition>]
1152
1153For example, [w for w in words if w == w.lower()] would yield the list
1154of words that contain no uppercase characters. This is more efficient
Guido van Rossumf62ed9c2000-09-26 11:16:10 +00001155than a for loop with an if statement and a list.append() call.
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001156
1157You can also have nested for loops and more than one 'if' clause. For
1158example, here's a function that flattens a sequence of sequences::
1159
1160 def flatten(seq):
1161 return [x for subseq in seq for x in subseq]
1162
1163 flatten([[0], [1,2,3], [4,5], [6,7,8,9], []])
1164
1165This prints
1166
1167 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
1168
1169List comprehensions originated as a patch set from Greg Ewing; Skip
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001170Montanaro and Thomas Wouters also contributed. Described by PEP 202.
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001171
1172
1173Extended Import Statement
1174-------------------------
1175
1176Many people have asked for a way to import a module under a different
1177name. This can be accomplished like this:
1178
1179 import foo
1180 bar = foo
1181 del foo
1182
1183but this common idiom gets old quickly. A simple extension of the
1184import statement now allows this to be written as follows:
1185
1186 import foo as bar
1187
1188There's also a variant for 'from ... import':
1189
1190 from foo import bar as spam
1191
1192This also works with packages; e.g. you can write this:
1193
1194 import test.regrtest as regrtest
1195
1196Note that 'as' is not a new keyword -- it is recognized only in this
1197context (this is only possible because the syntax for the import
1198statement doesn't involve expressions).
1199
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001200Implemented by Thomas Wouters. Described by PEP 221.
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001201
1202
1203Extended Print Statement
1204------------------------
1205
1206Easily the most controversial new feature, this extension to the print
1207statement adds an option to make the output go to a different file
1208than the default sys.stdout.
1209
1210For example, to write an error message to sys.stderr, you can now
1211write:
1212
1213 print >> sys.stderr, "Error: bad dog!"
1214
1215As a special feature, if the expression used to indicate the file
Fred Drake45888ff2000-09-29 17:09:11 +00001216evaluates to None, the current value of sys.stdout is used. Thus:
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001217
1218 print >> None, "Hello world"
1219
1220is equivalent to
1221
1222 print "Hello world"
1223
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001224Design and implementation by Barry Warsaw. Described by PEP 214.
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001225
1226
1227Optional Collection of Cyclical Garbage
1228---------------------------------------
1229
1230Python is now equipped with a garbage collector that can hunt down
1231cyclical references between Python objects. It's no replacement for
1232reference counting; in fact, it depends on the reference counts being
1233correct, and decides that a set of objects belong to a cycle if all
1234their reference counts can be accounted for from their references to
1235each other. This devious scheme was first proposed by Eric Tiedemann,
1236and brought to implementation by Neil Schemenauer.
1237
1238There's a module "gc" that lets you control some parameters of the
1239garbage collection. There's also an option to the configure script
1240that lets you enable or disable the garbage collection. In 2.0b1,
1241it's on by default, so that we (hopefully) can collect decent user
1242experience with this new feature. There are some questions about its
Fred Drake9f11cf82000-09-29 17:54:40 +00001243performance. If it proves to be too much of a problem, we'll turn it
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001244off by default in the final 2.0 release.
1245
1246
1247Smaller Changes
1248---------------
1249
1250A new function zip() was added. zip(seq1, seq2, ...) is equivalent to
1251map(None, seq1, seq2, ...) when the sequences have the same length;
1252i.e. zip([1,2,3], [10,20,30]) returns [(1,10), (2,20), (3,30)]. When
1253the lists are not all the same length, the shortest list wins:
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001254zip([1,2,3], [10,20]) returns [(1,10), (2,20)]. See PEP 201.
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001255
1256sys.version_info is a tuple (major, minor, micro, level, serial).
1257
1258Dictionaries have an odd new method, setdefault(key, default).
1259dict.setdefault(key, default) returns dict[key] if it exists; if not,
1260it sets dict[key] to default and returns that value. Thus:
1261
1262 dict.setdefault(key, []).append(item)
1263
1264does the same work as this common idiom:
1265
1266 if not dict.has_key(key):
1267 dict[key] = []
1268 dict[key].append(item)
1269
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001270There are two new variants of SyntaxError that are raised for
1271indentation-related errors: IndentationError and TabError.
1272
1273Changed \x to consume exactly two hex digits; see PEP 223. Added \U
1274escape that consumes exactly eight hex digits.
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001275
1276The limits on the size of expressions and file in Python source code
1277have been raised from 2**16 to 2**32. Previous versions of Python
1278were limited because the maximum argument size the Python VM accepted
1279was 2**16. This limited the size of object constructor expressions,
1280e.g. [1,2,3] or {'a':1, 'b':2}, and the size of source files. This
1281limit was raised thanks to a patch by Charles Waldman that effectively
1282fixes the problem. It is now much more likely that you will be
1283limited by available memory than by an arbitrary limit in Python.
1284
1285The interpreter's maximum recursion depth can be modified by Python
1286programs using sys.getrecursionlimit and sys.setrecursionlimit. This
1287limit is the maximum number of recursive calls that can be made by
1288Python code. The limit exists to prevent infinite recursion from
1289overflowing the C stack and causing a core dump. The default value is
12901000. The maximum safe value for a particular platform can be found
1291by running Misc/find_recursionlimit.py.
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001292
1293New Modules and Packages
1294------------------------
1295
1296atexit - for registering functions to be called when Python exits.
1297
1298imputil - Greg Stein's alternative API for writing custom import
1299hooks.
1300
1301pyexpat - an interface to the Expat XML parser, contributed by Paul
1302Prescod.
1303
1304xml - a new package with XML support code organized (so far) in three
1305subpackages: xml.dom, xml.sax, and xml.parsers. Describing these
1306would fill a volume. There's a special feature whereby a
1307user-installed package named _xmlplus overrides the standard
1308xmlpackage; this is intended to give the XML SIG a hook to distribute
1309backwards-compatible updates to the standard xml package.
1310
1311webbrowser - a platform-independent API to launch a web browser.
1312
1313
Guido van Rossume905e952000-09-05 12:42:46 +00001314Changed Modules
1315---------------
1316
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001317array -- new methods for array objects: count, extend, index, pop, and
1318remove
1319
1320binascii -- new functions b2a_hex and a2b_hex that convert between
1321binary data and its hex representation
1322
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001323calendar -- Many new functions that support features including control
1324over which day of the week is the first day, returning strings instead
1325of printing them. Also new symbolic constants for days of week,
1326e.g. MONDAY, ..., SUNDAY.
1327
1328cgi -- FieldStorage objects have a getvalue method that works like a
1329dictionary's get method and returns the value attribute of the object.
1330
1331ConfigParser -- The parser object has new methods has_option,
1332remove_section, remove_option, set, and write. They allow the module
1333to be used for writing config files as well as reading them.
1334
1335ftplib -- ntransfercmd(), transfercmd(), and retrbinary() all now
Guido van Rossume905e952000-09-05 12:42:46 +00001336optionally support the RFC 959 REST command.
1337
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001338gzip -- readline and readlines now accept optional size arguments
Guido van Rossume905e952000-09-05 12:42:46 +00001339
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001340httplib -- New interfaces and support for HTTP/1.1 by Greg Stein. See
1341the module doc strings for details.
Guido van Rossum830ca2a2000-09-05 15:34:16 +00001342
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001343locale -- implement getdefaultlocale for Win32 and Macintosh
1344
1345marshal -- no longer dumps core when marshaling deeply nested or
1346recursive data structures
1347
1348os -- new functions isatty, seteuid, setegid, setreuid, setregid
1349
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001350os/popen2 -- popen2/popen3/popen4 support under Windows. popen2/popen3
1351support under Unix.
1352
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001353os/pty -- support for openpty and forkpty
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001354
1355os.path -- fix semantics of os.path.commonprefix
1356
1357smtplib -- support for sending very long messages
1358
1359socket -- new function getfqdn()
1360
1361readline -- new functions to read, write and truncate history files.
1362The readline section of the library reference manual contains an
1363example.
1364
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001365select -- add interface to poll system call
1366
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001367shutil -- new copyfileobj function
1368
1369SimpleHTTPServer, CGIHTTPServer -- Fix problems with buffering in the
1370HTTP server.
1371
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001372Tkinter -- optimization of function flatten
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001373
1374urllib -- scans environment variables for proxy configuration,
Tim Peters8b092332000-09-05 20:15:25 +00001375e.g. http_proxy.
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001376
1377whichdb -- recognizes dumbdbm format
Guido van Rossume905e952000-09-05 12:42:46 +00001378
1379
1380Obsolete Modules
1381----------------
1382
1383None. However note that 1.6 made a whole slew of modules obsolete:
1384stdwin, soundex, cml, cmpcache, dircache, dump, find, grep, packmail,
1385poly, zmod, strop, util, whatsound.
1386
1387
1388Changed, New, Obsolete Tools
1389----------------------------
1390
Tim Peters8b092332000-09-05 20:15:25 +00001391None.
Guido van Rossume905e952000-09-05 12:42:46 +00001392
1393
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001394C-level Changes
1395---------------
1396
1397Several cleanup jobs were carried out throughout the source code.
1398
1399All C code was converted to ANSI C; we got rid of all uses of the
1400Py_PROTO() macro, which makes the header files a lot more readable.
1401
1402Most of the portability hacks were moved to a new header file,
1403pyport.h; several other new header files were added and some old
1404header files were removed, in an attempt to create a more rational set
1405of header files. (Few of these ever need to be included explicitly;
1406they are all included by Python.h.)
1407
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001408Trent Mick ensured portability to 64-bit platforms, under both Linux
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001409and Win64, especially for the new Intel Itanium processor. Mick also
1410added large file support for Linux64 and Win64.
Guido van Rossumf2ffce02000-09-05 04:38:34 +00001411
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001412The C APIs to return an object's size have been update to consistently
1413use the form PyXXX_Size, e.g. PySequence_Size and PyDict_Size. In
1414previous versions, the abstract interfaces used PyXXX_Length and the
1415concrete interfaces used PyXXX_Size. The old names,
1416e.g. PyObject_Length, are still available for backwards compatibility
1417at the API level, but are deprecated.
1418
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001419The PyOS_CheckStack function has been implemented on Windows by
1420Fredrik Lundh. It prevents Python from failing with a stack overflow
1421on Windows.
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001422
1423The GC changes resulted in creation of two new slots on object,
1424tp_traverse and tp_clear. The augmented assignment changes result in
Guido van Rossum4338a282000-09-06 13:02:08 +00001425the creation of a new slot for each in-place operator.
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001426
1427The GC API creates new requirements for container types implemented in
Guido van Rossum4338a282000-09-06 13:02:08 +00001428C extension modules. See Include/objimpl.h for details.
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001429
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001430PyErr_Format has been updated to automatically calculate the size of
1431the buffer needed to hold the formatted result string. This change
1432prevents crashes caused by programmer error.
Jeremy Hyltonbdebd542000-09-05 18:28:54 +00001433
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001434New C API calls: PyObject_AsFileDescriptor, PyErr_WriteUnraisable.
Guido van Rossume905e952000-09-05 12:42:46 +00001435
Jeremy Hylton24c3d602000-09-05 19:36:26 +00001436PyRun_AnyFileEx, PyRun_SimpleFileEx, PyRun_FileEx -- New functions
1437that are the same as their non-Ex counterparts except they take an
1438extra flag argument that tells them to close the file when done.
1439
1440XXX There were other API changes that should be fleshed out here.
Guido van Rossumab9d6f01998-08-10 22:01:13 +00001441
Tim Peters8b092332000-09-05 20:15:25 +00001442
1443Windows Changes
1444---------------
1445
1446New popen2/popen3/peopen4 in os module (see Changed Modules above).
1447
1448os.popen is much more usable on Windows 95 and 98. See Microsoft
1449Knowledge Base article Q150956. The Win9x workaround described there
1450is implemented by the new w9xpopen.exe helper in the root of your
1451Python installation. Note that Python uses this internally; it is not
1452a standalone program.
1453
1454Administrator privileges are no longer required to install Python
1455on Windows NT or Windows 2000. If you have administrator privileges,
1456Python's registry info will be written under HKEY_LOCAL_MACHINE.
1457Otherwise the installer backs off to writing Python's registry info
Guido van Rossum4338a282000-09-06 13:02:08 +00001458under HKEY_CURRENT_USER. The latter is sufficient for all "normal"
Tim Peters8b092332000-09-05 20:15:25 +00001459uses of Python, but will prevent some advanced uses from working
1460(for example, running a Python script as an NT service, or possibly
1461from CGI).
1462
1463[This was new in 1.6] The installer no longer runs a separate Tcl/Tk
1464installer; instead, it installs the needed Tcl/Tk files directly in the
1465Python directory. If you already have a Tcl/Tk installation, this
1466wastes some disk space (about 4 Megs) but avoids problems with
1467conflicting Tcl/Tk installations, and makes it much easier for Python
1468to ensure that Tcl/Tk can find all its files.
1469
1470[This was new in 1.6] The Windows installer now installs by default in
1471\Python20\ on the default volume, instead of \Program Files\Python-2.0\.
1472
Guido van Rossumf62ed9c2000-09-26 11:16:10 +00001473
1474Updates to the changes between 1.5.2 and 1.6
1475--------------------------------------------
1476
1477The 1.6 NEWS file can't be changed after the release is done, so here
1478is some late-breaking news:
1479
1480New APIs in locale.py: normalize(), getdefaultlocale(), resetlocale(),
1481and changes to getlocale() and setlocale().
1482
1483The new module is now enabled per default.
1484
1485It is not true that the encodings codecs cannot be used for normal
1486strings: the string.encode() (which is also present on 8-bit strings
1487!) allows using them for 8-bit strings too, e.g. to convert files from
1488cp1252 (Windows) to latin-1 or vice-versa.
1489
1490Japanese codecs are available from Tamito KAJIYAMA:
1491http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/python/
1492
1493
Guido van Rossumab9d6f01998-08-10 22:01:13 +00001494======================================================================