fix(sqlite): align adaptation protocol with CPython (#5964)

This commit is contained in:
Jiseok CHOI authored and GitHub committed 2025-07-14 14:22:52 +09:00
1 parent 97e85b220e
commit 5ab64b7002
2 files changed
+10 -6

No files matched your search

+10 -2
View File
@@ -695,7 +695,11 @@ mod _sqlite {
}
if let Ok(adapter) = proto.get_attr("__adapt__", vm) {
match adapter.call((obj,), vm) {
Ok(val) => return Ok(val),
Ok(val) => {
if !vm.is_none(&val) {
return Ok(val);
}
}
Err(exc) => {
if !exc.fast_isinstance(vm.ctx.exceptions.type_error) {
return Err(exc);
@@ -705,7 +709,11 @@ mod _sqlite {
}
if let Ok(adapter) = obj.get_attr("__conform__", vm) {
match adapter.call((proto,), vm) {
Ok(val) => return Ok(val),
Ok(val) => {
if !vm.is_none(&val) {
return Ok(val);
}
}
Err(exc) => {
if !exc.fast_isinstance(vm.ctx.exceptions.type_error) {
return Err(exc);