[Zope3-checkins] CVS: Zope3/src/zope/proxy/context - decorator.c:1.8.2.1
Steve Alexander
steve@cat-box.net
Thu, 15 May 2003 10:50:06 -0400
Update of /cvs-repository/Zope3/src/zope/proxy/context
In directory cvs.zope.org:/tmp/cvs-serv12712/src/zope/proxy/context
Modified Files:
Tag: stevea-decorators-branch
decorator.c
Log Message:
More work on Decorators.
Converted existing tests to use decorators instead of ZopeContainerAdapter.
=== Zope3/src/zope/proxy/context/decorator.c 1.8 => 1.8.2.1 ===
--- Zope3/src/zope/proxy/context/decorator.c:1.8 Mon May 12 12:17:39 2003
+++ Zope3/src/zope/proxy/context/decorator.c Thu May 15 10:49:35 2003
@@ -176,15 +176,27 @@
decorator->names_dict = names_dict;
for (i=0; i<size; ++i) {
temp = PySequence_Fast_GET_ITEM(fast_names, i);
+#ifdef Py_USING_UNICODE
+ if (PyUnicode_Check(temp)) {
+ temp = PyUnicode_AsEncodedString(temp, NULL, NULL);
+ if (temp == NULL)
+ goto finally;
+ }
+ else
+#endif
if (!PyString_CheckExact(temp)) {
PyErr_SetString(PyExc_TypeError,
"'names' must contain only strings.");
goto finally;
}
+ else
+ Py_INCREF(temp);
if (PyDict_SetItem(names_dict, temp,
dispatch_to_mixin_marker) != 0) {
+ Py_DECREF(temp);
goto finally;
}
+ Py_DECREF(temp);
}
}
/* otherwise, names == (), and names_dict == NULL */