message: CleanupFunc doesn't need to do cleanup if _py_funcs is already destroyed.
diff: @@ -176,6 +176,9 @@ class CleanupFunc(object):
  self._token = token
  def __del__(self):
  + if _py_funcs is not None:
  + # If _py_funcs is None, the program is most likely in shutdown, and the
  + # _py_funcs object has been destroyed already.
  _py_funcs.remove(self._token)
  