Title: Segfault when manipulating a recursive union · Issue #15192 · python/mypy · GitHub
Open Graph Title: Segfault when manipulating a recursive union · Issue #15192 · python/mypy
X Title: Segfault when manipulating a recursive union · Issue #15192 · python/mypy
Description: Bug Report Running mypy on the following program produces a segfault. To Reproduce from typing import Literal, TypeAlias, Union Expr: TypeAlias = Union[ tuple[Literal["const"], int], tuple[Literal["neg"], "Expr"], ] def eval(e: Expr) -> ...
Open Graph Description: Bug Report Running mypy on the following program produces a segfault. To Reproduce from typing import Literal, TypeAlias, Union Expr: TypeAlias = Union[ tuple[Literal["const"], int], tuple[Literal[...
X Description: Bug Report Running mypy on the following program produces a segfault. To Reproduce from typing import Literal, TypeAlias, Union Expr: TypeAlias = Union[ tuple[Literal["const"], int], tupl...
Opengraph URL: https://github.com/python/mypy/issues/15192
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Segfault when manipulating a recursive union","articleBody":"**Bug Report**\r\n\r\nRunning mypy on the following program produces a segfault.\r\n\r\n**To Reproduce**\r\n\r\n```python\r\nfrom typing import Literal, TypeAlias, Union\r\n\r\n\r\nExpr: TypeAlias = Union[\r\n tuple[Literal[\"const\"], int],\r\n tuple[Literal[\"neg\"], \"Expr\"],\r\n]\r\n\r\n\r\ndef eval(e: Expr) -> int:\r\n if e[0] == \"const\":\r\n return e[1]\r\n elif e[0] == \"neg\":\r\n return -eval(e[1])\r\n```\r\n\r\n**Expected Behavior**\r\n\r\nMypy returns successfully.\r\n\r\n**Actual Behavior**\r\n\r\nMypy segfaults: \r\n\r\n```\r\nfish: Job 1, 'mypy ...' terminated by signal SIGSEGV (Address boundary error)\r\n```\r\n\r\nThe problem can be replicated in the [mypy playground](https://mypy-play.net/?mypy=latest&python=3.11&gist=51e21382324203063b7a6373c7cf1405).\r\n\r\n\u003c!-- What went wrong? Paste mypy's output. -->\r\n\r\n**Your Environment**\r\n\r\n\u003c!-- Include as many relevant details about the environment you experienced the bug in -->\r\n\r\n- Mypy version used: 1.2.0\r\n- Mypy command-line flags: none\r\n- Mypy configuration options from `mypy.ini` (and other config files): none\r\n- Python version used: 3.11\r\n\r\n\u003c!-- You can freely edit this text, please remove all the lines you believe are unnecessary. -->\r\n","author":{"url":"https://github.com/jonathan-laurent","@type":"Person","name":"jonathan-laurent"},"datePublished":"2023-05-05T12:39:44Z","url":"https://github.com/python/mypy/issues/15192"}
| 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:5c01b4e7-ea35-de2a-431b-8d26a8f20976 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 834E:3FDF0C:C99CE6:10CD2C5:6B004E73 |
| html-safe-nonce | c862100c173d9072f51987ca8ab1386f1157e1c6a241cf73b1c7e3e07dcb057e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzRFOjNGREYwQzpDOTlDRTY6MTBDRDJDNTo2QjAwNEU3MyIsInZpc2l0b3JfaWQiOiIxNjkwNTQ5ODgzMTI5MzE5MDI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5a7a0e6e7356f38f079cf9e80a578ca0ab5a1a08ac5028c2d34eebc44dcdff1c |
| hovercard-subject-tag | issue:1697552693 |
| 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/15192/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8a77fb20e690b86ee92e3af9d1bda594afd52fa1d90a285bf574daa370add602/python/mypy/issues/15192 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8a77fb20e690b86ee92e3af9d1bda594afd52fa1d90a285bf574daa370add602/python/mypy/issues/15192 |
| og:image:alt | Bug Report Running mypy on the following program produces a segfault. To Reproduce from typing import Literal, TypeAlias, Union Expr: TypeAlias = Union[ tuple[Literal["const"], int], tuple[Literal[... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jonathan-laurent |
| hostname | github.com |
| expected-hostname | github.com |
| None | f9517bf360d46638a1e5e7daee7158842fe5ef43c9000afa0e127564a7c2f39b |
| 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 | b27c5dde30676028abd5c5fc53ce5c9b625f8281 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width