summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-03-01 08:03:02 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-03-01 08:03:02 (GMT)
commit490055a1673b524da2ebe2312f072aba2a826036 (patch)
treea40049ade7567c316ab0b5217668179eac7644ac /Objects
parent50adb9fc3297377a606371cd208a91d2ff89b05a (diff)
downloadcpython-490055a1673b524da2ebe2312f072aba2a826036.zip
cpython-490055a1673b524da2ebe2312f072aba2a826036.tar.gz
cpython-490055a1673b524da2ebe2312f072aba2a826036.tar.bz2
Issue #20204: Deprecation warning is now raised for builtin type without the
__module__ attribute.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index f0ad7fd..d59108e 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2808,6 +2808,12 @@ PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
_PyDict_SetItemId(type->tp_dict, &PyId___module__,
PyUnicode_FromStringAndSize(
spec->name, (Py_ssize_t)(s - spec->name)));
+ else {
+ if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
+ "builtin type %.200s has no the __module__ attribute",
+ spec->name))
+ goto fail;
+ }
return (PyObject*)res;