Skip to content

SWIG: Numpy fixed-width float types, more fixes to aid debugging

Description

This MR extends !1880 (merged) to handle NumPy fixed-width float types. It should now be possible to use numpy.complex_, numpy.complex128, numpy.complex64, numpy.float_, numpy.float16, numpy.float32, numpy.float64, numpy.int16, numpy.int32, numpy.int64, numpy.int8, numpy.uint16, numpy.uint32, numpy.uint64, numpy.uint8 anywhere the equivalent Python built-in integer/float type can be used. Closes #561 (closed)

Also a few more SWIG debugging aids:

  • Can now use cd swig && make debug-python-test SCRIPT=... to debug a specific script, instead of the test script
  • Rename the generated SWIG source files to include the library name, e.g. swiglal_python.c to swiglal_lal_python.c. This leads to more informative error messages from error code which prints __FILE__. (I'd previously tried to address this in e31810ff by adding a <lal...> suffix to the filename using a #line directive, but that doesn't work well with debuggers: since the filename swiglal_python.c<lal> doesn't actually exist, the debugger can't load the sources when examining a backtrace. So it's better to actually rename the sources themselves.)

API Changes and Justification

Backwards Compatible Changes

  • This change does not modify any class/function/struct/type definitions in a public C header file or any Python class/function definitions
  • This change adds new classes/functions/structs/types to a public C header file or Python module

Backwards Incompatible Changes

  • This change modifies an existing class/function/struct/type definition in a public C header file or Python module
  • This change removes an existing class/function/struct/type from a public C header file or Python module

Review Status

cc @david-keitel

Merge request reports

Loading