@@ -1876,8 +1876,6 @@ impl VirtualMachine {
1876
1876
op : PyComparisonOp ,
1877
1877
) -> PyResult < Either < PyObjectRef , bool > > {
1878
1878
let swapped = op. swapped ( ) ;
1879
- // TODO: _Py_EnterRecursiveCall(tstate, " in comparison")
1880
-
1881
1879
let call_cmp = |obj : & PyObjectRef , other, op| {
1882
1880
let cmp = obj
1883
1881
. class ( )
@@ -1896,17 +1894,19 @@ impl VirtualMachine {
1896
1894
!v_class. is ( & w_class) && w_class. issubclass ( & v_class)
1897
1895
} ;
1898
1896
if is_strict_subclass {
1899
- let res = call_cmp ( w, v, swapped) ?;
1897
+ let res = self . with_recursion ( "in comparison" , || call_cmp ( w, v, swapped) ) ?;
1900
1898
checked_reverse_op = true ;
1901
1899
if let PyArithmeticValue :: Implemented ( x) = res {
1902
1900
return Ok ( x) ;
1903
1901
}
1904
1902
}
1905
- if let PyArithmeticValue :: Implemented ( x) = call_cmp ( v, w, op) ? {
1903
+ if let PyArithmeticValue :: Implemented ( x) =
1904
+ self . with_recursion ( "in comparison" , || call_cmp ( v, w, op) ) ?
1905
+ {
1906
1906
return Ok ( x) ;
1907
1907
}
1908
1908
if !checked_reverse_op {
1909
- let res = call_cmp ( w, v, swapped) ?;
1909
+ let res = self . with_recursion ( "in comparison" , || call_cmp ( w, v, swapped) ) ?;
1910
1910
if let PyArithmeticValue :: Implemented ( x) = res {
1911
1911
return Ok ( x) ;
1912
1912
}
@@ -1916,7 +1916,6 @@ impl VirtualMachine {
1916
1916
PyComparisonOp :: Ne => Ok ( Either :: B ( !v. is ( & w) ) ) ,
1917
1917
_ => Err ( self . new_unsupported_binop_error ( v, w, op. operator_token ( ) ) ) ,
1918
1918
}
1919
- // TODO: _Py_LeaveRecursiveCall(tstate);
1920
1919
}
1921
1920
1922
1921
pub fn bool_cmp ( & self , a : & PyObjectRef , b : & PyObjectRef , op : PyComparisonOp ) -> PyResult < bool > {
0 commit comments