-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fixed an inconsistency in reporting of unbound variables when the var… #5551
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…iable is captured by an inner scope. The new behavior correctly identifies unbound (or potentially unbound) variables in cases where the captured variable is narrowed. This happens when there are no assignments to the variable after it is captured. This addresses #5548. Fixed a bug in type narrowing for captured variables. Captured variables that are modified in other scopes using a `nonlocal` or `global` binding should be ineligible for type narrowing.
Diff from mypy_primer, showing the effect of this PR on open source code: spack (https://github.com/spack/spack)
+ /tmp/mypy_primer/projects/spack/lib/spack/llnl/util/tty/__init__.py:351:42 - error: "fcntl" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/spack/lib/spack/llnl/util/tty/__init__.py:351:58 - error: "termios" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/audit.py:187:29 - error: Argument of type "Unknown | syaml_dict | Any | None" cannot be assigned to parameter "__iterable" of type "Iterable[_T@sorted]" in function "sorted"
+ Type "Unknown | syaml_dict | Any | None" cannot be assigned to type "Iterable[Unknown]"
+ "__iter__" is not present (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/audit.py:215:43 - error: "items" is not a known member of "None" (reportOptionalMemberAccess)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/binary_distribution.py:1411:64 - error: Argument of type "Unknown | syaml_dict | Any | None" cannot be assigned to parameter "suppress_warnings" of type "bool" in function "verify"
+ Type "Unknown | syaml_dict | Any | None" cannot be assigned to type "bool"
+ "syaml_dict" is incompatible with "bool" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/binary_distribution.py:1770:80 - error: Argument of type "Unknown | syaml_dict | Any | None" cannot be assigned to parameter "suppress_warnings" of type "bool" in function "verify"
+ Type "Unknown | syaml_dict | Any | None" cannot be assigned to type "bool"
+ "syaml_dict" is incompatible with "bool" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/build_environment.py:274:27 - error: Argument of type "Unknown | syaml_dict | Any" cannot be assigned to parameter "value" of type "str" in function "set"
+ Type "Unknown | syaml_dict | Any" cannot be assigned to type "str"
+ "syaml_dict" is incompatible with "str" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/build_environment.py:570:26 - error: Argument of type "Unknown | syaml_dict | Any | None" cannot be assigned to parameter "__arg2" of type "SupportsRichComparisonT@min" in function "min"
+ Type "Unknown | syaml_dict | Any | None" cannot be assigned to type "SupportsRichComparison" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/build_environment.py:953:19 - error: "exe_deps" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/ci.py:735:51 - error: Operator "in" not supported for types "Literal['build-group']" and "Unknown | syaml_dict | Any | None"
+ Operator "in" not supported for types "Literal['build-group']" and "None" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/mirror.py:299:63 - error: "items" is not a known member of "None" (reportOptionalMemberAccess)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/repo.py:1250:42 - error: "get" is not a known member of "None" (reportOptionalMemberAccess)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/report.py:107:28 - error: "name_fmt" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/stage.py:198:29 - error: "values" is not a known member of "None" (reportOptionalMemberAccess)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/tengine.py:79:68 - error: Argument of type "Unknown | syaml_dict | Any | None" cannot be assigned to parameter "iterables" of type "Iterable[_T@chain]" in function "__init__"
+ Type "Unknown | syaml_dict | Any | None" cannot be assigned to type "Iterable[str]"
+ "__iter__" is not present (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/bootstrap/config.py:119:17 - error: "pop" is not a known member of "None" (reportOptionalMemberAccess)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/bootstrap/core.py:354:20 - error: "get" is not a known member of "None" (reportOptionalMemberAccess)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/build_systems/python.py:297:25 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/bootstrap.py:242:27 - error: "get" is not a known member of "None" (reportOptionalMemberAccess)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/bootstrap.py:251:34 - error: "get" is not a known member of "None" (reportOptionalMemberAccess)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/bootstrap.py:264:27 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/bootstrap.py:266:37 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/bootstrap.py:352:15 - error: Operator "+" not supported for types "list[dict[str, Unknown]]" and "Unknown | syaml_dict | Any | list[Any]"
+ Operator "+" not supported for types "list[dict[str, Unknown]]" and "syaml_dict" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:293:8 - error: Operator "in" not supported for types "Literal['build-group']" and "Unknown | syaml_dict | Any | None"
+ Operator "in" not supported for types "Literal['build-group']" and "None" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:327:8 - error: Operator "in" not supported for types "Literal['temporary-storage-url-prefix']" and "Unknown | syaml_dict | Any | None"
+ Operator "in" not supported for types "Literal['temporary-storage-url-prefix']" and "None" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:328:35 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:332:8 - error: Operator "in" not supported for types "Literal['enable-artifacts-buildcache']" and "Unknown | syaml_dict | Any | None"
+ Operator "in" not supported for types "Literal['enable-artifacts-buildcache']" and "None" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:333:35 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:499:12 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:572:12 - error: Operator "in" not supported for types "Literal['broken-specs-url']" and "Unknown | syaml_dict | Any | None"
+ Operator "in" not supported for types "Literal['broken-specs-url']" and "None" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:573:32 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:594:9 - error: Operator "in" not supported for types "Literal['broken-tests-packages']" and "Unknown | syaml_dict | Any | None"
+ Operator "in" not supported for types "Literal['broken-tests-packages']" and "None" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:595:30 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:671:42 - error: Operator "in" not supported for types "Literal['broken-specs-url']" and "Unknown | syaml_dict | Any | None"
+ Operator "in" not supported for types "Literal['broken-specs-url']" and "None" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/ci.py:672:32 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/graph.py:89:33 - error: Argument of type "Unknown | syaml_dict | Any | None" cannot be assigned to parameter "debug" of type "bool" in function "graph_ascii"
+ Type "Unknown | syaml_dict | Any | None" cannot be assigned to type "bool"
+ "syaml_dict" is incompatible with "bool" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/graph.py:92:33 - error: Argument of type "Unknown | syaml_dict | Any | None" cannot be assigned to parameter "debug" of type "bool" in function "graph_ascii"
+ Type "Unknown | syaml_dict | Any | None" cannot be assigned to type "bool"
+ "syaml_dict" is incompatible with "bool" (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/mirror.py:226:33 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/mirror.py:249:9 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/repo.py
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/repo.py:111:11 - error: Cannot access member "insert" for type "syaml_dict"
+ Member "insert" is unknown (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/repo.py:123:22 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/repo.py:126:19 - error: "remove" is not a known member of "None" (reportOptionalMemberAccess)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/repo.py:126:19 - error: Cannot access member "remove" for type "syaml_dict"
+ Member "remove" is unknown (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/repo.py:132:17 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
+ /tmp/mypy_primer/projects/spack/lib/spack/spack/cmd/repo.py:136:23 - error: "remove" is not a known member of "None" (reportOptionalMemberAccess)
... (truncated 68 lines) ...
pandera (https://github.com/pandera-dev/pandera)
+ /tmp/mypy_primer/projects/pandera/pandera/api/extensions.py:200:36 - error: "ps" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/api/extensions.py:208:35 - error: "ps" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:95:22 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:95:31 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:120:22 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:120:53 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:122:13 - error: "pdst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:126:22 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:129:15 - error: "pdst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:131:15 - error: "pdst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:236:16 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:239:13 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:241:18 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:241:34 - error: "npst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:243:16 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:292:38 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:328:16 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:330:9 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:337:9 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:346:6 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:349:9 - error: "hypothesis" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:351:13 - error: "hypothesis" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:424:12 - error: "npst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:450:49 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:615:28 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:654:16 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:679:16 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:704:16 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:726:16 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:750:16 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:765:12 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:858:9 - error: "pdst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:861:19 - error: "pdst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:921:12 - error: "pdst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:955:16 - error: "pdst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:1106:21 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:1107:25 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:1143:28 - error: "st" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:1150:20 - error: "pdst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:1156:19 - error: "pdst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:1235:16 - error: "pdst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/strategies/pandas_strategies.py:1237:15 - error: "pdst" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/pandera/typing/modin.py:21:26 - error: "modin" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/core/test_pydantic.py:56:24 - error: "ValidationError" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/core/test_pydantic.py:62:24 - error: "ValidationError" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/core/test_pydantic.py:87:24 - error: "ValidationError" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/core/test_pydantic.py:90:24 - error: "ValidationError" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/core/test_pydantic.py:123:24 - error: "ValidationError" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/core/test_pydantic.py:140:24 - error: "ValidationError" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/core/test_pydantic.py:143:24 - error: "ValidationError" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/core/test_pydantic.py:161:24 - error: "ValidationError" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/core/test_pydantic.py:164:24 - error: "ValidationError" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/core/test_pydantic.py:167:24 - error: "ValidationError" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/hypotheses/test_hypotheses.py:47:22 - error: "stats" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/hypotheses/test_hypotheses.py:56:22 - error: "stats" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/hypotheses/test_hypotheses.py:78:22 - error: "stats" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/hypotheses/test_hypotheses.py:127:30 - error: "stats" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/hypotheses/test_hypotheses.py:163:30 - error: "stats" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/hypotheses/test_hypotheses.py:207:30 - error: "stats" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:601:24 - error: "io" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:612:16 - error: "io" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:638:24 - error: "io" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:651:9 - error: "io" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:654:9 - error: "io" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:659:5 - error: "io" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:664:9 - error: "io" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:701:14 - error: "io" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:739:18 - error: "io" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:741:28 - error: "io" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:760:18 - error: "io" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/pandera/tests/io/test_io.py:762:28 - error: "io" is possibly unbound (reportUnboundVariable)
... (truncated 11 lines) ...
dd-trace-py (https://github.com/DataDog/dd-trace-py): typechecking got 1.31x faster (51.7s -> 39.6s)
(Performance measurements are based on a single noisy sample)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/appsec/ddwaf/__init__.py:178:16 - error: "ddwaf_get_version" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/bootstrap/sitecustomize.py:87:13 - error: "_unloaded_modules" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/commands/ddtrace_run.py
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/commands/ddtrace_run.py:144:12 - error: "PermissionError" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/contrib/aiobotocore/patch.py:168:77 - error: "ClientResponseContentProxy" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/contrib/grpc/patch.py:213:20 - error: "create_aio_client_interceptors" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/contrib/grpc/patch.py:248:19 - error: "create_aio_server_interceptor" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/contrib/psycopg/patch.py:121:55 - error: "patched_connect_async_factory" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/contrib/psycopg/patch.py:147:59 - error: "_original_connect" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/contrib/psycopg/patch.py:148:64 - error: "_original_async_connect" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/contrib/psycopg/patch.py:177:33 - error: "Psycopg3FetchTracedAsyncCursor" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/contrib/psycopg/patch.py:177:92 - error: "Psycopg3TracedAsyncCursor" is possibly unbound (reportUnboundVariable)
- /tmp/mypy_primer/projects/dd-trace-py/ddtrace/internal/ci_visibility/coverage.py:54:24 - error: Cannot access member "start" for type "None"
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/internal/ci_visibility/coverage.py:54:24 - error: "start" is not a known member of "None" (reportOptionalMemberAccess)
- Member "start" is unknown (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/dd-trace-py/ddtrace/internal/ci_visibility/coverage.py:59:24 - error: Cannot access member "stop" for type "None"
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/internal/ci_visibility/coverage.py:59:24 - error: "stop" is not a known member of "None" (reportOptionalMemberAccess)
- Member "stop" is unknown (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/dd-trace-py/ddtrace/internal/ci_visibility/coverage.py:61:24 - error: Cannot access member "_collector" for type "None"
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/internal/ci_visibility/coverage.py:61:24 - error: "_collector" is not a known member of "None" (reportOptionalMemberAccess)
- Member "_collector" is unknown (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/dd-trace-py/ddtrace/internal/ci_visibility/coverage.py:62:24 - error: Cannot access member "_collector" for type "None"
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/internal/ci_visibility/coverage.py:62:24 - error: "_collector" is not a known member of "None" (reportOptionalMemberAccess)
- Member "_collector" is unknown (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/profiling/_asyncio.py:58:25 - error: "clear_threads" is not a known member of "None" (reportOptionalMemberAccess)
+ /tmp/mypy_primer/projects/dd-trace-py/ddtrace/profiling/_asyncio.py:61:29 - error: "link_object" is not a known member of "None" (reportOptionalMemberAccess)
- /tmp/mypy_primer/projects/dd-trace-py/ddtrace/profiling/_asyncio.py:58:25 - error: Cannot access member "clear_threads" for type "None"
- Member "clear_threads" is unknown (reportGeneralTypeIssues)
- /tmp/mypy_primer/projects/dd-trace-py/ddtrace/profiling/_asyncio.py:61:29 - error: Cannot access member "link_object" for type "None"
- Member "link_object" is unknown (reportGeneralTypeIssues)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_path_traversal.py:25:5 - error: "pt_open" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_path_traversal.py:26:19 - error: "core" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_path_traversal.py:26:33 - error: "IAST" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_path_traversal.py:27:57 - error: "VULN_PATH_TRAVERSAL" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:19:5 - error: "taint_tracking_setup" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:20:5 - error: "oce" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:25:28 - error: "taint_ranges_as_evidence_info" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:33:18 - error: "Source" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:33:46 - error: "OriginType" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:34:20 - error: "taint_pyobject" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:34:100 - error: "OriginType" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:35:28 - error: "taint_ranges_as_evidence_info" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:43:18 - error: "Source" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:43:46 - error: "OriginType" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:45:20 - error: "taint_pyobject" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:45:100 - error: "OriginType" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:46:26 - error: "add_aspect" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:48:28 - error: "taint_ranges_as_evidence_info" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:56:18 - error: "Source" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:56:46 - error: "OriginType" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:58:20 - error: "taint_pyobject" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:58:100 - error: "OriginType" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:59:26 - error: "add_aspect" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:61:28 - error: "taint_ranges_as_evidence_info" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:69:18 - error: "Source" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:69:46 - error: "OriginType" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:71:20 - error: "taint_pyobject" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:71:100 - error: "OriginType" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:72:26 - error: "add_aspect" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:72:51 - error: "add_aspect" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:74:28 - error: "taint_ranges_as_evidence_info" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:83:19 - error: "Source" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:83:48 - error: "OriginType" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:84:19 - error: "Source" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:84:48 - error: "OriginType" is possibly unbound (reportUnboundVariable)
+ /tmp/mypy_primer/projects/dd-trace-py/tests/appsec/iast/test_taint_tracking.py:86:21 - error: "taint_pyobject" is possibly unbound (reportUnboundVariable)
... (truncated 121 lines) ...
discord.py (https://github.com/Rapptz/discord.py)
... (truncated 6 lines) ...``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…iable is captured by an inner scope. The new behavior correctly identifies unbound (or potentially unbound) variables in cases where the captured variable is narrowed. This happens when there are no assignments to the variable after it is captured. This addresses #5548.
Fixed a bug in type narrowing for captured variables. Captured variables that are modified in other scopes using a
nonlocal
orglobal
binding should be ineligible for type narrowing.