Title: Value returned by enter_context method of contextlib.ExitStack appears as __NoneType__ · Issue #1499 · microsoft/python-language-server · GitHub
Open Graph Title: Value returned by enter_context method of contextlib.ExitStack appears as __NoneType__ · Issue #1499 · microsoft/python-language-server
X Title: Value returned by enter_context method of contextlib.ExitStack appears as __NoneType__ · Issue #1499 · microsoft/python-language-server
Description: I'm having an issue with the returned value of the enter_context(...) instance method of contextlib.ExitStack. If you enter the following snippet into VSCode and mouse-over the file variable, the tool-tip says that the inferred type is _...
Open Graph Description: I'm having an issue with the returned value of the enter_context(...) instance method of contextlib.ExitStack. If you enter the following snippet into VSCode and mouse-over the file variable, the t...
X Description: I'm having an issue with the returned value of the enter_context(...) instance method of contextlib.ExitStack. If you enter the following snippet into VSCode and mouse-over the file variable, t...
Opengraph URL: https://github.com/microsoft/python-language-server/issues/1499
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Value returned by enter_context method of contextlib.ExitStack appears as __NoneType__","articleBody":"I'm having an issue with the returned value of the `enter_context(...)` instance method of `contextlib.ExitStack`.\r\n\r\nIf you enter the following snippet into VSCode and mouse-over the `file` variable, the tool-tip says that the inferred type is `__NoneType__` but it should be `TextIOWrapper`.\r\n\r\n```python\r\nimport contextlib\r\n\r\nwith contextlib.ExitStack() as stack:\r\n file = stack.enter_context(open(\"temporary-file.txt\", mode=\"w\"))\r\n # reveal_type(file) # Revealed type is 'typing.TextIO*'\r\n```\r\n\r\nYou can uncomment the `reveal_type(file)` line with `mypy` enabled and it will tell you that the revealed type is `typing.TextIO*`, which is fine for this case.\r\n\r\nI've also observed this behavior with `tempfile.NamedTemporaryFile`.\r\n\r\nAny idea what's going on here?\r\n\r\nThanks!","author":{"url":"https://github.com/willfrey","@type":"Person","name":"willfrey"},"datePublished":"2019-09-03T14:50:03Z","url":"https://github.com/microsoft/python-language-server/issues/1499"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:629f8afa-f737-f57f-221c-4c463d2ae38c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 94AC:3F8DC1:314826:40A09D:6AFE5F8B |
| html-safe-nonce | 564edd98c3d554d7f85f4ca0f1ef48b1c2161854cf390aa2edf110ca3eea3ed4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NEFDOjNGOERDMTozMTQ4MjY6NDBBMDlEOjZBRkU1RjhCIiwidmlzaXRvcl9pZCI6IjU2MzUzMzU0OTQ2MjAzMDczMzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d5bded7fd8a373dfa54ae2bd921f4832ec43ca9295a10c0a5cd0f3054e031f65 |
| hovercard-subject-tag | issue:488652638 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/python-language-server/1499/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9393a57f9088b4eb572e1562d825d10516c2592a1c5b7015525371160ee233c2/microsoft/python-language-server/issues/1499 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9393a57f9088b4eb572e1562d825d10516c2592a1c5b7015525371160ee233c2/microsoft/python-language-server/issues/1499 |
| og:image:alt | I'm having an issue with the returned value of the enter_context(...) instance method of contextlib.ExitStack. If you enter the following snippet into VSCode and mouse-over the file variable, the t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | willfrey |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/python-language-server git https://github.com/microsoft/python-language-server.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 145901977 |
| octolytics-dimension-repository_nwo | microsoft/python-language-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 145901977 |
| octolytics-dimension-repository_network_root_nwo | microsoft/python-language-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width