@@ -1151,7 +1151,9 @@ impl AsNumber for PySet {
11511151 }
11521152 } ) ,
11531153 inplace_subtract : Some ( |a, b, vm| {
1154- if let Some ( a) = a. downcast_ref :: < PySet > ( ) {
1154+ if let Some ( a) = a. downcast_ref :: < PySet > ( )
1155+ && PyRef :: < PyAnySet > :: check ( b, vm)
1156+ {
11551157 PySet :: __isub__ (
11561158 a. to_owned ( ) ,
11571159 PyRef :: < PyAnySet > :: try_from_object ( vm, b. to_owned ( ) ) ?,
@@ -1163,7 +1165,9 @@ impl AsNumber for PySet {
11631165 }
11641166 } ) ,
11651167 inplace_and : Some ( |a, b, vm| {
1166- if let Some ( a) = a. downcast_ref :: < PySet > ( ) {
1168+ if let Some ( a) = a. downcast_ref :: < PySet > ( )
1169+ && PyRef :: < PyAnySet > :: check ( b, vm)
1170+ {
11671171 PySet :: __iand__ (
11681172 a. to_owned ( ) ,
11691173 PyRef :: < PyAnySet > :: try_from_object ( vm, b. to_owned ( ) ) ?,
@@ -1175,7 +1179,9 @@ impl AsNumber for PySet {
11751179 }
11761180 } ) ,
11771181 inplace_xor : Some ( |a, b, vm| {
1178- if let Some ( a) = a. downcast_ref :: < PySet > ( ) {
1182+ if let Some ( a) = a. downcast_ref :: < PySet > ( )
1183+ && PyRef :: < PyAnySet > :: check ( b, vm)
1184+ {
11791185 PySet :: __ixor__ (
11801186 a. to_owned ( ) ,
11811187 PyRef :: < PyAnySet > :: try_from_object ( vm, b. to_owned ( ) ) ?,
@@ -1187,7 +1193,9 @@ impl AsNumber for PySet {
11871193 }
11881194 } ) ,
11891195 inplace_or : Some ( |a, b, vm| {
1190- if let Some ( a) = a. downcast_ref :: < PySet > ( ) {
1196+ if let Some ( a) = a. downcast_ref :: < PySet > ( )
1197+ && PyRef :: < PyAnySet > :: check ( b, vm)
1198+ {
11911199 PySet :: __ior__ (
11921200 a. to_owned ( ) ,
11931201 PyRef :: < PyAnySet > :: try_from_object ( vm, b. to_owned ( ) ) ?,
0 commit comments