The python wrapper for xpa in display_ds9 defines several C/C++ functions that call into xpa and then wraps them for Python. Unfortunately the code is rather messy. Issues I would like cleaned up:
The functions have no documentation.
Some of the char * arguments and return values should probably be std::string const & or similar. In particular XPASet1 takes char * buf, int len where len is the number of characters in the buffer. That argument would be much safer as a std::string. One subtlety is that the xpa functions this code calls don't specify const for some of the arguments that clearly are intended to be const.
The functions are defined with one name, then used in Python with another name. I would be easier to understand the code if the C/C++ names matched the Python names.
The new functions have no header file and are defined in the same file as the pybind11 wrapper (emulating SWIG). It would be cleaner and more standard to separate the new functions into header and implementation files, with the wrapper separate.