Message1331

Author leouserz
Recipients
Date 2007-01-19.16:00:30
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
ok,

it appears that python's implementation has special getDoc code for this situation:
static PyObject *
type_get_doc(PyTypeObject *type, void *context)
{
	PyObject *result;
	if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL)
		return PyString_FromString(type->tp_doc);
	result = PyDict_GetItemString(type->tp_dict, "__doc__");
	if (result == NULL) {
		result = Py_None;
		Py_INCREF(result);
	}
	else if (result->ob_type->tp_descr_get) {
		result = result->ob_type->tp_descr_get(result, NULL,
						       (PyObject *)type);
	}
	else {
		Py_INCREF(result);
	}
	return result;
}
http://svn.python.org/view/python/trunk/Objects/typeobject.c?rev=52245&view=markup

By overriding the getDoc for PyType we can add an additional check for a "__get__" implementation.  If not null we call __get__ on the return value.

There is a patch for this up here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1639663&group_id=12867&atid=312867

leouser
History
Date User Action Args
2008-02-20 17:17:37adminlinkissue1605006 messages
2008-02-20 17:17:37admincreate