bpo-46541: Replace _Py_IDENTIFIER with _Py_ID in sqlite3 (GH-31351)

This commit is contained in:
Erlend Egeberg Aasland 2022-02-16 16:24:44 +01:00 committed by GitHub
parent d64f3caebe
commit b2077117d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 39 deletions

View file

@ -23,8 +23,6 @@
* 3. This notice may not be removed or altered from any source distribution.
*/
#define NEEDS_PY_IDENTIFIER
#include <Python.h>
#include "cursor.h"
@ -76,8 +74,6 @@ PyObject *
pysqlite_microprotocols_adapt(pysqlite_state *state, PyObject *obj,
PyObject *proto, PyObject *alt)
{
_Py_IDENTIFIER(__adapt__);
_Py_IDENTIFIER(__conform__);
PyObject *adapter, *key, *adapted;
/* we don't check for exact type conformance as specified in PEP 246
@ -102,7 +98,7 @@ pysqlite_microprotocols_adapt(pysqlite_state *state, PyObject *obj,
}
/* try to have the protocol adapt this object */
if (_PyObject_LookupAttrId(proto, &PyId___adapt__, &adapter) < 0) {
if (_PyObject_LookupAttr(proto, state->str___adapt__, &adapter) < 0) {
return NULL;
}
if (adapter) {
@ -121,7 +117,7 @@ pysqlite_microprotocols_adapt(pysqlite_state *state, PyObject *obj,
}
/* and finally try to have the object adapt itself */
if (_PyObject_LookupAttrId(obj, &PyId___conform__, &adapter) < 0) {
if (_PyObject_LookupAttr(obj, state->str___conform__, &adapter) < 0) {
return NULL;
}
if (adapter) {