[issue46517] Review exception handling in urllib.parse

2022-01-25 Thread Irit Katriel
Irit Katriel added the comment: In urllib.request, there are in a few places things like: except OSError as msg: raise OSError('socket error', msg).with_traceback(sys.exc_info()[2]) I imagine this predates chaining - is there a reason not to raise..from here instead of wrapping the "

[issue46517] Review exception handling in urllib.parse

2022-01-25 Thread Irit Katriel
New submission from Irit Katriel : Is there a reason for this raising, catching and reraising the exception here: https://github.com/python/cpython/blob/main/Lib/urllib/parse.py#L934 rather than just: if len(query) and not isinstance(query[0], tuple): raise TypeError("not a valid non-str