summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Modules/_sqlite/microprotocols.c
diff options
context:
space:
mode:
authorshadchin <[email protected]>2026-02-03 21:59:07 +0300
committershadchin <[email protected]>2026-02-03 22:28:51 +0300
commitbce46f28de392862d5c6c3b185d844ee7c623be3 (patch)
tree424878b5b90144f98970ce4a2745990c77330ad2 /contrib/tools/python3/Modules/_sqlite/microprotocols.c
parent0e0ee9fa48ce9411b4038aa769493d22ff6c10a2 (diff)
Import Python 3.13.11
commit_hash:bbb53cefb159aa3e7afaa475fd19d5a03b66945f
Diffstat (limited to 'contrib/tools/python3/Modules/_sqlite/microprotocols.c')
-rw-r--r--contrib/tools/python3/Modules/_sqlite/microprotocols.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/contrib/tools/python3/Modules/_sqlite/microprotocols.c b/contrib/tools/python3/Modules/_sqlite/microprotocols.c
index 148220d0f91..f77458d94a8 100644
--- a/contrib/tools/python3/Modules/_sqlite/microprotocols.c
+++ b/contrib/tools/python3/Modules/_sqlite/microprotocols.c
@@ -85,20 +85,19 @@ pysqlite_microprotocols_adapt(pysqlite_state *state, PyObject *obj,
if (!key) {
return NULL;
}
- adapter = PyDict_GetItemWithError(state->psyco_adapters, key);
+ if (PyDict_GetItemRef(state->psyco_adapters, key, &adapter) < 0) {
+ Py_DECREF(key);
+ return NULL;
+ }
Py_DECREF(key);
if (adapter) {
- Py_INCREF(adapter);
adapted = PyObject_CallOneArg(adapter, obj);
Py_DECREF(adapter);
return adapted;
}
- if (PyErr_Occurred()) {
- return NULL;
- }
/* try to have the protocol adapt this object */
- if (_PyObject_LookupAttr(proto, state->str___adapt__, &adapter) < 0) {
+ if (PyObject_GetOptionalAttr(proto, state->str___adapt__, &adapter) < 0) {
return NULL;
}
if (adapter) {
@@ -117,7 +116,7 @@ pysqlite_microprotocols_adapt(pysqlite_state *state, PyObject *obj,
}
/* and finally try to have the object adapt itself */
- if (_PyObject_LookupAttr(obj, state->str___conform__, &adapter) < 0) {
+ if (PyObject_GetOptionalAttr(obj, state->str___conform__, &adapter) < 0) {
return NULL;
}
if (adapter) {