Bug #1505

GMatrix division operator doesn't work in Python 3

Added by Deil Christoph over 9 years ago. Updated over 7 years ago.

Status:ClosedStart date:07/03/2015
Priority:LowDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:1.3.0
Duration:

Description

This example is broken on Python 3:

$ python gammalib/examples/python/matrix_howto.py 
...

Traceback (most recent call last):
  File "matrix_howto.py", line 181, in <module>
    handle_matrix()
  File "matrix_howto.py", line 90, in handle_matrix
    other_matrix /= 2.0                        # Divide elements by 2
TypeError: unsupported operand type(s) for /=: 'GMatrix' and 'float'

The solution is to add division operators in the Swig Python wrapper for GMatrix.
I tried copying and adapting the methods from GModelSky, but it first didn’t work (same error) and then I got a segfault.
So I’m just reporting the error here.

This needs to be implemented for every class that has division operator, and Python 2 / 3 tests should be added to CI to make sure it works.


Recurrence

No recurrence.

History

#1 Updated by Deil Christoph over 9 years ago

  • Subject changed from Division operator doesn't work in Python 3 to GMatrix division operator doesn't work in Python 3

#2 Updated by Knödlseder Jürgen about 8 years ago

  • Target version set to 1.2.0

#3 Updated by Knödlseder Jürgen over 7 years ago

  • Target version changed from 1.2.0 to 1.3.0

#4 Updated by Knödlseder Jürgen over 7 years ago

  • Status changed from New to Closed
  • Assigned To set to Knödlseder Jürgen
  • % Done changed from 0 to 100

Division operators have been added since a while, but for some reason the issue was kept open. Close now.

Also available in: Atom PDF