[issue35447] Redundant try-except block in urllib

2018-12-09 Thread Shishmarev Pavel


New submission from Shishmarev Pavel :

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

--
components: Library (Lib)
messages: 331436
nosy: PashaWNN
priority: normal
severity: normal
status: open
title: Redundant try-except block in urllib
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 
<https://bugs.python.org/issue35447>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35447] Redundant try-except block in urllib

2018-12-09 Thread Shishmarev Pavel


Change by Shishmarev Pavel :


--
keywords: +patch
pull_requests: +10287
stage:  -> patch review

___
Python tracker 
<https://bugs.python.org/issue35447>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35447] Redundant try-except block in urllib

2018-12-09 Thread Shishmarev Pavel


Change by Shishmarev Pavel :


--
pull_requests: +10288

___
Python tracker 
<https://bugs.python.org/issue35447>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35447] Redundant try-except block in urllib

2018-12-09 Thread Shishmarev Pavel


Shishmarev Pavel  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 
<https://bugs.python.org/issue35447>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com