[Python-projects] Problem with ``with`` statement.

Marc 'BlackJack Rintsch marc at rintsch.de
Mon Jul 23 10:15:46 CEST 2007


Hi *,

Versions: Ubuntu 7.04, Python 2.5.1, pylint 0.12.1, astng 0.16.2, 
common 0.21.0

Source:

from __future__ import with_statement

class Test(object):
    def __enter__(self):
        return self
    
    def __exit__(self, type_, value, traceback):
        pass

with Test() as test:
    pass


Pylint output + traceback:

$ pylint test.py
No config file found, using default configuration
************* Module test
C:  1: Missing docstring
C:  4:Test: Missing docstring
R:  4:Test: To few public methods (0/2)
Traceback (most recent call last):
  File "/usr/bin/pylint", line 4, in <module>
    lint.Run(sys.argv[1:])
  File "/usr/lib/python2.5/site-packages/pylint/lint.py", line 847, in 
__init__
    linter.check(args)
  File "/usr/lib/python2.5/site-packages/pylint/lint.py", line 481, in 
check
    self.check_file(filepath, modname, checkers)
  File "/usr/lib/python2.5/site-packages/pylint/lint.py", line 495, in 
check_file
    astng = self._check_file(filepath, modname, checkers)
  File "/usr/lib/python2.5/site-packages/pylint/lint.py", line 519, in 
_check_file
    self.check_astng_module(astng, checkers)
  File "/usr/lib/python2.5/site-packages/pylint/lint.py", line 578, in 
check_astng_module
    if implements(checker, IASTNGChecker)])
  File "/usr/lib/python2.5/site-packages/pylint/lint.py", line 594, in 
astng_events
    self.astng_events(child, checkers, _reversed_checkers)
  File "/usr/lib/python2.5/site-packages/pylint/lint.py", line 594, in 
astng_events
    self.astng_events(child, checkers, _reversed_checkers)
  File "/usr/lib/python2.5/site-packages/pylint/lint.py", line 594, in 
astng_events
    self.astng_events(child, checkers, _reversed_checkers)
  File "/usr/lib/python2.5/site-packages/pylint/lint.py", line 591, in 
astng_events
    checker.visit(astng)
  File "/usr/lib/python2.5/site-packages/logilab/astng/utils.py", line 
85, in visit
    method(node)
  File "/usr/lib/python2.5/site-packages/pylint/checkers/base.py", line 
367, in visit_assname
    ass_type = node.ass_type()
  File "/usr/lib/python2.5/site-packages/logilab/astng/inference.py", 
line 377, in assend_ass_type
    return self.parent.ass_type()
AttributeError: With instance has no attribute 'ass_type'


I wanted to try newer versions of the involved packages but the FTP 
server seems to be down ATM.

Ciao,
	Marc 'BlackJack' Rintsch
-- 
I'm not a complete idiot - several parts are missing.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.logilab.org/pipermail/python-projects/attachments/20070723/a9dd44c8/attachment.pgp 


More information about the Python-Projects mailing list