Fixing unfortunate editing mishap. This reverts the last remaining test…

Fixing unfortunate editing mishap. This reverts the last remaining test manipulation in commit 249df7cb and makes all existing unit tests pass with smart_holder as default holder.
parent 23036a45
...@@ -162,8 +162,7 @@ void construct(value_and_holder &v_h, Cpp<Class> &&result, bool need_alias) { ...@@ -162,8 +162,7 @@ void construct(value_and_holder &v_h, Cpp<Class> &&result, bool need_alias) {
// return-by-value version 2: returning a value of the alias type itself. We move-construct an // return-by-value version 2: returning a value of the alias type itself. We move-construct an
// Alias instance (even if no the python-side inheritance is involved). The is intended for // Alias instance (even if no the python-side inheritance is involved). The is intended for
// cases where Alias initialization is always desired. // cases where Alias initialization is always desired.
template <typename Class, template <typename Class>
detail::enable_if_t<!detail::is_smart_holder_type_caster<Cpp<Class>>::value, int> = 0>
void construct(value_and_holder &v_h, Alias<Class> &&result, bool) { void construct(value_and_holder &v_h, Alias<Class> &&result, bool) {
static_assert(std::is_move_constructible<Alias<Class>>::value, static_assert(std::is_move_constructible<Alias<Class>>::value,
"pybind11::init() return-by-alias-value factory function requires a movable alias class"); "pybind11::init() return-by-alias-value factory function requires a movable alias class");
......
...@@ -177,10 +177,10 @@ def test_init_factory_alias(): ...@@ -177,10 +177,10 @@ def test_init_factory_alias():
assert f.has_alias() assert f.has_alias()
assert ConstructorStats.detail_reg_inst() == n_inst + 6 assert ConstructorStats.detail_reg_inst() == n_inst + 6
assert [i.alive() for i in cstats] in ([6, 4], [6, 2]) # SMART_HOLDER_WIP assert [i.alive() for i in cstats] == [6, 4]
del a, b, e del a, b, e
assert [i.alive() for i in cstats] in ([3, 3], [3, 2]) # SMART_HOLDER_WIP assert [i.alive() for i in cstats] == [3, 3]
assert ConstructorStats.detail_reg_inst() == n_inst + 3 assert ConstructorStats.detail_reg_inst() == n_inst + 3
del f, c, d del f, c, d
assert [i.alive() for i in cstats] == [0, 0] assert [i.alive() for i in cstats] == [0, 0]
...@@ -214,10 +214,10 @@ def test_init_factory_alias(): ...@@ -214,10 +214,10 @@ def test_init_factory_alias():
assert [i.alive() for i in cstats] == [0, 0] assert [i.alive() for i in cstats] == [0, 0]
assert ConstructorStats.detail_reg_inst() == n_inst assert ConstructorStats.detail_reg_inst() == n_inst
line1 = ["1", "8", "3", "4", "5", "6", "123", "10", "47"] assert [i.values() for i in cstats] == [
line2 = ["hi there", "3", "4", "6", "move", "123", "why hello!", "move", "47"] ["1", "8", "3", "4", "5", "6", "123", "10", "47"],
line2b = line2[:-2] + ["move", "10"] + line2[-2:] # SMART_HOLDER_WIP ["hi there", "3", "4", "6", "move", "123", "why hello!", "move", "47"],
assert [i.values() for i in cstats] in ([line1, line2], [line1, line2b]) ]
def test_init_factory_dual(): def test_init_factory_dual():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment