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.

classification
Title: urllib.urlopen crashes when used on Mac OS 10.6.1 through a proxy
Type: crash Stage: resolved
Components: macOS Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: jweber, ned.deily, orsenthil, ronaldoussoren
Priority: normal Keywords:

Created on 2009-10-03 03:30 by jweber, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg93473 - (view) Author: (jweber) Date: 2009-10-03 03:30
In Python 2.6.3 on Mac OS 10.6.1, there is a bug in 
lib/python2.6/urllib.py, line 1367. The variable hostIP is used before 
it's defined. You can fix it by adding "hostIP = None" at around line 
1355. I got the following exception when calling urllib.urlopen using a 
proxy:

  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.
py", line 87, in urlopen
    return opener.open(url)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.
py", line 206, in open
    return getattr(self, name)(url)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.
py", line 317, in open_http
    if proxy_bypass(realhost):
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.
py", line 1398, in proxy_bypass
    return proxy_bypass_macosx_sysconf(host)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.
py", line 1367, in proxy_bypass_macosx_sysconf
    if hostIP is None:
UnboundLocalError: local variable 'hostIP' referenced before assignment
msg93474 - (view) Author: (jweber) Date: 2009-10-03 03:39
Let me know if you need me to create a test case....it doesn't seem to 
happen in all situations.
msg94125 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2009-10-16 04:51
See also Issue7149.
msg94129 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-10-16 07:22
I've posted a patch for this in Issue7149.
msg94204 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-10-18 07:11
Fixed in r75482 (trunk) and r75483 (2.6)
History
Date User Action Args
2022-04-11 14:56:53adminsetgithub: 51293
2009-10-18 07:11:02ronaldoussorensetstatus: open -> closed
resolution: fixed
messages: + msg94204

stage: resolved
2009-10-16 07:22:52ronaldoussorensetmessages: + msg94129
2009-10-16 04:53:19orsenthilsetnosy: + orsenthil
2009-10-16 04:51:00ned.deilysetnosy: + ned.deily
messages: + msg94125
2009-10-03 03:39:08jwebersetmessages: + msg93474
2009-10-03 03:30:53jwebercreate