Fixed memory management issues

Fixed an issue where Py_True or Py_False was being released without
being retained. Also fixed a potential memory leak if py_callfunc
failed.