as far as you describes, it's not a bug.
When the file/buffer has a shebang indicating a different Python you want to execute with, use a command explicitly specifying it:
For example M-x py-execute-buffer-ipython will use IPython even if shebang says #! /usr/bin/env python
Precedences: Shebang precedes default py-shell-name, a call of py-execute-buffer-PY-SHELL-NAME precedes shebang
There is a bug which deserves the title, not described here however,