-
Notifications
You must be signed in to change notification settings - Fork 259
Open
Description
Describe the Bug
Consider the following code
import shutil
import urllib.request as request
with request.urlopen("https://duckduckgo.com") as remote, open("main.html", 'wb') as local:
shutil.copyfileobj(remote, local)
It runs successfully at runtime, but pyrefly gives an error
ERROR `Buffer` is not assignable to upper bound `bytes | str` of type variable `AnyStr` [bad-specialization]
--> a.py:4:23
|
4 | shutil.copyfileobj(remote, local)
| ^^^^^^^^^^^^^^^
|
INFO 1 error
This is because remote has type Unknown (Any in mypy). For comparison, mypy is more tolerant, and if the argument is Any, it will not type-check this argument.
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
Metadata
Metadata
Assignees
Labels
No labels