Good news, everyone!

I've been able to play for a bit, however more thorough testing is required.


Turns out on Python side, there was another incompatibility that needed
addressing:

[*] Previously, the division operator (/) would perform integer division if
both operands were integers. That was something we relied upon. Well, no
more with Python 3. Luckily, since Python 2.2 there's the floor division
operator (//) that will still do the correct thing.

[*] More of a concern is another change in SWIGs behaviour, though.
Previously, when calling a wrapped C++ method such as
connect_callback(PyObject *callback, PyObject *args = NULL) on Python side
with only a single argument, args would indeed be NULL. Right now they get
set to Py_None. That in turn leads to issues when actually calling the
callback, since Py_None is not a valid argument tuple. I've not yet figured
out what is causing this change in behaviour. For now I am setting args to
NULL if they come as Py_None, but I am not sure if I fixed all possible
locations yet. The better thing would be to find the root cause and restore
the expected behaviour.


Other than that, my TODO list just keeps growing, as other areas that may
need changes come to mind.
[*] I.e. using the proper directories for configuration and savegames on
Linux systems instead of stuffing everything into ~/.adonthell.

[*] And then, just today, gcc 6.1 was released. A couple days after I
finally got my hands on 5.3 :-(. To make matters worse, it'll enable C++-14
by default, so there definitely will be more changes required. (And I've
yet to try and compile with C++-11 turned on!)


But we'll be getting there eventually. Weekend is near and then there are
some holidays over the next couple weeks as well, so time should be plenty
for once. It's actually a quite fun little project for a change. Just hope
I am not boring you with these little progress updates.

And yes, I should be able to commit the first part of the work this weekend.

Regards,

Kai

P.S: An invaluable resource for the upgrade to Python 3 is
http://python3porting.com/, should somebody ever get into a similar
situation.


On Wed, Apr 27, 2016 at 11:57 AM, Kai Sterker <kai.ster...@gmail.com> wrote:

> Actually, that is an easy one. With SWIG 3.x, integers are no longer
> converted to booleans automatically.
>
> There appears to be a define (SWIG_PYTHON_LEGACY_BOOL) to restore the old
> behaviour, but it might be better to change the Python scripts and use the
> True/False boolean types present since Python 2.2.1.
>
> I don't think limiting us to Python newer than 2.2 in this day and age
> would be big restriction (2.2.1 was released in April 2002).
>
> Tonight will see the beast fully running again (I hope!) :-)
>
> Kai
>
> P.S.: I am also thinking of adding a bit of a version check to the
> configure script, to make sure SWIG and Python are compatible. Here's an
> incomplete list I came across right now. Need to check newer Pythons and
> then the details for the 2.x series, but it's a start:
>
>    swig version:            2.0.3   2.0.4
>
> A. python 2.x                 +       +
> B. python 3.1                 +       +
> C. python 3.2                 -       +
>
>
_______________________________________________
Adonthell-devel mailing list
Adonthell-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/adonthell-devel

Reply via email to