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