Title: ZoneInfo object raises OSError instead of ZoneInfoNotFoundError for timezone input larger than 255 characters · Issue #96463 · python/cpython · GitHub
Open Graph Title: ZoneInfo object raises OSError instead of ZoneInfoNotFoundError for timezone input larger than 255 characters · Issue #96463 · python/cpython
X Title: ZoneInfo object raises OSError instead of ZoneInfoNotFoundError for timezone input larger than 255 characters · Issue #96463 · python/cpython
Description: Bug report According to documentation all calls to ZoneInfo should raise ValueError or ZoneInfoNotFoundError. Creating a ZoneInfo object with an invalid very long timezone (length > 255) an OSError is raised instead (OSError: [Errno 36] ...
Open Graph Description: Bug report According to documentation all calls to ZoneInfo should raise ValueError or ZoneInfoNotFoundError. Creating a ZoneInfo object with an invalid very long timezone (length > 255) an OSError...
X Description: Bug report According to documentation all calls to ZoneInfo should raise ValueError or ZoneInfoNotFoundError. Creating a ZoneInfo object with an invalid very long timezone (length > 255) an OSEr...
Opengraph URL: https://github.com/python/cpython/issues/96463
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ZoneInfo object raises OSError instead of ZoneInfoNotFoundError for timezone input larger than 255 characters","articleBody":"\u003c!--\r\n If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not\r\n the right place to seek help. Consider the following options instead:\r\n\r\n - reading the Python tutorial: https://docs.python.org/3/tutorial/\r\n - posting in the \"Users\" category on discuss.python.org: https://discuss.python.org/c/users/7\r\n - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list\r\n - searching our issue tracker (https://github.com/python/cpython/issues) to see if\r\n your problem has already been reported\r\n--\u003e\r\n\r\n# Bug report\r\n\r\nAccording to documentation all calls to ZoneInfo should raise `ValueError` or `ZoneInfoNotFoundError`. \r\nCreating a ZoneInfo object with an invalid very long timezone (length \u003e 255) an OSError is raised instead (`OSError: [Errno 36] File name too long`). \r\n\r\nI believe that https://github.com/python/cpython/blob/29f1b0bb1ff73dcc28f0ca7e11794141b6de58c9/Lib/zoneinfo/_common.py#L11-L24 should also handle the `OSError` exception raised by open and reraise it to `ZoneInfoNotFoundError`.\r\n\r\nSample code for reproduction:\r\n```\r\nfrom zoneinfo import ZoneInfo\r\nZoneInfo(\"a\"*256)\r\n```\r\n\r\n# Your environment\r\n\r\n\u003c!-- Include as many relevant details as possible about the environment you experienced the bug in --\u003e\r\n\r\n- CPython versions tested on: Python 3.10.4\r\n- Operating system and architecture: Debian GNU/Linux 11 (bullseye)\r\n\r\n\u003c!--\r\nYou can freely edit this text. Remove any lines you believe are unnecessary.\r\n--\u003e\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-99602\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/lleontop","@type":"Person","name":"lleontop"},"datePublished":"2022-08-31T15:08:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/96463/cpython/issues/96463"}
| 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:7856d2a4-a2a2-37f5-3175-2cf594463f9e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D508:1FA88E:4BCAEB:65982C:6969C800 |
| html-safe-nonce | c63f822b372d45b711dea8a59e04ab02ce03ac397e193b321c564d832b3d0318 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTA4OjFGQTg4RTo0QkNBRUI6NjU5ODJDOjY5NjlDODAwIiwidmlzaXRvcl9pZCI6IjIyNTcwMDI5NTc4Nzk0OTQ2NTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b34b056798e9fcac3a852b1b17cd24384e7a3478672036c9fe9bb55fb2739cdf |
| hovercard-subject-tag | issue:1357480140 |
| 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/96463/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7ef7c1368132c0055a383ca250fc23d77b2256f83f03d9677d16f4bd393d9d07/python/cpython/issues/96463 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7ef7c1368132c0055a383ca250fc23d77b2256f83f03d9677d16f4bd393d9d07/python/cpython/issues/96463 |
| og:image:alt | Bug report According to documentation all calls to ZoneInfo should raise ValueError or ZoneInfoNotFoundError. Creating a ZoneInfo object with an invalid very long timezone (length > 255) an OSError... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lleontop |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| 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 | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width