SIGN IN SIGN UP

gh-138535: Optimize fill_time for typical timestamps (#138537)

While file timestamps can be anything the file system can store, most
lie between the recent past and the near future.  Optimize fill_time()
for typical timestamps in three ways:

- When possible, convert to nanoseconds with C arithmetic.
- When using C arithmetic and the seconds member is not required (for
  st_birthtime), avoid creating a long object.
- When using C arithmetic, reorder the code to avoid the null checks
  implied in Py_XDECREF().

Co-authored-by: Victor Stinner <vstinner@python.org>
J
Jeffrey Bosboom committed
d4825ac27cba68d02221e13910ea42ee9caac38c
Parent: 5edfe55
Committed by GitHub <noreply@github.com> on 9/9/2025, 9:05:54 AM