{
  "id": 23503612,
  "title": "Python parsed the timestamp. Converting it to UTC raised OverflowError.",
  "url": "https://urgent.news/2026/12/04/python-parsed-the-timestamp-converting-it-to-utc-raised-overflowerror",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-12-04T22:22:49.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/shikiyusuke/python-parsed-the-timestamp-converting-it-to-utc-raised-overflowerror-2i1"
  },
  "original_language": null,
  "account": "A Python developer encountered an issue when converting a timestamp to UTC, resulting in an OverflowError. By providing a timestamp of 0001-01-01T00:00:00+23:59, the issue could be reproduced using Python's standard library. The problem arose due to the offset; converting the timestamp to UTC required subtracting 23 hours and 59 minutes, which resulted in an invalid date. Similarly, converting the year 9999 date caused the same issue when converting to UTC.\n\nThe source code uses the fromisoformat() function to parse the string, but the subsequent astimezone() function was not caught by the existing exception handler. In version 0.5.1, the OverflowError exception was added to catch this issue for both explicit offsets and time zones supplied by the command line. The updated function now returns a clearer error message, such as \"invalid date/time: '0001-01-01T00:00:00+23:59' (out of range)\", and exits with code 1, providing more helpful information for users. Regression tests were also added to ensure the fix worked as expected.",
  "summary": "Give agent-cost report a start date of not-a-date and it tells you which argument it couldn't read. Give version 0.5.0 a timestamp Python can read, 0001-01-01T00:00:00+23:59 , and you get a traceback instead. What happened between reading the argument and running the report? Move the date forward one day You can reproduce this with Python’s standard library. Here’s the example I ran on Python…",
  "summary_source": "publisher",
  "key_points": [
    "Python developer encounters OverflowError when converting timestamp to UTC",
    "Issue reproduced using timestamp 0001-01-01T00:00:00+23:59",
    "Updated function returns clearer error message and exits with code 1"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "outlets_capped": false,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}