Re: [pypy-dev] Python C-API on Windows

2014-02-24 Thread Johan Råde
Thanks Yury, import imp imp.get_suffixes() [('.pypy-22.pyd', 'rb', 3), ('.py', 'U', 1), ('.pyc', 'rb', 2)] That's useful to know. Cheers, Johan On 2014-02-24 14:20, Yury V. Zaytsev wrote: On Mon, 2014-02-24 at 13:50 +0100, Johan Råde wrote: On Windows a dynamic library, by d

Re: [pypy-dev] Python C-API on Windows

2014-02-24 Thread Johan Råde
Thanks Antonio, This solved the problem. Tomorrow I will see if this takes me closer to getting PySide to run under PyPy. Cheers, Johan On 2014-02-24 14:15, Antonio Cuni wrote: Hi Johan, the extension module needs to have an extension like *.pypy-22.pyd: this is to avoid trying to load cpyt

Re: [pypy-dev] Python C-API on Windows

2014-02-24 Thread Yury V. Zaytsev
On Mon, 2014-02-24 at 13:50 +0100, Johan Råde wrote: > > On Windows a dynamic library, by default, has the extension .dll. But > a Python extension module must have the extension .pyd, at least under > CPython. I assumed that the extension should be .pyd under PyPy too. Maybe you can check like

Re: [pypy-dev] Python C-API on Windows

2014-02-24 Thread Antonio Cuni
Hi Johan, the extension module needs to have an extension like *.pypy-22.pyd: this is to avoid trying to load cpython modules by mistake. You should use setup.py+distutils to build your module, so that such details are taken into account automatically. ciao, Anto On Mon, Feb 24, 2014 at 1:50 PM

Re: [pypy-dev] Python C-API on Windows

2014-02-24 Thread Johan Råde
Hi Yury, On Windows a dynamic library, by default, has the extension .dll. But a Python extension module must have the extension .pyd, at least under CPython. I assumed that the extension should be .pyd under PyPy too. For what it is worth, here is a link to the Visual Studio solution I used

Re: [pypy-dev] Python C-API on Windows

2014-02-24 Thread Yury V. Zaytsev
On Mon, 2014-02-24 at 12:11 +0100, Johan Råde wrote: > > Observed behavior with PyPy: > > Traceback (most recent call last): >File "app_main.py", line 72, in run_toplevel >File "C:\Test\test\test.py", line 1, in > import foo > ImportError: No module named foo

[pypy-dev] Python C-API on Windows

2014-02-24 Thread Johan Råde
Is it possible to use the Python C-API with PyPy on Windows? Has it ever been tested? I tried to build and import a simple hello world extension module using the C-API with PyPy on Windows. It fails. You can find the code (and its expected and observed behavior) at the end of this post. One r