Issue #1 resolved

pyind example crashes on Windows

Anonymous created an issue

The pyind example crashes with

object.Error: Access Violation

Unfortunately OPTLINK does not work with the -g option so I had to add some console output to Pyd to find out where it crashes. It seems that py_init() is the problem; more specifically the block

foreach(action; after_py_init_deferred_actions) {
    action();
}

I added a

writeln(action.funcptr);

and found out that the function in question (according to the map file) is shared static this() in make_object.d. I tried Python 2.7 and 3.2 with DMD v2.060. The 3.2 version crashes in py_init() in the version(Python_3_0_Or_Later) block.

Any suggestions?

Comments (8)

  1. ariovistus repo owner

    Thanks for the drill down.

    The problem is the linker is not linking to PyType_Type (and everything else declared like it) properly. I may have a good deal of work cut out for me.

    In the meantime, if you really want to play with pyd, 49e3a9f is the latest commit that does not exhibit this particular bug [because it uses the old headers].

    Sorry bout that.

  2. volatilevoid

    It's working now! :-)

    I'd just change the pyind example like this:

        py_stmts(q"<
    y = Y()
    y.brain_status = "HURTS"
    print("MY BRAIN %s" % y.brain_status)
    print(y.resolution)
    >","office");
    

    That way, Python 3 is not complaining about bad syntax because print is a function now.

  3. Log in to comment