mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
Support pointers to member functions in def_buffer.
Closes #857, by adding overloads to def_buffer that match pointers to member functions and wrap them in lambdas.
This commit is contained in:
committed by
Jason Rhinelander
parent
37b2383a64
commit
fe0cf8b73b
@@ -1,5 +1,6 @@
|
||||
import struct
|
||||
import pytest
|
||||
from pybind11_tests import Matrix, ConstructorStats
|
||||
from pybind11_tests import Matrix, ConstructorStats, PTMFBuffer, ConstPTMFBuffer, DerivedPTMFBuffer
|
||||
|
||||
pytestmark = pytest.requires_numpy
|
||||
|
||||
@@ -60,3 +61,12 @@ def test_to_python():
|
||||
# assert cstats.move_constructions >= 0 # Don't invoke any
|
||||
assert cstats.copy_assignments == 0
|
||||
assert cstats.move_assignments == 0
|
||||
|
||||
|
||||
@pytest.unsupported_on_pypy
|
||||
def test_ptmf():
|
||||
for cls in [PTMFBuffer, ConstPTMFBuffer, DerivedPTMFBuffer]:
|
||||
buf = cls()
|
||||
buf.value = 0x12345678
|
||||
value = struct.unpack('i', bytearray(buf))[0]
|
||||
assert value == 0x12345678
|
||||
|
||||
Reference in New Issue
Block a user