This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, vstinner
Date 2017-06-20.16:13:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I tried to be more strict, and I was bitten by tests: test_urllib fails on splittype("data:...") where (...) contains newlines characters. One example:


ERROR: test_read_text_base64 (test.test_urllib.urlopen_DataTests)


Traceback (most recent call last):

  File "/home/travis/build/python/cpython/Lib/test/", line 511, in setUp

    self.image_url_resp = urllib.request.urlopen(self.image_url)

  File "/home/travis/build/python/cpython/Lib/urllib/", line 222, in urlopen

    return, data, timeout)

  File "/home/travis/build/python/cpython/Lib/urllib/", line 510, in open

    req = Request(fullurl, data)

  File "/home/travis/build/python/cpython/Lib/urllib/", line 328, in __init__

    self.full_url = url

  File "/home/travis/build/python/cpython/Lib/urllib/", line 354, in full_url


  File "/home/travis/build/python/cpython/Lib/urllib/", line 383, in _parse

    raise ValueError("unknown url type: %r" % self.full_url)

ValueError: unknown url type: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAIAAAB7\nQOjdAAAAAXNSR0IArs4c6QAAAA9JREFUCNdj%0AYGBg%2BP//PwAGAQL%2BCm8 vHgAAAABJRU5ErkJggg%3D%3D%0A%20'

I modified splittype() to reject newlines before the type, but accept them after the type.
Date User Action Args
2017-06-20 16:13:07vstinnersetrecipients: + vstinner, serhiy.storchaka
2017-06-20 16:13:07vstinnersetmessageid: <>
2017-06-20 16:13:07vstinnerlinkissue30713 messages
2017-06-20 16:13:07vstinnercreate