mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-17 06:00:51 +00:00
Merge branch 'master' into smart_holder
This commit is contained in:
commit
d6cf6dfed3
@ -35,7 +35,7 @@ public:
|
|||||||
using rep = typename type::rep;
|
using rep = typename type::rep;
|
||||||
using period = typename type::period;
|
using period = typename type::period;
|
||||||
|
|
||||||
using days = std::chrono::duration<uint_fast32_t, std::ratio<86400>>;
|
using days = std::chrono::duration<int_least32_t, std::ratio<86400>>; // signed 25 bits required by the standard.
|
||||||
|
|
||||||
bool load(handle src, bool) {
|
bool load(handle src, bool) {
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
@ -39,9 +39,7 @@ def test_chrono_system_clock_roundtrip():
|
|||||||
|
|
||||||
# They should be identical (no information lost on roundtrip)
|
# They should be identical (no information lost on roundtrip)
|
||||||
diff = abs(date1 - date2)
|
diff = abs(date1 - date2)
|
||||||
assert diff.days == 0
|
assert diff == datetime.timedelta(0)
|
||||||
assert diff.seconds == 0
|
|
||||||
assert diff.microseconds == 0
|
|
||||||
|
|
||||||
|
|
||||||
def test_chrono_system_clock_roundtrip_date():
|
def test_chrono_system_clock_roundtrip_date():
|
||||||
@ -64,9 +62,7 @@ def test_chrono_system_clock_roundtrip_date():
|
|||||||
assert diff.microseconds == 0
|
assert diff.microseconds == 0
|
||||||
|
|
||||||
# Year, Month & Day should be the same after the round trip
|
# Year, Month & Day should be the same after the round trip
|
||||||
assert date1.year == date2.year
|
assert date1 == date2
|
||||||
assert date1.month == date2.month
|
|
||||||
assert date1.day == date2.day
|
|
||||||
|
|
||||||
# There should be no time information
|
# There should be no time information
|
||||||
assert time2.hour == 0
|
assert time2.hour == 0
|
||||||
@ -117,10 +113,7 @@ def test_chrono_system_clock_roundtrip_time(time1, tz, monkeypatch):
|
|||||||
assert isinstance(time2, datetime.time)
|
assert isinstance(time2, datetime.time)
|
||||||
|
|
||||||
# Hour, Minute, Second & Microsecond should be the same after the round trip
|
# Hour, Minute, Second & Microsecond should be the same after the round trip
|
||||||
assert time1.hour == time2.hour
|
assert time1 == time2
|
||||||
assert time1.minute == time2.minute
|
|
||||||
assert time1.second == time2.second
|
|
||||||
assert time1.microsecond == time2.microsecond
|
|
||||||
|
|
||||||
# There should be no date information (i.e. date = python base date)
|
# There should be no date information (i.e. date = python base date)
|
||||||
assert date2.year == 1970
|
assert date2.year == 1970
|
||||||
@ -140,9 +133,13 @@ def test_chrono_duration_roundtrip():
|
|||||||
|
|
||||||
cpp_diff = m.test_chrono3(diff)
|
cpp_diff = m.test_chrono3(diff)
|
||||||
|
|
||||||
assert cpp_diff.days == diff.days
|
assert cpp_diff == diff
|
||||||
assert cpp_diff.seconds == diff.seconds
|
|
||||||
assert cpp_diff.microseconds == diff.microseconds
|
# Negative timedelta roundtrip
|
||||||
|
diff = datetime.timedelta(microseconds=-1)
|
||||||
|
cpp_diff = m.test_chrono3(diff)
|
||||||
|
|
||||||
|
assert cpp_diff == diff
|
||||||
|
|
||||||
|
|
||||||
def test_chrono_duration_subtraction_equivalence():
|
def test_chrono_duration_subtraction_equivalence():
|
||||||
@ -153,9 +150,7 @@ def test_chrono_duration_subtraction_equivalence():
|
|||||||
diff = date2 - date1
|
diff = date2 - date1
|
||||||
cpp_diff = m.test_chrono4(date2, date1)
|
cpp_diff = m.test_chrono4(date2, date1)
|
||||||
|
|
||||||
assert cpp_diff.days == diff.days
|
assert cpp_diff == diff
|
||||||
assert cpp_diff.seconds == diff.seconds
|
|
||||||
assert cpp_diff.microseconds == diff.microseconds
|
|
||||||
|
|
||||||
|
|
||||||
def test_chrono_duration_subtraction_equivalence_date():
|
def test_chrono_duration_subtraction_equivalence_date():
|
||||||
@ -166,9 +161,7 @@ def test_chrono_duration_subtraction_equivalence_date():
|
|||||||
diff = date2 - date1
|
diff = date2 - date1
|
||||||
cpp_diff = m.test_chrono4(date2, date1)
|
cpp_diff = m.test_chrono4(date2, date1)
|
||||||
|
|
||||||
assert cpp_diff.days == diff.days
|
assert cpp_diff == diff
|
||||||
assert cpp_diff.seconds == diff.seconds
|
|
||||||
assert cpp_diff.microseconds == diff.microseconds
|
|
||||||
|
|
||||||
|
|
||||||
def test_chrono_steady_clock():
|
def test_chrono_steady_clock():
|
||||||
@ -183,9 +176,7 @@ def test_chrono_steady_clock_roundtrip():
|
|||||||
assert isinstance(time2, datetime.timedelta)
|
assert isinstance(time2, datetime.timedelta)
|
||||||
|
|
||||||
# They should be identical (no information lost on roundtrip)
|
# They should be identical (no information lost on roundtrip)
|
||||||
assert time1.days == time2.days
|
assert time1 == time2
|
||||||
assert time1.seconds == time2.seconds
|
|
||||||
assert time1.microseconds == time2.microseconds
|
|
||||||
|
|
||||||
|
|
||||||
def test_floating_point_duration():
|
def test_floating_point_duration():
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
fun:_Znwm
|
fun:_Znwm
|
||||||
fun:PyInit_pypocketfft
|
fun:PyInit_pypocketfft
|
||||||
fun:_PyImport_LoadDynamicModuleWithSpec
|
fun:_PyImport_LoadDynamicModuleWithSpec
|
||||||
fun:_imp_create_dynamic_impl.constprop.3
|
fun:_imp_create_dynamic_impl.constprop.*
|
||||||
fun:_imp_create_dynamic
|
fun:_imp_create_dynamic
|
||||||
fun:cfunction_vectorcall_FASTCALL
|
fun:cfunction_vectorcall_FASTCALL
|
||||||
fun:PyVectorcall_Call
|
fun:PyVectorcall_Call
|
||||||
|
Loading…
Reference in New Issue
Block a user