Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mypybot/sync typeshed #17280

Merged
merged 9 commits into from
May 24, 2024
Merged

Mypybot/sync typeshed #17280

merged 9 commits into from
May 24, 2024

Conversation

koogoro
Copy link
Collaborator

@koogoro koogoro commented May 23, 2024

Sync typeshed before 1.11 release.

koogoro and others added 4 commits May 23, 2024 15:49
This is allegedly causing large performance problems, see 13821

typeshed/8231 had zero hits on mypy_primer, so it's not the worst thing
to undo. Patching this in typeshed also feels weird, since there's a
more general soundness issue. If a typevar has a bound or constraint, we
might not want to solve it to a Literal.

If we can confirm the performance regression or fix the unsoundness
within mypy, I might pursue upstreaming this in typeshed.

(Reminder: add this to the sync_typeshed script once merged)

This comment has been minimized.

@JelleZijlstra
Copy link
Member

There's some new errors in mypy itself, I can look into fixing those over the next few days.

@koogoro
Copy link
Collaborator Author

koogoro commented May 23, 2024

Should I even merge this if it's going to cause errors in mypy checking mypy?

@JelleZijlstra
Copy link
Member

No, the type checking issues need to be addressed first. I'll take a look now.

This comment has been minimized.

This comment has been minimized.

mypy/fastparse.py Outdated Show resolved Hide resolved
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pyp (https://github.com/hauntsaninja/pyp)
+ pyp.py:585: error: "AST" has no attribute "lineno"  [attr-defined]
+ pyp.py:586: error: "AST" has no attribute "end_lineno"  [attr-defined]

mypy (https://github.com/python/mypy)
+ mypy/pyinfo.py:74: error: Unused "type: ignore" comment  [unused-ignore]
+ mypy/pyinfo.py:74: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "reconfigure"  [union-attr]
+ mypy/pyinfo.py:74: note: Error code "union-attr" not covered by "type: ignore" comment
+ mypy/pyinfo.py:74: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-union-attr for more info
+ mypy/fastparse.py:2048: error: "Index" has no attribute "col_offset"  [attr-defined]
+ mypy/fastparse.py:2051: error: "Slice" has no attribute "col_offset"  [attr-defined]
+ mypy/fastparse.py:2052: error: Argument 1 to "Tuple" has incompatible type "List[slice]"; expected "List[expr]"  [arg-type]

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/capture.py:204: error: Item "None" of "TextIOWrapper | None" has no attribute "encoding"  [union-attr]
+ src/_pytest/faulthandler.py:65: error: Item "None" of "TextIOWrapper | None" has no attribute "fileno"  [union-attr]

tornado (https://github.com/tornadoweb/tornado)
+ tornado/test/runtests.py:174: error: Unused "type: ignore" comment  [unused-ignore]

rich (https://github.com/Textualize/rich)
+ rich/console.py:93: error: Item "None" of "TextIOWrapper | None" has no attribute "fileno"  [union-attr]
+ rich/console.py:97: error: Item "None" of "TextIOWrapper | None" has no attribute "fileno"  [union-attr]
+ rich/console.py:101: error: Item "None" of "TextIOWrapper | None" has no attribute "fileno"  [union-attr]
- rich/live.py:180: error: Subclass of "TextIO" and "FileProxy" cannot exist: would have incompatible method signatures  [unreachable]
- rich/live.py:183: error: Subclass of "TextIO" and "FileProxy" cannot exist: would have incompatible method signatures  [unreachable]

cwltool (https://github.com/common-workflow-language/cwltool)
+ tests/test_context.py:17: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_context.py:18: error: Unused "type: ignore" comment  [unused-ignore]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/routing/rules.py:785: error: Argument 1 to "JoinedStr" has incompatible type "list[AST]"; expected "list[expr]"  [arg-type]
+ src/werkzeug/routing/rules.py:788: error: List item 0 has incompatible type "AST"; expected "expr"  [list-item]
+ src/werkzeug/routing/rules.py:788: error: List item 1 has incompatible type "AST"; expected "expr"  [list-item]
+ src/werkzeug/routing/rules.py:818: error: "AST" has no attribute "lineno"  [attr-defined]
+ src/werkzeug/routing/rules.py:820: error: "AST" has no attribute "end_lineno"  [attr-defined]
+ src/werkzeug/routing/rules.py:820: error: "AST" has no attribute "lineno"  [attr-defined]
+ src/werkzeug/routing/rules.py:822: error: "AST" has no attribute "col_offset"  [attr-defined]
+ src/werkzeug/routing/rules.py:824: error: "AST" has no attribute "end_col_offset"  [attr-defined]
+ src/werkzeug/routing/rules.py:824: error: "AST" has no attribute "col_offset"  [attr-defined]
- tests/test_debug.py:196: error: Incompatible types in assignment (expression has type "HTMLStringO", variable has type "TextIO")  [assignment]
- tests/test_debug.py:199: error: "TextIO" has no attribute "reset"  [attr-defined]
- tests/test_debug.py:201: error: "TextIO" has no attribute "reset"  [attr-defined]
- tests/test_debug.py:213: error: Incompatible types in assignment (expression has type "HTMLStringO", variable has type "TextIO")  [assignment]
- tests/test_debug.py:216: error: "TextIO" has no attribute "reset"  [attr-defined]

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/utils/log.py:127: error: Unused "type: ignore" comment  [unused-ignore]

streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/web/bootstrap_test.py:107:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:107:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:131:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:131:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:153:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:153:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:178:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:178:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:203:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:203:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:224:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:224:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:248:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:248:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:273:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:273:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:298:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:298:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:315:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:315:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:336:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:336:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]
- lib/tests/streamlit/web/bootstrap_test.py:345:15: error: "TextIO" has no attribute "getvalue"  [attr-defined]
+ lib/tests/streamlit/web/bootstrap_test.py:345:15: error: Item "TextIO" of "Union[TextIO, Any]" has no attribute "getvalue"  [union-attr]

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/bigquery/udf/core.py:69: error: Missing positional arguments "args", "keywords" in call to "Call"  [call-arg]
+ ibis/backends/bigquery/udf/core.py:82: error: Missing positional arguments "args", "keywords" in call to "Call"  [call-arg]
+ ibis/backends/bigquery/udf/core.py:88: error: Missing positional arguments "args", "keywords" in call to "Call"  [call-arg]
+ ibis/backends/bigquery/udf/core.py:88: error: Missing positional argument "value" in call to "Attribute"  [call-arg]
+ ibis/backends/bigquery/udf/core.py:98: error: Missing positional arguments "args", "keywords" in call to "Call"  [call-arg]

@JelleZijlstra JelleZijlstra merged commit 43a605f into master May 24, 2024
18 checks passed
@JelleZijlstra JelleZijlstra deleted the mypybot/sync-typeshed branch May 24, 2024 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants