-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch time(), ftime(), localtime() and clock() errors #58055
Comments
Attach patch catchs errors on time(), ftime(), localtime() and clock(). It changes floattime() and _Py_gettimeofday() signature: result now indicates if an error occurred or not, and these function now directly raise an exception. Catching time() error is maybe overflow: modern version of its manual page don't mention errors. |
New changeset 9ee4a104e33d by Victor Stinner in branch 'default': |
New changeset 94b7eb09d0b3 by Victor Stinner in branch 'default': |
I added tests on localtime() and clock(). I read more carefully time(), ftime() and gettimeofday() manpage: it is not possible that they fail if the argument is an invalid pointer, the current code is correct. I don't want to backport changes because they are incompatible. -- There is a failure on FreeBSD 8.2: ====================================================================== Traceback (most recent call last):
File "/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/test_time.py", line 358, in test_localtime_failure
self.assertRaises(OSError, time.localtime, invalid_time_t)
AssertionError: OSError not raised by localtime test_localtime_failure() should be removed or at least skipped on FreeBSD, except if someone knows another invalid time_t value on this platform. |
New changeset 516d42a6e518 by Victor Stinner in branch 'default': |
New changeset 856f0864437a by Victor Stinner in branch 'default': |
The issue should be done with the last commit. |
There is still an error on Windows: ====================================================================== Traceback (most recent call last):
File "D:\Buildslave\3.x.moore-windows\build\lib\test\test_time.py", line 364, in test_localtime_failure
self.assertRaises(OSError, time.gmtime, invalid_time_t)
AssertionError: OSError not raised by gmtime http://www.python.org/dev/buildbot/all/builders/x86%20XP-5%203.x/builds/4074/steps/test/logs/stdio time.ctime() uses localtime() internally, whereas time.gmtime() doesn't. Another time should maybe be written (to test a different time_t value). Or remove completly the whole test because it is not reliable :-) |
New changeset 5b42aefb8969 by Victor Stinner in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: