FreeRADIUS/freeradius-server — pull request #415 by theY4Kman (2013-08-23 21:27:22+00:00)
Title: Load Python with RTLD_GLOBAL to ensure symbols are accessible by dynload libraries / C extensions

It seems by default, implicit link loading of libpython does not allow its symbols to be used by libraries loaded later. So I was getting errors like this:
```
rlm_python:EXCEPT:: /usr/lib/python2.7/lib-dynload/_io.so: undefined symbol: _Py_ZeroStruct
```

The solution is to explicitly load libpython with `dlopen` and the `RTLD_GLOBAL` flag (though, in a [previous project](https://github.com/theY4Kman/viper/blob/2f7a4c5d460d06c8bd1b0e16906af01cc23b438d/src/extension.cpp#L164) I only needed `RTLD_NOW`. Hmm... I'll have to revisit this). All was well after this.

However, because multiple versions of Python are supported by rlm_python, I can't be hardcoding the version number in there. I've been trying to figure out autoconf to send the version number as a preprocessor define, but I keep fucking up :P I'm sure there's a define in Python.h which has it, but I've been using PY_VERSION, which includes the micro version. All I want is "2.7".

The Python.h approach is likely the way to go. It's certainly cleaner and requires less dependencies. I shall figure it out and update the pull request.