Skip to content

Commit a3646c9

Browse files
author
Erlend E. Aasland
committed
Use PyObject_SetAttrString iso. _PyObject_SetAttrId => slow path/readability
1 parent cf551b1 commit a3646c9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Modules/_sqlite/util.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,16 @@ _pysqlite_seterror(pysqlite_state *state, sqlite3 *db)
105105
goto exit;
106106
}
107107

108-
_Py_IDENTIFIER(sqlite_errorcode);
109108
PyObject *code = PyLong_FromLong(errorcode);
110109
if (code == NULL) {
111110
goto exit;
112111
}
113-
int rc = _PyObject_SetAttrId(exc, &PyId_sqlite_errorcode, code);
112+
int rc = PyObject_SetAttrString(exc, "sqlite_errorcode", code);
114113
Py_DECREF(code);
115114
if (rc < 0) {
116115
goto exit;
117116
}
118117

119-
_Py_IDENTIFIER(sqlite_errorname);
120118
const char *error_name = pysqlite_error_name(errorcode);
121119
PyObject *name;
122120
if (error_name) {
@@ -128,7 +126,7 @@ _pysqlite_seterror(pysqlite_state *state, sqlite3 *db)
128126
if (name == NULL) {
129127
goto exit;
130128
}
131-
rc = _PyObject_SetAttrId(exc, &PyId_sqlite_errorname, name);
129+
rc = PyObject_SetAttrString(exc, "sqlite_errorname", name);
132130
Py_DECREF(name);
133131
if (rc < 0) {
134132
goto exit;

0 commit comments

Comments
 (0)