Index: Lib/test/test_functools.py =================================================================== --- Lib/test/test_functools.py (revision 66976) +++ Lib/test/test_functools.py (working copy) @@ -36,12 +36,16 @@ self.assertEqual(p.func, capture) self.assertEqual(p.args, (1, 2)) self.assertEqual(p.keywords, dict(a=10, b=20)) + self.assertEqual(p.__name__, capture.__name__) + self.assertEqual(p.__doc__, capture.__doc__) # attributes should not be writable if not isinstance(self.thetype, type): return self.assertRaises(TypeError, setattr, p, 'func', map) self.assertRaises(TypeError, setattr, p, 'args', (1, 2)) self.assertRaises(TypeError, setattr, p, 'keywords', dict(a=1, b=2)) + self.assertRaises(TypeError, setattr, p, '__name__', "foo") + self.assertRaises(TypeError, setattr, p, '__doc__', "bar") def test_argument_checking(self): self.assertRaises(TypeError, self.thetype) # need at least a func arg Index: Modules/_functoolsmodule.c =================================================================== --- Modules/_functoolsmodule.c (revision 66976) +++ Modules/_functoolsmodule.c (working copy) @@ -234,6 +234,18 @@ }; static PyObject * +partial_get_name(partialobject *pto) +{ + return PyObject_GetAttrString(pto->fn, "__name__"); +} + +static PyObject * +partial_get_doc(partialobject *pto) +{ + return PyObject_GetAttrString(pto->fn, "__doc__"); +} + +static PyObject * partial_get_dict(partialobject *pto) { if (pto->dict == NULL) { @@ -271,6 +283,8 @@ static PyGetSetDef partial_getsetlist[] = { {"__dict__", (getter)partial_get_dict, (setter)partial_set_dict}, + {"__name__", (getter)partial_get_name, NULL}, + {"__doc__", (getter)partial_get_doc, NULL}, {NULL} /* Sentinel */ };