[Python-projects] Crash detected in ASTNG 0.13.1- Proposed patch included.
Sylvain Thénault
sylvain.thenault at logilab.fr
Thu May 3 08:37:55 CEST 2007
On Wednesday 02 May à 16:38, Pierre_Rouleau at ImpathNetworks.com wrote:
> Bonjour Sylvain,
Bonjour Pierre
> I ran into a ASTNG problem when pylinting a module that imports a SWIGged
> module.
>
> I am using:
> pylintw.py 0.13.1,
> astng 0.17.0, common 0.21.2
> Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
>
> The traceback is:
>
> Traceback (most recent call last):
[snip]
> File "c:\python24\lib\site-packages\logilab\astng\manager.py", line 197, in
> astng_from_something
> modname = klass.__module__
> NameError: Unknown C global variable
> imcapserver.py:1: [F0002] logilab.astng._exceptions.ASTNGBuildingException: 1-
> Unable to load module imcapserver (Unknown C global variable)
duh!
> I used the following patch to fix the problem:
>
> --- manager.py 2007-05-02 16:24:28.146250000 -0400
> +++ manager.1.py 2007-05-02 16:23:26.505625000 -0400
> @@ -197,7 +197,11 @@
> modname = klass.__module__
> except AttributeError:
> raise ASTNGBuildingException(
> - 'Unable to get module for object %r' % obj)
> + 'Unable to get module for object %r' % obj)
> + except NameError:
> + raise ASTNGBuildingException(
> + 'Unable to get module for object ??')
> +
> try:
> name = klass.__name__
> except AttributeError:
> @@ -366,3 +370,4 @@
> def __repr__(self):
> return '<Project %r at %s (%s modules)>' % (self.name, id(self),
> len(self.modules))
> +
> ----------------------
>
> I did not really investigate why repr(obj) fails, but the patch appears to fix
> the problem
hum, I think we could even catch bare Exception to avoid such weirdness
when accessing external code. I'll check this in the repository.
> What I did, though is to print obj, and that caused Python itself to crash,
> something I don't see very often!
indeed...
Thanks for the report and the patch, cheers
--
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Python et calcul scientifique: http://www.logilab.fr/science
More information about the Python-Projects
mailing list