Title: datetime.fromisoformat() accepts invalid ISO 8601 timestamps · Issue #115783 · python/cpython · GitHub
Open Graph Title: datetime.fromisoformat() accepts invalid ISO 8601 timestamps · Issue #115783 · python/cpython
X Title: datetime.fromisoformat() accepts invalid ISO 8601 timestamps · Issue #115783 · python/cpython
Description: Bug report Bug description: Since Python 3.11, datetime.fromisoformat(...) accepts invalid timestamps. The same code was tested in many Python versions via GitHub Actions: Wrong format: 2024-01-17T15:21:00-0800 Fixed format: 2024-01-17T1...
Open Graph Description: Bug report Bug description: Since Python 3.11, datetime.fromisoformat(...) accepts invalid timestamps. The same code was tested in many Python versions via GitHub Actions: Wrong format: 2024-01-17T...
X Description: Bug report Bug description: Since Python 3.11, datetime.fromisoformat(...) accepts invalid timestamps. The same code was tested in many Python versions via GitHub Actions: Wrong format: 2024-01-17T...
Opengraph URL: https://github.com/python/cpython/issues/115783
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"datetime.fromisoformat() accepts invalid ISO 8601 timestamps","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\nSince Python 3.11, `datetime.fromisoformat(...)` accepts invalid timestamps. The same code was tested in many Python versions via GitHub Actions:\r\n\r\nWrong format: `2024-01-17T15:21:00-0800` \r\nFixed format: `2024-01-17T15:21:00-08:00`\r\n\r\nPython code to check:\r\n```python\r\ndatetime.fromisoformat(\"2024-01-17T15:21:00-0800\")\r\n```\r\n\r\nISO 8601 defines 2 formats:\r\n* **basic** format (in short: without separators) and\r\n* **extended** format (with separators).\r\n\r\nWhen checking the EBNF rules, all parts of the timestamp must be with or without separators. A mix of formats is not allowed.\r\n\r\nI haven't checked for other basic and extended format mixes. \r\nMy CI checked many Python versions and platforms. Here a failed CI pipeline, shows a correct implementation. A successful pipeline denotes a buggy Python version. \r\n\r\n\r\n\r\nOther resources:\r\n* #75981\r\n* #86537\r\n* #107779\r\n * #107791\r\n* https://github.com/dateutil/dateutil/issues/1341\r\n* https://github.com/adlnet/xAPI-Spec/issues/541\r\n* https://github.com/bitwalker/timex/issues/98\r\n* ISO 8601 - https://web.archive.org/web/20171019211402/https://www.loc.gov/standards/datetime/ISO_DIS%208601-1.pdf\r\n\r\n### CPython versions tested on:\r\n\r\n3.8, 3.9, 3.10, 3.11, 3.12, 3.13\r\n\r\n### Operating systems tested on:\r\n\r\nLinux, macOS, Windows\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-131522\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/Paebbels","@type":"Person","name":"Paebbels"},"datePublished":"2024-02-21T21:05:28Z","url":"https://github.com/python/cpython/issues/115783"}
| 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:be1ea7de-6a07-4c81-6425-8b7768f2fdf3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8846:380435:4EAC06:633E9B:6B0202AA |
| html-safe-nonce | baf86d3138998cf28b15d5a67ac1a3d533334b0c5e2bf0b739e37f87ac0ee0fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODQ2OjM4MDQzNTo0RUFDMDY6NjMzRTlCOjZCMDIwMkFBIiwidmlzaXRvcl9pZCI6IjQ2MDM0NTMyMTIxNjEzNDQxNzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cc7605e59065a6d0171ac16df5422592592866265bc66084db4be25c76ecd674 |
| hovercard-subject-tag | issue:2147712024 |
| 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/115783/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f6995b41de23eb0bff8c5c2ce47fc43724d29e9f452f6cd77a0e63e80b95e2a3/python/cpython/issues/115783 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f6995b41de23eb0bff8c5c2ce47fc43724d29e9f452f6cd77a0e63e80b95e2a3/python/cpython/issues/115783 |
| og:image:alt | Bug report Bug description: Since Python 3.11, datetime.fromisoformat(...) accepts invalid timestamps. The same code was tested in many Python versions via GitHub Actions: Wrong format: 2024-01-17T... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Paebbels |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width