69 assert(PyDict_Check(dict));
73 classdict = PyObject_GetAttrString(aclass,
"__dict__");
74 if (classdict == NULL)
77 int status = PyDict_Update(dict, classdict);
84 bases = PyObject_GetAttrString(aclass,
"__bases__");
90 n = PySequence_Size(bases);
94 for (i = 0; i <
n; i++) {
96 PyObject *base = PySequence_GetItem(bases, i);
101 status = merge_class_dict(dict, base);
114#if PY_VERSION_HEX < 0x03000000
129 assert(PyDict_Check(dict));
133 list = PyObject_GetAttrString(obj, attrname);
137 else if (PyList_Check(list)) {
139 for (i = 0; i < PyList_GET_SIZE(list); ++i) {
140 PyObject *item = PyList_GET_ITEM(list, i);
141 if (PyString_Check(item)) {
142 result = PyDict_SetItem(dict, item, Py_None);
147 if (Py_Py3kWarningFlag &&
148 (strcmp(attrname,
"__members__") == 0 ||
149 strcmp(attrname,
"__methods__") == 0)) {
150 if (PyErr_WarnEx(PyExc_DeprecationWarning,
151 "__members__ and __methods__ not "
152 "supported in 3.x", 1) < 0) {
175 if (dict != NULL && merge_class_dict(dict, obj) == 0)
176 result = PyDict_Keys(dict);
184 if (PyType_Check(obj) || PyClass_Check(obj))
185 return _specialized_dir_type(obj);
192 dict = PyObject_GetAttrString(obj,
"__dict__");
197 else if (!PyDict_Check(dict)) {
211#if PY_VERSION_HEX < 0x03000000
214 if (merge_list_attr(dict, obj,
"__members__") < 0)
216 if (merge_list_attr(dict, obj,
"__methods__") < 0)
221 itsclass = PyObject_GetAttrString(obj,
"__class__");
222 if (itsclass == NULL)
227 if (merge_class_dict(dict, itsclass) != 0)
231 result = PyDict_Keys(dict);
234 Py_XDECREF(itsclass);