Title: `datetime.strptime` no longer raises `ValueError: stray % in format '%Y %'` · Issue #131434 · python/cpython · GitHub
Open Graph Title: `datetime.strptime` no longer raises `ValueError: stray % in format '%Y %'` · Issue #131434 · python/cpython
X Title: `datetime.strptime` no longer raises `ValueError: stray % in format '%Y %'` · Issue #131434 · python/cpython
Description: Bug report Bug description: in 3.13.2 and 3.13.1 datetime.strptime no longer raises ValueError: stray % in format '%Y %' Python 3.13.2 (main, Mar 19 2025, 01:28:14) [Clang 16.0.0 (clang-1600.0.26.6)] on Darwin >>> from datetime import da...
Open Graph Description: Bug report Bug description: in 3.13.2 and 3.13.1 datetime.strptime no longer raises ValueError: stray % in format '%Y %' Python 3.13.2 (main, Mar 19 2025, 01:28:14) [Clang 16.0.0 (clang-1600.0.26.6...
X Description: Bug report Bug description: in 3.13.2 and 3.13.1 datetime.strptime no longer raises ValueError: stray % in format '%Y %' Python 3.13.2 (main, Mar 19 2025, 01:28:14) [Clang 16.0.0 (clang-160...
Opengraph URL: https://github.com/python/cpython/issues/131434
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`datetime.strptime` no longer raises `ValueError: stray % in format '%Y %'`","articleBody":"# Bug report\n\n### Bug description:\n\nin 3.13.2 and 3.13.1 `datetime.strptime` no longer raises `ValueError: stray % in format '%Y %'`\n```\nPython 3.13.2 (main, Mar 19 2025, 01:28:14) [Clang 16.0.0 (clang-1600.0.26.6)] on Darwin\n>>> from datetime import datetime\n>>> datetime.strptime(\"2000 %\", \"%Y %\")\ndatetime.datetime(2000, 1, 1, 0, 0)\n```\n\nas it used to do in 3.13.0:\n```\nPython 3.13.0 (main, Mar 19 2025, 01:42:48) [Clang 16.0.0 (clang-1600.0.26.6)] on darwin\n>>> from datetime import datetime\n>>> datetime.strptime(\"2000 %\", \"%Y %\")\nTraceback (most recent call last):\n File \"\u003cpython-input-1>\", line 1, in \u003cmodule>\n datetime.strptime(\"2000 %\", \"%Y %\")\n ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^\n File \"/Users/nik/.pyenv/versions/3.13.0/lib/python3.13/_strptime.py\", line 573, in _strptime_datetime\n tt, fraction, gmtoff_fraction = _strptime(data_string, format)\n ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/nik/.pyenv/versions/3.13.0/lib/python3.13/_strptime.py\", line 348, in _strptime\n raise ValueError(\"stray %% in format '%s'\" % format) from None\nValueError: stray % in format '%Y %'\n```\nand e.g. 3.10:\n```\nPython 3.10.15 (main, Nov 28 2024, 23:39:17) [Clang 16.0.0 (clang-1600.0.26.4)] on Darwin\n>>> from datetime import datetime\n>>> datetime.strptime(\"2000 %\", \"%Y %\")\nTraceback (most recent call last):\n File \"\u003cstdin>\", line 1, in \u003cmodule>\n File \"/Users/nik/.pyenv/versions/3.10.15/lib/python3.10/_strptime.py\", line 568, in _strptime_datetime\n tt, fraction, gmtoff_fraction = _strptime(data_string, format)\n File \"/Users/nik/.pyenv/versions/3.10.15/lib/python3.10/_strptime.py\", line 345, in _strptime\n raise ValueError(\"stray %% in format '%s'\" % format) from None\nValueError: stray % in format '%Y %'\n```\n\nedit 1:\ngot the same in the latest 3.12.9 (used to work in older 3.12)\n\n### CPython versions tested on:\n\n3.13\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-131568\n* gh-132309\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/westandskif","@type":"Person","name":"westandskif"},"datePublished":"2025-03-18T22:47:46Z","url":"https://github.com/python/cpython/issues/131434"}
| 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:7b12e8ee-f3f0-160a-8271-b74c606be9c9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B0A0:785A9:43827CA:5595D8A:6B022C45 |
| html-safe-nonce | 4757154b202b2c4224bc8de014725e1a294c972a01f01d170afce29a10a6cbdb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEEwOjc4NUE5OjQzODI3Q0E6NTU5NUQ4QTo2QjAyMkM0NSIsInZpc2l0b3JfaWQiOiI2NzYzNzg3OTY5MjQ2NjY5ODkzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 31c78ab7a90bb6d061508c27d79a7bd5bdaabf565c61c5dd4de415d926fb70b9 |
| hovercard-subject-tag | issue:2930019835 |
| 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/131434/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3ec5e735b2a12164bfda714f056bc84485e5ec51812c0501ea14db4249ac249b/python/cpython/issues/131434 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3ec5e735b2a12164bfda714f056bc84485e5ec51812c0501ea14db4249ac249b/python/cpython/issues/131434 |
| og:image:alt | Bug report Bug description: in 3.13.2 and 3.13.1 datetime.strptime no longer raises ValueError: stray % in format '%Y %' Python 3.13.2 (main, Mar 19 2025, 01:28:14) [Clang 16.0.0 (clang-1600.0.26.6... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | westandskif |
| 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