Respect settings.fast_parser

This commit is contained in:
Takafumi Arakaki
2013-03-12 14:36:15 +01:00
parent c2e9ccda2b
commit 8fc396371c
2 changed files with 6 additions and 2 deletions

View File

@@ -56,7 +56,7 @@ class Script(object):
:type source_encoding: str
"""
def __init__(self, source, line, column, source_path,
source_encoding='utf-8', fast=True):
source_encoding='utf-8', fast=None):
api_classes._clear_caches()
debug.reset_time()
self.source = modules.source_to_unicode(source, source_encoding)

View File

@@ -91,9 +91,13 @@ class ModuleWithCursor(Module):
:param path: The module path of the file or None.
:param position: The position, the user is currently in. Only important \
for the main file.
:param fast: Use `fast_parser.FastParser` or not. If None, respect
`settings.fast_parser`.
"""
def __init__(self, path, source, position, fast=True):
def __init__(self, path, source, position, fast=None):
super(ModuleWithCursor, self).__init__(path, source)
if fast is None:
fast = settings.fast_parser
self._parserclass = fast_parser.FastParser if fast else \
parsing.Parser
self.position = position