diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-07-15 12:09:54 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-07-15 12:09:54 +0200 |
| commit | bae9b9ea7997efec0a8b9a68e43cc110125e40a8 (patch) | |
| tree | 27f7f39c06485602088faa8842be6e566c0b2ba8 | |
| parent | e52afd688f1caa22ee722b971a2846083e4fbc2f (diff) | |
Detect recursive 'source' earlier
Off-by-one error, though still functional. The recursive source is now
detected immediately as the file is source'd the second time.
Also remove an outdated comment re. KconfigError.
| -rw-r--r-- | kconfiglib.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index c6a51f9..b96bd19 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1483,10 +1483,11 @@ class Kconfig(object): # Jumps to the beginning of a sourced Kconfig file, saving the previous # position and file object + self._filestack.append((self._file, self._filename, self._linenr)) + # Check for recursive 'source' for _, name, _ in self._filestack: if name == filename: - # KconfigParseError might have been a better name, but too late raise KconfigError( "\n{}:{}: Recursive 'source' of '{}' detected. Check that " "environment variables are set correctly.\n" @@ -1496,7 +1497,6 @@ class Kconfig(object): for _, name, linenr in reversed(self._filestack)))) - self._filestack.append((self._file, self._filename, self._linenr)) try: self._file = self._open(filename) except IOError as e: |
