diff options
author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2011-09-16 09:47:33 +0200 |
---|---|---|
committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2011-09-16 09:47:33 +0200 |
commit | 6e6e182003ad3cff1ac7632f908a8d543148d9c5 (patch) | |
tree | 40a8769dbd31b2a9340332691e83ae205277449e /builder.py | |
parent | 9ff64c05eba629886c4c437731840014ee1f840b (diff) | |
download | astroid-git-6e6e182003ad3cff1ac7632f908a8d543148d9c5.tar.gz |
remove sys.path manipulation around builder.string_build (closes #76159)
That has probably been added in the past as a work around to have relative
import working. Not sure if it's still necessary or not, but that's not
a correct solution anyway, as this may cause pb with some module wrongly
named and added to sys.modules, which may lead to crash (see details
on stack overflow, link on the ticket)
Diffstat (limited to 'builder.py')
-rw-r--r-- | builder.py | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -121,18 +121,14 @@ class ASTNGBuilder(InspectBuilder): raise ASTNGBuildingException(exc) except LookupError, exc: # unknown encoding raise ASTNGBuildingException(exc) - # get module name if necessary, *before modifying sys.path* + # get module name if necessary if modname is None: try: modname = '.'.join(modpath_from_file(path)) except ImportError: modname = splitext(basename(path))[0] # build astng representation - try: - sys.path.insert(0, dirname(path)) # XXX (syt) iirk - node = self.string_build(data, modname, path) - finally: - sys.path.pop(0) + node = self.string_build(data, modname, path) node.file_encoding = encoding node.file_stream = stream return node |