Title: `_sre.compile` overwrites `TypeError` with `OverflowError` · Issue #110590 · python/cpython · GitHub
Open Graph Title: `_sre.compile` overwrites `TypeError` with `OverflowError` · Issue #110590 · python/cpython
X Title: `_sre.compile` overwrites `TypeError` with `OverflowError` · Issue #110590 · python/cpython
Description: Bug report Reproduction: >>> import _sre >>> _sre.compile('', 0, ['abc'], 0, {}, ()) Traceback (most recent call last): File "
Open Graph Description: Bug report Reproduction: >>> import _sre >>> _sre.compile('', 0, ['abc'], 0, {}, ()) Traceback (most recent call last): File "
X Description: Bug report Reproduction: >>> import _sre >>> _sre.compile('', 0, ['abc'], 0, {}, ()) Traceback (most recent call last): File "<stdin>", line 1, in ...
Opengraph URL: https://github.com/python/cpython/issues/110590
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`_sre.compile` overwrites `TypeError` with `OverflowError`","articleBody":"# Bug report\n\nReproduction:\n\n```python\n\u003e\u003e\u003e import _sre\n\u003e\u003e\u003e _sre.compile('', 0, ['abc'], 0, {}, ())\nTraceback (most recent call last):\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\nOverflowError: regular expression code size limit exceeded\n```\n\nIt should be:\n\n```python\n\u003e\u003e\u003e import _sre\n\u003e\u003e\u003e _sre.compile('', 0, ['abc'], 0, {}, ())\nTraceback (most recent call last):\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\nTypeError: an integer is required\n```\n\nBecause the third arg is `code: object(subclass_of='\u0026PyList_Type')`, it is assumed to be integers inside.\n\nProblematic lines: https://github.com/python/cpython/blob/def7ea5cec41e8d3112641bb4af7572c0ac4f380/Modules/_sre/sre.c#L1510-L1515\n\nThey do not check for `PyLong_AsUnsignedLong` errors.\nI have a PR ready :)\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-110591\n* gh-110613\n* gh-110614\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2023-10-10T07:43:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/110590/cpython/issues/110590"}
| 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:f7aecfb3-20f3-f530-70cb-c423f9eaeab5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 963C:2AB87B:462DB7:620367:696A7424 |
| html-safe-nonce | 092bbccb192941e6385b0c809d8454458de7f12753276d3004149b6704ac469b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjNDOjJBQjg3Qjo0NjJEQjc6NjIwMzY3OjY5NkE3NDI0IiwidmlzaXRvcl9pZCI6IjIyODkwNTYxNjk5NjA1Njc4NDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c8fd0fdd136b5a16ff977e936597ae851480d2513d4222704c6948eabca4ad1d |
| hovercard-subject-tag | issue:1934624035 |
| 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/cpython/110590/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4925d13c1b64a441541cf7220cc2ec576adc38e5e4b0338ac8d4e83c0ff4a69a/python/cpython/issues/110590 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4925d13c1b64a441541cf7220cc2ec576adc38e5e4b0338ac8d4e83c0ff4a69a/python/cpython/issues/110590 |
| og:image:alt | Bug report Reproduction: >>> import _sre >>> _sre.compile('', 0, ['abc'], 0, {}, ()) Traceback (most recent call last): File " |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| hostname | github.com |
| expected-hostname | github.com |
| None | cfa223d62d272274e0b68350b4bd7741f3ca7498b8c4b8b1bc1e6deabbdbc09d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 6a0b6893c221f98f607598e939299fdf5763435d |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width