[Pyrex] Pyrex idioms and optimizations?

Alexander Belchenko bialix at ukr.net
Thu Jul 26 13:44:34 CEST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

William Stein пишет:
> On 7/25/07, Alexander Belchenko <bialix at ukr.net> wrote:
>> > On 7/25/07, Alexander Belchenko <bialix at ukr.net> wrote:
>> >> No, we can't. Because you package only small part of your repo.
>> >> hg status show 4 files added and all others as unknown.
>> >> It's better if you publish your repo on your server.
>> >>
>> >
>> > Sorry for the confusion but that is the wrong repository.
>> > Thanks for pointing out my mistake (and for your interested
>> > in Cython).  If you download cython-0.9.tar from
>> > http://www.cython.org, then do the following, you'll see
>> > the changelog:
>> >
>> >
>> > $ tar xvf cython-0.9.tar
>> > $ cd cython-0.9/Pyrex
>>
>> Yes, it works fine now. I did not realize that you have two repo in
>> your tar.
>> I works on Windows, so I'd like to see is Cython will working for me or
>> not.
> 
> Please let me know either way.  If it doesn't work, I definitely
> want to know about it.  Thanks for testing it out.

Quick test with MS VS 2003 shows that Cython indeed generate incompatible code:

building 'bzrlib._knit_load_data_c' extension
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX
/DNDEBUG -IG:\Python25\include -IG:
\Python25\PC /Tcbzrlib/_knit_load_data_c.c /Fobuild\temp.win32-2.5\Release\bzrlib/_knit_load_data_c.obj
_knit_load_data_c.c
bzrlib\_knit_load_data_c.c(30) : error C2054: expected '(' to follow 'inline'
bzrlib\_knit_load_data_c.c(30) : error C2085: '__Pyx_PyObject_IsTrue' : not in formal parameter list
bzrlib\_knit_load_data_c.c(30) : error C2143: syntax error : missing ';' before '{'
bzrlib\_knit_load_data_c.c(155) : warning C4013: '__builtin_expect' undefined; assuming extern
returning int
error: command '"d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe"' failed with
exit status 2

Here the lines that cause problems:

line 30:

static inline int __Pyx_PyObject_IsTrue(PyObject* x) {
   if (x == Py_True) return 1;
   else if (x == Py_False) return 0;
   else return PyObject_IsTrue(x);
}

line 155 use macro
#define unlikely(x) __builtin_expect(!!(x), 0)
and __builtin_expect is somewhat gcc-specific, I guess.

I have also gcc-4.1.2-mingw version. It compiles successful but with some warnings:

G:\mingw\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python25\include -IC:\Python25\PC -c
bzrlib/_knit_load_data_c.c -o bu
ild\temp.win32-2.5\Release\bzrlib\_knit_load_data_c.o
bzrlib/_knit_load_data_c.c: In function '__pyx_f_17_knit_load_data_c_string_to_int_safe':
bzrlib/_knit_load_data_c.c:127: warning: statement with no effect
bzrlib/_knit_load_data_c.c: In function '__pyx_f_17_knit_load_data_c_15KnitIndexReader_process_options':
bzrlib/_knit_load_data_c.c:411: warning: statement with no effect
bzrlib/_knit_load_data_c.c: In function
'__pyx_f_17_knit_load_data_c_15KnitIndexReader_process_one_record':
bzrlib/_knit_load_data_c.c:802: warning: statement with no effect
bzrlib/_knit_load_data_c.c: In function
'__pyx_f_17_knit_load_data_c_15KnitIndexReader_process_next_record':
bzrlib/_knit_load_data_c.c:1280: warning: statement with no effect
writing build\temp.win32-2.5\Release\bzrlib\_knit_load_data_c.def
G:\mingw\mingw\bin\gcc.exe -mno-cygwin -shared -s
build\temp.win32-2.5\Release\bzrlib\_knit_load_data_c.o build\temp.win32-2.5\R
elease\bzrlib\_knit_load_data_c.def -LC:\Python25\libs -LC:\Python25\PCBuild -lpython25 -lmsvcr71 -o
bzrlib\_knit_load_data_c.py

[µ]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGqIkizYr338mxwCURAlv9AJ95CUIoabAUSM/H6te1gBkEhmS+KgCfVVlA
ijcYY8I7CQBNMehjw3rDEWg=
=LfXV
-----END PGP SIGNATURE-----



More information about the Pyrex mailing list