mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
Fix py::cast from pytype rvalue to pytype (#3949)
* Fix py::cast from pytype rvalue to pytype Previously, py::cast blindly assumed that the destination type was a C++ type rather than a python type when the source type was an rvalue. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -123,3 +123,10 @@ def test_move_fallback():
|
||||
assert m1.value == 1
|
||||
m2 = m.get_moveissue2(2)
|
||||
assert m2.value == 2
|
||||
|
||||
|
||||
def test_pytype_rvalue_cast():
|
||||
"""Make sure that cast from pytype rvalue to other pytype works"""
|
||||
|
||||
value = m.get_pytype_rvalue_castissue(1.0)
|
||||
assert value == 1
|
||||
|
||||
Reference in New Issue
Block a user