[Zope-Checkins] CVS: Zope3/lib/python/Zope/ContextWrapper - wrapper.c:1.12.2.7

Fred Drake Jr fdrake@acm.org
Sat, 1 Dec 2001 15:26:18 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/ContextWrapper
In directory cvs.zope.org:/tmp/cvs-serv1024

Modified Files:
      Tag: Zope-3x-branch
	wrapper.c 
Log Message:
Modify constructor to support keyword args to initialize the context
dictionary.


=== Zope3/lib/python/Zope/ContextWrapper/wrapper.c 1.12.2.6 => 1.12.2.7 ===
         Py_XINCREF(context);
         wrapper->wrap_context = context;
-        wrapper->wrap_dict = NULL;
+        if (kwds != NULL && PyDict_Size(kwds) > 0) {
+            wrapper->wrap_dict = PyDict_Copy(kwds);
+            if (wrapper->wrap_dict == NULL) {
+                Py_DECREF(wrapper);
+                return result;
+            }
+        }
+        else
+            wrapper->wrap_dict = NULL;
         result = 0;
     }
  finally: