Robert Bradshaw | 1 Sep 07:10
Favicon

Re: [Pyrex] Callbacks from threads and PyGILState_Ensure/PyGILState_Release

Thanks. I think it looks pretty good, but I don't do much with the  
GIL so maybe someone with more experience on that end could comment.

I would propose renaming it to withGIL or something like that (or  
dropping the __ at the very least).

- Robert

On Aug 30, 2007, at 10:00 AM, Ulisses Furquim wrote:

> Hi Stefan,
>
> On 8/15/07, Stefan Behnel <stefan_ml@...> wrote:
>> ... interesting stuff should go into Cython as well ...
>>
>> Thanks for the patch, lxml needs this functionality in a couple of  
>> places, so
>> it would be nice to have Cython support for this.
>
> Here is the grabgil patch for Cython (applies cleanly to
> cython-0.9.6.5). Please, tell me what you think of it. Note you have
> to apply it inside the Cython directory as it was generated from
> Mercurial repository.
>
> Regards,
>
> -- Ulisses
> <cython-grabgil.patch>
> _______________________________________________
> Cython-dev mailing list
(Continue reading)

Stefan Behnel | 1 Sep 08:38
Picon
Favicon
Gravatar

Re: [Pyrex] Callbacks from threads and PyGILState_Ensure/PyGILState_Release


Robert Bradshaw wrote:
> Thanks. I think it looks pretty good, but I don't do much with the GIL
> so maybe someone with more experience on that end could comment.

I'll give it a try ASAP. lxml already implements things like this by hand, so
I'll have to rewrite a couple of functions the new way.

> I would propose renaming it to withGIL or something like that (or
> dropping the __ at the very least).

I also like withGIL.

Stefan
Ulisses Furquim | 2 Sep 00:28

Re: [Pyrex] Callbacks from threads and PyGILState_Ensure/PyGILState_Release

On 9/1/07, Stefan Behnel <stefan_ml@...> wrote:
>
> Robert Bradshaw wrote:
> > Thanks. I think it looks pretty good, but I don't do much with the GIL
> > so maybe someone with more experience on that end could comment.
>
> I'll give it a try ASAP. lxml already implements things like this by hand, so
> I'll have to rewrite a couple of functions the new way.

Great! Thanks!

> > I would propose renaming it to withGIL or something like that (or
> > dropping the __ at the very least).
>
> I also like withGIL.

Ok, that can be easily changed. :-)

Regards,

-- Ulisses
Stefan Behnel | 2 Sep 17:06
Picon
Favicon
Gravatar

setuptools special case Pyrex and break Cython

Hi,

in current setuptools, the file setuptools/extension.py checks for Pyrex being
installed and otherwise renames all .pyx file entries to .c. This does not
work when Cython is installed *instead of* Pyrex, as Cython will never be
executed in this case. It just fails saying that the .c file doesn't exist.

I'm currently shipping a fake Pyrex/Distutils/build_ext.py module with lxml to
make it work with both, but I don't even see a major advantage in the
extension.py module at all. It's plain easy to do that yourself in the
setup.py script if (and only if) you want it to build without Pyrex/Cython,
but currently, it is enforced in setuptools. This really only works if the
distributor wants it and does something to make it work, so always enforcing
this behaviour doesn't give you any real advantage.

I'd like to see this module removed from setuptools or at least have Cython
supported in the same way.

Stefan
William Stein | 3 Sep 04:50
Picon
Gravatar

Re: [Pyrex] Pyrex wiki

On 9/2/07, David McNab <david@...> wrote:
> My latest skirmish with Pyrex, and Greg's wonderful solution, have made
> me wonder if now might be a good time to set up a wiki for Pyrex.
>
> Over time, a wiki could evolve into a huge treasure-trove of tips and
> tricks.
>
> Thoughts?

I've created a new Cython / Pyrex wiki at

         http://wiki.cython.org

NOTES:
  (0) I *just* registered wiki.cython.org, so you might have to use
        http://cython.org:9011 for a few hours until the dns gets
        circulated.
  (1) You must create an account to submit content (this is easy).
  (2) This wiki is hosted on a machine I own that is hosted by
        University of Washington; I make backups offsite once per day.
  (3) Both Cython and Pyrex discussion is greatly welcome.

William
William Stein | 3 Sep 04:51
Picon
Gravatar

Fwd: [Bug 136879] Cython doesn't understand ** operator.

Hi Robert,

Maybe you can respond to this about why we disabled ** in some
cases in Cython.  I can't remember exactly why, except it was
in fact a *very* good idea to do so, and helped deal with numerous
bugs we had.

 -- William

---------- Forwarded message ----------
From: arkanes <arkanes@...>
Date: Sep 2, 2007 5:26 PM
Subject: [Bug 136879] Cython doesn't understand ** operator.
To: wstein@...

Public bug reported:

Following minimal file:

cdef int a = 10
a ** 20

Cython will fail to compile with the error:

/home/arkanes/euler.pyx:2:2: Invalid operand types for '**' (int; long)

Casting the int literal to a long gives the same error, just with type (int;int)

Pyrex 0.9.5 can compile this, and uses the c library pow() for the
operation, so this is a regression.
(Continue reading)

William Stein | 3 Sep 04:55
Picon
Gravatar

Fwd: pyrex versus swig versus boost

On 9/2/07, David McNab <david <at> rebirthing.co.nz> wrote:
> Hi,
>
> Does anyone know of any comparisons between pyrex, swig, boost and the
> other wrapper-helpers?
>
> Especially, some insights on which situations favour which wrapping
> approach?

I wrote something a few months ago about this for the SAGE programming
guide, about why Pyrex is by far the best choice *for us* as compared to
the other options.  See section 5.1.2 of the programming guide here:

  http://sagemath.org/doc/html/prog/prog.html

I think SWIG, boost, and Pyrex all have their optimal domains of application.
E.g., SWIG is better if you want to expose an existing library to more
than just Python.   Pyrex is the best when raw speed is absolutely critical,
but working directly in C (against the Python/C API) is too time consuming
and bug prone given the size of the project.

 -- William

--

-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://www.williamstein.org
David McNab | 3 Sep 05:13
Picon
Favicon

Re: Pyrex wiki

On Sun, 2007-09-02 at 19:50 -0700, William Stein wrote:
> I've created a new Cython / Pyrex wiki at
> 
>          http://wiki.cython.org
> 
> NOTES:
>   (0) I *just* registered wiki.cython.org, so you might have to use
>         http://cython.org:9011 for a few hours until the dns gets
>         circulated.
>   (1) You must create an account to submit content (this is easy).
>   (2) This wiki is hosted on a machine I own that is hosted by
>         University of Washington; I make backups offsite once per day.
>   (3) Both Cython and Pyrex discussion is greatly welcome.

Cool bananas! :)

Now all we need is for Greg to link to it from the Pyrex homepage!

Cheers
David
William Stein | 3 Sep 05:18
Picon
Gravatar

Re: Pyrex wiki

On 9/2/07, David McNab <david <at> rebirthing.co.nz> wrote:
> Cool bananas! :)
>
> Now all we need is for Greg to link to it from the Pyrex homepage!

Greg, please do :-)

If you're worried about backups, etc., I'm fine with making a link to
a tarball of the wiki that is updated regularly...

 -- William
William Stein | 3 Sep 05:36
Picon
Gravatar

Re: [Bug 136879] Cython doesn't understand ** operator.

On 9/2/07, Chris Mellon <arkanes@...> wrote:
> Looking at the HG history, it looks like it's because it returns a
> double, and presumably the automatic float/int conversion was a
> problem.
>
> I'm looking at the source right now, but it should be possible to just
> use the C ** operator instead, shouldn't it?

There is no C ** operator.  Maybe you are thinking of FORTRAN,
which does have a ** operator, I think.  To compute a power in C,
one has to use a (library) function, I think.

 -- Wiliam

>
> On 9/2/07, William Stein <wstein@...> wrote:
> > Hi Robert,
> >
> > Maybe you can respond to this about why we disabled ** in some
> > cases in Cython.  I can't remember exactly why, except it was
> > in fact a *very* good idea to do so, and helped deal with numerous
> > bugs we had.
> >
> >  -- William
> >
> > ---------- Forwarded message ----------
> > From: arkanes <arkanes@...>
> > Date: Sep 2, 2007 5:26 PM
> > Subject: [Bug 136879] Cython doesn't understand ** operator.
> > To: wstein@...
(Continue reading)


Gmane