Author: Matti Picus <[email protected]>
Branch: py3.6
Changeset: r97450:930650622627
Date: 2019-09-11 22:52 +0300
http://bitbucket.org/pypy/pypy/changeset/930650622627/
Log: enable more capi tests; test, fix exception compatibility
diff --git a/lib_pypy/_testcapimodule.c b/lib_pypy/_testcapimodule.c
--- a/lib_pypy/_testcapimodule.c
+++ b/lib_pypy/_testcapimodule.c
@@ -4449,9 +4449,11 @@
{"crash_no_current_thread", (PyCFunction)crash_no_current_thread,
METH_NOARGS},
#ifndef PYPY_VERSION
{"run_in_subinterp", run_in_subinterp, METH_VARARGS},
+#endif
{"pytime_object_to_time_t", test_pytime_object_to_time_t, METH_VARARGS},
{"pytime_object_to_timeval", test_pytime_object_to_timeval, METH_VARARGS},
{"pytime_object_to_timespec", test_pytime_object_to_timespec,
METH_VARARGS},
+#ifndef PYPY_VERSION
{"with_tp_del", with_tp_del, METH_VARARGS},
#endif
{"create_cfunction", create_cfunction, METH_NOARGS},
diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py
--- a/pypy/module/time/interp_time.py
+++ b/pypy/module/time/interp_time.py
@@ -528,6 +528,9 @@
seconds = pytime.time()
else:
seconds = space.float_w(w_seconds)
+ if math.isnan(seconds):
+ raise oefmt(space.w_ValueError,
+ "Invalid value Nan (not a number)")
#
t = rffi.cast(rffi.TIME_T, seconds)
#
diff --git a/pypy/module/time/test/test_time.py
b/pypy/module/time/test/test_time.py
--- a/pypy/module/time/test/test_time.py
+++ b/pypy/module/time/test/test_time.py
@@ -111,6 +111,11 @@
else:
time.localtime(-1)
+ def test_localtime_invalid(self):
+ from time import localtime
+ exc = raises(ValueError, localtime, float('nan'))
+ assert 'Invalid value' in str(exc.value)
+
def test_mktime(self):
import time
import os, sys
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit