diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-22 07:46:36 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-22 07:46:36 (GMT) |
commit | d357b89f0bf3de2957e93ea5aa6ead5e50d30930 (patch) | |
tree | b4d622a8e0060d527dc6a576bad7f1496319e0da /Objects | |
parent | 52027c301a0b3675bb5db23d33eede3f6b19395f (diff) | |
download | cpython-d357b89f0bf3de2957e93ea5aa6ead5e50d30930.zip cpython-d357b89f0bf3de2957e93ea5aa6ead5e50d30930.tar.gz cpython-d357b89f0bf3de2957e93ea5aa6ead5e50d30930.tar.bz2 |
Issue #22079: Deprecation warning now is issued in PyType_Ready() instead of
raising TypeError when statically allocated type subclasses dynamically
allocated type
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index cf58911..0fccecd 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4803,11 +4803,14 @@ PyType_Ready(PyTypeObject *type) PyObject *b = PyTuple_GET_ITEM(bases, i); if (PyType_Check(b) && (((PyTypeObject *)b)->tp_flags & Py_TPFLAGS_HEAPTYPE)) { - PyErr_Format(PyExc_TypeError, - "type '%.100s' is not dynamically allocated but " - "its base type '%.100s' is dynamically allocated", - type->tp_name, ((PyTypeObject *)b)->tp_name); - goto error; + char buf[300]; + PyOS_snprintf(buf, sizeof(buf), + "type '%.100s' is not dynamically allocated but " + "its base type '%.100s' is dynamically allocated", + type->tp_name, ((PyTypeObject *)b)->tp_name); + if (PyErr_Warn(PyExc_DeprecationWarning, buf) < 0) + goto error; + break; } } |