floodlight/loxigen

Error when trying to generate code

ederlf opened this issue · 5 comments

When I try to generate code, c or python, with make command, the following error appears:

Traceback (most recent call last):
  File "/usr/lib/python2.7/pdb.py", line 1314, in main
      pdb._runscript(mainpyfile)
  File "/usr/lib/python2.7/pdb.py", line 1233, in _runscript
      self.run(statement)
  File "/usr/lib/python2.7/bdb.py", line 387, in run
       exec cmd in globals, locals
  File "<string>", line 1, in <module>
  File "loxigen.py", line 70, in <module>
  """
  File "loxigen.py", line 459, in read_input
      of_g.identifiers, of_g.identifiers_by_group)
  File "loxi_front_end/identifiers.py", line 41, in add_identifier
      assert(isinstance(value, int))

Executing with the pdb debugger, I found that the error comes from trying to assert the long number 0xffffffff.

In loxi_front_end/identifiers.py, I changed the line 41

- assert(isinstance(value, int))
+ assert(isinstance(value, (int,long)))

And the code was generated. Is that the right workout?

Regards,
Eder.

Thanks for the error report. What platform are you running on? I haven't
seen this before and have used Python 2.7 on Mac and Linux.

-Dan

On Wed, Apr 24, 2013 at 10:43 AM, Eder Leão Fernandes <
notifications@github.com> wrote:

When I try to generate code, c or python, with make command, the following
error appears:

Traceback (most recent call last):
File "/usr/lib/python2.7/pdb.py", line 1314, in main
pdb._runscript(mainpyfile)
File "/usr/lib/python2.7/pdb.py", line 1233, in _runscript
self.run(statement)
File "/usr/lib/python2.7/bdb.py", line 387, in run
exec cmd in globals, locals
File "", line 1, in
File "loxigen.py", line 70, in
"""
File "loxigen.py", line 459, in read_input
of_g.identifiers, of_g.identifiers_by_group)
File "loxi_front_end/identifiers.py", line 41, in add_identifier
assert(isinstance(value, int))

Executing with the pdb debugger, I found that the error comes from trying
to assert the long number 0xffffffff.

In loxi_front_end/identifiers.py, I changed the line 41

  • assert(isinstance(value, int))
  • assert(isinstance(value, (int,long)))

And the code was generated. Is that the right workout?

Regards,
Eder.


Reply to this email directly or view it on GitHubhttps://github.com//issues/5
.

I'm running on Linux (Ubuntu 12.4) and using Python 2.7 also.

The error appeared to me after a git pull to get the most recent code. (The last commit was the one of the initial commits, adding authors - commit 2803a8f).

I think this is a difference between 32 and 64 bit Python. type(0xffffffff) == int on my usual 64-bit VM, but it's long on a 32-bit VM.

I think the fix is correct. Eder, would you like to send in a pull request or should I apply it directly?

Rich, you are right. My system is a 32 bits one. I forked the code (ease any possible future contribution :] ) and committed the change. I will submit the pull request now.

I merged the fix, thanks!