Skip to content

Conversation

@DetachHead
Copy link
Owner

fixes #10

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@DetachHead
Copy link
Owner Author

DetachHead commented Feb 25, 2024

contextmanager is incorrectly typed so it now treats some stuff as reachable when it's not. but that's nowhere near as bad as marking stuff as unreachable when it actually is reachable

follow-up issue: #114

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@DetachHead DetachHead force-pushed the fix-context-manager-unreachable branch from dff9c2d to 7272176 Compare February 25, 2024 06:18
@github-actions

This comment has been minimized.

@DetachHead DetachHead force-pushed the fix-context-manager-unreachable branch from 7272176 to 75f969a Compare February 25, 2024 07:35
@DetachHead DetachHead marked this pull request as draft February 25, 2024 07:41
@github-actions

This comment has been minimized.

@DetachHead DetachHead force-pushed the fix-context-manager-unreachable branch from 75f969a to 1b1174c Compare December 19, 2024 09:45
@DetachHead DetachHead marked this pull request as ready for review December 19, 2024 09:45
@DetachHead DetachHead force-pushed the fix-context-manager-unreachable branch from 1b1174c to cbdd6d3 Compare December 19, 2024 09:57
@github-actions

This comment has been minimized.

@DetachHead DetachHead marked this pull request as draft December 19, 2024 10:55
@DetachHead DetachHead marked this pull request as ready for review December 20, 2024 13:04
@github-actions

This comment has been minimized.


## the solution

basedpyright introduces a new setting, `strictContextManagerExitTypes` to address this issue. when enabled, context managers where the `__exit__` dunder returns `bool | None` are treated the same way as context managers that return `bool` or `Literal[True]`. put simply, if `True` is assignable to the return type, then it's treated as if it can suppress exceptions.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this to the playground

@DetachHead DetachHead force-pushed the fix-context-manager-unreachable branch from ccbd0fd to b176dd1 Compare December 21, 2024 03:16
@github-actions

This comment has been minimized.

@DetachHead DetachHead force-pushed the fix-context-manager-unreachable branch from b176dd1 to 0a8dda6 Compare December 21, 2024 06:26
@github-actions

This comment has been minimized.

@DetachHead DetachHead force-pushed the fix-context-manager-unreachable branch from 0a8dda6 to 5c23134 Compare December 25, 2024 10:21
@github-actions
Copy link
Contributor

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

kornia (https://github.com/kornia/kornia)
+   /tmp/mypy_primer/projects/kornia/kornia/nerf/nerf_model.py:211:21 - error: "rgb_model" is possibly unbound (reportPossiblyUnboundVariable)
- 6236 errors, 46950 warnings, 0 notes
+ 6237 errors, 46950 warnings, 0 notes

paasta (https://github.com/yelp/paasta)
+   /tmp/mypy_primer/projects/paasta/paasta_tools/paasta_execute_docker_command.py:111:19 - error: "output" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/paasta/paasta_tools/kubernetes/bin/paasta_secrets_sync.py:550:54 - error: "secret_data" is possibly unbound (reportPossiblyUnboundVariable)
- 1535 errors, 23719 warnings, 0 notes
+ 1537 errors, 23719 warnings, 0 notes

pytest (https://github.com/pytest-dev/pytest)
+   /tmp/mypy_primer/projects/pytest/testing/test_assertrewrite.py:1165:16 - error: Operator "+" not supported for types "Unbound | str" and "Literal['.pyc']"
+     Operator "+" not supported for types "Unbound" and "Literal['.pyc']" (reportOperatorIssue)
+   /tmp/mypy_primer/projects/pytest/testing/test_assertrewrite.py:1165:16 - error: "tagged" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1085:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1086:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1093:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1094:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1105:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1112:16 - error: "capture_result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1113:16 - error: "capture_result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1119:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1126:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1127:20 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1140:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1141:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1152:16 - error: "out1" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1153:16 - error: "out2" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1160:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1161:20 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1168:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1169:20 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1175:16 - error: "newstdin" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1198:16 - error: "out1" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1199:16 - error: "out2" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1234:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_capture.py:1235:16 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_collection.py:711:32 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_collection.py:720:37 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_collection.py:1351:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_config.py:1079:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_config.py:1080:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_config.py:1081:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_config.py:1084:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_config.py:1084:34 - error: "inipath" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_config.py:1085:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_config.py:1086:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_config.py:1361:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_pathlib.py:569:20 - error: "module" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:248:12 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:250:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:251:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:279:12 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:281:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:282:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:310:12 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:312:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:313:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:341:12 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:345:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/test_unraisableexception.py:346:5 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/_py/test_local.py:242:16 - error: "x" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/_py/test_local.py:285:16 - error: "contents" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/_py/test_local.py:291:16 - error: "contents" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/code/test_excinfo.py:912:16 - error: "lines" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/code/test_excinfo.py:914:16 - error: "last_lines" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/code/test_excinfo.py:915:16 - error: "last_lines" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pytest/testing/python/approx.py:69:32 - error: "e" is possibly unbound (reportPossiblyUnboundVariable)
- 1156 errors, 17298 warnings, 0 notes
+ 1212 errors, 17298 warnings, 0 notes

ibis (https://github.com/ibis-project/ibis)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/clickhouse/__init__.py:201:16 - warning: Return type is Any (reportAny)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/clickhouse/__init__.py:201:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/clickhouse/__init__.py:209:12 - error: "results" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/clickhouse/__init__.py:241:12 - error: "results" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:48:16 - warning: Return type is unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:48:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:48:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:54:16 - warning: Return type is unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:54:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:54:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:302:16 - error: "version_info" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:404:21 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:404:35 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:405:16 - warning: Return type is unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:405:16 - warning: Return type, "bool | Unknown", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:405:16 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:586:12 - error: "res" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:589:40 - error: "res" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/databricks/__init__.py:604:16 - error: "rows" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:44:16 - warning: Return type is unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:44:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:44:16 - error: "version" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:140:30 - error: "row" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:166:21 - error: "tables" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/druid/__init__.py:239:70 - error: "tables" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:83:16 - warning: Return type is Any (reportAny)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:83:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:89:16 - warning: Return type is Any (reportAny)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:89:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:324:9 - warning: Type of "dbs" is Any (reportAny)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:324:9 - warning: Type of "dbs" is partially unknown
+     Type of "dbs" is "Unknown | Any" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:324:15 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:325:39 - warning: Type of "to_pylist" is Any (reportAny)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:325:39 - warning: Type of "to_pylist" is partially unknown
+     Type of "to_pylist" is "Unknown | Any" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:325:39 - warning: Argument type is Any
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:325:39 - warning: Argument type is partially unknown
-     Argument corresponds to parameter "values" in function "_filter_with_like" (reportAny)
+     Argument corresponds to parameter "values" in function "_filter_with_like"
+     Argument type is "Unknown | Any" (reportUnknownArgumentType)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:340:39 - warning: Type of "to_pylist" is Any (reportAny)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:340:39 - warning: Type of "to_pylist" is partially unknown
+     Type of "to_pylist" is "Unknown | Any" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:340:39 - warning: Argument type is Any
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:340:39 - warning: Argument type is partially unknown
-     Argument corresponds to parameter "values" in function "_filter_with_like" (reportAny)
+     Argument corresponds to parameter "values" in function "_filter_with_like"
+     Argument type is "Unknown | Any" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:340:39 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/__init__.py:1564:16 - error: "rows" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/tests/test_decompile_tpch.py:97:5 - error: "expected_df" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/tests/test_decompile_tpch.py:97:27 - error: "result_df" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/tests/test_decompile_tpch.py:99:44 - error: "expected_df" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/duckdb/tests/test_decompile_tpch.py:101:25 - error: "result_df" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:56:16 - warning: Return type is unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:56:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:56:16 - error: "version" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:255:54 - error: Function with declared return type "Schema" must return value on all code paths
+     "None" is not assignable to "Schema" (reportReturnType)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:423:16 - warning: Return type is unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:423:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:423:16 - error: "schema" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/exasol/__init__.py:475:56 - error: "databases" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:198:16 - warning: Return type is unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:198:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:198:16 - error: "result" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:203:39 - error: "databases" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:228:39 - error: "tables" is possibly unbound (reportPossiblyUnboundVariable)
-   /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:284:16 - warning: Return type is unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:284:16 - warning: Return type, "Unbound | Unknown", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/ibis/ibis/backends/impala/__init__.py:284:16 - error: "db" is possibly unbound (reportPossiblyUnboundVariable)
-     Type of "udfs" is "list[Unknown]" (reportUnknownVariableType)
+     Type of "udfs" is "list[Unknown] | None" (reportUnknownVariableType)
-     Type of "list_udfs" is "(database: Unknown | None = None, like: Unknown | None = None) -> list[Unknown]" (reportUnknownMemberType)

... (truncated 185 lines) ...

openlibrary (https://github.com/internetarchive/openlibrary)
+   /tmp/mypy_primer/projects/openlibrary/openlibrary/plugins/upstream/account.py:929:52 - error: "lists" is possibly unbound (reportPossiblyUnboundVariable)
- 1902 errors, 33566 warnings, 0 notes
+ 1903 errors, 33566 warnings, 0 notes

psycopg (https://github.com/psycopg/psycopg)
+   /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/_typeinfo.py:109:40 - error: "recs" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/psycopg/psycopg/_typeinfo.py:127:40 - error: "recs" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common.py:287:12 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common.py:288:12 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common.py:289:12 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common_async.py:287:19 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common_async.py:288:12 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/test_cursor_common_async.py:289:12 - error: "cur" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/test_pipeline.py:596:50 - error: "cursors" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/test_pipeline_async.py:605:58 - error: "cursors" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:457:5 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:459:9 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:460:16 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:485:5 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:487:9 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:488:21 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/psycopg/tests/pq/test_pgconn.py:489:16 - error: "cancel_conn" is possibly unbound (reportPossiblyUnboundVariable)
- 2014 errors, 38603 warnings, 0 notes
+ 2031 errors, 38603 warnings, 0 notes

pyodide (https://github.com/pyodide/pyodide)
+   /tmp/mypy_primer/projects/pyodide/src/tests/test_cmdline_runner.py:220:62 - error: "msgs" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/pypabuild.py:141:6 - error: Function with declared return type "str" must return value on all code paths
+     "None" is not assignable to "str" (reportReturnType)
+   /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/pypabuild.py:304:6 - error: Function with declared return type "str" must return value on all code paths
+     "None" is not assignable to "str" (reportReturnType)
+   /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/xbuildenv_releases.py:242:53 - error: "data" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/out_of_tree/build.py:43:23 - error: "built_wheel" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/out_of_tree/pypi.py:119:27 - error: "wheel_path" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/pyodide/pyodide-build/pyodide_build/tests/test_cli_xbuildenv.py:71:27 - error: "archive_name" is possibly unbound (reportPossiblyUnboundVariable)
- 965 errors, 9987 warnings, 0 notes
+ 972 errors, 9987 warnings, 0 notes

mkosi (https://github.com/systemd/mkosi)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3131:30 - error: "output" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3133:51 - error: "output" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3436:30 - error: "j" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3439:51 - error: "j" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3699:16 - error: "stub" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3699:25 - error: "kver" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3699:34 - error: "kimg" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3700:45 - error: "microcode" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3702:16 - error: "stub" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3702:25 - error: "kver" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3702:34 - error: "kimg" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3703:45 - error: "microcode" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/__init__.py:3706:16 - error: "stub" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/archive.py:136:51 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/config.py:1586:16 - error: "args" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/config.py:1936:16 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:34:18 - error: "modules" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:42:18 - error: "modules" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:47:9 - error: Operator "-=" not supported for types "Unbound | set[Path]" and "set[Unknown]"
+     Operator "-" not supported for types "Unbound" and "set[Unknown]" (reportOperatorIssue)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:47:9 - warning: Type of "modules" is partially unknown
+     Type of "modules" is "Unknown | set[Path]" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:47:9 - error: "modules" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:49:19 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iterable" in function "sorted"
+     Argument type is "Unknown | set[Path]" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:49:19 - error: "modules" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:77:54 - error: "allmodules" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:187:26 - error: Operator "|" not supported for types "set[Path] | Unbound" and "set[Path] | set[Unknown]"
+     Operator "|" not supported for types "Unbound" and "set[Path]"
+     Operator "|" not supported for types "Unbound" and "set[Unknown]" (reportOperatorIssue)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:187:26 - error: "mods" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:190:13 - error: "mods" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:197:16 - error: "mods" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:226:18 - error: "modules" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/kmod.py:236:19 - error: "firmware" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/qemu.py:772:13 - error: "p" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/qemu.py:1434:12 - error: "state" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/qemu.py:1442:15 - error: "state" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/qemu.py:1448:31 - error: "state" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/run.py:167:58 - error: "out" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/mkosi/run.py:167:63 - error: "err" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/conftest.py:50:17 - error: "release" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:121:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:122:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:123:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:124:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:125:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:138:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:139:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:140:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:141:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:155:12 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:156:28 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)
+   /tmp/mypy_primer/projects/mkosi/tests/test_config.py:157:29 - error: "config" is possibly unbound (reportPossiblyUnboundVariable)

... (truncated 2287 lines) ...```

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe something like this instead

@contextmanager
def f() -> Generator[None, BaseException, True]:
    error = yield
    return True

@DetachHead DetachHead marked this pull request as draft January 27, 2025 02:03
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.

context managers where __exit__ returns bool | None are incorrectly treated as if they never suppress the exception

3 participants