This has been fixed few months ago, in theory in swig 4.3:
https://github.com/swig/swig/commit/ba9b0a35ab62f0d3cfbb4f7109569d86a00ec53c