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

AssertionError: Failed at object (analyzing bytecode) #2296

Closed
ebonat opened this issue Feb 26, 2017 · 3 comments
Closed

AssertionError: Failed at object (analyzing bytecode) #2296

ebonat opened this issue Feb 26, 2017 · 3 comments

Comments

@ebonat
Copy link

ebonat commented Feb 26, 2017

Hi,

I run the sample code from the site as:

@jit
def sum2(two_dimensional_array):    
    result = 0.0
    J, I = two_dimensional_array.shape    
    for i in range(J):
        for j in range(I):
            result += two_dimensional_array[i,j]    
    return result

When I add the try-catch error handling as:

@jit
def sum1(two_dimensional_array):
    result = 0.0
    try:
        J, I = two_dimensional_array.shape    
        for i in range(J):
            for j in range(I):
                result += two_dimensional_array[i,j]    
    except Exception:
        pass
    return result

I got an error as:

  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\dispatcher.py", line 287, in _compile_for_args
    return self.compile(tuple(argtypes))
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\dispatcher.py", line 555, in compile
    cres = self._compiler.compile(args, return_type)
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\dispatcher.py", line 81, in compile
    flags=flags, locals=self.locals)
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\compiler.py", line 699, in compile_extra
    return pipeline.compile_extra(func)
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\compiler.py", line 352, in compile_extra
    return self._compile_bytecode()
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\compiler.py", line 660, in _compile_bytecode
    return self._compile_core()
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\compiler.py", line 647, in _compile_core
    res = pm.run(self.status)
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\compiler.py", line 238, in run
    raise patched_exception
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\compiler.py", line 230, in run
    stage()
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\compiler.py", line 366, in stage_analyze_bytecode
    func_ir = translate_stage(self.func_id, self.bc)
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\compiler.py", line 762, in translate_stage
    return interp.interpret(bytecode)
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\interpreter.py", line 91, in interpret
    self.cfa.run()
  File "C:\Users\Ernest\AppData\Local\Continuum\lib\site-packages\numba\controlflow.py", line 515, in run
    assert not inst.is_jump, inst
AssertionError: Failed at object (analyzing bytecode)
SETUP_EXCEPT(arg=85, lineno=14)

Any help?

Thank you!

@sklam
Copy link
Member

sklam commented Feb 27, 2017

Try-catch is not supported.

@ebonat
Copy link
Author

ebonat commented Feb 27, 2017

In this case, we can't use it at this time. Very bad for Python programmers!

@sklam
Copy link
Member

sklam commented Feb 28, 2017

Exceptions can still be raised and they get propagated all the way up. You can still catch them in the non-jit function.

Our current focus is in high-performance numeric code, such code rarely needs to catch exceptions. On the other hand, the catch semantic can affect the optimizations, disabling auto-vectorization and other aggressive loop transformation.

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

3 participants