almostearthling / pyclips

PyCLIPS - a Python module to integrate CLIPS into Python
Other
35 stars 19 forks source link

pyclips-1.1_clips-6.30: Large integer errors with Python for Windows 32 bit #2

Closed gitttt closed 6 years ago

gitttt commented 7 years ago

I outlined here and especially here how I got pyclips-1.1_clips-6.30 to build on Windows 7 64 bit, both with cygwin/gcc and Visual Studio 2008.

However, as written in the two posts linked above, there are errors regarding large integers with the modules I built with cygwin 32 bit and Visual Studio 2008.

The 32bit Version of clips (installed via the official installer) works fine on my Windows 7 64 bit.

How do I install PyCLIPS based on CLIPS 6.30 on Windows 7 64 bit for use with a 32bit Windows Python 2.7 ?

gitttt commented 7 years ago

It seems to work with python interpreters that have a sys.maxint of 9223372036854775807 but not with interpreters that have a sys.maxint of 2147483647. Interestingly, even the 64bit Windows Python has the latter value.

Summary: cygwin Python 64 bit, maxint: 9223372036854775807, no error cygwin Python 32 bit, maxint: 2147483647, error Windows Python 2.7 32 bit, maxint: 2147483647, error Windows Python 2.7 64 bit, maxint: 2147483647, error

gitttt commented 7 years ago

I think I fixed it. See modifications in my fork at https://github.com/gitttt/pyclips/tree/pyclips-1.1_clips-6.30

Comments, reviews etc very welcome!

almostearthling commented 7 years ago

I'll try to see if everything works on Linux, too. Does the fixed version pass the unit tests?

gitttt commented 7 years ago

I think they passed. I ran python ..\testsuite\tests.py and got this result:


Ran 124 tests in 7.103s

OK

[ENVRNMNT8] Environment data not fully deallocated.

[ENVRNMNT8] MemoryAmount = 88.

[ENVRNMNT8] MemoryCalls = 1.

[ENVRNMNT8] Environment data not fully deallocated.

[ENVRNMNT8] MemoryAmount = 88.

[ENVRNMNT8] MemoryCalls = 1.

But as important, the following code does not cause any errors any more:

import clips

clips.Reset()
t0 = clips.BuildTemplate("somestring", """(slot largeint (type INTEGER)) """, "")

f1 = clips.Fact(t0)

f1.Slots['largeint'] = 2147483648  # sys.maxint + 1 on 32bit Python
print f1.Slots['largeint']

But maybe we should add some more tests reading/writing large integers values multi slots (in clips) and lists (in python). What do you think?

almostearthling commented 7 years ago

Of course it would be a good idea: since the CLIPS version I lastly used was written in the pre-64bit era it was not of much concern at the time. I'm pretty concerned about the deallocation errors, though, will comment on it in the other issue.

gitttt commented 6 years ago

I guess we can close this, right? You accepted my pull request if I remember correctly...

almostearthling commented 6 years ago

Of course we can, I'll proceed immediately. Thank you.