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

Catch-all exception handlers break Ctrl+C #5

Open
cpitclaudel opened this issue Mar 6, 2020 · 0 comments
Open

Catch-all exception handlers break Ctrl+C #5

cpitclaudel opened this issue Mar 6, 2020 · 0 comments

Comments

@cpitclaudel
Copy link
Contributor

This block:

                try:
                    # try to call collection_set()
                    obj.collection_set(value)
                except:
                    raise TypeError("Item '%s' can not be set" % name)

and this one:

            try:
                obj.collection_set(value)
            except:
                raise TypeError("Item '%s' can not be set" % name)

cause issues with keyboard interrupts:

Traceback (most recent call last):
  File "/build/pyverilator/pyverilator/pyverilator.py", line 187, in __setattr__
    obj.collection_set(value)
  File "/build/pyverilator/pyverilator/pyverilator.py", line 326, in collection_set
    self.write(value)
  File "/build/pyverilator/pyverilator/pyverilator.py", line 323, in write
    self.write_function_and_args[0](*self.write_function_and_args[1:], value)
  File "/build/pyverilator/pyverilator/pyverilator.py", line 652, in _write_32
    self._post_write_hook(port_name, value)
  File "/build/pyverilator/pyverilator/pyverilator.py", line 670, in _post_write_hook
    self.eval()
  File "/build/pyverilator/pyverilator/pyverilator.py", line 707, in eval
    fn.argtypes = [ctypes.c_void_p]
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "_objects/rv32.v/rvcore.pyverilator.py", line 125, in <module>
    main()
  File "_objects/rv32.v/rvcore.pyverilator.py", line 122, in main
    sim.run(args.ncycles)
  File "_objects/rv32.v/rvcore.pyverilator.py", line 88, in run
    self.tick()
  File "_objects/rv32.v/rvcore.pyverilator.py", line 49, in tick
    self.sim.io.CLK = 1
  File "/build/pyverilator/pyverilator/pyverilator.py", line 189, in __setattr__
    raise TypeError("Item '%s' can not be set" % name)
TypeError: Item 'CLK' can not be set

Could these except: be change to catch a specific error, instead of any exception? Maybe the Signal class should have a generic collection_get that throws an error that Input would override

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