[issue44520] In Lib/urllib/parse.py quote_from_bytes, exception is thrown if bs = None

Олег Масло report at bugs.python.org
Fri Jul 2 07:34:53 EDT 2021


Олег Масло <asicscwcs at gmail.com> added the comment:

If you pass None to the quote_from_bytes function, then there is no point in the "if not bs" check, because it won't even reach it. 

This function is not with dynamic behavior, which violates python concepts. If you pass a string instead of bytes, it will throw a TypeError exception, it's ok. But if for some reason you need to pass None, and this happens, then the function does not behave as expected.

Why even check that bs is not None, if this can never be? And if it does, there will always be a TypeError exception.

----------
status: pending -> open

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


More information about the Python-bugs-list mailing list