tomerfiliba/rpyc — Issue #61: Suspicious code in vinecar.py
Author: pyscripter
Created: 2012-01-07 18:06:59+00:00
State: open

In the load function of vinecar.py I see the following code:

if instantiate_custom_exceptions:
if modname in sys.modules:
cls = getattr(sys.modules[modname], clsname, None)
elif not is_py3k and modname == "builtins":
cls = getattr(exceptions_module, clsname, None)
else:
cls = None

The second if statement looks suspicious because it will never be true.

Furter below in the same function I see the following code:

if not isinstance(cls, (type, ClassType)):
cls = None
elif issubclass(cls, ClassType) and not instantiate_oldstyle_exceptions:
cls = None
elif not issubclass(cls, BaseException):
cls = None

In python 3k ClassType will be pointing to type and issubclass will always return True and if it is combined with instantiate_oldstyle_exceptions set to True will give the unwantd result cls = None