[issue35447] Redundant try-except block in urllib

Shishmarev Pavel report at bugs.python.org
Sun Dec 9 23:17:07 EST 2018


Shishmarev Pavel <pashawnn at gmail.com> added the comment:

https://github.com/python/cpython/blob/master/Lib/urllib/parse.py#L875
It's redundant to raise and then catch exception.

I mean:
if len(query) and not isinstance(query[0], tuple):
    ty, va, tb = sys.exc_info()
    raise TypeError("not a valid non-string sequence "
                    "or mapping object").with_traceback(tb)


Would be more clean.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35447>
_______________________________________


More information about the Python-bugs-list mailing list