Thanks for the report. Platform checks currently only apply within the if/elif/else statement. If you use an explicit else branch, this will work as expected:
importsysdeffoo() ->None:
ifsys.platform!="darwin":
print("not darwin")
returnelse:
print("darwin") # OK
Activity
brianschubert commented on Apr 2, 2025
Thanks for the report. Platform checks currently only apply within the if/elif/else statement. If you use an explicit else branch, this will work as expected:
Closing as duplicate of #10773