diff options
author | cpopa <devnull@localhost> | 2014-04-02 16:50:47 +0300 |
---|---|---|
committer | cpopa <devnull@localhost> | 2014-04-02 16:50:47 +0300 |
commit | 83e9f2f36e51f3c52d20fe0de81a54c9cbc618b1 (patch) | |
tree | dbb8e63d25c5686a6cfd1e2e4a23a6bc1868a197 | |
parent | f0c159849c951d22b56a62515211418359b97bbc (diff) | |
download | astroid-83e9f2f36e51f3c52d20fe0de81a54c9cbc618b1.tar.gz |
Backout changeset.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | raw_building.py | 20 | ||||
-rw-r--r-- | test/unittest_raw_building.py | 24 |
3 files changed, 3 insertions, 47 deletions
@@ -15,11 +15,7 @@ Change log for the astroid package (used to be astng) * Don't crash when inferring nodes from `with` clauses with multiple context managers. Closes #18. - * Add a new YieldFrom node. - - * Fix a false positive with builtin exceptions, - by rewriting the `args` and `message` attributes with - their real values. + * Add a new YieldFrom node. 2013-10-18 -- 1.0.1 * fix py3k/windows installation issue (issue #4) diff --git a/raw_building.py b/raw_building.py index a9185c3..720cdce 100644 --- a/raw_building.py +++ b/raw_building.py @@ -26,7 +26,7 @@ from os.path import abspath from inspect import (getargspec, isdatadescriptor, isfunction, ismethod, ismethoddescriptor, isclass, isbuiltin, ismodule) -from astroid.node_classes import CONST_CLS, Tuple +from astroid.node_classes import CONST_CLS from astroid.nodes import (Module, Class, Const, const_factory, From, Function, EmptyNode, Name, Arguments) from astroid.bases import BUILTINS, Generator @@ -43,21 +43,6 @@ def _io_discrepancy(member): member_self.__name__ == '_io' and member.__module__ == 'io') -def _set_exception_attr(node, member, name): - """ Resolve trouble with dynamic exception attributes, - like `args` or `message`, which are defined in C as - descriptors and set to a real value when an exception - is caught. - """ - if (isdatadescriptor(member) and - hasattr(member, '__objclass__') and - member.__objclass__ is BaseException): - - if name == "args": - node.locals[name] = [Tuple()] - elif name == "message": - node.locals[name] = [Const("")] - def _attach_local_node(parent, node, name): node.name = name # needed by add_local_node parent.add_local_node(node) @@ -190,9 +175,6 @@ def _base_class_object_build(node, member, basenames, name=None, localname=None) basenames, member.__doc__) klass._newstyle = isinstance(member, type) node.add_local_node(klass, localname) - - _set_exception_attr(node, member, name) - try: # limit the instantiation trick since it's too dangerous # (such as infinite test execution...) diff --git a/test/unittest_raw_building.py b/test/unittest_raw_building.py index 8051422..414d8be 100644 --- a/test/unittest_raw_building.py +++ b/test/unittest_raw_building.py @@ -1,10 +1,5 @@ -from textwrap import dedent - from logilab.common.testlib import TestCase, unittest_main from astroid.raw_building import (attach_dummy_node, build_module, build_class, build_function, build_from_import) -from astroid.builder import AstroidBuilder -from astroid.manager import AstroidManager -from astroid.node_classes import Tuple class RawBuildingTC(TestCase): @@ -45,21 +40,4 @@ class RawBuildingTC(TestCase): def test_build_from_import(self): names = ['exceptions, inference, inspector'] node = build_from_import('astroid', names) - self.assertEqual(len(names), len(node.names)) - - def test_exception_dynamic_attr(self): - # Pylint issue 32: e1101-false-positives-for-exception - manager = AstroidManager() - builder = AstroidBuilder(manager) - node = builder.string_build(dedent(""" - try: - x[0] - except IndexError as err: - pass - """)) - handler = node.body[0].handlers[0] - instance = handler.name.infered()[0] - args = instance.getattr('args') - for arg in args: - self.assertIsInstance(arg, Tuple) -
\ No newline at end of file + self.assertEqual(len(names), len(node.names))
\ No newline at end of file |