gh-80480: Emit DeprecationWarning for array's 'u' type code (#95760)

This commit is contained in:
Hugo van Kemenade 2023-06-11 12:17:35 +03:00 committed by GitHub
parent 3a314f7c3d
commit cc879481e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 10 deletions

View file

@ -2679,6 +2679,15 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL;
}
if (c == 'u') {
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"The 'u' type code is deprecated and "
"will be removed in Python 3.16",
1)) {
return NULL;
}
}
bool is_unicode = c == 'u' || c == 'w';
if (initial && !is_unicode) {