Skip to content

urllib2 mangles file://-scheme URLs #52902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dabrahams mannequin opened this issue May 8, 2010 · 5 comments
Closed

urllib2 mangles file://-scheme URLs #52902

dabrahams mannequin opened this issue May 8, 2010 · 5 comments
Assignees
Labels
type-bug An unexpected behavior, bug, or error

Comments

@dabrahams
Copy link
Mannequin

dabrahams mannequin commented May 8, 2010

BPO 8656
Nosy @orsenthil, @dabrahams

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/orsenthil'
closed_at = <Date 2010-05-08.03:32:26.665>
created_at = <Date 2010-05-08.01:45:27.111>
labels = ['type-bug']
title = 'urllib2 mangles file://-scheme URLs'
updated_at = <Date 2010-05-08.05:15:52.695>
user = 'https://github.com/dabrahams'

bugs.python.org fields:

activity = <Date 2010-05-08.05:15:52.695>
actor = 'orsenthil'
assignee = 'orsenthil'
closed = True
closed_date = <Date 2010-05-08.03:32:26.665>
closer = 'orsenthil'
components = []
creation = <Date 2010-05-08.01:45:27.111>
creator = 'dabrahams'
dependencies = []
files = []
hgrepos = []
issue_num = 8656
keywords = []
message_count = 5.0
messages = ['105250', '105255', '105258', '105259', '105263']
nosy_count = 3.0
nosy_names = ['exarkun', 'orsenthil', 'dabrahams']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue8656'
versions = ['Python 2.6']

@dabrahams
Copy link
Mannequin Author

dabrahams mannequin commented May 8, 2010

$ touch /tmp/x.html
$ python -c 'import urllib2;resp=urllib2.urlopen("file:///tmp/x.html");print resp.geturl()'
file:/tmp/x.html

note the missing // after the colon

@orsenthil
Copy link
Member

Fixed in r80953, r80954 , r80955 and r80956.

@orsenthil orsenthil self-assigned this May 8, 2010
@orsenthil orsenthil added the type-bug An unexpected behavior, bug, or error label May 8, 2010
@exarkun
Copy link
Mannequin

exarkun mannequin commented May 8, 2010

Major buildbot failures caused by this change, eg:

ERROR: test_file (test.test_urllib2net.OtherNetworkTests)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/test_urllib2net.py", line 126, in test_file
    self._test_urls(urls, self._extra_handlers(), retry=True)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/test_urllib2net.py", line 175, in _test_urls
    f = urlopen(url, req, TIMEOUT)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/test_urllib2net.py", line 28, in wrapped
    return _retry_thrice(func, exc, *args, **kwargs)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/test_urllib2net.py", line 19, in _retry_thrice
    return func(*args, **kwargs)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/urllib2.py", line 391, in open
    response = self._open(req, data)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/urllib2.py", line 409, in _open
    '_open', req)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/urllib2.py", line 1257, in file_open
    return self.open_local_file(req)
  File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/urllib2.py", line 1291, in open_local_file
    headers, 'file://'+ host + file)
TypeError: cannot concatenate 'str' and 'NoneType' objects

@orsenthil
Copy link
Member

On Sat, May 8, 2010 at 10:04 AM, Jean-Paul Calderone
<[email protected]> wrote:

TypeError: cannot concatenate 'str' and 'NoneType' objects

Okay, I see where the problem is. I shall quickly fix it.

@orsenthil
Copy link
Member

Fixed the change which resulted in Buildbots failure. Those should
turn green now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant