[Python-checkins] r52197 - in python/branches/pep302_phase2: Doc/lib/libimp.tex Doc/lib/liblogging.tex Lib/distutils/command/wininst-8.exe Lib/email/utils.py Lib/logging/__init__.py Lib/test/list_tests.py Lib/test/test_builtin.py Lib/test/test_imp.py Lib/test/test_long.py Lib/test/test_syntax.py Misc/NEWS Modules/_sre.c Modules/cPickle.c Modules/linuxaudiodev.c Modules/ossaudiodev.c Objects/abstract.c Objects/fileobject.c Objects/intobject.c Objects/listobject.c Objects/longobject.c Objects/stringobject.c Objects/typeobject.c Objects/unicodeobject.c PC/bdist_wininst/wininst-8.sln PC/bdist_wininst/wininst-8.vcproj Python/compile.c Python/errors.c Python/getargs.c Python/import.c Python/marshal.c Python/modsupport.c Python/mystrtoul.c Python/sysmodule.c Tools/msi/uuids.py

brett.cannon python-checkins at python.org
Fri Oct 6 00:51:51 CEST 2006


Author: brett.cannon
Date: Fri Oct  6 00:51:44 2006
New Revision: 52197

Added:
   python/branches/pep302_phase2/Lib/distutils/command/wininst-8.exe
      - copied unchanged from r52196, python/trunk/Lib/distutils/command/wininst-8.exe
   python/branches/pep302_phase2/PC/bdist_wininst/wininst-8.sln
      - copied unchanged from r52196, python/trunk/PC/bdist_wininst/wininst-8.sln
   python/branches/pep302_phase2/PC/bdist_wininst/wininst-8.vcproj
      - copied unchanged from r52196, python/trunk/PC/bdist_wininst/wininst-8.vcproj
Modified:
   python/branches/pep302_phase2/   (props changed)
   python/branches/pep302_phase2/Doc/lib/libimp.tex
   python/branches/pep302_phase2/Doc/lib/liblogging.tex
   python/branches/pep302_phase2/Lib/email/utils.py
   python/branches/pep302_phase2/Lib/logging/__init__.py
   python/branches/pep302_phase2/Lib/test/list_tests.py
   python/branches/pep302_phase2/Lib/test/test_builtin.py
   python/branches/pep302_phase2/Lib/test/test_imp.py
   python/branches/pep302_phase2/Lib/test/test_long.py
   python/branches/pep302_phase2/Lib/test/test_syntax.py
   python/branches/pep302_phase2/Misc/NEWS
   python/branches/pep302_phase2/Modules/_sre.c
   python/branches/pep302_phase2/Modules/cPickle.c
   python/branches/pep302_phase2/Modules/linuxaudiodev.c
   python/branches/pep302_phase2/Modules/ossaudiodev.c
   python/branches/pep302_phase2/Objects/abstract.c
   python/branches/pep302_phase2/Objects/fileobject.c
   python/branches/pep302_phase2/Objects/intobject.c
   python/branches/pep302_phase2/Objects/listobject.c
   python/branches/pep302_phase2/Objects/longobject.c
   python/branches/pep302_phase2/Objects/stringobject.c
   python/branches/pep302_phase2/Objects/typeobject.c
   python/branches/pep302_phase2/Objects/unicodeobject.c
   python/branches/pep302_phase2/Python/compile.c
   python/branches/pep302_phase2/Python/errors.c
   python/branches/pep302_phase2/Python/getargs.c
   python/branches/pep302_phase2/Python/import.c
   python/branches/pep302_phase2/Python/marshal.c
   python/branches/pep302_phase2/Python/modsupport.c
   python/branches/pep302_phase2/Python/mystrtoul.c
   python/branches/pep302_phase2/Python/sysmodule.c
   python/branches/pep302_phase2/Tools/msi/uuids.py
Log:
Merged revisions 52092-52196 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk



Modified: python/branches/pep302_phase2/Doc/lib/libimp.tex
==============================================================================
--- python/branches/pep302_phase2/Doc/lib/libimp.tex	(original)
+++ python/branches/pep302_phase2/Doc/lib/libimp.tex	Fri Oct  6 00:51:44 2006
@@ -161,10 +161,10 @@
 
 \begin{funcdesc}{init_builtin}{name}
 Initialize the built-in module called \var{name} and return its module
-object.  If the module was already initialized, it will be initialized
-\emph{again}.  A few modules cannot be initialized twice --- attempting
-to initialize these again will raise an \exception{ImportError}
-exception.  If there is no
+object along with storing it in \code{sys.modules}.  If the module was already
+initialized, it will be initialized \emph{again}.  Re-initialization involves
+the copying of the built-in module's \code{__dict__} from the cached
+module over the module's entry in \code{sys.modules}.  If there is no
 built-in module called \var{name}, \code{None} is returned.
 \end{funcdesc}
 
@@ -208,14 +208,15 @@
 \begin{funcdesc}{load_dynamic}{name, pathname\optional{, file}}
 Load and initialize a module implemented as a dynamically loadable
 shared library and return its module object.  If the module was
-already initialized, it will be initialized \emph{again}.  Some modules
-don't like that and may raise an exception.  The \var{pathname}
-argument must point to the shared library.  The \var{name} argument is
-used to construct the name of the initialization function: an external
-C function called \samp{init\var{name}()} in the shared library is
-called.  The optional \var{file} argument is ignored.  (Note: using
-shared libraries is highly system dependent, and not all systems
-support it.)
+already initialized, it will be initialized \emph{again}.
+Re-initialization involves copying the \code{__dict__} attribute of the cached
+instance of the module over the value used in the module cached in
+\code{sys.modules}.  The \var{pathname} argument must point to the shared
+library.  The \var{name} argument is used to construct the name of the
+initialization function: an external C function called
+\samp{init\var{name}()} in the shared library is called.  The optional
+\var{file} argument is ignored.  (Note: using shared libraries is highly
+system dependent, and not all systems support it.)
 \end{funcdesc}
 
 \begin{funcdesc}{load_source}{name, pathname\optional{, file}}

Modified: python/branches/pep302_phase2/Doc/lib/liblogging.tex
==============================================================================
--- python/branches/pep302_phase2/Doc/lib/liblogging.tex	(original)
+++ python/branches/pep302_phase2/Doc/lib/liblogging.tex	Fri Oct  6 00:51:44 2006
@@ -528,8 +528,8 @@
 \method{filter()}.
 \end{methoddesc}
 
-\begin{methoddesc}{makeRecord}{name, lvl, fn, lno, msg, args, exc_info,
-                               func, extra}
+\begin{methoddesc}{makeRecord}{name, lvl, fn, lno, msg, args, exc_info
+                               \optional{, func, extra}}
 This is a factory method which can be overridden in subclasses to create
 specialized \class{LogRecord} instances.
 \versionchanged[\var{func} and \var{extra} were added]{2.5}
@@ -1479,7 +1479,7 @@
 information to be logged.
 
 \begin{classdesc}{LogRecord}{name, lvl, pathname, lineno, msg, args,
-                             exc_info}
+                             exc_info \optional{, func}}
 Returns an instance of \class{LogRecord} initialized with interesting
 information. The \var{name} is the logger name; \var{lvl} is the
 numeric level; \var{pathname} is the absolute pathname of the source
@@ -1489,7 +1489,9 @@
 which, together with \var{msg}, makes up the user message; and
 \var{exc_info} is the exception tuple obtained by calling
 \function{sys.exc_info() }(or \constant{None}, if no exception information
-is available).
+is available). The \var{func} is the name of the function from which the
+logging call was made. If not specified, it defaults to \var{None}.
+\versionchanged[\var{func} was added]{2.5}
 \end{classdesc}
 
 \begin{methoddesc}{getMessage}{}

Modified: python/branches/pep302_phase2/Lib/email/utils.py
==============================================================================
--- python/branches/pep302_phase2/Lib/email/utils.py	(original)
+++ python/branches/pep302_phase2/Lib/email/utils.py	Fri Oct  6 00:51:44 2006
@@ -235,10 +235,6 @@
     parts = s.split(TICK, 2)
     if len(parts) <= 2:
         return None, None, s
-    if len(parts) > 3:
-        charset, language = parts[:2]
-        s = TICK.join(parts[2:])
-        return charset, language, s
     return parts
 
 

Modified: python/branches/pep302_phase2/Lib/logging/__init__.py
==============================================================================
--- python/branches/pep302_phase2/Lib/logging/__init__.py	(original)
+++ python/branches/pep302_phase2/Lib/logging/__init__.py	Fri Oct  6 00:51:44 2006
@@ -214,7 +214,7 @@
     information to be logged.
     """
     def __init__(self, name, level, pathname, lineno,
-                 msg, args, exc_info, func):
+                 msg, args, exc_info, func=None):
         """
         Initialize a logging record with interesting information.
         """

Modified: python/branches/pep302_phase2/Lib/test/list_tests.py
==============================================================================
--- python/branches/pep302_phase2/Lib/test/list_tests.py	(original)
+++ python/branches/pep302_phase2/Lib/test/list_tests.py	Fri Oct  6 00:51:44 2006
@@ -269,7 +269,6 @@
         self.assertRaises(TypeError, a.insert)
 
     def test_pop(self):
-        from decimal import Decimal
         a = self.type2test([-1, 0, 1])
         a.pop()
         self.assertEqual(a, [-1, 0])
@@ -281,8 +280,6 @@
         self.assertRaises(IndexError, a.pop)
         self.assertRaises(TypeError, a.pop, 42, 42)
         a = self.type2test([0, 10, 20, 30, 40])
-        self.assertEqual(a.pop(Decimal(2)), 20)
-        self.assertRaises(IndexError, a.pop, Decimal(25))
 
     def test_remove(self):
         a = self.type2test([0, 0, 1])

Modified: python/branches/pep302_phase2/Lib/test/test_builtin.py
==============================================================================
--- python/branches/pep302_phase2/Lib/test/test_builtin.py	(original)
+++ python/branches/pep302_phase2/Lib/test/test_builtin.py	Fri Oct  6 00:51:44 2006
@@ -116,6 +116,7 @@
         self.assertEqual(abs(0), 0)
         self.assertEqual(abs(1234), 1234)
         self.assertEqual(abs(-1234), 1234)
+        self.assertTrue(abs(-sys.maxint-1) > 0)
         # float
         self.assertEqual(abs(0.0), 0.0)
         self.assertEqual(abs(3.14), 3.14)
@@ -155,6 +156,11 @@
         S = [10, 20, 30]
         self.assertEqual(any(x > 42 for x in S), False)
 
+    def test_neg(self):
+        x = -sys.maxint-1
+        self.assert_(isinstance(x, int))
+        self.assertEqual(-x, sys.maxint+1)
+
     def test_apply(self):
         def f0(*args):
             self.assertEqual(args, ())
@@ -701,9 +707,11 @@
                         pass
 
         s = repr(-1-sys.maxint)
-        self.assertEqual(int(s)+1, -sys.maxint)
+        x = int(s)
+        self.assertEqual(x+1, -sys.maxint)
+        self.assert_(isinstance(x, int))
         # should return long
-        int(s[1:])
+        self.assertEqual(int(s[1:]), sys.maxint+1)
 
         # should return long
         x = int(1e100)

Modified: python/branches/pep302_phase2/Lib/test/test_imp.py
==============================================================================
--- python/branches/pep302_phase2/Lib/test/test_imp.py	(original)
+++ python/branches/pep302_phase2/Lib/test/test_imp.py	Fri Oct  6 00:51:44 2006
@@ -1,43 +1,47 @@
 import imp
-from test.test_support import TestFailed, TestSkipped
-try:
-    import thread
-except ImportError:
-    raise TestSkipped("test only valid when thread support is available")
-
-def verify_lock_state(expected):
-    if imp.lock_held() != expected:
-        raise TestFailed("expected imp.lock_held() to be %r" % expected)
-
-def testLock():
-    LOOPS = 50
-
-    # The import lock may already be held, e.g. if the test suite is run
-    # via "import test.autotest".
-    lock_held_at_start = imp.lock_held()
-    verify_lock_state(lock_held_at_start)
-
-    for i in range(LOOPS):
-        imp.acquire_lock()
-        verify_lock_state(True)
+import thread
+import unittest
+from test import test_support
 
-    for i in range(LOOPS):
-        imp.release_lock()
 
-    # The original state should be restored now.
-    verify_lock_state(lock_held_at_start)
+class LockTests(unittest.TestCase):
 
-    if not lock_held_at_start:
-        try:
+    """Very basic test of import lock functions."""
+
+    def verify_lock_state(self, expected):
+        self.failUnlessEqual(imp.lock_held(), expected,
+                             "expected imp.lock_held() to be %r" % expected)
+    def testLock(self):
+        LOOPS = 50
+
+        # The import lock may already be held, e.g. if the test suite is run
+        # via "import test.autotest".
+        lock_held_at_start = imp.lock_held()
+        self.verify_lock_state(lock_held_at_start)
+
+        for i in range(LOOPS):
+            imp.acquire_lock()
+            self.verify_lock_state(True)
+
+        for i in range(LOOPS):
             imp.release_lock()
-        except RuntimeError:
-            pass
-        else:
-            raise TestFailed("release_lock() without lock should raise "
-                             "RuntimeError")
+
+        # The original state should be restored now.
+        self.verify_lock_state(lock_held_at_start)
+
+        if not lock_held_at_start:
+            try:
+                imp.release_lock()
+            except RuntimeError:
+                pass
+            else:
+                self.fail("release_lock() without lock should raise "
+                            "RuntimeError")
 
 def test_main():
-    testLock()
+    test_support.run_unittest(
+                LockTests,
+            )
 
 if __name__ == "__main__":
     test_main()

Modified: python/branches/pep302_phase2/Lib/test/test_long.py
==============================================================================
--- python/branches/pep302_phase2/Lib/test/test_long.py	(original)
+++ python/branches/pep302_phase2/Lib/test/test_long.py	Fri Oct  6 00:51:44 2006
@@ -247,17 +247,23 @@
             "long(-sys.maxint-1) != -sys.maxint-1")
 
         # long -> int should not fail for hugepos_aslong or hugeneg_aslong
+        x = int(hugepos_aslong)
         try:
-            self.assertEqual(int(hugepos_aslong), hugepos,
+            self.assertEqual(x, hugepos,
                   "converting sys.maxint to long and back to int fails")
         except OverflowError:
             self.fail("int(long(sys.maxint)) overflowed!")
+        if not isinstance(x, int):
+            raise TestFailed("int(long(sys.maxint)) should have returned int")
+        x = int(hugeneg_aslong)
         try:
-            self.assertEqual(int(hugeneg_aslong), hugeneg,
+            self.assertEqual(x, hugeneg,
                   "converting -sys.maxint-1 to long and back to int fails")
         except OverflowError:
             self.fail("int(long(-sys.maxint-1)) overflowed!")
-
+        if not isinstance(x, int):
+            raise TestFailed("int(long(-sys.maxint-1)) should have "
+                             "returned int")
         # but long -> int should overflow for hugepos+1 and hugeneg-1
         x = hugepos_aslong + 1
         try:
@@ -282,6 +288,17 @@
         self.assert_(type(y) is long,
             "overflowing int conversion must return long not long subtype")
 
+        # long -> Py_ssize_t conversion
+        class X(object):
+            def __getslice__(self, i, j):
+                return i, j
+
+        self.assertEqual(X()[-5L:7L], (-5, 7))
+        # use the clamping effect to test the smallest and largest longs
+        # that fit a Py_ssize_t
+        slicemin, slicemax = X()[-2L**100:2L**100]
+        self.assertEqual(X()[slicemin:slicemax], (slicemin, slicemax))
+
 # ----------------------------------- tests of auto int->long conversion
 
     def test_auto_overflow(self):

Modified: python/branches/pep302_phase2/Lib/test/test_syntax.py
==============================================================================
--- python/branches/pep302_phase2/Lib/test/test_syntax.py	(original)
+++ python/branches/pep302_phase2/Lib/test/test_syntax.py	Fri Oct  6 00:51:44 2006
@@ -322,6 +322,20 @@
       ...
     SyntaxError: 'continue' not supported inside 'finally' clause (<doctest test.test_syntax[41]>, line 8)
 
+There is one test for a break that is not in a loop.  The compiler
+uses a single data structure to keep track of try-finally and loops,
+so we need to be sure that a break is actually inside a loop.  If it
+isn't, there should be a syntax error.
+
+   >>> try:
+   ...     print 1
+   ...     break
+   ...     print 2
+   ... finally:
+   ...     print 3
+   Traceback (most recent call last):
+     ...
+   SyntaxError: 'break' outside loop (<doctest test.test_syntax[42]>, line 3)
 """
 
 import re

Modified: python/branches/pep302_phase2/Misc/NEWS
==============================================================================
--- python/branches/pep302_phase2/Misc/NEWS	(original)
+++ python/branches/pep302_phase2/Misc/NEWS	Fri Oct  6 00:51:44 2006
@@ -12,6 +12,15 @@
 Core and builtins
 -----------------
 
+- list.pop(x) accepts any object x following the __index__ protocol.
+
+- Fix some leftovers from the conversion from int to Py_ssize_t
+  (relevant to strings and sequences of more than 2**31 items).
+
+- A number of places, including integer negation and absolute value,
+  were fixed to not rely on undefined behaviour of the C compiler
+  anymore.
+
 - Bug #1566800: make sure that EnvironmentError can be called with any
   number of arguments, as was the case in Python 2.4.
 
@@ -63,6 +72,8 @@
 Library
 -------
 
+- Support for MSVC 8 was added to bdist_wininst.
+
 - Bug #1446043: correctly raise a LookupError if an encoding name given
   to encodings.search_function() contains a dot.
 
@@ -139,6 +150,8 @@
 Tests
 -----
 
+- Converted test_imp to use unittest.
+
 - Fix bsddb test_basics.test06_Transactions to check the version
   number properly.
 

Modified: python/branches/pep302_phase2/Modules/_sre.c
==============================================================================
--- python/branches/pep302_phase2/Modules/_sre.c	(original)
+++ python/branches/pep302_phase2/Modules/_sre.c	Fri Oct  6 00:51:44 2006
@@ -1166,9 +1166,10 @@
 
             /* install new repeat context */
             ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep));
-            /* XXX(nnorwitz): anything else we need to do on error? */
-            if (!ctx->u.rep)
+            if (!ctx->u.rep) {
+                PyErr_NoMemory();
                 RETURN_FAILURE;
+            }
             ctx->u.rep->count = -1;
             ctx->u.rep->pattern = ctx->pattern;
             ctx->u.rep->prev = state->repeat;
@@ -1884,6 +1885,8 @@
     }
 
     TRACE(("|%p|%p|END\n", PatternObject_GetCode(self), state.ptr));
+    if (PyErr_Occurred())
+        return NULL;
 
     state_fini(&state);
 
@@ -1922,6 +1925,9 @@
 
     state_fini(&state);
 
+    if (PyErr_Occurred())
+        return NULL;
+
     return pattern_new_match(self, &state, status);
 }
 
@@ -2071,6 +2077,9 @@
 #endif
         }
 
+	if (PyErr_Occurred())
+	    goto error;
+
         if (status <= 0) {
             if (status == 0)
                 break;
@@ -2198,6 +2207,9 @@
 #endif
         }
 
+	if (PyErr_Occurred())
+	    goto error;
+
         if (status <= 0) {
             if (status == 0)
                 break;
@@ -2347,6 +2359,9 @@
 #endif
         }
 
+	if (PyErr_Occurred())
+	    goto error;
+
         if (status <= 0) {
             if (status == 0)
                 break;
@@ -3250,6 +3265,8 @@
         status = sre_umatch(state, PatternObject_GetCode(self->pattern));
 #endif
     }
+    if (PyErr_Occurred())
+        return NULL;
 
     match = pattern_new_match((PatternObject*) self->pattern,
                                state, status);
@@ -3281,6 +3298,8 @@
         status = sre_usearch(state, PatternObject_GetCode(self->pattern));
 #endif
     }
+    if (PyErr_Occurred())
+        return NULL;
 
     match = pattern_new_match((PatternObject*) self->pattern,
                                state, status);

Modified: python/branches/pep302_phase2/Modules/cPickle.c
==============================================================================
--- python/branches/pep302_phase2/Modules/cPickle.c	(original)
+++ python/branches/pep302_phase2/Modules/cPickle.c	Fri Oct  6 00:51:44 2006
@@ -1024,7 +1024,7 @@
 static int
 save_long(Picklerobject *self, PyObject *args)
 {
-	int size;
+	Py_ssize_t size;
 	int res = -1;
 	PyObject *repr = NULL;
 
@@ -1066,7 +1066,7 @@
 		 * byte at the start, and cut it back later if possible.
 		 */
 		nbytes = (nbits >> 3) + 1;
-		if ((int)nbytes < 0 || (size_t)(int)nbytes != nbytes) {
+		if (nbytes > INT_MAX) {
 			PyErr_SetString(PyExc_OverflowError, "long too large "
 				"to pickle");
 			goto finally;
@@ -1208,12 +1208,14 @@
 			c_str[1] = size;
 			len = 2;
 		}
-		else {
+		else if (size <= INT_MAX) {
 			c_str[0] = BINSTRING;
 			for (i = 1; i < 5; i++)
 				c_str[i] = (int)(size >> ((i - 1) * 8));
 			len = 5;
 		}
+		else
+			return -1;    /* string too large */
 
 		if (self->write_func(self, c_str, len) < 0)
 			return -1;
@@ -1286,7 +1288,7 @@
 static int
 save_unicode(Picklerobject *self, PyObject *args, int doput)
 {
-	int size, len;
+	Py_ssize_t size, len;
 	PyObject *repr=0;
 
 	if (!PyUnicode_Check(args))
@@ -1325,6 +1327,8 @@
 
 		if ((size = PyString_Size(repr)) < 0)
 			goto err;
+		if (size > INT_MAX)
+			return -1;   /* string too large */
 
 		c_str[0] = BINUNICODE;
 		for (i = 1; i < 5; i++)

Modified: python/branches/pep302_phase2/Modules/linuxaudiodev.c
==============================================================================
--- python/branches/pep302_phase2/Modules/linuxaudiodev.c	(original)
+++ python/branches/pep302_phase2/Modules/linuxaudiodev.c	Fri Oct  6 00:51:44 2006
@@ -28,7 +28,9 @@
 #if defined(linux)
 #include <linux/soundcard.h>
 
+#ifndef HAVE_STDINT_H
 typedef unsigned long uint32_t;
+#endif
 
 #elif defined(__FreeBSD__)
 #include <machine/soundcard.h>

Modified: python/branches/pep302_phase2/Modules/ossaudiodev.c
==============================================================================
--- python/branches/pep302_phase2/Modules/ossaudiodev.c	(original)
+++ python/branches/pep302_phase2/Modules/ossaudiodev.c	Fri Oct  6 00:51:44 2006
@@ -34,7 +34,9 @@
 
 #if defined(linux)
 
+#ifndef HAVE_STDINT_H
 typedef unsigned long uint32_t;
+#endif
 
 #elif defined(__FreeBSD__)
 

Modified: python/branches/pep302_phase2/Objects/abstract.c
==============================================================================
--- python/branches/pep302_phase2/Objects/abstract.c	(original)
+++ python/branches/pep302_phase2/Objects/abstract.c	Fri Oct  6 00:51:44 2006
@@ -1652,20 +1652,18 @@
 		if (cmp > 0) {
 			switch (operation) {
 			case PY_ITERSEARCH_COUNT:
-				++n;
-				if (n <= 0) {
-					/* XXX(nnorwitz): int means ssize_t */
+				if (n == PY_SSIZE_T_MAX) {
 					PyErr_SetString(PyExc_OverflowError,
-				                "count exceeds C int size");
+					       "count exceeds C integer size");
 					goto Fail;
 				}
+				++n;
 				break;
 
 			case PY_ITERSEARCH_INDEX:
 				if (wrapped) {
-					/* XXX(nnorwitz): int means ssize_t */
 					PyErr_SetString(PyExc_OverflowError,
-			                	"index exceeds C int size");
+					       "index exceeds C integer size");
 					goto Fail;
 				}
 				goto Done;
@@ -1680,9 +1678,9 @@
 		}
 
 		if (operation == PY_ITERSEARCH_INDEX) {
-			++n;
-			if (n <= 0)
+			if (n == PY_SSIZE_T_MAX)
 				wrapped = 1;
+			++n;
 		}
 	}
 

Modified: python/branches/pep302_phase2/Objects/fileobject.c
==============================================================================
--- python/branches/pep302_phase2/Objects/fileobject.c	(original)
+++ python/branches/pep302_phase2/Objects/fileobject.c	Fri Oct  6 00:51:44 2006
@@ -1001,6 +1001,7 @@
 	size_t nfree;	/* # of free buffer slots; pvend-pvfree */
 	size_t total_v_size;  /* total # of slots in buffer */
 	size_t increment;	/* amount to increment the buffer */
+	size_t prev_v_size;
 
 	/* Optimize for normal case:  avoid _PyString_Resize if at all
 	 * possible via first reading into stack buffer "buf".
@@ -1115,8 +1116,11 @@
 		/* expand buffer and try again */
 		assert(*(pvend-1) == '\0');
 		increment = total_v_size >> 2;	/* mild exponential growth */
+		prev_v_size = total_v_size;
 		total_v_size += increment;
-		if (total_v_size > PY_SSIZE_T_MAX) {
+		/* check for overflow */
+		if (total_v_size <= prev_v_size ||
+		    total_v_size > PY_SSIZE_T_MAX) {
 			PyErr_SetString(PyExc_OverflowError,
 			    "line is longer than a Python string can hold");
 			Py_DECREF(v);
@@ -1125,7 +1129,7 @@
 		if (_PyString_Resize(&v, (int)total_v_size) < 0)
 			return NULL;
 		/* overwrite the trailing null byte */
-		pvfree = BUF(v) + (total_v_size - increment - 1);
+		pvfree = BUF(v) + (prev_v_size - 1);
 	}
 	if (BUF(v) + total_v_size != p)
 		_PyString_Resize(&v, p - BUF(v));

Modified: python/branches/pep302_phase2/Objects/intobject.c
==============================================================================
--- python/branches/pep302_phase2/Objects/intobject.c	(original)
+++ python/branches/pep302_phase2/Objects/intobject.c	Fri Oct  6 00:51:44 2006
@@ -546,6 +546,17 @@
 	}
 }
 
+/* Integer overflow checking for unary negation: on a 2's-complement
+ * box, -x overflows iff x is the most negative long.  In this case we
+ * get -x == x.  However, -x is undefined (by C) if x /is/ the most
+ * negative long (it's a signed overflow case), and some compilers care.
+ * So we cast x to unsigned long first.  However, then other compilers
+ * warn about applying unary minus to an unsigned operand.  Hence the
+ * weird "0-".
+ */
+#define UNARY_NEG_WOULD_OVERFLOW(x)	\
+	((x) < 0 && (unsigned long)(x) == 0-(unsigned long)(x))
+
 /* Return type of i_divmod */
 enum divmod_result {
 	DIVMOD_OK,		/* Correct result */
@@ -565,7 +576,7 @@
 		return DIVMOD_ERROR;
 	}
 	/* (-sys.maxint-1)/-1 is the only overflow case. */
-	if (y == -1 && x == LONG_MIN)
+	if (y == -1 && UNARY_NEG_WOULD_OVERFLOW(x))
 		return DIVMOD_OVERFLOW;
 	xdivy = x / y;
 	xmody = x - xdivy * y;
@@ -754,10 +765,10 @@
 static PyObject *
 int_neg(PyIntObject *v)
 {
-	register long a, x;
+	register long a;
 	a = v->ob_ival;
-	x = -a;
-	if (a < 0 && x < 0) {
+        /* check for overflow */
+	if (UNARY_NEG_WOULD_OVERFLOW(a)) {
 		PyObject *o = PyLong_FromLong(a);
 		if (o != NULL) {
 			PyObject *result = PyNumber_Negative(o);
@@ -766,7 +777,7 @@
 		}
 		return NULL;
 	}
-	return PyInt_FromLong(x);
+	return PyInt_FromLong(-a);
 }
 
 static PyObject *

Modified: python/branches/pep302_phase2/Objects/listobject.c
==============================================================================
--- python/branches/pep302_phase2/Objects/listobject.c	(original)
+++ python/branches/pep302_phase2/Objects/listobject.c	Fri Oct  6 00:51:44 2006
@@ -863,17 +863,12 @@
 listpop(PyListObject *self, PyObject *args)
 {
 	Py_ssize_t i = -1;
-	PyObject *v, *arg = NULL;
+	PyObject *v;
 	int status;
 
-	if (!PyArg_UnpackTuple(args, "pop", 0, 1, &arg))
+	if (!PyArg_ParseTuple(args, "|n:pop", &i))
 		return NULL;
-	if (arg != NULL) {
-		if (PyInt_Check(arg))
-			i = PyInt_AS_LONG((PyIntObject*) arg);
-		else if (!PyArg_ParseTuple(args, "|n:pop", &i))
-   			return NULL;
-	}
+
 	if (self->ob_size == 0) {
 		/* Special-case most common failure cause */
 		PyErr_SetString(PyExc_IndexError, "pop from empty list");

Modified: python/branches/pep302_phase2/Objects/longobject.c
==============================================================================
--- python/branches/pep302_phase2/Objects/longobject.c	(original)
+++ python/branches/pep302_phase2/Objects/longobject.c	Fri Oct  6 00:51:44 2006
@@ -193,6 +193,18 @@
 	return (PyObject *)v;
 }
 
+/* Checking for overflow in PyLong_AsLong is a PITA since C doesn't define
+ * anything about what happens when a signed integer operation overflows,
+ * and some compilers think they're doing you a favor by being "clever"
+ * then.  The bit pattern for the largest postive signed long is
+ * (unsigned long)LONG_MAX, and for the smallest negative signed long
+ * it is abs(LONG_MIN), which we could write -(unsigned long)LONG_MIN.
+ * However, some other compilers warn about applying unary minus to an
+ * unsigned operand.  Hence the weird "0-".
+ */
+#define PY_ABS_LONG_MIN		(0-(unsigned long)LONG_MIN)
+#define PY_ABS_SSIZE_T_MIN	(0-(size_t)PY_SSIZE_T_MIN)
+
 /* Get a C long int from a long int object.
    Returns -1 and sets an error condition if overflow occurs. */
 
@@ -225,14 +237,16 @@
 		if ((x >> SHIFT) != prev)
 			goto overflow;
 	}
-	/* Haven't lost any bits, but if the sign bit is set we're in
-	 * trouble *unless* this is the min negative number.  So,
-	 * trouble iff sign bit set && (positive || some bit set other
-	 * than the sign bit).
-	 */
-	if ((long)x < 0 && (sign > 0 || (x << 1) != 0))
-		goto overflow;
-	return (long)x * sign;
+	/* Haven't lost any bits, but casting to long requires extra care
+	 * (see comment above).
+         */
+	if (x <= (unsigned long)LONG_MAX) {
+		return (long)x * sign;
+	}
+	else if (sign < 0 && x == PY_ABS_LONG_MIN) {
+		return LONG_MIN;
+	}
+	/* else overflow */
 
  overflow:
 	PyErr_SetString(PyExc_OverflowError,
@@ -268,14 +282,16 @@
 		if ((x >> SHIFT) != prev)
 			goto overflow;
 	}
-	/* Haven't lost any bits, but if the sign bit is set we're in
-	 * trouble *unless* this is the min negative number.  So,
-	 * trouble iff sign bit set && (positive || some bit set other
-	 * than the sign bit).
+	/* Haven't lost any bits, but casting to a signed type requires
+	 * extra care (see comment above).
 	 */
-	if ((Py_ssize_t)x < 0 && (sign > 0 || (x << 1) != 0))
-		goto overflow;
-	return (Py_ssize_t)x * sign;
+	if (x <= (size_t)PY_SSIZE_T_MAX) {
+		return (Py_ssize_t)x * sign;
+	}
+	else if (sign < 0 && x == PY_ABS_SSIZE_T_MIN) {
+		return PY_SSIZE_T_MIN;
+	}
+	/* else overflow */
 
  overflow:
 	PyErr_SetString(PyExc_OverflowError,
@@ -1167,7 +1183,7 @@
 {
 	register PyLongObject *a = (PyLongObject *)aa;
 	PyStringObject *str;
-	Py_ssize_t i;
+	Py_ssize_t i, j, sz;
 	Py_ssize_t size_a;
 	char *p;
 	int bits;
@@ -1187,11 +1203,18 @@
 		++bits;
 		i >>= 1;
 	}
-	i = 5 + (addL ? 1 : 0) + (size_a*SHIFT + bits-1) / bits;
-	str = (PyStringObject *) PyString_FromStringAndSize((char *)0, i);
+	i = 5 + (addL ? 1 : 0);
+	j = size_a*SHIFT + bits-1;
+	sz = i + j / bits;
+	if (j / SHIFT < size_a || sz < i) {
+		PyErr_SetString(PyExc_OverflowError,
+				"long is too large to format");
+		return NULL;
+	}
+	str = (PyStringObject *) PyString_FromStringAndSize((char *)0, sz);
 	if (str == NULL)
 		return NULL;
-	p = PyString_AS_STRING(str) + i;
+	p = PyString_AS_STRING(str) + sz;
 	*p = '\0';
         if (addL)
                 *--p = 'L';
@@ -1305,7 +1328,7 @@
 		} while ((*q++ = *p++) != '\0');
 		q--;
 		_PyString_Resize((PyObject **)&str,
-				 (int) (q - PyString_AS_STRING(str)));
+				 (Py_ssize_t) (q - PyString_AS_STRING(str)));
 	}
 	return (PyObject *)str;
 }
@@ -1363,14 +1386,14 @@
 	while (_PyLong_DigitValue[Py_CHARMASK(*p)] < base)
 		++p;
 	*str = p;
-	n = (p - start) * bits_per_char;
-	if (n / bits_per_char != p - start) {
+	/* n <- # of Python digits needed, = ceiling(n/SHIFT). */
+	n = (p - start) * bits_per_char + SHIFT - 1;
+	if (n / bits_per_char < p - start) {
 		PyErr_SetString(PyExc_ValueError,
 				"long string too large to convert");
 		return NULL;
 	}
-	/* n <- # of Python digits needed, = ceiling(n/SHIFT). */
-	n = (n + SHIFT - 1) / SHIFT;
+	n = n / SHIFT;
 	z = _PyLong_New(n);
 	if (z == NULL)
 		return NULL;

Modified: python/branches/pep302_phase2/Objects/stringobject.c
==============================================================================
--- python/branches/pep302_phase2/Objects/stringobject.c	(original)
+++ python/branches/pep302_phase2/Objects/stringobject.c	Fri Oct  6 00:51:44 2006
@@ -804,10 +804,22 @@
 		return ret;
 	}
 	if (flags & Py_PRINT_RAW) {
+		char *data = op->ob_sval;
+		Py_ssize_t size = op->ob_size;
+		while (size > INT_MAX) {
+			/* Very long strings cannot be written atomically.
+			 * But don't write exactly INT_MAX bytes at a time
+			 * to avoid memory aligment issues.
+			 */
+			const int chunk_size = INT_MAX & ~0x3FFF;
+			fwrite(data, 1, chunk_size, fp);
+			data += chunk_size;
+			size -= chunk_size;
+		}
 #ifdef __VMS
-                if (op->ob_size) fwrite(op->ob_sval, (int) op->ob_size, 1, fp);
+                if (size) fwrite(data, (int)size, 1, fp);
 #else
-                fwrite(op->ob_sval, 1, (int) op->ob_size, fp);
+                fwrite(data, 1, (int)size, fp);
 #endif
 		return 0;
 	}
@@ -844,7 +856,7 @@
 	register PyStringObject* op = (PyStringObject*) obj;
 	size_t newsize = 2 + 4 * op->ob_size;
 	PyObject *v;
-	if (newsize > PY_SSIZE_T_MAX) {
+	if (newsize > PY_SSIZE_T_MAX || newsize / 4 != op->ob_size) {
 		PyErr_SetString(PyExc_OverflowError,
 			"string is too large to make repr");
 	}
@@ -4237,7 +4249,7 @@
 		return NULL;
 	}
 	llen = PyString_Size(result);
-	if (llen > PY_SSIZE_T_MAX) {
+	if (llen > INT_MAX) {
 		PyErr_SetString(PyExc_ValueError, "string too large in _PyString_FormatLong");
 		return NULL;
 	}
@@ -4726,9 +4738,10 @@
 			default:
 				PyErr_Format(PyExc_ValueError,
 				  "unsupported format character '%c' (0x%x) "
-				  "at index %i",
+				  "at index %zd",
 				  c, c,
-				  (int)(fmt - 1 - PyString_AsString(format)));
+				  (Py_ssize_t)(fmt - 1 -
+					       PyString_AsString(format)));
 				goto error;
 			}
 			if (sign) {

Modified: python/branches/pep302_phase2/Objects/typeobject.c
==============================================================================
--- python/branches/pep302_phase2/Objects/typeobject.c	(original)
+++ python/branches/pep302_phase2/Objects/typeobject.c	Fri Oct  6 00:51:44 2006
@@ -98,7 +98,7 @@
 		s = strrchr(type->tp_name, '.');
 		if (s != NULL)
 			return PyString_FromStringAndSize(
-				type->tp_name, (int)(s - type->tp_name));
+			    type->tp_name, (Py_ssize_t)(s - type->tp_name));
 		return PyString_FromString("__builtin__");
 	}
 }
@@ -4116,19 +4116,10 @@
 		return -1;
 	len = PyInt_AsSsize_t(res);
 	Py_DECREF(res);
-	if (len == -1 && PyErr_Occurred())
-		return -1;
-#if SIZEOF_SIZE_T < SIZEOF_INT
-	/* Overflow check -- range of PyInt is more than C ssize_t */
-	if (len != (int)len) {
-		PyErr_SetString(PyExc_OverflowError,
-			"__len__() should return 0 <= outcome < 2**31");
-		return -1;
-	}
-#endif
 	if (len < 0) {
-		PyErr_SetString(PyExc_ValueError,
-				"__len__() should return >= 0");
+		if (!PyErr_Occurred())
+			PyErr_SetString(PyExc_ValueError,
+					"__len__() should return >= 0");
 		return -1;
 	}
 	return len;

Modified: python/branches/pep302_phase2/Objects/unicodeobject.c
==============================================================================
--- python/branches/pep302_phase2/Objects/unicodeobject.c	(original)
+++ python/branches/pep302_phase2/Objects/unicodeobject.c	Fri Oct  6 00:51:44 2006
@@ -2384,6 +2384,7 @@
     Py_UNICODE unimax = PyUnicode_GetMax();
 #endif
 
+    /* XXX overflow detection missing */
     v = _PyUnicode_New((size+Py_UNICODE_SIZE-1)/ Py_UNICODE_SIZE);
     if (v == NULL)
 	goto onError;
@@ -3170,6 +3171,7 @@
 			Py_ssize_t needed = (targetsize - extrachars) + \
 				     (targetsize << 2);
 			extrachars += needed;
+			/* XXX overflow detection missing */
 			if (_PyUnicode_Resize(&v,
 					     PyUnicode_GET_SIZE(v) + needed) < 0) {
 			    Py_DECREF(x);
@@ -7762,10 +7764,11 @@
 	    default:
 		PyErr_Format(PyExc_ValueError,
 			     "unsupported format character '%c' (0x%x) "
-			     "at index %i",
+			     "at index %zd",
 			     (31<=c && c<=126) ? (char)c : '?',
                              (int)c,
-			     (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat)));
+			     (Py_ssize_t)(fmt - 1 -
+					  PyUnicode_AS_UNICODE(uformat)));
 		goto onError;
 	    }
 	    if (sign) {

Modified: python/branches/pep302_phase2/Python/compile.c
==============================================================================
--- python/branches/pep302_phase2/Python/compile.c	(original)
+++ python/branches/pep302_phase2/Python/compile.c	Fri Oct  6 00:51:44 2006
@@ -187,6 +187,8 @@
 				basicblock *);
 static void compiler_pop_fblock(struct compiler *, enum fblocktype,
 				basicblock *);
+/* Returns true if there is a loop on the fblock stack. */
+static int compiler_in_loop(struct compiler *);
 
 static int inplace_binop(struct compiler *, operator_ty);
 static int expr_constant(expr_ty e);
@@ -2157,7 +2159,7 @@
 	case Pass_kind:
 		break;
 	case Break_kind:
-		if (!c->u->u_nfblocks)
+                if (!compiler_in_loop(c))
 			return compiler_error(c, "'break' outside loop");
 		ADDOP(c, BREAK_LOOP);
 		break;
@@ -3147,6 +3149,16 @@
 	assert(u->u_fblock[u->u_nfblocks].fb_block == b);
 }
 
+static int
+compiler_in_loop(struct compiler *c) {
+        int i;
+        struct compiler_unit *u = c->u;
+        for (i = 0; i < u->u_nfblocks; ++i) {
+                if (u->u_fblock[i].fb_type == LOOP)
+                        return 1;
+        }
+        return 0;
+}
 /* Raises a SyntaxError and returns 0.
    If something goes wrong, a different exception may be raised.
 */

Modified: python/branches/pep302_phase2/Python/errors.c
==============================================================================
--- python/branches/pep302_phase2/Python/errors.c	(original)
+++ python/branches/pep302_phase2/Python/errors.c	Fri Oct  6 00:51:44 2006
@@ -551,7 +551,8 @@
 			goto failure;
 	}
 	if (PyDict_GetItemString(dict, "__module__") == NULL) {
-		modulename = PyString_FromStringAndSize(name, (int)(dot-name));
+		modulename = PyString_FromStringAndSize(name,
+						     (Py_ssize_t)(dot-name));
 		if (modulename == NULL)
 			goto failure;
 		if (PyDict_SetItemString(dict, "__module__", modulename) != 0)

Modified: python/branches/pep302_phase2/Python/getargs.c
==============================================================================
--- python/branches/pep302_phase2/Python/getargs.c	(original)
+++ python/branches/pep302_phase2/Python/getargs.c	Fri Oct  6 00:51:44 2006
@@ -815,7 +815,7 @@
 #endif
 			else
 				return converterr("string", arg, msgbuf, bufsize);
-			if ((int)strlen(*p) != PyString_Size(arg))
+			if ((Py_ssize_t)strlen(*p) != PyString_Size(arg))
 				return converterr("string without null bytes",
 						  arg, msgbuf, bufsize);
 		}
@@ -882,7 +882,7 @@
 				format++;
 			}
 			else if (*p != NULL &&
-				 (int)strlen(*p) != PyString_Size(arg))
+				 (Py_ssize_t)strlen(*p) != PyString_Size(arg))
 				return converterr(
 					"string without null bytes or None", 
 					arg, msgbuf, bufsize);
@@ -1029,7 +1029,8 @@
 			   PyMem_Free()ing it after usage
 
 			*/
-			if ((int)strlen(PyString_AS_STRING(s)) != size) {
+			if ((Py_ssize_t)strlen(PyString_AS_STRING(s))
+								!= size) {
 				Py_DECREF(s);
 				return converterr(
 					"(encoded string without NULL bytes)",

Modified: python/branches/pep302_phase2/Python/import.c
==============================================================================
--- python/branches/pep302_phase2/Python/import.c	(original)
+++ python/branches/pep302_phase2/Python/import.c	Fri Oct  6 00:51:44 2006
@@ -1801,7 +1801,7 @@
 
 
 /* Initialize a built-in module.
-   Return 1 for succes, 0 if the module is not found, and -1 with
+   Return 1 for success, 0 if the module is not found, and -1 with
    an exception set if the initialization failed. */
 
 static int

Modified: python/branches/pep302_phase2/Python/marshal.c
==============================================================================
--- python/branches/pep302_phase2/Python/marshal.c	(original)
+++ python/branches/pep302_phase2/Python/marshal.c	Fri Oct  6 00:51:44 2006
@@ -546,6 +546,11 @@
 			int size;
 			PyLongObject *ob;
 			n = r_long(p);
+			if (n < -INT_MAX || n > INT_MAX) {
+				PyErr_SetString(PyExc_ValueError,
+						"bad marshal data");
+				return NULL;
+			}
 			size = n<0 ? -n : n;
 			ob = _PyLong_New(size);
 			if (ob == NULL)
@@ -654,7 +659,7 @@
 	case TYPE_INTERNED:
 	case TYPE_STRING:
 		n = r_long(p);
-		if (n < 0) {
+		if (n < 0 || n > INT_MAX) {
 			PyErr_SetString(PyExc_ValueError, "bad marshal data");
 			return NULL;
 		}
@@ -689,7 +694,7 @@
 		char *buffer;
 
 		n = r_long(p);
-		if (n < 0) {
+		if (n < 0 || n > INT_MAX) {
 			PyErr_SetString(PyExc_ValueError, "bad marshal data");
 			return NULL;
 		}
@@ -710,7 +715,7 @@
 
 	case TYPE_TUPLE:
 		n = r_long(p);
-		if (n < 0) {
+		if (n < 0 || n > INT_MAX) {
 			PyErr_SetString(PyExc_ValueError, "bad marshal data");
 			return NULL;
 		}
@@ -733,7 +738,7 @@
 
 	case TYPE_LIST:
 		n = r_long(p);
-		if (n < 0) {
+		if (n < 0 || n > INT_MAX) {
 			PyErr_SetString(PyExc_ValueError, "bad marshal data");
 			return NULL;
 		}
@@ -831,10 +836,11 @@
 			
 			v = NULL;
 
-			argcount = r_long(p);
-			nlocals = r_long(p);
-			stacksize = r_long(p);
-			flags = r_long(p);
+                        /* XXX ignore long->int overflows for now */
+			argcount = (int)r_long(p);
+			nlocals = (int)r_long(p);
+			stacksize = (int)r_long(p);
+			flags = (int)r_long(p);
 			code = r_object(p);
 			if (code == NULL)
 				goto code_error;
@@ -859,7 +865,7 @@
 			name = r_object(p);
 			if (name == NULL)
 				goto code_error;
-			firstlineno = r_long(p);
+			firstlineno = (int)r_long(p);
 			lnotab = r_object(p);
 			if (lnotab == NULL)
 				goto code_error;
@@ -1031,10 +1037,16 @@
 	wf.strings = (version > 0) ? PyDict_New() : NULL;
 	w_object(x, &wf);
 	Py_XDECREF(wf.strings);
-	if (wf.str != NULL)
-		_PyString_Resize(&wf.str,
-		    (int) (wf.ptr -
-			   PyString_AS_STRING((PyStringObject *)wf.str)));
+	if (wf.str != NULL) {
+		char *base = PyString_AS_STRING((PyStringObject *)wf.str);
+		if (wf.ptr - base > PY_SSIZE_T_MAX) {
+			Py_DECREF(wf.str);
+			PyErr_SetString(PyExc_OverflowError,
+					"too much marshall data for a string");
+			return NULL;
+		}
+		_PyString_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base));
+	}
 	if (wf.error) {
 		Py_XDECREF(wf.str);
 		PyErr_SetString(PyExc_ValueError,

Modified: python/branches/pep302_phase2/Python/modsupport.c
==============================================================================
--- python/branches/pep302_phase2/Python/modsupport.c	(original)
+++ python/branches/pep302_phase2/Python/modsupport.c	Fri Oct  6 00:51:44 2006
@@ -421,7 +421,7 @@
 							"string too long for Python string");
 						return NULL;
 					}
-					n = (int)m;
+					n = (Py_ssize_t)m;
 				}
 				v = PyString_FromStringAndSize(str, n);
 			}

Modified: python/branches/pep302_phase2/Python/mystrtoul.c
==============================================================================
--- python/branches/pep302_phase2/Python/mystrtoul.c	(original)
+++ python/branches/pep302_phase2/Python/mystrtoul.c	Fri Oct  6 00:51:44 2006
@@ -195,13 +195,10 @@
 	return (unsigned long)-1;
 }
 
-/* Checking for overflow in PyOS_strtol is a PITA since C doesn't define
- * anything about what happens when a signed integer operation overflows,
- * and some compilers think they're doing you a favor by being "clever"
- * then.  Python assumes a 2's-complement representation, so that the bit
- * pattern for the largest postive signed long is LONG_MAX, and for
- * the smallest negative signed long is LONG_MAX + 1.
+/* Checking for overflow in PyOS_strtol is a PITA; see comments
+ * about PY_ABS_LONG_MIN in longobject.c.
  */
+#define PY_ABS_LONG_MIN		(0-(unsigned long)LONG_MIN)
 
 long
 PyOS_strtol(char *str, char **ptr, int base)
@@ -224,8 +221,7 @@
 		if (sign == '-')
 			result = -result;
 	}
-	else if (sign == '-' && uresult == (unsigned long)LONG_MAX + 1) {
-		assert(LONG_MIN == -LONG_MAX-1);
+	else if (sign == '-' && uresult == PY_ABS_LONG_MIN) {
 		result = LONG_MIN;
 	}
 	else {

Modified: python/branches/pep302_phase2/Python/sysmodule.c
==============================================================================
--- python/branches/pep302_phase2/Python/sysmodule.c	(original)
+++ python/branches/pep302_phase2/Python/sysmodule.c	Fri Oct  6 00:51:44 2006
@@ -1225,7 +1225,7 @@
 		p = strchr(path, delim);
 		if (p == NULL)
 			p = strchr(path, '\0'); /* End of string */
-		w = PyString_FromStringAndSize(path, (int) (p - path));
+		w = PyString_FromStringAndSize(path, (Py_ssize_t) (p - path));
 		if (w == NULL) {
 			Py_DECREF(v);
 			return NULL;

Modified: python/branches/pep302_phase2/Tools/msi/uuids.py
==============================================================================
--- python/branches/pep302_phase2/Tools/msi/uuids.py	(original)
+++ python/branches/pep302_phase2/Tools/msi/uuids.py	Fri Oct  6 00:51:44 2006
@@ -22,6 +22,8 @@
     '2.4.2150':'{b191e49c-ea23-43b2-b28a-14e0784069b8}', # 2.4.2
     '2.4.3121':'{f669ed4d-1dce-41c4-9617-d985397187a1}', # 2.4.3c1
     '2.4.3150':'{75e71add-042c-4f30-bfac-a9ec42351313}', # 2.4.3
+    '2.4.4121':'{cd2862db-22a4-4688-8772-85407ea21550}', # 2.4.4c1
+    '2.4.4150':'{60e2c8c9-6cf3-4b1a-9618-e304946c94e6}', # 2.4.4
     '2.5.101': '{bc14ce3e-5e72-4a64-ac1f-bf59a571898c}', # 2.5a1
     '2.5.102': '{5eed51c1-8e9d-4071-94c5-b40de5d49ba5}', # 2.5a2
     '2.5.103': '{73dcd966-ffec-415f-bb39-8342c1f47017}', # 2.5a3


More information about the Python-checkins mailing list