Title: Semantic analyzer confuses a function with a module · Issue #7203 · python/mypy · GitHub
Open Graph Title: Semantic analyzer confuses a function with a module · Issue #7203 · python/mypy
X Title: Semantic analyzer confuses a function with a module · Issue #7203 · python/mypy
Description: The following code creates a package structure that demonstrates what I think is a bug in mypy's new semantic analyzer. from os import makedirs makedirs('src/core') makedirs('src/stuff') open('src/__init__.py', 'w').write(""" # nothing h...
Open Graph Description: The following code creates a package structure that demonstrates what I think is a bug in mypy's new semantic analyzer. from os import makedirs makedirs('src/core') makedirs('src/stuff') open('src/...
X Description: The following code creates a package structure that demonstrates what I think is a bug in mypy's new semantic analyzer. from os import makedirs makedirs('src/core') makedirs('src/st...
Opengraph URL: https://github.com/python/mypy/issues/7203
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Semantic analyzer confuses a function with a module","articleBody":"The following code creates a package structure that demonstrates what I think is a bug in mypy's new semantic analyzer.\r\n\r\n```\r\nfrom os import makedirs\r\n\r\nmakedirs('src/core')\r\nmakedirs('src/stuff')\r\n\r\nopen('src/__init__.py', 'w').write(\"\"\"\r\n# nothing here\r\n\"\"\")\r\n\r\nopen('src/core/__init__.py', 'w').write(\"\"\"\r\nfrom .run import config\r\n\"\"\")\r\n\r\nopen('src/core/run.py', 'w').write(\"\"\"\r\nfrom ..stuff import somefunction\r\n\r\nconfig = None\r\n\r\nsomefunction()\r\n\"\"\")\r\n\r\nopen('src/stuff/__init__.py', 'w').write(\"\"\"\r\nfrom .somemore import more\r\nfrom .somefunction import somefunction\r\n\"\"\")\r\n\r\nopen('src/stuff/somefunction.py', 'w').write(\"\"\"\r\ndef somefunction():\r\n print(\"Hello, World!\")\r\n\"\"\")\r\n\r\nopen('src/stuff/somemore.py', 'w').write(\"\"\"\r\ndef more():\r\n from ..core import config\r\n\"\"\")\r\n```\r\n\r\nWhen checking the created `src` package with mypy 0.720 and Python 3.7, I get the following error:\r\n```\r\nsrc/core/run.py:6: error: Module not callable\r\n```\r\n\r\nWhat mypy thinks is a module is actually a function. It just has the same name as its containing module.\r\n\r\nWhen I check with ` --no-new-semantic-analyzer`, I do not get this error.\r\n","author":{"url":"https://github.com/Cito","@type":"Person","name":"Cito"},"datePublished":"2019-07-13T13:44:55Z","url":"https://github.com/python/mypy/issues/7203"}
| 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:7c18f9a5-2ced-b12b-bede-3ef9a8c99ed1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F8A:1A1C04:195851C:224C077:6AFFF902 |
| html-safe-nonce | 82a1e6f00f0a0a2d02ce111e6ff5d71cb04c8a653b5cc8654d6eafc189f77c36 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjhBOjFBMUMwNDoxOTU4NTFDOjIyNEMwNzc6NkFGRkY5MDIiLCJ2aXNpdG9yX2lkIjoiNDgzNDI0MDQ0NDEwOTkyODk4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 87e41ffdc914355ff86e8cfeb1bcebd2bd377a972d34e59e508da4444a3e86bd |
| hovercard-subject-tag | issue:467722238 |
| 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/python/mypy/7203/issue_layout |
| twitter:image | https://opengraph.githubassets.com/10323e4c484a08761ad52b5e29b06363a0dbc8d979c6924a9ba0f6ed45b2efa5/python/mypy/issues/7203 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/10323e4c484a08761ad52b5e29b06363a0dbc8d979c6924a9ba0f6ed45b2efa5/python/mypy/issues/7203 |
| og:image:alt | The following code creates a package structure that demonstrates what I think is a bug in mypy's new semantic analyzer. from os import makedirs makedirs('src/core') makedirs('src/stuff') open('src/... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Cito |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width