1. Mike Miller
  2. pytave
  3. Pull requests

Pull requests

#29 Merged
Repository
Deleted repository
Branch
default (0a4f620da178)
Repository
pytave
Branch
default

Convert numeric value to long instead of int to avoid overflow (fixes issue #40)

Author
  1. Abhinav Tripathi
Reviewers
Description
  • python_to_octave.cc: Try conversion of py_object to 'long' instead of 'int'

Comments (6)

  1. Abhinav Tripathi author

    Since long is guaranteed to be at-least 4 bytes (as far as I know), this will not cause overflow.
    I think I read somewhere that on 64 bit machines even int is 4 bytes. But it seems to not be the case. As boost's numeric_cast<> throws the exception.

  2. Mike Miller repo owner

    Merged, slight fixup with ecca6a8. You might have been running your tests in a different order, if some other test does an import sys, then this test would have passed.

    I'm slowly trying to move more code toward the side-effect free __import__ variant, which returns the module as a lvalue rather than assigning it into the main namespace, but that's a separate issue.

    Thanks for fixing this!

    1. Abhinav Tripathi author

      You might have been running your tests in a different order

      Sorry, I generally run tests of pyeval.cc pycall.cc and pyexec.cc together. I should've checked this separately.

      I'm slowly trying to move more code toward the side-effect free import variant, which returns the module as a lvalue

      Sure. I'll use it in new tests.