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: UnboundLocalError during test.test_linecache.LineCacheTests
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: r.david.murray Nosy List: flox, ivank, r.david.murray
Priority: low Keywords: patch

Created on 2009-12-03 22:12 by ivank, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue7431.diff flox, 2009-12-03 22:54 Patch, apply to trunk and py3k
Messages (4)
msg95948 - (view) Author: ivank (ivank) Date: 2009-12-03 22:12
Python 2.7, svn r76655.
I ran the tests with
python2.7 Lib/test/testall.py > test-results.txt

test_linecache
test_checkcache (test.test_linecache.LineCacheTests) ... ERROR
test_clearcache (test.test_linecache.LineCacheTests) ... ok
test_getline (test.test_linecache.LineCacheTests) ... ok

======================================================================
ERROR: test_checkcache (test.test_linecache.LineCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/Python-latest/lib/python2.7/test/test_linecache.py", line
121, in test_checkcache
    source.close()
UnboundLocalError: local variable 'source' referenced before assignment

----------------------------------------------------------------------
Ran 3 tests in 0.022s

FAILED (errors=1)
test test_linecache failed -- Traceback (most recent call last):
  File "/opt/Python-latest/lib/python2.7/test/test_linecache.py", line
121, in test_checkcache
    source.close()
UnboundLocalError: local variable 'source' referenced before assignment
msg95949 - (view) Author: ivank (ivank) Date: 2009-12-03 22:18
This error is just masking a Permission denied error during
source = open(source_name, 'w')

so I guess it's not very important, just annoying.
msg95954 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2009-12-03 22:54
Actually it should use the TESTFN filename which is always writable.

Patch attached.
msg95955 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-12-04 00:25
Fixed in r76659, r76660, r76661, and r76662.  I also changed the open to
use 'with' so that errors raised by the open will not be masked.

Flox, given how active you are being, you might enjoy joining us in
#python-dev on freenode.
History
Date User Action Args
2022-04-11 14:56:55adminsetgithub: 51680
2009-12-04 00:25:40r.david.murraysetstatus: open -> closed
resolution: fixed
messages: + msg95955

stage: resolved
2009-12-04 00:05:30r.david.murraysetversions: + Python 2.6, Python 3.1
nosy: + r.david.murray

priority: low
assignee: r.david.murray
components: + Tests, - Library (Lib)
2009-12-03 22:57:13floxsetversions: + Python 3.2
2009-12-03 22:54:40floxsetfiles: + issue7431.diff

nosy: + flox
messages: + msg95954

keywords: + patch
2009-12-03 22:18:04ivanksetmessages: + msg95949
2009-12-03 22:12:24ivankcreate