configure --with-python=$PYPATH
Shouldn't I expect gdb to be linked against python version Y?
I would think so. But from what I can tell by looking at the configury,
I think that your GDB was in fact linked against the Python install
that you provided (using -L${with_python}/lib in the link command).
However, your loader is selecting the libpython in your default install
because it does not know about you local one. You have several solutions
to fix this, typical ones being: use th rpath during the link, or
add your python install lib dir to LD_LIBRARY_PATH, for instance.