Morten Lied Johansen created THRIFT-2616:
--------------------------------------------

             Summary: Double constant that happens to be a whole number 
(integer) gets converted to int in generated code
                 Key: THRIFT-2616
                 URL: https://issues.apache.org/jira/browse/THRIFT-2616
             Project: Thrift
          Issue Type: Bug
          Components: Python - Compiler
    Affects Versions: 0.9.1
            Reporter: Morten Lied Johansen
            Priority: Minor


In Python, the value you use to initialize a constant determines the type it 
has. When a constant is declared as a double, it should be a double in the 
generated code, even if it happens to be possible to represent it as an int.

Example:
{code}
const double RADIUS = 15.0;
{code}

will generate the following Python:
{code}
RADIUS = 15
{code}

it should have generated this:
{code}
RADIUS = 15.0
{code}

Most of the time this is not going to be a problem, but every now and then you 
get some wrong results when doing math with different types.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to