libvips / pyvips

python binding for libvips using cffi
MIT License
649 stars 50 forks source link

Fix `type_map()` #488

Closed kleisauke closed 2 months ago

kleisauke commented 4 months ago

We cannot declare VipsTypeMap2Fn as opaque as this callback is used by type_map(). Instead, restore the VipsTypeMap2Fn definition and use an opaque pointer for the second argument of vips_type_map().

Details ```console $ python3 gen_cpp_binding.py Traceback (most recent call last): File "/home/kleisauke/wasm-vips/build/gen_cpp_binding.py", line 295, in generate_enums_flags('enums.cpp') File "/home/kleisauke/wasm-vips/build/gen_cpp_binding.py", line 230, in generate_enums_flags type_map(type_from_name('GEnum'), add_enum) File "/home/kleisauke/.local/lib/python3.12/site-packages/pyvips/base.py", line 105, in type_map cb = ffi.callback('VipsTypeMap2Fn', fn) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: expected a function ctype, got 'VipsTypeMap2Fn' ```

Regressed since: #464.