Commit 2fd42739 authored by Jim Fulton's avatar Jim Fulton

Changed the way __doc__ is managed to get backward compatible behavior.

parent 9bcc66f1
......@@ -308,6 +308,15 @@ EC_init(PyTypeObject *self, PyObject *args, PyObject *kw)
if (PyType_Type.tp_init(OBJECT(self), args, kw) < 0)
return -1;
if (self->tp_dict != NULL)
{
r = PyDict_GetItemString(self->tp_dict, "__doc__");
if ((r == Py_None) &&
(PyDict_DelItemString(self->tp_dict, "__doc__") < 0)
)
return -1;
}
/* set up __get__, if necessary */
if (self->tp_descr_get != of_get)
{
......
......@@ -170,6 +170,8 @@ def test__basicnew__():
{}
"""
def cmpattrs(self, other, *attrs):
for attr in attrs:
if attr[:3] in ('_v_', '_p_'):
......@@ -690,6 +692,23 @@ def test_of_not_called_when_not_accessed_through_EC_instance():
"""
def test_inheriting___doc__():
"""Old-style ExtensionClass inherited __doc__ from base classes.
>>> class E(Base):
... "eek"
>>> class EE(E):
... pass
>>> EE.__doc__
'eek'
>>> EE().__doc__
'eek'
"""
from doctest import DocTestSuite
import unittest
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment