Skip to content

Commit

Permalink
fixup! pythongh-80480 Deprecate array's 'u' type code
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Aug 7, 2022
1 parent 39bf673 commit 03226a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Modules/arraymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2620,11 +2620,6 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (!PyArg_ParseTuple(args, "C|O:array", &c, &initial))
return NULL;

if (PySys_Audit("array.__new__", "CO",
c, initial ? initial : Py_None) < 0) {
return NULL;
}

if (c == 'u') {
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"The 'u' type code is deprecated and "
Expand All @@ -2634,6 +2629,11 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
}
}

if (PySys_Audit("array.__new__", "CO",
c, initial ? initial : Py_None) < 0) {
return NULL;
}

if (initial && c != 'u') {
if (PyUnicode_Check(initial)) {
PyErr_Format(PyExc_TypeError, "cannot use a str to initialize "
Expand Down

0 comments on commit 03226a6

Please sign in to comment.