Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suspicious code in vinegar.py #61

Closed
pyscripter opened this issue Jan 7, 2012 · 0 comments
Closed

Suspicious code in vinegar.py #61

pyscripter opened this issue Jan 7, 2012 · 0 comments
Assignees

Comments

@pyscripter
Copy link
Contributor

In the load function of vinegar.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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants