Skip to content
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
Harmonize to Python C code style guidelines
  • Loading branch information
MonadChains committed Sep 7, 2022
commit 9248a25a1c4f986022f282b1bd7fef164dfb6667
12 changes: 7 additions & 5 deletions Modules/_testcapimodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4852,20 +4852,22 @@ hasattr_string(PyObject *self, PyObject* args)
PyObject* obj;
PyObject* attr_name;

if(!PyArg_UnpackTuple(args, "hasattr_string", 2, 2, &obj, &attr_name))
if (!PyArg_UnpackTuple(args, "hasattr_string", 2, 2, &obj, &attr_name)) {
return NULL;
}

if(!PyUnicode_Check(attr_name))
{
if (!PyUnicode_Check(attr_name)) {
PyErr_SetString(PyExc_TypeError, "attribute name must a be string");
return PyErr_Occurred();
}

const char *name_str = PyUnicode_AsUTF8(attr_name);
if(PyObject_HasAttrString(obj, name_str))
if (PyObject_HasAttrString(obj, name_str)) {
Py_RETURN_TRUE;
else
}
else {
Py_RETURN_FALSE;
}
}
Comment thread
MonadChains marked this conversation as resolved.


Expand Down