DEF X = 0x1234 raises ValueError in ExprNodes.py

Bug #220108 reported by Jacques Frechet
2
Affects Status Importance Assigned to Milestone
Cython
Fix Committed
Medium
Unassigned

Bug Description

I use Cython 0.9.13.1 to compile source containing a hexadecimal compile-time constant such as this one:

  DEF X = 0x1234

The build fails with the following exception:

  ...
  File "/usr/local/lib/python2.5/site-packages/Cython/Compiler/ExprNodes.py", line 672, in compile_time_value
    return int(self.value)
ValueError: invalid literal for int() with base 10: '0xffff'

I would naively imagine that this could be fixed quite easily by replacing the relevant line in ExprNodes.py with

    return int(self.value, 0)

Hardly seems worth the trouble of attaching a patch, but if you'd like me to do so, just say the word.

Thanks!

Revision history for this message
scoder (scoder) wrote :

Yes, that's probably the right way to do it. Thanks!

Changed in cython:
importance: Undecided → Medium
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.