Skip to content

Commit 0bc0198

Browse files
committed
PyUnicode_EqualToUTF8 can't error (and doesn't type-check)
1 parent d9728de commit 0bc0198

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Modules/xxlimited.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,7 @@ static int
277277
Xxo_setattro(PyObject *self, PyObject *name, PyObject *v)
278278
{
279279
// filter a specific attribute name
280-
int is_reserved = PyUnicode_EqualToUTF8(name, "reserved");
281-
if (is_reserved < 0) {
282-
return -1;
283-
}
284-
else if (is_reserved) {
280+
if (PyUnicode_Check(name) && PyUnicode_EqualToUTF8(name, "reserved")) {
285281
PyErr_Format(PyExc_AttributeError, "cannot set %R", name);
286282
return -1;
287283
}

0 commit comments

Comments
 (0)