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

2021-07-02 Thread Eric V. Smith
Eric V. Smith added the comment: I agree this should be closed (and I'm closing it). I don't see any reason why this function should do something other than raise TypeError if given bs=None. If you want that behavior, write a small wrapper function. The "if not bs" check appears to be an

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

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: I meant: ... it will be true for bs which is an empty bytes(). You are thinking of b'' and None as if they are the same thing. They are not. If this was a check for None it would be "if bs is None" and not "if not bs". -- status: pending -> open

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

2021-07-02 Thread Irit Katriel
Change by Irit Katriel : -- status: open -> pending ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2021-07-02 Thread Irit Katriel
Change by Irit Katriel : -- status: open -> pending ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: There is still a point in the "if not bs:" check, it will be true for bs which is an empty string. -- ___ Python tracker ___

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

2021-07-02 Thread Олег Масло
Олег Масло 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

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

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: The documentation states that this function accepts bytes: https://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote_from_bytes None is not of type bytes, so raising a TypeError is not unreasonable. It would certainly be wrong to return any

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

2021-07-02 Thread Irit Katriel
Irit Katriel added the comment: As I wrote on the PR, and again on this issue, a PR that makes a behavior change (like this one) is not complete without a unit test (which fails before the change and passes after the change, and can show what the bug being fixed is). You could add such a

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

2021-07-02 Thread Олег Масло
Олег Масло added the comment: What are the next actions? Do I need to do something or are we waiting for something? -- ___ Python tracker ___

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

2021-06-28 Thread Irit Katriel
Irit Katriel added the comment: I don’t know if it needs to change, but if anything I would map None to None and not to ‘’. -- ___ Python tracker ___

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

2021-06-28 Thread Олег Масло
Олег Масло added the comment: That is, all the libraries already created need to follow your advice? :) -- ___ Python tracker ___

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

2021-06-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If you want to interpret None as an empty string, you can just write quote_from_bytes(data or b''). -- nosy: +serhiy.storchaka ___ Python tracker

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

2021-06-28 Thread Eric V. Smith
Eric V. Smith added the comment: Clarifying the title. -- nosy: +eric.smith title: exception is thrown if bs = None -> In Lib/urllib/parse.py quote_from_bytes, exception is thrown if bs = None ___ Python tracker