diff options
author | Aleksandr <[email protected]> | 2022-02-10 16:47:52 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:52 +0300 |
commit | ea6c5b7f172becca389cacaff7d5f45f6adccbe6 (patch) | |
tree | d16cef493ac1e092b4a03ab9437ec06ffe3d188f /contrib/tools/cython/Cython/Compiler/Errors.py | |
parent | 37de222addabbef336dcaaea5f7c7645a629fc6d (diff) |
Restoring authorship annotation for Aleksandr <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Compiler/Errors.py')
-rw-r--r-- | contrib/tools/cython/Cython/Compiler/Errors.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/contrib/tools/cython/Cython/Compiler/Errors.py b/contrib/tools/cython/Cython/Compiler/Errors.py index 9761b52c32f..66fe05487c4 100644 --- a/contrib/tools/cython/Cython/Compiler/Errors.py +++ b/contrib/tools/cython/Cython/Compiler/Errors.py @@ -10,7 +10,7 @@ except ImportError: any_string_type = (bytes, str) import sys -from contextlib import contextmanager +from contextlib import contextmanager from ..Utils import open_new_file from . import DebugFlags @@ -146,8 +146,8 @@ def close_listing_file(): listing_file.close() listing_file = None -def report_error(err, use_stack=True): - if error_stack and use_stack: +def report_error(err, use_stack=True): + if error_stack and use_stack: error_stack[-1].append(err) else: global num_errors @@ -229,34 +229,34 @@ def warn_once(position, message, level=0): error_stack = [] - + def hold_errors(): error_stack.append([]) - + def release_errors(ignore=False): held_errors = error_stack.pop() if not ignore: for err in held_errors: report_error(err) - + def held_errors(): return error_stack[-1] -# same as context manager: - -@contextmanager -def local_errors(ignore=False): - errors = [] - error_stack.append(errors) - try: - yield errors - finally: - release_errors(ignore=ignore) - - +# same as context manager: + +@contextmanager +def local_errors(ignore=False): + errors = [] + error_stack.append(errors) + try: + yield errors + finally: + release_errors(ignore=ignore) + + # this module needs a redesign to support parallel cythonisation, but # for now, the following works at least in sequential compiler runs |