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

KeyError: 'exception match' #712

Open
antingshen opened this issue Jul 1, 2022 · 2 comments
Open

KeyError: 'exception match' #712

antingshen opened this issue Jul 1, 2022 · 2 comments
Labels
alpha-user bug Something isn't working python 3.8

Comments

@antingshen
Copy link

I run this in a new notebook:

try:
    raise ValueError
except Exception as e:
    pass

and I get this error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/var/folders/w8/wx98k7w1093497fd8l72lwdnj3ln52/T/tmp77h_1vwmlinea_ipython/658d4341-37c6-4ddf-812a-61dd669cd2dd_3.py in <module>
      1 try:
----> 2     raise ValueError
      3 except Exception as e:

ValueError: 

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
/var/folders/w8/wx98k7w1093497fd8l72lwdnj3ln52/T/tmp77h_1vwmlinea_ipython/658d4341-37c6-4ddf-812a-61dd669cd2dd_3.py in <module>
----> 1 try:
      2     raise ValueError
      3 except Exception as e:
      4     pass

~/opt/anaconda3/lib/python3.8/site-packages/lineapy/utils/lineabuiltins.py in l_exec_statement(code)
    162         path = "<unknown>"
    163     bytecode = compile(code, path, "exec")
--> 164     trace_fn = exec_and_record_function_calls(
    165         bytecode, context.global_variables
    166     )

~/opt/anaconda3/lib/python3.8/site-packages/lineapy/system_tracing/exec_and_record_function_calls.py in exec_and_record_function_calls(code, globals_)
     27     try:
     28         settrace(trace_func)
---> 29         exec(code, globals_)
     30     # Always stop tracing even if exception raised
     31     finally:

/var/folders/w8/wx98k7w1093497fd8l72lwdnj3ln52/T/tmp77h_1vwmlinea_ipython/658d4341-37c6-4ddf-812a-61dd669cd2dd_3.py in <module>
      1 try:
      2     raise ValueError
----> 3 except Exception as e:
      4     pass

/var/folders/w8/wx98k7w1093497fd8l72lwdnj3ln52/T/tmp77h_1vwmlinea_ipython/658d4341-37c6-4ddf-812a-61dd669cd2dd_3.py in <module>
      1 try:
      2     raise ValueError
----> 3 except Exception as e:
      4     pass

~/opt/anaconda3/lib/python3.8/site-packages/lineapy/system_tracing/_trace_func.py in __call__(self, frame, event, arg)
    103         if code in self.code_to_return_value_callback:
    104             return_value_callback = self.code_to_return_value_callback[code]
--> 105             function_call = return_value_callback(op_stack, frame.f_lasti)
    106             if isinstance(function_call, FunctionCall):
    107                 self.function_calls.append(function_call)

~/opt/anaconda3/lib/python3.8/site-packages/lineapy/system_tracing/_trace_func.py in <lambda>(post_stack, _)
    649             args.reverse()
    650         return lambda post_stack, _: FunctionCall(
--> 651             COMPARE_OPS[value], args, res=post_stack[-1]
    652         )
    653 

KeyError: 'exception match'

am on version 0.1.4

@antingshen antingshen added alpha-user bug Something isn't working labels Jul 1, 2022
@yifanwu
Copy link
Contributor

yifanwu commented Jul 2, 2022

Thanks for catching the bug Anting! We'll look into it next week and let you know an ETA for the fix!

@LordDarkula
Copy link
Contributor

I could not replicate this issue.

However, when I run

raise ValueError

I get the following.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [3], in <cell line: 2>()
      1 import lineapy.editors.ipython
----> 2 lineapy.editors.ipython._end_cell()

File ~/Workspaces/linea/lineapy/lineapy/editors/ipython.py:172, in _end_cell()
    169 # Write the code text to a file for error reporting
    170 get_cell_path(location).write_text(code)
--> 172 last_node = transform(code, location, STATE.tracer)
    173 if STATE.visualize_display_handle:
    174     STATE.visualize_display_handle.update(
    175         STATE.create_visualize_display_object()
    176     )

File ~/Workspaces/linea/lineapy/lineapy/transformer/transform_code.py:53, in transform(code, location, tracer)
     50 res = None
     51 for trans in transformers:
     52     # print(ast.dump(stmt))
---> 53     res = trans.visit(stmt)
     54     # or some other statement to figure out whether the node is properly processed or not
     55     if res is not None:

File /usr/local/Caskroom/miniconda/base/envs/lineapy9/lib/python3.9/ast.py:407, in NodeVisitor.visit(self, node)
    405 method = 'visit_' + node.__class__.__name__
    406 visitor = getattr(self, method, self.generic_visit)
--> 407 return visitor(node)

File ~/Workspaces/linea/lineapy/lineapy/transformer/node_transformer.py:191, in NodeTransformer.visit_Raise(self, node)
    190 def visit_Raise(self, node: ast.Raise) -> None:
--> 191     return super().visit_Raise(node)

AttributeError: 'super' object has no attribute 'visit_Raise'

This is a pretty ugly error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha-user bug Something isn't working python 3.8
Projects
None yet
Development

No branches or pull requests

4 participants