Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1:/tmp/cvs-serv29361
Modified Files:
MiscTypes.cpp PyIBase.cpp
Log Message:
Allow the PyIEnum* interfaces to act as iterators. Only the new
win32com.shell.shell interfaces take advantage of this.
Index: MiscTypes.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/MiscTypes.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MiscTypes.cpp 1 Sep 1999 23:02:42 -0000 1.1
--- MiscTypes.cpp 6 Oct 2003 13:09:44 -0000 1.2
***************
*** 27,35 ****
0, /*tp_call*/
0, /*tp_str*/
! 0, /*tp_xxx1*/
! 0, /*tp_xxx2*/
! 0, /*tp_xxx3*/
! 0, /*tp_xxx4*/
! "Define the behavior of a PythonCOM Interface type.",
};
--- 27,35 ----
0, /*tp_call*/
0, /*tp_str*/
! 0, /*tp_getattro */
! 0, /*tp_setattro */
! 0, /* tp_as_buffer */
! 0, /* tp_flags */
! "Define the behavior of a PythonCOM Interface type.", /* tp_doc */
};
***************
*** 53,56 ****
--- 53,72 ----
(reprfunc)PyIBase::repr, /*tp_repr*/
0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro */
+ 0, /*tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_HAVE_ITER, /* tp_flags */
+ 0, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ PyIBase::iter, /* tp_iter */
+ PyIBase::iternext /* tp_iternext */
};
Index: PyIBase.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIBase.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyIBase.cpp 1 Sep 1999 23:02:42 -0000 1.1
--- PyIBase.cpp 6 Oct 2003 13:09:44 -0000 1.2
***************
*** 40,43 ****
--- 40,56 ----
return Py_FindMethodInChain(&((PyComTypeObject *)ob_type)->chain, this, name);
}
+ PyObject *
+ PyIBase::iter()
+ {
+ return PyErr_Format(PyExc_TypeError,
+ "COM objects of type '%s' can not be iterated.", ob_type->tp_name);
+ return NULL;
+ }
+ PyObject *
+ PyIBase::iternext()
+ {
+ PyErr_SetString(PyExc_RuntimeError, "not iterable");
+ return NULL;
+ }
/*static*/int PyIBase::setattr(PyObject *op, char *name, PyObject *v)
***************
*** 74,76 ****
--- 87,99 ----
{
return ((PyIBase *)ob1)->compare(ob2);
+ }
+
+ /*static*/ PyObject *PyIBase::iter(PyObject *self)
+ {
+ return ((PyIBase *)self)->iter();
+ }
+
+ /*static*/ PyObject *PyIBase::iternext(PyObject *self)
+ {
+ return ((PyIBase *)self)->iternext();
}
|