-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionbugSomething isn't workingSomething isn't working
Description
Describe the bug
I get different behaviors of type inference depending on whether or not I use intermediate variables.
To Reproduce
from concurrent.futures import ThreadPoolExecutor
import asyncio
from typing_extensions import reveal_type
def do_work() -> int:
return 123
async def foo():
executor = ThreadPoolExecutor()
result = await asyncio.wrap_future(executor.submit(do_work))
reveal_type(result) # Type of "result" is "_T@wrap_future"
#the same, but now with a variable holding the concurrent future
concurrent_future = executor.submit(do_work)
result2 = await asyncio.wrap_future(concurrent_future)
reveal_type(result2) # Type of "result2" is "int"Expected behavior
I expected the concurrent_future variable to not be necessary for result2 to be inferred as an int.
VS Code extension or command-line
Commnd line version 1.1.313
Additional Context
I just tested and this behavior started at 1.1.306
Metadata
Metadata
Assignees
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionbugSomething isn't workingSomething isn't working