Re: [Cython] [cython-users] Re: Preparing the language level change

2018-09-25 Thread John Ehresman
On 9/25/18 1:24 AM, Stefan Behnel wrote: I started off with "unicode_literals=False", and then renamed it because this name didn't cover the change of "str" to "unicode" (i.e. renaming the usages of the builtin type internally, so that "str(x)" actually calls "unicode(x)"). Looks like this bikes

Re: [Cython] Python callable staticmethods?

2017-09-25 Thread John Ehresman
On 9/25/17 3:32 PM, Stefan Behnel wrote: Am 25. September 2017 20:59:01 MESZ schrieb John Ehresman: Is there a way to define a Python callable staticmethod in a Cython cdef class? Did you try it? Not fully, I'll admit. I found that the following are invalid in a .pxd: cdef clas

[Cython] Python callable staticmethods?

2017-09-25 Thread John Ehresman
Hi, Is there a way to define a Python callable staticmethod in a Cython cdef class? If not, how hard might this be implement? Thanks, John ___ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] Function calls and ref counts

2016-03-19 Thread John Ehresman
On 3/15/16 5:55 PM, Jeroen Demeyer wrote: I cannot reproduce the problem... It might be relevant to mention things like OS and Python version. It may only crash in a pydebug build since freed memory isn't necessarily overwritten right away. I tested with a pydebug build of Python 2.7 on OS

[Cython] Function calls and ref counts

2016-03-15 Thread John Ehresman
Hi, I ran into a bug where a python object was deleted in the middle of a function that was using it because a callback decref'd the one and only reference to the object. This doesn't happen with python bytecode because ref counts of the callable and of all args are essentially incref'd befo

[Cython] Bug in ord(Py_UNICODE) optimization

2011-05-27 Thread John Ehresman
Hi, ord() applied to a Py_UNICODE typed variable seems to yield a 1 character unicode string rather than an integer. The following doctest fails when added to unicodefunction.pyx: def Py_UNICODE_ord(unicode s): """ >>> Py_UNICODE_ord(u' ') 32 """ cdef Py_UNICODE u u =

Re: [Cython] [cython] Initial startswith / endswith optimization (#35)

2011-05-26 Thread John Ehresman
On 5/26/11 3:27 AM, Stefan Behnel wrote: I think this means that the current unicode optimizations aren't used when variables are declared as str and a python 3 runtime is used. Should all unicode optimizations support str eventually? Yes. Well, minus those that are not portable. For example,

Re: [Cython] [cython] Initial startswith / endswith optimization (#35)

2011-05-25 Thread John Ehresman
On 5/25/11 3:51 PM, Robert Bradshaw wrote: I'm glad you're thinking about this question, some explanation of the various string types is at http://wiki.cython.org/enhancements/stringliterals Probably the way to do this is have one optimization for bytes, one for unicode, and then have a third ty

Re: [Cython] Specializing str methods?

2011-05-19 Thread John Ehresman
On 5/19/11 3:35 PM, Stefan Behnel wrote: This is already optimised in Cython/Compiler/Optimize.py ("tailmatch"), basically because it allows different numbers of arguments that need to be dealt with. It may be worth going the same route for "str". The decision usually depends on how complex the c