Title: `datetime.strptime` accepts incompatible arguments · Issue #124549 · python/cpython · GitHub
Open Graph Title: `datetime.strptime` accepts incompatible arguments · Issue #124549 · python/cpython
X Title: `datetime.strptime` accepts incompatible arguments · Issue #124549 · python/cpython
Description: Bug report Bug description: If you over-specify a datetime strptime string, it seems that datetime.strptime when encountering a component that has been specified twice, will overwrite earlier values with more recent ones. >>> datetime.st...
Open Graph Description: Bug report Bug description: If you over-specify a datetime strptime string, it seems that datetime.strptime when encountering a component that has been specified twice, will overwrite earlier value...
X Description: Bug report Bug description: If you over-specify a datetime strptime string, it seems that datetime.strptime when encountering a component that has been specified twice, will overwrite earlier value...
Opengraph URL: https://github.com/python/cpython/issues/124549
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`datetime.strptime` accepts incompatible arguments","articleBody":"# Bug report\n\n### Bug description:\n\nIf you over-specify a datetime strptime string, it seems that `datetime.strptime` when encountering a component that has been specified twice, will overwrite earlier values with more recent ones.\n\n```python\n>>> datetime.strptime(\"200099\", \"%Y%y\")\ndatetime.datetime(1999, 1, 1, 0, 0)\n```\n\nOne approach would be to ban over-specified formats, but that would be a problem for someone who wants to, use a format like \"%M %B\" (e.g. something sortable by month number while also showing month name), so I think we don't want to do that.\n\nAlternatively we could start raising an exception if you get *different* values from these two things, or possibly a warning.\n\nOr we can just accept that if you use a weird format you should expect weird behavior.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-125009\n* gh-132524\n* gh-159950\n* gh-159951\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/pganssle","@type":"Person","name":"pganssle"},"datePublished":"2024-09-25T21:18:32Z","url":"https://github.com/python/cpython/issues/124549"}
| 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:78d3f201-ba70-a63d-eee3-459185a1d128 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DDC4:76F02:3C826A9:4D53525:6B020978 |
| html-safe-nonce | f49378c56661eda8ee91b5bd3c5fdcbd654b664ed8a9a99de1d3c750c10f360d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEREM0Ojc2RjAyOjNDODI2QTk6NEQ1MzUyNTo2QjAyMDk3OCIsInZpc2l0b3JfaWQiOiI5NDI0ODk0NzIwNjU0NzI4ODkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a5c2bd0a25fcbc4ba3875e138a32592b370abca2876f359db7ab32349bcbb47d |
| hovercard-subject-tag | issue:2549017766 |
| 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/124549/issue_layout |
| twitter:image | https://opengraph.githubassets.com/91df627e0785136cd2b441e1cdb308412de733ef71428b15ca4027f0bd7946e7/python/cpython/issues/124549 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/91df627e0785136cd2b441e1cdb308412de733ef71428b15ca4027f0bd7946e7/python/cpython/issues/124549 |
| og:image:alt | Bug report Bug description: If you over-specify a datetime strptime string, it seems that datetime.strptime when encountering a component that has been specified twice, will overwrite earlier value... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pganssle |
| 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