diff options
-rw-r--r-- | numpy/lib/tests/test_type_check.py | 7 | ||||
-rw-r--r-- | numpy/lib/type_check.py | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_type_check.py b/numpy/lib/tests/test_type_check.py index 01494594b..751392fef 100644 --- a/numpy/lib/tests/test_type_check.py +++ b/numpy/lib/tests/test_type_check.py @@ -375,5 +375,12 @@ class TestArrayConversion(TestCase): assert issubdtype(a.dtype,float) +class TestDateTimeData: + + def test_basic(self): + a = array(['1980-03-23'], dtype=datetime64) + assert_equal(datetime_data(a.dtype), ('us', 1, 1, 1)) + + if __name__ == "__main__": run_module_suite() diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py index 7c88b192d..05070b3ba 100644 --- a/numpy/lib/type_check.py +++ b/numpy/lib/type_check.py @@ -619,6 +619,7 @@ def datetime_data(dtype): ('den', ctypes.c_int), ('events', ctypes.c_int)] + import sys if sys.version_info[:2] >= (3,1): func = ctypes.pythonapi.PyCapsule_GetPointer func.argtypes = [ctypes.py_object, ctypes.c_char_p] |