Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to import a module inside of the project() statement crashes Meson #5134

Closed
Akaricchi opened this issue Mar 22, 2019 · 0 comments · Fixed by #13647 · May be fixed by #13262
Closed

Trying to import a module inside of the project() statement crashes Meson #5134

Akaricchi opened this issue Mar 22, 2019 · 0 comments · Fixed by #13647 · May be fixed by #13262

Comments

@Akaricchi
Copy link
Contributor

I admit this is not a bright idea, but an unhandled exception is still a bug, so I'm reporting it.

project('shaderc', 'cpp',
    version : run_command(import('python').find_installation('python3'), 'meson-tools/get-version.py').stdout().strip(),
    meson_version : '>=0.47.0',
    default_options : [
        'cpp_std=c++11',
    ]
)
The Meson build system
Version: 0.50.999
Source dir: /data/git/shaderc
Build dir: /data/git/shaderc/mbuild
Build type: native build
Traceback (most recent call last):
  File "/data/git/meson/mesonbuild/mesonmain.py", line 122, in run
    return options.run_func(options)
  File "/data/git/meson/mesonbuild/msetup.py", line 245, in run
    app.generate()
  File "/data/git/meson/mesonbuild/msetup.py", line 163, in generate
    self._generate(env)
  File "/data/git/meson/mesonbuild/msetup.py", line 180, in _generate
    intr = interpreter.Interpreter(b)
  File "/data/git/meson/mesonbuild/interpreter.py", line 2042, in __init__
    self.parse_project()
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 392, in parse_project
    self.evaluate_codeblock(self.ast, end=1)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock
    raise e
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement
    return self.function_call(cur)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 753, in function_call
    (posargs, kwargs) = self.reduce_arguments(node.args)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 992, in reduce_arguments
    reduced_kw[key] = self.evaluate_statement(a)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 440, in evaluate_statement
    return self.method_call(cur)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 772, in method_call
    obj = self.evaluate_statement(invokable)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 440, in evaluate_statement
    return self.method_call(cur)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 772, in method_call
    obj = self.evaluate_statement(invokable)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement
    return self.function_call(cur)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 753, in function_call
    (posargs, kwargs) = self.reduce_arguments(node.args)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 986, in reduce_arguments
    reduced_pos = [self.evaluate_statement(arg) for arg in args.arguments]
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 986, in <listcomp>
    reduced_pos = [self.evaluate_statement(arg) for arg in args.arguments]
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 440, in evaluate_statement
    return self.method_call(cur)
  File "/data/git/meson/mesonbuild/interpreterbase.py", line 799, in method_call
    return obj.method_call(method_name, args, kwargs)
  File "/data/git/meson/mesonbuild/interpreter.py", line 1657, in method_call
    project_version=self.interpreter.build.dep_manifest[self.interpreter.active_projectname],
AttributeError: 'Interpreter' object has no attribute 'active_projectname'
amcn added a commit to amcn/meson that referenced this issue Sep 9, 2024
If a user imports a module and invokes a method on it,
a raw Python exception is raised to the user. This commit
adds a check to ensure that in this case an appropriate
exception is raised instead.

A test has been added to ensure that this exception is
in fact raised on offending code.

Fixes: mesonbuild#11393, mesonbuild#5134
eli-schwartz pushed a commit that referenced this issue Sep 15, 2024
If a user imports a module and invokes a method on it,
a raw Python exception is raised to the user. This commit
adds a check to ensure that in this case an appropriate
exception is raised instead.

A test has been added to ensure that this exception is
in fact raised on offending code.

Fixes: #11393, #5134
eli-schwartz pushed a commit that referenced this issue Sep 16, 2024
If a user imports a module and invokes a method on it,
a raw Python exception is raised to the user. This commit
adds a check to ensure that in this case an appropriate
exception is raised instead.

A test has been added to ensure that this exception is
in fact raised on offending code.

Fixes: #11393, #5134
(cherry picked from commit 74dd77e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant