diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-11-20 11:06:45 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-11-20 14:48:35 -0800 |
commit | cc34b71eaadbf3406c98e7e023540fd3c572d597 (patch) | |
tree | 96d75d48f11cfd57a60645572569f6e7904a750e /mesonbuild/mesonlib.py | |
parent | cef406b3a5d502cde58cdad9fc9b978efb413327 (diff) | |
download | meson-cc34b71eaadbf3406c98e7e023540fd3c572d597.zip meson-cc34b71eaadbf3406c98e7e023540fd3c572d597.tar.gz meson-cc34b71eaadbf3406c98e7e023540fd3c572d597.tar.bz2 |
Allow setting attributes in MesonException intializer
Instead of forcing them to be set afterwards
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 352c5ca..6ebf262 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -70,9 +70,13 @@ meson_command = None class MesonException(Exception): '''Exceptions thrown by Meson''' - file = None # type: T.Optional[str] - lineno = None # type: T.Optional[int] - colno = None # type: T.Optional[int] + def __init__(self, *args: object, file: T.Optional[str] = None, + lineno: T.Optional[int] = None, colno: T.Optional[int] = None): + super().__init__(*args) + self.file = file + self.lineno = lineno + self.colno = colno + class EnvironmentException(MesonException): '''Exceptions thrown while processing and creating the build environment''' |