Issue 28865: [MinGW32-x64]-PyList_Check PyDict_Check does not work (original) (raw)

Created on 2016-12-04 12:14 by mifik, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
PyAPITests.zip mifik,2016-12-04 18:24
Messages (6)
msg282333 - (view) Author: Mikhail (mifik) Date: 2016-12-04 12:14
Windows 10 x64 Python 3.4, 3.5, Anaconda3 4.2 - x64 SWIG 3.0.8, 3.0.10 MinGW32/64 - TDM-GCC-64 5.1.0-2, x86_64-5.3.0-win32-sjlj-rt_v4-rev0, x86_64-6.2.0-win32-sjlj-rt_v5-rev1 The code in C compiles fine, there are no warnings. But then, in the finished module, do not work C-API functions such as: PyList_Check PyDict_Check PyDict_Next PyObject *result = PyList_New(1); printf("%i \n", PyList_Check(result)); Check always returns zero, even if the object is created in the previous line. But PyMapping_Check works fine
msg282334 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-12-04 12:40
Could you please provide a complete C file that is compiled? Output also PyType_GetFlags(Py_TYPE(result)). And check that result is not NULL.
msg282347 - (view) Author: Mikhail (mifik) Date: 2016-12-04 15:18
Project included. building output in the console: running build_ext building '_PyAPITests' extension swigging PyAPITests.i to PyAPITests_wrap.c z:\PortableApps\MyApps\Dev\SWIGWin\swigwin-3.0.10\swig.exe -python -py3 -o PyAPITests_wrap.c PyAPITests.i z:\PortableApps\MyApps\Dev\mingw64\x86_64-6.2.0-win32-sjlj-rt_v5-rev1\mingw64\bin\gcc.exe -mdll -O -Wall -IZ:\PortableApps\MyApps\Dev\Python\Anaconda3\include -IZ:\PortableApps\MyApps\Dev\Python\Anaconda3\include -c PyAPITests_wrap.c -o build\temp.win-amd64-3.5\Release\pyapitests_wrap.o -std=c99 z:\PortableApps\MyApps\Dev\mingw64\x86_64-6.2.0-win32-sjlj-rt_v5-rev1\mingw64\bin\gcc.exe -mdll -O -Wall -IZ:\PortableApps\MyApps\Dev\Python\Anaconda3\include -IZ:\PortableApps\MyApps\Dev\Python\Anaconda3\include -c PyAPITests.c -o build\temp.win-amd64-3.5\Release\pyapitests.o -std=c99 writing build\temp.win-amd64-3.5\Release\_PyAPITests.cp35-win_amd64.def z:\PortableApps\MyApps\Dev\mingw64\x86_64-6.2.0-win32-sjlj-rt_v5-rev1\mingw64\bin\gcc.exe -shared -s build\temp.win-amd64-3.5\Release\pyapitests_wrap.o build\temp.win-amd64-3.5\Release\pyapitests.o build\temp.win-amd64-3.5\Release\_PyAPITests.cp35-win_amd64.def -LZ:\PortableApps\MyApps\Dev\Python\Anaconda3\libs -LZ:\PortableApps\MyApps\Dev\Python\Anaconda3\PCbuild\amd64 -lpython35 -lvcruntime140 -o Z:\Projects\AI\PyAPITests\_PyAPITests.cp35-win_amd64.pyd main output: Start TestIteration: 0 tp_name for List: list tp_name for Dict: dict PyType_GetFlags for List: 34362368 PyType_GetFlags for Dict: 537678848 PyList_Size: 0 PyDict_Size: 0 PyMapping_Check for List: 1 PyMapping_Check for Dict: 1 PyList_Check: 0 PyDict_Check: 0 Iterators test for Dict: End iterators test. ----------------- TestIteration: 1 tp_name for List: list tp_name for Dict: dict PyType_GetFlags for List: 34362368 PyType_GetFlags for Dict: 537678848 PyList_Size: 1 PyDict_Size: 1 PyMapping_Check for List: 1 PyMapping_Check for Dict: 1 PyList_Check: 0 PyDict_Check: 0 Iterators test for Dict: End iterators test. ----------------- TestIteration: 2 tp_name for List: list tp_name for Dict: dict PyType_GetFlags for List: 34362368 PyType_GetFlags for Dict: 537678848 PyList_Size: 2 PyDict_Size: 2 PyMapping_Check for List: 1 PyMapping_Check for Dict: 1 PyList_Check: 0 PyDict_Check: 0 Iterators test for Dict: End iterators test. ----------------- ReturnedResult: 3 End
msg282354 - (view) Author: Mikhail (mifik) Date: 2016-12-04 18:24
I made a small correction to the project. But the essence has not changed. With Microsoft Visual C++ Build Tools everything is fine. But I would like to use the GCC.
msg282356 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-12-04 19:22
Is this the fork of MinGW specially for Python? I didn't think it supported 3.5 yet, because of the different CRT. Also, I can't easily tell right now, but if you're using the libpython35.a that's included with the regular install, you might want to regenerate it. Nobody could agree on what tools should be used to generate it, so I picked one fairly blind and it may not be compatible with your tools (really it should just be regenerated if you want to rely on it, rather than shipping one, but that's where we're currently at).
msg282398 - (view) Author: Mikhail (mifik) Date: 2016-12-05 08:10
SOLVED: I found a solution. It turned out that on the Windows x64 need to use '-DMS_WIN64' compiler option. Three days wasted. And although no one helped me, I felt that mentally you were with me, guys. Thank you! ;)
History
Date User Action Args
2022-04-11 14:58:40 admin set github: 73051
2016-12-05 08:10:43 mifik set status: open -> closedresolution: not a bugmessages: +
2016-12-04 19:22:01 steve.dower set messages: +
2016-12-04 18:24:58 mifik set files: + PyAPITests.zipmessages: +
2016-12-04 18:19:38 mifik set files: - PyAPITests.zip
2016-12-04 15🔞58 mifik set files: + PyAPITests.zipmessages: +
2016-12-04 12:40:33 serhiy.storchaka set nosy: + serhiy.storchakamessages: + versions: - Python 3.4
2016-12-04 12:14:37 mifik create