Convert a pointer coming from C code ( ) to a byte buffer containing the address that the pointer refers to.
(ptr_cdata)
| 94 | |
| 95 | |
| 96 | def ptr_to_bytes(ptr_cdata) -> bytes: |
| 97 | """ |
| 98 | Convert a pointer coming from C code (<cdata 'some_type *'>) |
| 99 | to a byte buffer containing the address that the pointer refers to. |
| 100 | """ |
| 101 | |
| 102 | pp = ffi.new('void **', ptr_cdata) |
| 103 | return bytes(ffi.buffer(pp)[:]) |
| 104 | |
| 105 | |
| 106 | @contextlib.contextmanager |
no outgoing calls
no test coverage detected
searching dependent graphs…