Details
-
Type:
RFC
-
Status: Implemented
-
Resolution: Done
-
Component/s: DM
-
Labels:None
Description
In python 3 all integers are 64 bit "long" integers, while in python 2, 32 and 64 bit integers are differentiated by the int and long types respectively. This causes confusion when adding a new field to a schema using addField in afw/table/Base.i in python 3, where the python type is converted into a C++ type using a dictionary
aliases = { |
long: "L", |
int: "I", |
float: "D", |
str: "String", |
futurestr: "String", |
numpy.uint16: "U", |
numpy.int32: "I", |
numpy.int64: "L", |
numpy.float32: "F", |
numpy.float64: "D", |
Angle: "Angle", |
}
|
So in python 3 all integers are truncated to the 32 bits in C++. The user can specify a suffix, for example "L" or "I", which will allow the code to work as expected, so it would be useful to remove the long key from aliases to prevent unexpected behavior in python 3, in other words
aliases = { |
int: "I", |
float: "D", |
str: "String", |
futurestr: "String", |
numpy.uint16: "U", |
numpy.int32: "I", |
numpy.int64: "L", |
numpy.float32: "F", |
numpy.float64: "D", |
Angle: "Angle", |
}
|
All existing code using `type=long` will need to be updated as part of this ticket.
Fair enough, I can do that.