The datetime.fromtimestamp() function works fine with integer timestamps and positive fractional timestamps, but fails if I pass a negative fractional timestamp. For example:
>>> import datetime
>>> datetime.datetime.fromtimestamp(-1.05)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: microsecond must be in 0..999999
It should return the same result as datetime.fromtimestamp(-1) - timedelta(seconds=.5).
The same bug can be triggered in datetime.utcfromtimestamp().
I have been able to reproduce this bug in Python 2.4.4 and Python 2.5 on Linux.

The problem seems to be in datetime_from_timestamp() from datetimemodule.c. It should probably be checking to see whether the microseconds value it calculates is negative, and adjust "timet" and "us" accordingly if so.