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

empty list of libraries to link with a target causes gersemi crash #13

Closed
michalkaptur opened this issue Dec 21, 2023 · 0 comments
Closed

Comments

@michalkaptur
Copy link

description

Although technically empty list of libraries to link with a target makes no sense, it's apparently a legal cmake syntax.
gersemi should not crash.

version

gersemi 0.9.4
lark 1.1.8
Python 3.9.18 (main, Oct 24 2023, 14:13:49) 

how to reproduce

$ cat CMakeLists.txt
target_link_libraries(foo)
$ gersemi CMakeLists.txt

outcome

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/tmp/.venv/lib/python3.9/site-packages/gersemi/runner.py", line 126, in run_task
    to_stderr=get_error_message(formatted_file),
  File "/tmp/.venv/lib/python3.9/site-packages/gersemi/result.py", line 36, in get_error_message
    exception, path = astuple(error)
  File "/usr/lib/python3.9/dataclasses.py", line 1140, in astuple
    return _astuple_inner(obj, tuple_factory)
  File "/usr/lib/python3.9/dataclasses.py", line 1147, in _astuple_inner
    value = _astuple_inner(getattr(obj, f.name), tuple_factory)
  File "/usr/lib/python3.9/dataclasses.py", line 1167, in _astuple_inner
    return copy.deepcopy(obj)
  File "/usr/lib/python3.9/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/usr/lib/python3.9/copy.py", line 264, in _reconstruct
    y = func(*args)
TypeError: __init__() missing 2 required positional arguments: 'obj' and 'orig_exc'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/tmp/.venv/bin/gersemi", line 8, in <module>
    sys.exit(main())
  File "/tmp/.venv/lib/python3.9/site-packages/gersemi/__main__.py", line 173, in main
    sys.exit(run(mode, configuration, args.sources))
  File "/tmp/.venv/lib/python3.9/site-packages/gersemi/runner.py", line 189, in run
    results = [
  File "/tmp/.venv/lib/python3.9/site-packages/gersemi/runner.py", line 189, in <listcomp>
    results = [
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 448, in <genexpr>
    return (item for chunk in result for item in chunk)
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 870, in next
    raise value
TypeError: __init__() missing 2 required positional arguments: 'obj' and 'orig_exc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant