[Python-3000-checkins] r56020 - in python/branches/py3k-struni: Doc/api/concrete.tex Doc/howto/unicode.rst Doc/lib/libsqlite3.tex Include/pyerrors.h Include/structmember.h Lib/_abcoll.py Lib/test/regrtest.py Misc/build.sh Misc/developers.txt Objects/exceptions.c Objects/longobject.c PC/_winreg.c PC/config.c PC/pyconfig.h PCbuild/pythoncore.vcproj Python/structmember.c Tools/buildbot/README.tcltk-AMD64 Tools/buildbot/external-amd64.bat

guido.van.rossum python-3000-checkins at python.org
Mon Jun 18 19:59:01 CEST 2007


Author: guido.van.rossum
Date: Mon Jun 18 19:58:50 2007
New Revision: 56020

Added:
   python/branches/py3k-struni/Tools/buildbot/README.tcltk-AMD64
      - copied unchanged from r56018, python/branches/p3yk/Tools/buildbot/README.tcltk-AMD64
Modified:
   python/branches/py3k-struni/   (props changed)
   python/branches/py3k-struni/Doc/api/concrete.tex
   python/branches/py3k-struni/Doc/howto/unicode.rst
   python/branches/py3k-struni/Doc/lib/libsqlite3.tex
   python/branches/py3k-struni/Include/pyerrors.h
   python/branches/py3k-struni/Include/structmember.h
   python/branches/py3k-struni/Lib/_abcoll.py
   python/branches/py3k-struni/Lib/test/regrtest.py
   python/branches/py3k-struni/Misc/build.sh
   python/branches/py3k-struni/Misc/developers.txt
   python/branches/py3k-struni/Objects/exceptions.c
   python/branches/py3k-struni/Objects/longobject.c
   python/branches/py3k-struni/PC/_winreg.c
   python/branches/py3k-struni/PC/config.c
   python/branches/py3k-struni/PC/pyconfig.h
   python/branches/py3k-struni/PCbuild/pythoncore.vcproj
   python/branches/py3k-struni/Python/structmember.c
   python/branches/py3k-struni/Tools/buildbot/external-amd64.bat
Log:
Merged revisions 55962-56019 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/p3yk

................
  r55985 | neal.norwitz | 2007-06-14 20:14:38 -0700 (Thu, 14 Jun 2007) | 2 lines
  
  All these tests have been flaky wrt reporting leaks.  Disable them.
................
  r56003 | neal.norwitz | 2007-06-15 19:41:09 -0700 (Fri, 15 Jun 2007) | 1 line
  
  Fix typo (certain).
................
  r56004 | neal.norwitz | 2007-06-15 20:54:18 -0700 (Fri, 15 Jun 2007) | 4 lines
  
  Fix it so test_os no longer reports ref leaks by clearing all the caches
  the ABCMeta stores on the class.  Apply this to all the ABC collections
  as well as the class of os.environ which inherits from an ABC collection.
................
  r56013 | neal.norwitz | 2007-06-17 19:56:31 -0700 (Sun, 17 Jun 2007) | 4 lines
  
  This should make it a little easier when adding new collections which use ABCs.
  The new subclass won't need to be listed in regrtest.
  It will be even better when Guido adds weakrefs. :-)
................
  r56014 | martin.v.loewis | 2007-06-17 20:15:51 -0700 (Sun, 17 Jun 2007) | 1 line
  
  Drop inline, as it's not support by VS 2003.
................
  r56015 | martin.v.loewis | 2007-06-17 20:17:19 -0700 (Sun, 17 Jun 2007) | 1 line
  
  Expect long objects for DWORD values.
................
  r56016 | martin.v.loewis | 2007-06-17 20:18:01 -0700 (Sun, 17 Jun 2007) | 1 line
  
  Drop modules that have been deleted.
................
  r56017 | martin.v.loewis | 2007-06-17 20:18:55 -0700 (Sun, 17 Jun 2007) | 1 line
  
  Bump DLL version number to 30.
................
  r56018 | neal.norwitz | 2007-06-17 20:55:43 -0700 (Sun, 17 Jun 2007) | 62 lines
  
  Merged revisions 55951-56013 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r55956 | thomas.heller | 2007-06-13 00:07:03 -0700 (Wed, 13 Jun 2007) | 2 lines
    
    Do not hardcode the buildbot's directory name.
  ........
    r55957 | thomas.heller | 2007-06-13 00:07:41 -0700 (Wed, 13 Jun 2007) | 2 lines
    
    Notes about building tcl/tk for windows/AMD64.
  ........
    r55958 | thomas.heller | 2007-06-13 00:54:57 -0700 (Wed, 13 Jun 2007) | 2 lines
    
    Build bzip2.
  ........
    r55962 | walter.doerwald | 2007-06-13 09:57:12 -0700 (Wed, 13 Jun 2007) | 8 lines
    
    Add T_PYSSIZET in structmember.h: This can be used for
    Py_ssize_t members.
    
    Simplify the implementation of UnicodeError objects:
    start and end attributes are now stored directly as
    Py_ssize_t members, which simplifies various get and
    set functions.
  ........
    r55975 | martin.v.loewis | 2007-06-14 13:46:25 -0700 (Thu, 14 Jun 2007) | 3 lines
    
    Patch #1734014: Use _I64_MAX instead of LLONG_MAX.
    Will backport to 2.5.
  ........
    r55984 | neal.norwitz | 2007-06-14 20:11:41 -0700 (Thu, 14 Jun 2007) | 4 lines
    
    urllib2_localnet says it leaks probably due to threads. So ignore it.
    popen2 is also complaining probably for similar reasons.
    make install always reports failure, so don't mail in this case.
  ........
    r56001 | andrew.kuchling | 2007-06-15 15:43:03 -0700 (Fri, 15 Jun 2007) | 1 line
    
    Add a word
  ........
    r56005 | martin.v.loewis | 2007-06-16 03:08:43 -0700 (Sat, 16 Jun 2007) | 2 lines
    
    Mention Senthil Kumaran.
  ........
    r56006 | georg.brandl | 2007-06-16 10:10:12 -0700 (Sat, 16 Jun 2007) | 2 lines
    
    Add missing \versionadded.
  ........
    r56009 | neal.norwitz | 2007-06-17 11:48:32 -0700 (Sun, 17 Jun 2007) | 1 line
    
    SF #1738670, make example in doc work
  ........
    r56011 | neal.norwitz | 2007-06-17 19:46:36 -0700 (Sun, 17 Jun 2007) | 1 line
    
    SF #1738754, remove extra backslash in string
  ........
    r56012 | neal.norwitz | 2007-06-17 19:50:15 -0700 (Sun, 17 Jun 2007) | 1 line
    
    Revert last change for SF #1738754, there's no print in there.
  ........
................


Modified: python/branches/py3k-struni/Doc/api/concrete.tex
==============================================================================
--- python/branches/py3k-struni/Doc/api/concrete.tex	(original)
+++ python/branches/py3k-struni/Doc/api/concrete.tex	Mon Jun 18 19:58:50 2007
@@ -99,6 +99,7 @@
 
 \begin{csimplemacrodesc}{Py_RETURN_NONE}
   Properly handle returning \cdata{Py_None} from within a C function.
+  \versionadded{2.4}
 \end{csimplemacrodesc}
 
 

Modified: python/branches/py3k-struni/Doc/howto/unicode.rst
==============================================================================
--- python/branches/py3k-struni/Doc/howto/unicode.rst	(original)
+++ python/branches/py3k-struni/Doc/howto/unicode.rst	Mon Jun 18 19:58:50 2007
@@ -152,7 +152,7 @@
 4. Many Internet standards are defined in terms of textual data, and 
    can't handle content with embedded zero bytes.
 
-Generally people don't use this encoding, choosing other encodings
+Generally people don't use this encoding, instead choosing other encodings
 that are more efficient and convenient.
 
 Encodings don't have to handle every possible Unicode character, and

Modified: python/branches/py3k-struni/Doc/lib/libsqlite3.tex
==============================================================================
--- python/branches/py3k-struni/Doc/lib/libsqlite3.tex	(original)
+++ python/branches/py3k-struni/Doc/lib/libsqlite3.tex	Mon Jun 18 19:58:50 2007
@@ -42,6 +42,12 @@
 # Insert a row of data
 c.execute("""insert into stocks
           values ('2006-01-05','BUY','RHAT',100,35.14)""")
+
+# Save (commit) the changes
+conn.commit()
+
+# We can also close the cursor if we are done with it
+c.close()
 \end{verbatim}    
 
 Usually your SQL operations will need to use values from Python

Modified: python/branches/py3k-struni/Include/pyerrors.h
==============================================================================
--- python/branches/py3k-struni/Include/pyerrors.h	(original)
+++ python/branches/py3k-struni/Include/pyerrors.h	Mon Jun 18 19:58:50 2007
@@ -30,8 +30,8 @@
     PyObject *args;
     PyObject *encoding;
     PyObject *object;
-    PyObject *start;
-    PyObject *end;
+    Py_ssize_t start;
+    Py_ssize_t end;
     PyObject *reason;
 } PyUnicodeErrorObject;
 

Modified: python/branches/py3k-struni/Include/structmember.h
==============================================================================
--- python/branches/py3k-struni/Include/structmember.h	(original)
+++ python/branches/py3k-struni/Include/structmember.h	Mon Jun 18 19:58:50 2007
@@ -68,9 +68,10 @@
 #ifdef HAVE_LONG_LONG
 #define T_LONGLONG      17  
 #define T_ULONGLONG     18
+#define T_PYSSIZET       19 /* Py_ssize_t */
 #endif /* HAVE_LONG_LONG */
 
-#define T_NONE          19      /* Value is always None */
+#define T_NONE          20      /* Value is always None */
 
 /* Flags */
 #define READONLY	1

Modified: python/branches/py3k-struni/Lib/_abcoll.py
==============================================================================
--- python/branches/py3k-struni/Lib/_abcoll.py	(original)
+++ python/branches/py3k-struni/Lib/_abcoll.py	Mon Jun 18 19:58:50 2007
@@ -4,7 +4,7 @@
 """Abstract Base Classes (ABCs) for collections, according to PEP 3119.
 
 DON'T USE THIS MODULE DIRECTLY!  The classes here should be imported
-via collections; they are defined here only to alleviate ceratin
+via collections; they are defined here only to alleviate certain
 bootstrapping issues.  Unit tests are in test_collections.
 """
 

Modified: python/branches/py3k-struni/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/regrtest.py	(original)
+++ python/branches/py3k-struni/Lib/test/regrtest.py	Mon Jun 18 19:58:50 2007
@@ -697,7 +697,7 @@
     import gc, copy_reg
     import _strptime, linecache, dircache
     import urlparse, urllib, urllib2, mimetypes, doctest
-    import struct, filecmp, collections
+    import struct, filecmp, _abcoll
     from distutils.dir_util import _path_created
 
     # Restore some original values.
@@ -708,8 +708,11 @@
     sys.path_importer_cache.update(pic)
 
     # Clear ABC registries.
-    for obj in [collections.Hashable, collections.Iterable]:
-        obj._ABCMeta__registry.clear()
+    for abc in [getattr(_abcoll, a) for a in _abcoll.__all__]:
+        for obj in abc.__subclasses__() + [abc]:
+            obj._ABCMeta__registry.clear()
+            obj._ABCMeta__cache.clear()
+            obj._ABCMeta__negative_cache.clear()
 
     # Clear assorted module caches.
     _path_created.clear()

Modified: python/branches/py3k-struni/Misc/build.sh
==============================================================================
--- python/branches/py3k-struni/Misc/build.sh	(original)
+++ python/branches/py3k-struni/Misc/build.sh	Mon Jun 18 19:58:50 2007
@@ -67,7 +67,7 @@
 # Note: test_XXX (none currently) really leak, but are disabled
 # so we don't send spam.  Any test which really leaks should only 
 # be listed here if there are also test cases under Lib/test/leakers.
-LEAKY_TESTS="test_(cmd_line|socket)"
+LEAKY_TESTS="test_(cmd_line|popen2|socket|threading_local|urllib2_localnet)"
 
 # These tests always fail, so skip them so we don't get false positives.
 _ALWAYS_SKIP=""
@@ -170,7 +170,6 @@
             start=`current_time`
             make install >& build/$F
             update_status "Installing" "$F" $start
-            mail_on_failure "install" build/$F
 
             if [ ! -x $PYTHON ]; then
                 ln -s ${PYTHON}3.* $PYTHON

Modified: python/branches/py3k-struni/Misc/developers.txt
==============================================================================
--- python/branches/py3k-struni/Misc/developers.txt	(original)
+++ python/branches/py3k-struni/Misc/developers.txt	Mon Jun 18 19:58:50 2007
@@ -17,6 +17,10 @@
 Permissions History
 -------------------
 
+- Senthil Kumaran  was given SVN access on June 16 2007
+  by MvL, for his Summer-of-Code project, mentored by
+  Skip Montanaro.
+
 - Alexandre Vassalotti was given SVN access on May 21 2007
   by MvL, for his Summer-of-Code project, mentored by
   Brett Cannon.

Modified: python/branches/py3k-struni/Objects/exceptions.c
==============================================================================
--- python/branches/py3k-struni/Objects/exceptions.c	(original)
+++ python/branches/py3k-struni/Objects/exceptions.c	Mon Jun 18 19:58:50 2007
@@ -947,36 +947,6 @@
 SimpleExtendsException(PyExc_ValueError, UnicodeError,
                        "Unicode related error.");
 
-static int
-get_int(PyObject *attr, Py_ssize_t *value, const char *name)
-{
-    if (!attr) {
-        PyErr_Format(PyExc_TypeError, "%.200s attribute not set", name);
-        return -1;
-    }
-
-    if (PyLong_Check(attr)) {
-        *value = PyLong_AsSsize_t(attr);
-        if (*value == -1 && PyErr_Occurred())
-            return -1;
-    } else {
-        PyErr_Format(PyExc_TypeError, "%.200s attribute must be int", name);
-        return -1;
-    }
-    return 0;
-}
-
-static int
-set_ssize_t(PyObject **attr, Py_ssize_t value)
-{
-    PyObject *obj = PyInt_FromSsize_t(value);
-    if (!obj)
-        return -1;
-    Py_CLEAR(*attr);
-    *attr = obj;
-    return 0;
-}
-
 static PyObject *
 get_bytes(PyObject *attr, const char *name)
 {
@@ -1054,40 +1024,37 @@
 int
 PyUnicodeEncodeError_GetStart(PyObject *exc, Py_ssize_t *start)
 {
-    if (!get_int(((PyUnicodeErrorObject *)exc)->start, start, "start")) {
-        Py_ssize_t size;
-        PyObject *obj = get_unicode(((PyUnicodeErrorObject *)exc)->object,
-                                    "object");
-        if (!obj) return -1;
-        size = PyUnicode_GET_SIZE(obj);
-        if (*start<0)
-            *start = 0; /*XXX check for values <0*/
-        if (*start>=size)
-            *start = size-1;
-        Py_DECREF(obj);
-        return 0;
-    }
-    return -1;
+    Py_ssize_t size;
+    PyObject *obj = get_unicode(((PyUnicodeErrorObject *)exc)->object,
+                                "object");
+    if (!obj)
+        return -1;
+    *start = ((PyUnicodeErrorObject *)exc)->start;
+    size = PyUnicode_GET_SIZE(obj);
+    if (*start<0)
+        *start = 0; /*XXX check for values <0*/
+    if (*start>=size)
+        *start = size-1;
+    Py_DECREF(obj);
+    return 0;
 }
 
 
 int
 PyUnicodeDecodeError_GetStart(PyObject *exc, Py_ssize_t *start)
 {
-    if (!get_int(((PyUnicodeErrorObject *)exc)->start, start, "start")) {
-        Py_ssize_t size;
-        PyObject *obj = get_bytes(((PyUnicodeErrorObject *)exc)->object,
-                                   "object");
-        if (!obj) return -1;
-        size = PyBytes_GET_SIZE(obj);
-        if (*start<0)
-            *start = 0;
-        if (*start>=size)
-            *start = size-1;
-        Py_DECREF(obj);
-        return 0;
-    }
-    return -1;
+    Py_ssize_t size;
+    PyObject *obj = get_bytes(((PyUnicodeErrorObject *)exc)->object, "object");
+    if (!obj)
+        return -1;
+    size = PyBytes_GET_SIZE(obj);
+    *start = ((PyUnicodeErrorObject *)exc)->start;
+    if (*start<0)
+        *start = 0;
+    if (*start>=size)
+        *start = size-1;
+    Py_DECREF(obj);
+    return 0;
 }
 
 
@@ -1101,61 +1068,61 @@
 int
 PyUnicodeEncodeError_SetStart(PyObject *exc, Py_ssize_t start)
 {
-    return set_ssize_t(&((PyUnicodeErrorObject *)exc)->start, start);
+    ((PyUnicodeErrorObject *)exc)->start = start;
+    return 0;
 }
 
 
 int
 PyUnicodeDecodeError_SetStart(PyObject *exc, Py_ssize_t start)
 {
-    return set_ssize_t(&((PyUnicodeErrorObject *)exc)->start, start);
+    ((PyUnicodeErrorObject *)exc)->start = start;
+    return 0;
 }
 
 
 int
 PyUnicodeTranslateError_SetStart(PyObject *exc, Py_ssize_t start)
 {
-    return set_ssize_t(&((PyUnicodeErrorObject *)exc)->start, start);
+    ((PyUnicodeErrorObject *)exc)->start = start;
+    return 0;
 }
 
 
 int
 PyUnicodeEncodeError_GetEnd(PyObject *exc, Py_ssize_t *end)
 {
-    if (!get_int(((PyUnicodeErrorObject *)exc)->end, end, "end")) {
-        Py_ssize_t size;
-        PyObject *obj = get_unicode(((PyUnicodeErrorObject *)exc)->object,
-                                    "object");
-        if (!obj) return -1;
-        size = PyUnicode_GET_SIZE(obj);
-        if (*end<1)
-            *end = 1;
-        if (*end>size)
-            *end = size;
-        Py_DECREF(obj);
-        return 0;
-    }
-    return -1;
+    Py_ssize_t size;
+    PyObject *obj = get_unicode(((PyUnicodeErrorObject *)exc)->object,
+                                "object");
+    if (!obj)
+        return -1;
+    *end = ((PyUnicodeErrorObject *)exc)->end;
+    size = PyUnicode_GET_SIZE(obj);
+    if (*end<1)
+        *end = 1;
+    if (*end>size)
+        *end = size;
+    Py_DECREF(obj);
+    return 0;
 }
 
 
 int
 PyUnicodeDecodeError_GetEnd(PyObject *exc, Py_ssize_t *end)
 {
-    if (!get_int(((PyUnicodeErrorObject *)exc)->end, end, "end")) {
-        Py_ssize_t size;
-        PyObject *obj = get_bytes(((PyUnicodeErrorObject *)exc)->object,
-                                   "object");
-        if (!obj) return -1;
-        size = PyBytes_GET_SIZE(obj);
-        if (*end<1)
-            *end = 1;
-        if (*end>size)
-            *end = size;
-        Py_DECREF(obj);
-        return 0;
-    }
-    return -1;
+    Py_ssize_t size;
+    PyObject *obj = get_bytes(((PyUnicodeErrorObject *)exc)->object, "object");
+    if (!obj)
+        return -1;
+    size = PyBytes_GET_SIZE(obj);
+    *end = ((PyUnicodeErrorObject *)exc)->end;
+    if (*end<1)
+        *end = 1;
+    if (*end>size)
+        *end = size;
+    Py_DECREF(obj);
+    return 0;
 }
 
 
@@ -1169,21 +1136,24 @@
 int
 PyUnicodeEncodeError_SetEnd(PyObject *exc, Py_ssize_t end)
 {
-    return set_ssize_t(&((PyUnicodeErrorObject *)exc)->end, end);
+    ((PyUnicodeErrorObject *)exc)->end = end;
+    return 0;
 }
 
 
 int
 PyUnicodeDecodeError_SetEnd(PyObject *exc, Py_ssize_t end)
 {
-    return set_ssize_t(&((PyUnicodeErrorObject *)exc)->end, end);
+    ((PyUnicodeErrorObject *)exc)->end = end;
+    return 0;
 }
 
 
 int
 PyUnicodeTranslateError_SetEnd(PyObject *exc, Py_ssize_t end)
 {
-    return set_ssize_t(&((PyUnicodeErrorObject *)exc)->end, end);
+    ((PyUnicodeErrorObject *)exc)->end = end;
+    return 0;
 }
 
 PyObject *
@@ -1237,25 +1207,20 @@
 {
     Py_CLEAR(self->encoding);
     Py_CLEAR(self->object);
-    Py_CLEAR(self->start);
-    Py_CLEAR(self->end);
     Py_CLEAR(self->reason);
 
-    if (!PyArg_ParseTuple(args, "O!O!O!O!O!",
+    if (!PyArg_ParseTuple(args, "O!O!nnO!",
         &PyUnicode_Type, &self->encoding,
         objecttype, &self->object,
-        &PyLong_Type, &self->start,
-        &PyLong_Type, &self->end,
+        &self->start,
+        &self->end,
         &PyUnicode_Type, &self->reason)) {
-        self->encoding = self->object = self->start = self->end =
-            self->reason = NULL;
+        self->encoding = self->object = self->reason = NULL;
         return -1;
     }
 
     Py_INCREF(self->encoding);
     Py_INCREF(self->object);
-    Py_INCREF(self->start);
-    Py_INCREF(self->end);
     Py_INCREF(self->reason);
 
     return 0;
@@ -1266,8 +1231,6 @@
 {
     Py_CLEAR(self->encoding);
     Py_CLEAR(self->object);
-    Py_CLEAR(self->start);
-    Py_CLEAR(self->end);
     Py_CLEAR(self->reason);
     return BaseException_clear((PyBaseExceptionObject *)self);
 }
@@ -1285,8 +1248,6 @@
 {
     Py_VISIT(self->encoding);
     Py_VISIT(self->object);
-    Py_VISIT(self->start);
-    Py_VISIT(self->end);
     Py_VISIT(self->reason);
     return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg);
 }
@@ -1296,9 +1257,9 @@
         PyDoc_STR("exception encoding")},
     {"object", T_OBJECT, offsetof(PyUnicodeErrorObject, object), 0,
         PyDoc_STR("exception object")},
-    {"start", T_OBJECT, offsetof(PyUnicodeErrorObject, start), 0,
+    {"start", T_PYSSIZET, offsetof(PyUnicodeErrorObject, start), 0,
         PyDoc_STR("exception start")},
-    {"end", T_OBJECT, offsetof(PyUnicodeErrorObject, end), 0,
+    {"end", T_PYSSIZET, offsetof(PyUnicodeErrorObject, end), 0,
         PyDoc_STR("exception end")},
     {"reason", T_OBJECT, offsetof(PyUnicodeErrorObject, reason), 0,
         PyDoc_STR("exception reason")},
@@ -1322,17 +1283,10 @@
 static PyObject *
 UnicodeEncodeError_str(PyObject *self)
 {
-    Py_ssize_t start;
-    Py_ssize_t end;
+    PyUnicodeErrorObject *uself = (PyUnicodeErrorObject *)self;
 
-    if (PyUnicodeEncodeError_GetStart(self, &start))
-        return NULL;
-
-    if (PyUnicodeEncodeError_GetEnd(self, &end))
-        return NULL;
-
-    if (end==start+1) {
-        int badchar = (int)PyUnicode_AS_UNICODE(((PyUnicodeErrorObject *)self)->object)[start];
+    if (uself->end==uself->start+1) {
+        int badchar = (int)PyUnicode_AS_UNICODE(uself->object)[uself->start];
         const char *fmt;
         if (badchar <= 0xff)
             fmt = "'%U' codec can't encode character u'\\x%02x' in position %zd: %U";
@@ -1344,15 +1298,15 @@
             fmt,
             ((PyUnicodeErrorObject *)self)->encoding,
             badchar,
-            start,
+            uself->start,
             ((PyUnicodeErrorObject *)self)->reason
         );
     }
     return PyUnicode_FromFormat(
         "'%U' codec can't encode characters in position %zd-%zd: %U",
         ((PyUnicodeErrorObject *)self)->encoding,
-        start,
-        (end-1),
+        uself->start,
+        uself->end-1,
         ((PyUnicodeErrorObject *)self)->reason
     );
 }
@@ -1398,30 +1352,23 @@
 static PyObject *
 UnicodeDecodeError_str(PyObject *self)
 {
-    Py_ssize_t start = 0;
-    Py_ssize_t end = 0;
-
-    if (PyUnicodeDecodeError_GetStart(self, &start))
-        return NULL;
-
-    if (PyUnicodeDecodeError_GetEnd(self, &end))
-        return NULL;
+    PyUnicodeErrorObject *uself = (PyUnicodeErrorObject *)self;
 
-    if (end==start+1) {
-        int byte = (int)(PyBytes_AS_STRING(((PyUnicodeErrorObject *)self)->object)[start]&0xff);
+    if (uself->end==uself->start+1) {
+        int byte = (int)(PyBytes_AS_STRING(((PyUnicodeErrorObject *)self)->object)[uself->start]&0xff);
         return PyUnicode_FromFormat(
             "'%U' codec can't decode byte 0x%02x in position %zd: %U",
             ((PyUnicodeErrorObject *)self)->encoding,
             byte,
-            start,
+            uself->start,
             ((PyUnicodeErrorObject *)self)->reason
         );
     }
     return PyUnicode_FromFormat(
         "'%U' codec can't decode bytes in position %zd-%zd: %U",
         ((PyUnicodeErrorObject *)self)->encoding,
-        start,
-        (end-1),
+        uself->start,
+        uself->end-1,
         ((PyUnicodeErrorObject *)self)->reason
     );
 }
@@ -1466,22 +1413,18 @@
         return -1;
 
     Py_CLEAR(self->object);
-    Py_CLEAR(self->start);
-    Py_CLEAR(self->end);
     Py_CLEAR(self->reason);
 
-    if (!PyArg_ParseTuple(args, "O!O!O!O!",
+    if (!PyArg_ParseTuple(args, "O!nnO!",
         &PyUnicode_Type, &self->object,
-        &PyLong_Type, &self->start,
-        &PyLong_Type, &self->end,
+        &self->start,
+        &self->end,
         &PyUnicode_Type, &self->reason)) {
-        self->object = self->start = self->end = self->reason = NULL;
+        self->object = self->reason = NULL;
         return -1;
     }
 
     Py_INCREF(self->object);
-    Py_INCREF(self->start);
-    Py_INCREF(self->end);
     Py_INCREF(self->reason);
 
     return 0;
@@ -1491,17 +1434,10 @@
 static PyObject *
 UnicodeTranslateError_str(PyObject *self)
 {
-    Py_ssize_t start;
-    Py_ssize_t end;
-
-    if (PyUnicodeTranslateError_GetStart(self, &start))
-        return NULL;
+    PyUnicodeErrorObject *uself = (PyUnicodeErrorObject *)self;
 
-    if (PyUnicodeTranslateError_GetEnd(self, &end))
-        return NULL;
-
-    if (end==start+1) {
-        int badchar = (int)PyUnicode_AS_UNICODE(((PyUnicodeErrorObject *)self)->object)[start];
+    if (uself->end==uself->start+1) {
+        int badchar = (int)PyUnicode_AS_UNICODE(uself->object)[uself->start];
         const char *fmt;
         if (badchar <= 0xff)
             fmt = "can't translate character u'\\x%02x' in position %zd: %U";
@@ -1512,15 +1448,15 @@
         return PyUnicode_FromFormat(
             fmt,
             badchar,
-            start,
-            ((PyUnicodeErrorObject *)self)->reason
+            uself->start,
+            uself->reason
         );
     }
     return PyUnicode_FromFormat(
         "can't translate characters in position %zd-%zd: %U",
-        start,
-        (end-1),
-        ((PyUnicodeErrorObject *)self)->reason
+        uself->start,
+        uself->end-1,
+        uself->reason
     );
 }
 

Modified: python/branches/py3k-struni/Objects/longobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/longobject.c	(original)
+++ python/branches/py3k-struni/Objects/longobject.c	Mon Jun 18 19:58:50 2007
@@ -24,7 +24,7 @@
 int quick_int_allocs, quick_neg_int_allocs;
 #endif
 
-static inline PyObject *
+static PyObject *
 get_small_int(int ival)
 {
 	PyObject *v = (PyObject*)(small_ints + ival + NSMALLNEGINTS);

Modified: python/branches/py3k-struni/PC/_winreg.c
==============================================================================
--- python/branches/py3k-struni/PC/_winreg.c	(original)
+++ python/branches/py3k-struni/PC/_winreg.c	Mon Jun 18 19:58:50 2007
@@ -693,9 +693,10 @@
 Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
 {
 	int i,j;
+	DWORD d;
 	switch (typ) {
 		case REG_DWORD:
-			if (value != Py_None && !PyInt_Check(value))
+			if (value != Py_None && !PyLong_Check(value))
 				return FALSE;
 			*retDataBuf = (BYTE *)PyMem_NEW(DWORD, 1);
 			if (*retDataBuf==NULL){
@@ -707,10 +708,10 @@
 				DWORD zero = 0;
 				memcpy(*retDataBuf, &zero, sizeof(DWORD));
 			}
-			else
-				memcpy(*retDataBuf,
-				       &PyInt_AS_LONG((PyIntObject *)value),
-				       sizeof(DWORD));
+			else {
+				d = PyLong_AsLong(value);
+				memcpy(*retDataBuf, &d, sizeof(DWORD));
+			}
 			break;
 		case REG_SZ:
 		case REG_EXPAND_SZ:

Modified: python/branches/py3k-struni/PC/config.c
==============================================================================
--- python/branches/py3k-struni/PC/config.c	(original)
+++ python/branches/py3k-struni/PC/config.c	Mon Jun 18 19:58:50 2007
@@ -14,11 +14,9 @@
 extern void initerrno(void);
 extern void initgc(void);
 extern void initmath(void);
-extern void init_md5(void);
 extern void initnt(void);
 extern void initoperator(void);
 extern void initsignal(void);
-extern void init_sha(void);
 extern void init_sha256(void);
 extern void init_sha512(void);
 extern void inittime(void);
@@ -61,7 +59,6 @@
 extern void init_lsprof(void);
 extern void init_ast(void);
 extern void init_types(void);
-extern void initatexit(void);
 
 /* tools/freeze/makeconfig.py marker for additional "extern" */
 /* -- ADDMODULE MARKER 1 -- */
@@ -73,7 +70,6 @@
 
         {"array", initarray},
 	{"_ast", init_ast},
-	{"atexit", initatexit},
 #ifdef MS_WINDOWS
 #ifndef MS_WINI64
         {"audioop", initaudioop},
@@ -84,11 +80,9 @@
         {"errno", initerrno},
         {"gc", initgc},
         {"math", initmath},
-        {"_md5", init_md5},
         {"nt", initnt}, /* Use the NT os functions, not posix */
         {"operator", initoperator},
         {"signal", initsignal},
-        {"_sha", init_sha},
         {"_sha256", init_sha256},
         {"_sha512", init_sha512},
         {"time", inittime},

Modified: python/branches/py3k-struni/PC/pyconfig.h
==============================================================================
--- python/branches/py3k-struni/PC/pyconfig.h	(original)
+++ python/branches/py3k-struni/PC/pyconfig.h	Mon Jun 18 19:58:50 2007
@@ -275,9 +275,9 @@
 #define HAVE_LONG_LONG 1
 #ifndef PY_LONG_LONG
 #	define PY_LONG_LONG __int64
-#	define PY_LLONG_MAX LLONG_MAX
-#	define PY_LLONG_MIN LLONG_MIN
-#	define PY_ULLONG_MAX ULLONG_MAX
+#	define PY_LLONG_MAX _I64_MAX
+#	define PY_LLONG_MIN _I64_MIN
+#	define PY_ULLONG_MAX _UI64_MAX
 #endif
 
 /* For Windows the Python core is in a DLL by default.  Test
@@ -303,9 +303,9 @@
 			their Makefile (other compilers are generally
 			taken care of by distutils.) */
 #			ifdef _DEBUG
-#				pragma comment(lib,"python26_d.lib")
+#				pragma comment(lib,"python30_d.lib")
 #			else
-#				pragma comment(lib,"python26.lib")
+#				pragma comment(lib,"python30.lib")
 #			endif /* _DEBUG */
 #		endif /* _MSC_VER */
 #	endif /* Py_BUILD_CORE */

Modified: python/branches/py3k-struni/PCbuild/pythoncore.vcproj
==============================================================================
--- python/branches/py3k-struni/PCbuild/pythoncore.vcproj	(original)
+++ python/branches/py3k-struni/PCbuild/pythoncore.vcproj	Mon Jun 18 19:58:50 2007
@@ -39,15 +39,15 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="getbuildinfo.o"
-				OutputFile="./python26.dll"
+				OutputFile="./python30.dll"
 				LinkIncremental="1"
 				SuppressStartupBanner="TRUE"
 				IgnoreDefaultLibraryNames="libc"
 				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\./python26.pdb"
+				ProgramDatabaseFile=".\./python30.pdb"
 				SubSystem="2"
 				BaseAddress="0x1e000000"
-				ImportLibrary=".\./python26.lib"
+				ImportLibrary=".\./python30.lib"
 				TargetMachine="1"/>
 			<Tool
 				Name="VCMIDLTool"/>
@@ -99,15 +99,15 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="getbuildinfo.o"
-				OutputFile="./python26_d.dll"
+				OutputFile="./python30_d.dll"
 				LinkIncremental="1"
 				SuppressStartupBanner="TRUE"
 				IgnoreDefaultLibraryNames="libc"
 				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\./python26_d.pdb"
+				ProgramDatabaseFile=".\./python30_d.pdb"
 				SubSystem="2"
 				BaseAddress="0x1e000000"
-				ImportLibrary=".\./python26_d.lib"
+				ImportLibrary=".\./python30_d.lib"
 				TargetMachine="1"/>
 			<Tool
 				Name="VCMIDLTool"/>
@@ -166,15 +166,15 @@
 				Name="VCLinkerTool"
 				AdditionalOptions=" /MACHINE:IA64 /USELINK:MS_SDK"
 				AdditionalDependencies="getbuildinfo.o"
-				OutputFile="./python26.dll"
+				OutputFile="./python30.dll"
 				LinkIncremental="1"
 				SuppressStartupBanner="FALSE"
 				IgnoreDefaultLibraryNames="libc"
 				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\./python26.pdb"
+				ProgramDatabaseFile=".\./python30.pdb"
 				SubSystem="2"
 				BaseAddress="0x1e000000"
-				ImportLibrary=".\./python26.lib"
+				ImportLibrary=".\./python30.lib"
 				TargetMachine="0"/>
 			<Tool
 				Name="VCMIDLTool"/>
@@ -233,15 +233,15 @@
 				Name="VCLinkerTool"
 				AdditionalOptions=" /MACHINE:AMD64 /USELINK:MS_SDK"
 				AdditionalDependencies="getbuildinfo.o"
-				OutputFile="./python26.dll"
+				OutputFile="./python30.dll"
 				LinkIncremental="1"
 				SuppressStartupBanner="TRUE"
 				IgnoreDefaultLibraryNames="libc"
 				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\./python26.pdb"
+				ProgramDatabaseFile=".\./python30.pdb"
 				SubSystem="2"
 				BaseAddress="0x1e000000"
-				ImportLibrary=".\./python26.lib"
+				ImportLibrary=".\./python30.lib"
 				TargetMachine="0"/>
 			<Tool
 				Name="VCMIDLTool"/>
@@ -365,6 +365,9 @@
 			RelativePath="..\Modules\_codecsmodule.c">
 		</File>
 		<File
+			RelativePath="..\Modules\_collectionsmodule.c">
+		</File>
+		<File
 			RelativePath="..\Modules\_csv.c">
 		</File>
 		<File
@@ -461,9 +464,6 @@
 			RelativePath="..\Objects\codeobject.c">
 		</File>
 		<File
-			RelativePath="..\Modules\_collectionsmodule.c">
-		</File>
-		<File
 			RelativePath="..\Python\compile.c">
 		</File>
 		<File

Modified: python/branches/py3k-struni/Python/structmember.c
==============================================================================
--- python/branches/py3k-struni/Python/structmember.c	(original)
+++ python/branches/py3k-struni/Python/structmember.c	Mon Jun 18 19:58:50 2007
@@ -81,6 +81,9 @@
 	case T_ULONG:
 		v = PyLong_FromUnsignedLong(*(unsigned long*)addr);
 		break;
+	case T_PYSSIZET:
+		v = PyInt_FromSsize_t(*(Py_ssize_t*)addr);
+		break;
 	case T_FLOAT:
 		v = PyFloat_FromDouble((double)*(float*)addr);
 		break;
@@ -259,6 +262,13 @@
 		}
 		break;
 		}
+	case T_PYSSIZET:{
+		*(Py_ssize_t*)addr = PyInt_AsSsize_t(v);
+		if ((*(Py_ssize_t*)addr == (Py_ssize_t)-1)
+		    && PyErr_Occurred())
+				return -1;
+		break;
+		}
 	case T_FLOAT:{
 		double double_val;
 		double_val = PyFloat_AsDouble(v);

Modified: python/branches/py3k-struni/Tools/buildbot/external-amd64.bat
==============================================================================
--- python/branches/py3k-struni/Tools/buildbot/external-amd64.bat	(original)
+++ python/branches/py3k-struni/Tools/buildbot/external-amd64.bat	Mon Jun 18 19:58:50 2007
@@ -7,23 +7,29 @@
 call "%MSSdk%\SetEnv" /XP64 /RETAIL
 
 @rem Assume we start inside the Python source directory
+for %%i in (.) do set CWD=%%~fi
 cd ..
 
 @rem sqlite
 if not exist sqlite-source-3.3.4 (
    svn export http://svn.python.org/projects/external/sqlite-source-3.3.4
-   if exist build\PCbuild\sqlite3.dll del build\PCbuild\sqlite3.dll
+   if exist %CWD%\PCbuild\sqlite3.dll del %CWD%\PCbuild\sqlite3.dll
 )
-if not exist build\PCbuild\sqlite3.dll (
+if not exist %CWD%\PCbuild\sqlite3.dll (
    cd sqlite-source-3.3.4\amd64
    cl ..\*.c
    link /def:..\sqlite3.def  /dll *.obj /out:sqlite3.dll bufferoverflowU.lib
    cd ..\..
-   copy sqlite-source-3.3.4\amd64\sqlite3.dll build\PCbuild
+   copy sqlite-source-3.3.4\amd64\sqlite3.dll %CWD%\PCbuild
 )
 
 @rem bzip
 if not exist bzip2-1.0.3 svn export http://svn.python.org/projects/external/bzip2-1.0.3
+if not exist bzip2-1.0.3\libbz2.lib (
+   cd bzip2-1.0.3
+   nmake /f makefile.msc CFLAGS="-DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo /GS-"
+   cd ..
+)
 
 @rem Sleepycat db
 if not exist db-4.4.20 svn export http://svn.python.org/projects/external/db-4.4.20


More information about the Python-3000-checkins mailing list