New submission from Dave Lawrence <mail.dave.lawre...@gmail.com>:
I am calling a python method from C using the attached code. The Site.py file is: import os def find_site(): path = os.path.abspath(".") return path Cross compiled to Windows from Linux using mxe.cc and python 2.7.17 On 32-bit this runs as expected: module = 028BC710 result = 0283D6B0 Found Site at \\wsl$\Ubuntu\home\dl result = 0283D6B0 decref module = 028BC710 decref Site = \\wsl$\Ubuntu\home\dl but crashes on 64-bit, failing to DECREF result: module = 0000000002750408 result = 0000000000E62EF0 Found Site at \\wsl$\Ubuntu\home\dl result = 0000000000E62EF0 decref In both cases the libpython was made using the .dll copied from the target Windows machine and pexports and dlltool to create the .a if the return value of the python is return "C:/Test/Path" it works. if you add test2 = test and return test2 it fails. if you say test2 = "".join(c for c in path) and return test2 it fails. if you set path2 = "C:/Test/Path and return test2 it works using Py_REFCNT [in the C code] shows a value of 2 for a return "c:/test" but a value of 1 a return test ---------- components: Library (Lib), Windows files: py.cc messages: 358033 nosy: Dave Lawrence, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: possible problem with 64-bit mingw DECREF type: crash versions: Python 2.7 Added file: https://bugs.python.org/file48767/py.cc _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39001> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com