Author: christian.heimes
Date: Tue Jan 29 13:18:50 2008
New Revision: 60408

Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Doc/c-api/set.rst
   python/branches/py3k/Doc/tools/sphinxext/   (props changed)
   python/branches/py3k/Include/setobject.h
   python/branches/py3k/Lib/ctypes/test/test_funcptr.py
   python/branches/py3k/Makefile.pre.in
   python/branches/py3k/Misc/Vim/python.vim
   python/branches/py3k/Misc/Vim/syntax_test.py
   python/branches/py3k/Misc/Vim/vim_syntax.py
   python/branches/py3k/Modules/_ctypes/_ctypes.c
   python/branches/py3k/Objects/setobject.c
   python/branches/py3k/Python/marshal.c
   python/branches/py3k/setup.py
Log:
Merged revisions 60383-60407 via svnmerge from 
svn+ssh://[EMAIL PROTECTED]/python/trunk

........
  r60388 | thomas.heller | 2008-01-28 09:44:13 +0100 (Mon, 28 Jan 2008) | 1 line
  
  Revert rev. 59925, it breaks comtypes (I need to further examine this).
........
  r60397 | raymond.hettinger | 2008-01-28 21:34:33 +0100 (Mon, 28 Jan 2008) | 5 
lines
  
  Make PySet_Add() work with frozensets.
  Works like PyTuple_SetItem() to build-up values in a brand new frozenset.
  Also, PyFrozenSet_New() is now guaranteed to produce a distinct new frozenset.
........
  r60398 | raymond.hettinger | 2008-01-28 22:34:30 +0100 (Mon, 28 Jan 2008) | 1 
line
  
  Let marshal built-up sets and frozensets one element at a time (without 
creating an intermediate tuple).
........
  r60399 | raymond.hettinger | 2008-01-28 22:47:42 +0100 (Mon, 28 Jan 2008) | 1 
line
  
  Factor-out common code with a new macro
........
  r60400 | raymond.hettinger | 2008-01-28 22:48:07 +0100 (Mon, 28 Jan 2008) | 1 
line
  
  Factor-out common code with a new macro
........
  r60401 | raymond.hettinger | 2008-01-28 22:51:25 +0100 (Mon, 28 Jan 2008) | 1 
line
  
  Removed unnecessary conditional (spotted by Neal Norwitz).
........
  r60403 | gregory.p.smith | 2008-01-29 00:21:00 +0100 (Tue, 29 Jan 2008) | 4 
lines
  
  Disable use of BerkeleyDB 4.6.x to see what the odd platform buildbots
  think.  In particular, neal norwitz has traced an Ubuntu sparc64 crash
  to the Lib/test/bsddb/test_basics.py test when opening a db with DB_THREAD.
........
  r60405 | brett.cannon | 2008-01-29 05:13:07 +0100 (Tue, 29 Jan 2008) | 2 lines
  
  Fix the reindent rule to use $(BUILDPYTHON).
........
  r60406 | brett.cannon | 2008-01-29 05:18:04 +0100 (Tue, 29 Jan 2008) | 3 lines
  
  Update Vim syntax highlighting to specify what revision was used to generate
  the file.
........
  r60407 | brett.cannon | 2008-01-29 05:20:56 +0100 (Tue, 29 Jan 2008) | 2 lines
  
  Ignore .pyc and .pyo files.
........


Modified: python/branches/py3k/Doc/c-api/set.rst
==============================================================================
--- python/branches/py3k/Doc/c-api/set.rst      (original)
+++ python/branches/py3k/Doc/c-api/set.rst      Tue Jan 29 13:18:50 2008
@@ -50,6 +50,12 @@
 the constructor functions work with any iterable Python object.
 
 
+.. cfunction:: int PySet_Check(PyObject *p)
+
+   Return true if *p* is a :class:`set` object or an instance of a subtype.
+
+   .. versionadded:: 2.6
+
 .. cfunction:: int PyAnySet_Check(PyObject *p)
 
    Return true if *p* is a :class:`set` object, a :class:`frozenset` object, 
or an
@@ -84,6 +90,11 @@
    set on success or *NULL* on failure.  Raise :exc:`TypeError` if *iterable* 
is
    not actually iterable.
 
+   .. versionchanged:: 2.6
+      Now guaranteed to return a brand-new :class:`frozenset`.  Formerly,
+      frozensets of zero-length were a singleton.  This got in the way of 
+      building-up new frozensets with :meth:`PySet_Add`.
+
 The following functions and macros are available for instances of :class:`set`
 or :class:`frozenset` or instances of their subtypes.
 
@@ -110,9 +121,6 @@
    the *key* is unhashable. Raise :exc:`PyExc_SystemError` if *anyset* is not a
    :class:`set`, :class:`frozenset`, or an instance of a subtype.
 
-The following functions are available for instances of :class:`set` or its
-subtypes but not for instances of :class:`frozenset` or its subtypes.
-
 
 .. cfunction:: int PySet_Add(PyObject *set, PyObject *key)
 
@@ -122,6 +130,14 @@
    Raise a :exc:`SystemError` if *set* is an not an instance of :class:`set` 
or its
    subtype.
 
+   .. versionchanged:: 2.6
+      Now works with instances of :class:`frozenset` or its subtypes.
+      Like :cfunc:`PyTuple_SetItem` in that it can be used to fill-in the
+      values of brand new frozensets before they are exposed to other code.
+
+The following functions are available for instances of :class:`set` or its
+subtypes but not for instances of :class:`frozenset` or its subtypes.
+
 
 .. cfunction:: int PySet_Discard(PyObject *set, PyObject *key)
 

Modified: python/branches/py3k/Include/setobject.h
==============================================================================
--- python/branches/py3k/Include/setobject.h    (original)
+++ python/branches/py3k/Include/setobject.h    Tue Jan 29 13:18:50 2008
@@ -74,6 +74,8 @@
        (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \
          PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
          PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
+#define PySet_Check(ob) \
+       (Py_TYPE(ob) == &PySet_Type || PyType_IsSubtype(Py_TYPE(ob), 
&PySet_Type))
 
 PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
 PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);

Modified: python/branches/py3k/Lib/ctypes/test/test_funcptr.py
==============================================================================
--- python/branches/py3k/Lib/ctypes/test/test_funcptr.py        (original)
+++ python/branches/py3k/Lib/ctypes/test/test_funcptr.py        Tue Jan 29 
13:18:50 2008
@@ -123,11 +123,5 @@
         self.failUnlessEqual(strtok(None, b"\n"), "c")
         self.failUnlessEqual(strtok(None, b"\n"), None)
 
-    def test_NULL_funcptr(self):
-        tp = CFUNCTYPE(c_int)
-        func = tp() # NULL function pointer
-        # raise a ValueError when we try to call it
-        self.assertRaises(ValueError, func)
-
 if __name__ == '__main__':
     unittest.main()

Modified: python/branches/py3k/Makefile.pre.in
==============================================================================
--- python/branches/py3k/Makefile.pre.in        (original)
+++ python/branches/py3k/Makefile.pre.in        Tue Jan 29 13:18:50 2008
@@ -1043,7 +1043,7 @@
 
 # Run reindent on the library
 reindent:
-       ./python$(EXEEXT) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
+       ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
 
 # Rerun configure with the same options as it was run last time,
 # provided the config.status script exists

Modified: python/branches/py3k/Misc/Vim/python.vim
==============================================================================
--- python/branches/py3k/Misc/Vim/python.vim    (original)
+++ python/branches/py3k/Misc/Vim/python.vim    Tue Jan 29 13:18:50 2008
@@ -1,4 +1,4 @@
-" Auto-generated Vim syntax file for Python
+" Auto-generated Vim syntax file for Python (trunk: r60376M).
 "
 " To use: copy or symlink to ~/.vim/syntax/python.vim
 
@@ -63,7 +63,7 @@
 
 if exists("python_highlight_builtins")
   syn keyword pythonBuiltin    Ellipsis False None NotImplemented True 
__debug__
-  syn keyword pythonBuiltin    __import__ abs all any basestring bool
+  syn keyword pythonBuiltin    __import__ abs all any bool
   syn keyword pythonBuiltin    buffer callable chr classmethod cmp
   syn keyword pythonBuiltin    complex copyright credits delattr dict
   syn keyword pythonBuiltin    dir divmod enumerate eval exec exit
@@ -73,7 +73,8 @@
   syn keyword pythonBuiltin    max min object oct open ord pow property quit
   syn keyword pythonBuiltin    range reload repr reversed round
   syn keyword pythonBuiltin    set setattr slice sorted staticmethod str sum
-  syn keyword pythonBuiltin    super tuple type unichr unicode vars zip
+  syn keyword pythonBuiltin    super trunc tuple type unicode vars 
+  syn keyword pythonBuiltin    zip
 
 endif
 

Modified: python/branches/py3k/Misc/Vim/syntax_test.py
==============================================================================
--- python/branches/py3k/Misc/Vim/syntax_test.py        (original)
+++ python/branches/py3k/Misc/Vim/syntax_test.py        Tue Jan 29 13:18:50 2008
@@ -4,9 +4,8 @@
 Not necessarily sensical or comprehensive (assume that if one exception is
 highlighted that all are, for instance).
 
-Highlighting extraneous whitespace at the end of the line is not represented
-here as all trailing whitespace is automatically removed from .py files in the
-repository.
+Extraneous trailing whitespace can't be tested because of svn pre-commit hook
+checks for such things.
 
 """
 # Comment

Modified: python/branches/py3k/Misc/Vim/vim_syntax.py
==============================================================================
--- python/branches/py3k/Misc/Vim/vim_syntax.py (original)
+++ python/branches/py3k/Misc/Vim/vim_syntax.py Tue Jan 29 13:18:50 2008
@@ -6,8 +6,9 @@
 import exceptions
 import builtins
 from string import Template
+from sys import subversion
 
-comment_header = '''" Auto-generated Vim syntax file for Python.
+comment_header = '''" Auto-generated Vim syntax file for Python (%s: r%s).
 "
 " To use: copy or symlink to ~/.vim/syntax/python.vim'''
 
@@ -162,7 +163,7 @@
 def main(file_path):
     with open(file_path, 'w') as FILE:
         # Comment for file
-        print>>FILE, comment_header
+        print>>FILE, comment_header % subversion[1:]
         print>>FILE, ''
         # Statements at start of file
         print>>FILE, statement_header

Modified: python/branches/py3k/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/_ctypes.c      (original)
+++ python/branches/py3k/Modules/_ctypes/_ctypes.c      Tue Jan 29 13:18:50 2008
@@ -3414,11 +3414,6 @@
 
 
        pProc = *(void **)self->b_ptr;
-       if (pProc == NULL) {
-               PyErr_SetString(PyExc_ValueError,
-                               "attempt to call NULL function pointer");
-               return NULL;
-       }
 #ifdef MS_WIN32
        if (self->index) {
                /* It's a COM method */

Modified: python/branches/py3k/Objects/setobject.c
==============================================================================
--- python/branches/py3k/Objects/setobject.c    (original)
+++ python/branches/py3k/Objects/setobject.c    Tue Jan 29 13:18:50 2008
@@ -2127,17 +2127,7 @@
 PyObject *
 PyFrozenSet_New(PyObject *iterable)
 {
-       PyObject *args, *result;
-
-       if (iterable == NULL)
-               args = PyTuple_New(0);
-       else
-               args = PyTuple_Pack(1, iterable);
-       if (args == NULL)
-               return NULL;
-       result = frozenset_new(&PyFrozenSet_Type, args, NULL);
-       Py_DECREF(args);
-       return result;
+       return make_new_set(&PyFrozenSet_Type, iterable);
 }
 
 Py_ssize_t
@@ -2153,7 +2143,7 @@
 int
 PySet_Clear(PyObject *set)
 {
-       if (!PyType_IsSubtype(Py_TYPE(set), &PySet_Type)) {
+       if (!PySet_Check(set)) {
                PyErr_BadInternalCall();
                return -1;
        }
@@ -2173,7 +2163,7 @@
 int
 PySet_Discard(PyObject *set, PyObject *key)
 {
-       if (!PyType_IsSubtype(Py_TYPE(set), &PySet_Type)) {
+       if (!PySet_Check(set)) {
                PyErr_BadInternalCall();
                return -1;
        }
@@ -2181,13 +2171,13 @@
 }
 
 int
-PySet_Add(PyObject *set, PyObject *key)
+PySet_Add(PyObject *anyset, PyObject *key)
 {
-       if (!PyType_IsSubtype(Py_TYPE(set), &PySet_Type)) {
+       if (!PyAnySet_Check(anyset)) {
                PyErr_BadInternalCall();
                return -1;
        }
-       return set_add_key((PySetObject *)set, key);
+       return set_add_key((PySetObject *)anyset, key);
 }
 
 int
@@ -2224,7 +2214,7 @@
 PyObject *
 PySet_Pop(PyObject *set)
 {
-       if (!PyType_IsSubtype(Py_TYPE(set), &PySet_Type)) {
+       if (!PySet_Check(set)) {
                PyErr_BadInternalCall();
                return NULL;
        }
@@ -2234,7 +2224,7 @@
 int
 _PySet_Update(PyObject *set, PyObject *iterable)
 {
-       if (!PyType_IsSubtype(Py_TYPE(set), &PySet_Type)) {
+       if (!PySet_Check(set)) {
                PyErr_BadInternalCall();
                return -1;
        }
@@ -2330,7 +2320,6 @@
        f = PyFrozenSet_New(dup);
        assert(PySet_Size(f) == 3);
        assert(PyFrozenSet_CheckExact(f));
-       assertRaises(PySet_Add(f, elem) == -1, PyExc_SystemError);
        assertRaises(PySet_Discard(f, elem) == -1, PyExc_SystemError);
        assertRaises(PySet_Pop(f) == NULL, PyExc_SystemError);
        Py_DECREF(f);

Modified: python/branches/py3k/Python/marshal.c
==============================================================================
--- python/branches/py3k/Python/marshal.c       (original)
+++ python/branches/py3k/Python/marshal.c       Tue Jan 29 13:18:50 2008
@@ -812,7 +812,7 @@
                        retval = NULL;
                        break;
                }
-               v = PyTuple_New((int)n);
+                v = (type == TYPE_SET) ? PySet_New(NULL) : 
PyFrozenSet_New(NULL);
                if (v == NULL) {
                        retval = NULL;
                        break;
@@ -827,18 +827,14 @@
                                v = NULL;
                                break;
                        }
-                       PyTuple_SET_ITEM(v, (int)i, v2);
+                       if (PySet_Add(v, v2) == -1) {
+                                Py_DECREF(v);
+                                Py_DECREF(v2);
+                                v = NULL;
+                                break;
+                        }
                }
-               if (v == NULL) {
-                       retval = NULL;
-                       break;
-               }
-               if (type == TYPE_SET)
-                       v3 = PySet_New(v);
-               else
-                       v3 = PyFrozenSet_New(v);
-               Py_DECREF(v);
-               retval = v3;
+               retval = v;
                break;
 
        case TYPE_CODE:

Modified: python/branches/py3k/setup.py
==============================================================================
--- python/branches/py3k/setup.py       (original)
+++ python/branches/py3k/setup.py       Tue Jan 29 13:18:50 2008
@@ -652,7 +652,10 @@
         # a release.  Most open source OSes come with one or more
         # versions of BerkeleyDB already installed.
 
-        max_db_ver = (4, 6)
+        max_db_ver = (4, 5)  # XXX(gregory.p.smith): 4.6 "works" but seems to
+                             # have issues on many platforms.  I've temporarily
+                             # disabled 4.6 to see what the odd platform
+                             # buildbots say.
         min_db_ver = (3, 3)
         db_setup_debug = False   # verbose debug prints from this script?
 
_______________________________________________
Python-3000-checkins mailing list
Python-3000-checkins@python.org
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to