Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(277624)

#25439: Add type checks to urllib.request.Request

Can't Edit
Can't Publish+Mail
Start Review
Created:
3 years, 10 months ago by ezio.melotti
Modified:
3 years, 9 months ago
Reviewers:
ghost.adh, nanbytesflow, vadmium+py
CC:
ezio.melotti, Martin Panter, nanwu, CuriousLearner
Visibility:
Public.

Patch Set 1 #

Total comments: 5

Patch Set 2 #

Total comments: 3

Patch Set 3 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Doc/library/urllib.request.rst View 1 2 1 chunk +9 lines, -5 lines 3 comments Download
Lib/test/test_urllib.py View 1 2 2 chunks +13 lines, -0 lines 0 comments Download
Lib/urllib/request.py View 1 2 3 chunks +9 lines, -4 lines 1 comment Download

Messages

Total messages: 12
ghost.adh_gmail.com
https://bugs.python.org/review/25439/diff/15793/Lib/test/test_urllib.py File Lib/test/test_urllib.py (right): https://bugs.python.org/review/25439/diff/15793/Lib/test/test_urllib.py#newcode1429 Lib/test/test_urllib.py:1429: def test_with_invalid_param_type(self): This could also cover int/bool/None. https://bugs.python.org/review/25439/diff/15793/Lib/urllib/request.py File ...
3 years, 10 months ago #1
nanwu
http://bugs.python.org/review/25439/diff/15793/Lib/urllib/request.py File Lib/urllib/request.py (right): http://bugs.python.org/review/25439/diff/15793/Lib/urllib/request.py#newcode375 Lib/urllib/request.py:375: if isinstance(data, str): On 2015/10/20 18:50:13, SilentGhost wrote: > ...
3 years, 10 months ago #2
nanwu
https://bugs.python.org/review/25439/diff/15793/Lib/test/test_urllib.py File Lib/test/test_urllib.py (right): https://bugs.python.org/review/25439/diff/15793/Lib/test/test_urllib.py#newcode1429 Lib/test/test_urllib.py:1429: def test_with_invalid_param_type(self): On 2015/10/20 18:50:13, SilentGhost wrote: > This ...
3 years, 10 months ago #3
ghost.adh_gmail.com
https://bugs.python.org/review/25439/diff/15793/Lib/urllib/request.py File Lib/urllib/request.py (right): https://bugs.python.org/review/25439/diff/15793/Lib/urllib/request.py#newcode375 Lib/urllib/request.py:375: if isinstance(data, str): On 2015/10/20 20:38:17, nanwu wrote: > ...
3 years, 10 months ago #4
nanwu
On 2015/10/20 20:44:03, SilentGhost wrote: > https://bugs.python.org/review/25439/diff/15793/Lib/urllib/request.py > File Lib/urllib/request.py (right): > > https://bugs.python.org/review/25439/diff/15793/Lib/urllib/request.py#newcode375 > ...
3 years, 10 months ago #5
ghost.adh_gmail.com
https://bugs.python.org/review/25439/diff/15800/Lib/urllib/request.py File Lib/urllib/request.py (right): https://bugs.python.org/review/25439/diff/15800/Lib/urllib/request.py#newcode379 Lib/urllib/request.py:379: for k in data.keys(): I would suggest: if any(not ...
3 years, 10 months ago #6
nanwu
On 2015/10/21 11:02:30, SilentGhost wrote: > https://bugs.python.org/review/25439/diff/15800/Lib/urllib/request.py > File Lib/urllib/request.py (right): > > https://bugs.python.org/review/25439/diff/15800/Lib/urllib/request.py#newcode379 > ...
3 years, 10 months ago #7
Martin Panter
http://bugs.python.org/review/25439/diff/15800/Lib/test/test_urllib.py File Lib/test/test_urllib.py (right): http://bugs.python.org/review/25439/diff/15800/Lib/test/test_urllib.py#newcode1436 Lib/test/test_urllib.py:1436: request = Request("http://www.python.org", urllib.parse.urlencode({})) Probably better to eliminate urlencode() ...
3 years, 10 months ago #8
Martin Panter
http://bugs.python.org/review/25439/diff/15800/Lib/urllib/request.py File Lib/urllib/request.py (right): http://bugs.python.org/review/25439/diff/15800/Lib/urllib/request.py#newcode1242 Lib/urllib/request.py:1242: if isinstance(data, str): I was wondering if this check ...
3 years, 10 months ago #9
ghost.adh_gmail.com
https://bugs.python.org/review/25439/diff/15859/Lib/urllib/request.py File Lib/urllib/request.py (right): https://bugs.python.org/review/25439/diff/15859/Lib/urllib/request.py#newcode380 Lib/urllib/request.py:380: raise TypeError("Key should be type of bytes in POST ...
3 years, 9 months ago #10
Martin Panter
https://bugs.python.org/review/25439/diff/15859/Doc/library/urllib.request.rst File Doc/library/urllib.request.rst (right): https://bugs.python.org/review/25439/diff/15859/Doc/library/urllib.request.rst#newcode180 Doc/library/urllib.request.rst:180: data may also be an iterable of :term:`bytes-like object ...
3 years, 9 months ago #11
Martin Panter
3 years, 9 months ago #12
https://bugs.python.org/review/25439/diff/15859/Doc/library/urllib.request.rst
File Doc/library/urllib.request.rst (right):

https://bugs.python.org/review/25439/diff/15859/Doc/library/urllib.request.rs...
Doc/library/urllib.request.rst:180: data may also be an iterable of
:term:`bytes-like object <bytes-like object>`,
On 2015/10/31 23:15:21, vadmium wrote:
> Plural: `bytes-like objects <bytes-like object>`

However I suggest only mentioning bytes until the SSL business is sorted out.
Something like this (based on my more extensive rewording proposed in Issue
23360):

The *data* argument should be a bytes object, or iterable of bytes objects,
specifying additional data to send to the server, or ``None`` if no such data is
needed.  . . .  [At end of paragraph:] If *data* is an iterable of bytes, a
Content-Length value must be specified in *headers*.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+