bastibe/lunatic-python — pull request #24 by mp-pbn (2014-01-29 09:31:06+00:00)
Title: Fix python int number conversion

Conversion from python int to lua number doesn't work for python code in
lua in case of python 2.7

The error can easily be reproduced via the following code:

import lua
script='i = python.eval("int(2)")\n' \
'print(type(i))'
lua.execute(script)

It is a regression introduced in commit ba53e14b7047a "Ported Lunatic to
Python 3.3.", because in python2.7 there are distinct types for int and
long in python.

The commit mentioned above removed the PyInt_check code, which is correct
for python 3.x code. In python2.7 this is still needed, otherwise a python
int is converted to userdata in lua.

This commit reintroduces the necessary PyInt_Check to ensure an int is
correctly converted to lua number and makes it conditional on the python
major version.