Skip to content

Commit bb228eb

Browse files
committed
Improve test
1 parent 38370a3 commit bb228eb

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,15 +2012,11 @@ def testfunc(n):
20122012

20132013
def test_call_isinstance_unknown_object(self):
20142014
def testfunc(n):
2015-
class Foo:
2016-
bar = 42
2017-
20182015
x = 0
20192016
for _ in range(n):
2020-
# we only know bar (LOAD_ATTR) is not null (set via sym_new_not_null)
2021-
bar = Foo.bar
2022-
# This will only narrow to bool and not to True due to 'bar' having
2023-
# unknown (non-null) type
2017+
# The optimizer doesn't know the return type here:
2018+
bar = eval("42")
2019+
# This will only narrow to bool:
20242020
y = isinstance(bar, int)
20252021
if y:
20262022
x += 1

0 commit comments

Comments
 (0)