Message6645

Author asmeurer
Recipients amak, asmeurer, fwierzbicki
Date 2011-09-11.20:22:19
SpamBayes Score 3.598133e-10
Marked as misclassified No
Message-id <1315772540.75.0.148438899017.issue1777@psf.upfronthosting.co.za>
In-reply-to
Content
This is not very easy to track down, as it seems to again be caused by some class inheritance stuff.  It might also be caused by some of the strange things that this particular module does with imports (e.g., it's the only module in SymPy that uses __all__ pretty heavily).

So far, all I've figured out is that a better way to reproduce the problem is to call

import sympy.physics.quantum.spin

You need to run this in my jython-slots branch (https://github.com/asmeurer/sympy/tree/jython-slots) because otherwise you will get the original error (btw, you can also browse the code from there).  If you don't know how to use git, the following will get you up and running:

git clone git://github.com/sympy/sympy.git
cd sympy
git remote add asmeurer git://github.com/asmeurer/sympy.git
git fetch asmeurer
git checkout asmeurer/jython-slots

Then you can run jython from that directory and run the above import, and it should reproduce it.

The actual line that causes the problem is shown in the traceback.  But this line is called hundreds of times without any problems (stuff inside of sympy/core is used basically everywhere).  It's just this particular class (JxOp) that causes problems for it.  

I will keep digging to see if I can make a smaller reproducible example. But any advice on what you think might be the problem on your part would be much appreciated.  In particular, I have no idea how to interpret the Java traceback or error message.

Here's the traceback from just running the import (instead of the tests, as I did originally):

>>> import sympy.physics.quantum.spin
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sympy/physics/quantum/__init__.py", line 46, in <module>
    import represent as repmod
  File "sympy/physics/quantum/represent.py", line 21, in <module>
    from sympy.physics.quantum.operatorset import operators_to_state, state_to_operators
  File "sympy/physics/quantum/operatorset.py", line 27, in <module>
    from sympy.physics.quantum.spin import (
  File "sympy/physics/quantum/spin.py", line 871, in <module>
    Jx = JxOp('J')
  File "sympy/physics/quantum/qexpr.py", line 120, in __new__
    inst = Expr.__new__(cls, *args, **{'commutative':False})
  File "sympy/core/basic.py", line 85, in __new__
    obj._init_assumptions(assumptions)
  File "sympy/core/assumptions.py", line 238, in _init_assumptions
    print getattr(self,'_assumptions', None)
java.lang.ArrayIndexOutOfBoundsException: 2
	at org.python.core.PyObjectDerived.getSlot(PyObjectDerived.java:9)
	at org.python.core.PySlot.member_descriptor___get__(PySlot.java:37)
	at org.python.core.PySlot.__get__(PySlot.java:30)
	at org.python.core.PyObject.object___findattr__(PyObject.java:3706)
	at org.python.core.Deriveds.__findattr_ex__(Deriveds.java:42)
	at org.python.core.PyObjectDerived.__findattr_ex__(PyObjectDerived.java:983)
	at org.python.core.__builtin__.getattr(__builtin__.java:620)
	at org.python.core.BuiltinFunctions.__call__(__builtin__.java:208)
	at org.python.core.PyObject.__call__(PyObject.java:426)
	at sympy.core.assumptions$py._init_assumptions$10(sympy/core/assumptions.py:260)
	at sympy.core.assumptions$py.call_function(sympy/core/assumptions.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:149)
	at org.python.core.PyFunction.__call__(PyFunction.java:327)
	at org.python.core.PyMethod.__call__(PyMethod.java:124)
	at sympy.core.basic$py.__new__$3(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.py:89)
	at sympy.core.basic$py.call_function(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
	at org.python.core.PyFunction.function___call__(PyFunction.java:376)
	at org.python.core.PyFunction.__call__(PyFunction.java:371)
	at org.python.core.PyFunction.__call__(PyFunction.java:366)
	at org.python.core.PyObject._callextra(PyObject.java:527)
	at sympy.physics.quantum.qexpr$py.__new__$5(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/physics/quantum/qexpr.py:123)
	at sympy.physics.quantum.qexpr$py.call_function(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/physics/quantum/qexpr.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
	at org.python.core.PyFunction.function___call__(PyFunction.java:376)
	at org.python.core.PyFunction.__call__(PyFunction.java:371)
	at org.python.core.PyFunction.__call__(PyFunction.java:366)
	at org.python.core.PyType.invokeNew(PyType.java:472)
	at org.python.core.PyType.type___call__(PyType.java:1558)
	at org.python.core.PyType$type___call___exposer.__call__(Unknown Source)
	at org.python.core.PyTypeDerived.__call__(PyTypeDerived.java:951)
	at org.python.core.PyObject.__call__(PyObject.java:387)
	at org.python.core.PyObject.__call__(PyObject.java:391)
	at sympy.physics.quantum.spin$py.f$0(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/physics/quantum/spin.py:1456)
	at sympy.physics.quantum.spin$py.call_function(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/physics/quantum/spin.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.imp.createFromCode(imp.java:386)
	at org.python.core.imp.createFromPyClass(imp.java:204)
	at org.python.core.imp.loadFromSource(imp.java:567)
	at org.python.core.imp.find_module(imp.java:473)
	at org.python.core.PyModule.impAttr(PyModule.java:100)
	at org.python.core.imp.import_next(imp.java:715)
	at org.python.core.imp.import_logic(imp.java:777)
	at org.python.core.imp.import_name(imp.java:839)
	at org.python.core.imp.importName(imp.java:884)
	at org.python.core.ImportFunction.__call__(__builtin__.java:1220)
	at org.python.core.PyObject.__call__(PyObject.java:357)
	at org.python.core.__builtin__.__import__(__builtin__.java:1173)
	at org.python.core.imp.importFromAs(imp.java:978)
	at org.python.core.imp.importFrom(imp.java:954)
	at sympy.physics.quantum.operatorset$py.f$0(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/physics/quantum/operatorset.py:275)
	at sympy.physics.quantum.operatorset$py.call_function(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/physics/quantum/operatorset.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.imp.createFromCode(imp.java:386)
	at org.python.core.imp.createFromPyClass(imp.java:204)
	at org.python.core.imp.loadFromSource(imp.java:567)
	at org.python.core.imp.find_module(imp.java:473)
	at org.python.core.PyModule.impAttr(PyModule.java:100)
	at org.python.core.imp.import_next(imp.java:715)
	at org.python.core.imp.import_logic(imp.java:777)
	at org.python.core.imp.import_name(imp.java:839)
	at org.python.core.imp.importName(imp.java:884)
	at org.python.core.ImportFunction.__call__(__builtin__.java:1220)
	at org.python.core.PyObject.__call__(PyObject.java:357)
	at org.python.core.__builtin__.__import__(__builtin__.java:1173)
	at org.python.core.imp.importFromAs(imp.java:978)
	at org.python.core.imp.importFrom(imp.java:954)
	at sympy.physics.quantum.represent$py.f$0(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/physics/quantum/represent.py:486)
	at sympy.physics.quantum.represent$py.call_function(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/physics/quantum/represent.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.imp.createFromCode(imp.java:386)
	at org.python.core.imp.createFromPyClass(imp.java:204)
	at org.python.core.imp.loadFromSource(imp.java:567)
	at org.python.core.imp.find_module(imp.java:473)
	at org.python.core.PyModule.impAttr(PyModule.java:100)
	at org.python.core.imp.import_next(imp.java:715)
	at org.python.core.imp.import_name(imp.java:824)
	at org.python.core.imp.importName(imp.java:884)
	at org.python.core.ImportFunction.__call__(__builtin__.java:1220)
	at org.python.core.PyObject.__call__(PyObject.java:357)
	at org.python.core.__builtin__.__import__(__builtin__.java:1173)
	at org.python.core.imp.importOneAs(imp.java:921)
	at sympy.physics.quantum$py.f$0(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/physics/quantum/__init__.py:60)
	at sympy.physics.quantum$py.call_function(/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/physics/quantum/__init__.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.imp.createFromCode(imp.java:386)
	at org.python.core.imp.createFromPyClass(imp.java:204)
	at org.python.core.imp.loadFromSource(imp.java:567)
	at org.python.core.imp.find_module(imp.java:473)
	at org.python.core.PyModule.impAttr(PyModule.java:100)
	at org.python.core.imp.import_next(imp.java:715)
	at org.python.core.imp.import_logic(imp.java:777)
	at org.python.core.imp.import_name(imp.java:839)
	at org.python.core.imp.importName(imp.java:884)
	at org.python.core.ImportFunction.__call__(__builtin__.java:1220)
	at org.python.core.PyObject.__call__(PyObject.java:357)
	at org.python.core.__builtin__.__import__(__builtin__.java:1173)
	at org.python.core.imp.importOne(imp.java:903)
	at org.python.pycode._pyx23.f$0(<stdin>:1)
	at org.python.pycode._pyx23.call_function(<stdin>)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1261)
	at org.python.core.Py.exec(Py.java:1305)
	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:215)
	at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:89)
	at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:70)
	at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:46)
	at org.python.util.InteractiveConsole.push(InteractiveConsole.java:110)
	at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:90)
	at org.python.util.jython.run(jython.java:317)
	at org.python.util.jython.main(jython.java:129)

java.lang.ArrayIndexOutOfBoundsException: java.lang.ArrayIndexOutOfBoundsException: 2

By the way, at first glance, this appears to me to be a Jython bug.  Would you agree with that?  Or is it common to get Java tracebacks from non-Jython problems?
History
Date User Action Args
2011-09-11 20:22:20asmeurersetmessageid: <1315772540.75.0.148438899017.issue1777@psf.upfronthosting.co.za>
2011-09-11 20:22:20asmeurersetrecipients: + asmeurer, fwierzbicki, amak
2011-09-11 20:22:20asmeurerlinkissue1777 messages
2011-09-11 20:22:19asmeurercreate