mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #20204: Deprecation warning is now raised for builtin type without the
__module__ attribute.
This commit is contained in:
parent
50adb9fc32
commit
490055a167
3 changed files with 17 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue