File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -439,17 +439,13 @@ def test_missing_protocol(self):
439
439
with self .assertRaises (sqlite .ProgrammingError ):
440
440
sqlite .adapt (1 , None )
441
441
442
- # TODO: RUSTPYTHON
443
- @unittest .expectedFailure
444
442
def test_defect_proto (self ):
445
443
class DefectProto ():
446
444
def __adapt__ (self ):
447
445
return None
448
446
with self .assertRaises (sqlite .ProgrammingError ):
449
447
sqlite .adapt (1. , DefectProto )
450
448
451
- # TODO: RUSTPYTHON
452
- @unittest .expectedFailure
453
449
def test_defect_self_adapt (self ):
454
450
class DefectSelfAdapt (float ):
455
451
def __conform__ (self , _ ):
Original file line number Diff line number Diff line change @@ -695,7 +695,11 @@ mod _sqlite {
695
695
}
696
696
if let Ok ( adapter) = proto. get_attr ( "__adapt__" , vm) {
697
697
match adapter. call ( ( obj, ) , vm) {
698
- Ok ( val) => return Ok ( val) ,
698
+ Ok ( val) => {
699
+ if !vm. is_none ( & val) {
700
+ return Ok ( val) ;
701
+ }
702
+ }
699
703
Err ( exc) => {
700
704
if !exc. fast_isinstance ( vm. ctx . exceptions . type_error ) {
701
705
return Err ( exc) ;
@@ -705,7 +709,11 @@ mod _sqlite {
705
709
}
706
710
if let Ok ( adapter) = obj. get_attr ( "__conform__" , vm) {
707
711
match adapter. call ( ( proto, ) , vm) {
708
- Ok ( val) => return Ok ( val) ,
712
+ Ok ( val) => {
713
+ if !vm. is_none ( & val) {
714
+ return Ok ( val) ;
715
+ }
716
+ }
709
717
Err ( exc) => {
710
718
if !exc. fast_isinstance ( vm. ctx . exceptions . type_error ) {
711
719
return Err ( exc) ;
You can’t perform that action at this time.
0 commit comments