Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Python parsed the timestamp. Converting it to UTC raised OverflowError.

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…

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.

The 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.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Get the news by email. Yesterday's most-covered stories, every morning.

See today's edition · More options

More in Tech

The Rise of Cozy Driving

Games like Over the Hill and Slow Roads change the context of driving games from racing to something more chill

  • "Cozy driving" concept gaining traction in gaming world
  • Over the Hill and Slow Roads exemplify cozy driving games
  • Cozy driving games offer narrative frameworks and zen-like experiences

More from Friday, 4 December 2026 →