File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -1053,18 +1053,16 @@ def execute(self, request: SubRequest) -> FixtureValue:
1053
1053
requested_fixtures_that_should_finalize_us .append (fixturedef )
1054
1054
1055
1055
# Check for (and return) cached value/exception.
1056
- my_cache_key = self .cache_key (request )
1057
1056
if self .cached_result is not None :
1057
+ request_cache_key = self .cache_key (request )
1058
1058
cache_key = self .cached_result [1 ]
1059
-
1060
- # First attempt to use 'is' for performance reasons (for example numpy arrays (#6497)).
1061
- cache_hit = my_cache_key is cache_key
1062
- if not cache_hit :
1063
- # If they are not the same, fallback to a bool comparison (#12600).
1064
- try :
1065
- cache_hit = bool (my_cache_key == cache_key )
1066
- except (ValueError , RuntimeError ):
1067
- cache_hit = False
1059
+ try :
1060
+ # Attempt to make a normal == check: this might fail for objects
1061
+ # which do not implement the standard comparison (like numpy arrays -- #6497).
1062
+ cache_hit = bool (request_cache_key == cache_key )
1063
+ except (ValueError , RuntimeError ):
1064
+ # If the comparison raises, use 'is' as fallback.
1065
+ cache_hit = request_cache_key is cache_key
1068
1066
1069
1067
if cache_hit :
1070
1068
if self .cached_result [2 ] is not None :
You can’t perform that action at this time.
0 commit comments