[Cython] kivy patch for: Cython 0.21 released

Yaroslav Halchenko lists at onerussian.com
Sat Oct 11 17:13:23 CEST 2014


On Sat, 11 Oct 2014, Stefan Behnel wrote:

> Yaroslav Halchenko schrieb am 11.10.2014 um 16:18:
> > On Wed, 10 Sep 2014, Stefan Behnel wrote:
> >> on behalf of the Cython dev team, I'm pleased to announce the release of
> >> Cython 0.21, a major feature release. Thanks everyone who contributed code,
> >> documentation improvements, test feedback, bug reports and/or otherwise
> >> helpful insights for this release.

> > a little change detected while down-stream testing builds in Debian
> > (previous version was 0.20.2 and it built fine)

> >  ------------------------------------------------------------
> >  ...
> >              vertex_format.last_shader = self
> >              for i in xrange(vertex_format.vattr_count):
> >                  attr = &vertex_format.vattr[i]
> >                  if attr.per_vertex == 0:
> >                      continue
> >                  attr.index = glGetAttribLocation(self.program, <char *><bytes>attr.name)
> >                                                                ^
> >  ------------------------------------------------------------

> >  kivy/graphics/shader.pyx:448:63: Casting temporary Python object to non-numeric non-Python type

> Wow, interesting piece of code. What's that even supposed to do?

> Looking up their code, I find that "attr.name" is a char*:

> https://github.com/kivy/kivy/blob/master/kivy/graphics/vertex.pxd

> So the above code creates a temporary Python bytes object by copying data
> from a char*, then gets the char* to the internal object buffer and throws
> the object away, thus deleting its buffer. Then it passes that invalidated
> char* into a function. I can't see how this makes any sense. And I'm happy
> to see that Cython catches this kind of bug now.


> > I wondered if that is an intentional restriction now to restrict such casting
> > only to numeric (and exclude the simplest form -- bytes/chars) or a
> > regression?

> It seems they fixed their code already:

> https://github.com/kivy/kivy/commit/827bd6c7b7d04ec72cb3bdbf0ffcd90630d90008

Gotcha -- THANKS a bunch for a detailed response!

CCing kivy maintainers in Debian -- get ready for upcoming cython 0.21
upload - a little patch to pick up! ;)

-- 
Yaroslav O. Halchenko, Ph.D.
http://neuro.debian.net http://www.pymvpa.org http://www.fail2ban.org
Research Scientist,            Psychological and Brain Sciences Dept.
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        


More information about the cython-devel mailing list