8000 gh-80480: Emit DeprecationWarning for array's 'u' type code by hugovk · Pull Request #95760 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move warning after audit
  • Loading branch information
hugovk committed Jun 6, 2023
commit e3b96bb6eec9bbc6f4c8cfda012decdcd0380795
10 changes: 5 additions & 5 deletions 10 Modules/arraymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2674,6 +2674,11 @@ 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 @@ -2683,11 +2688,6 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
}
}

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

bool is_unicode = c == 'u' || c == 'w';

if (initial && !is_unicode) {
Expand Down
0