[Cython] Two minor bugs

2013-03-01 Thread Nikita Nemkin
sion.c#L140-142 Interleaving declarations and statements is not allowed in C90... Best Regards, Nikita Nemkin 0001-Fixed-explicit-coercion-of-ctypedef-ed-C-types.patch Description: Binary data ___ cython-devel mailing list cython-devel@python.org http://mail.pyt

[Cython] Py_UNICODE* string support

2013-03-02 Thread Nikita Nemkin
points, like the choice of base type (Py_UNICODE vs wchar_t) or the nature of Py_UNICODE* literals or why this feature is necessary at all. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman

Re: [Cython] Py_UNICODE* string support

2013-03-03 Thread Nikita Nemkin
dling in the future. Believe me, nobody calls Py_UNICODE APIs because they want to, they just have to. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] Py_UNICODE* string support

2013-03-03 Thread Nikita Nemkin
literals. If you are still not convinced, so be it, I'll drop C-level literal support. Best regards, Nikita Nemkin PS. I made a false claim in the previous mail. (Some of) Python's wchar_t APIs do exist in Py2. But they won't manage the memory automatically anyway. __

Re: [Cython] Py_UNICODE* string support

2013-03-04 Thread Nikita Nemkin
lated section, that also warns about the inefficiency in Py3.3, so that users don't accidentally assume it's efficient for anything that needs to be portable. Sure, I'm writing the docs now. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] Cython syntax to pre-allocate lists for performance

2013-03-07 Thread Nikita Nemkin
On Thu, 07 Mar 2013 17:16:10 +0600, Yury V. Zaytsev wrote: Hi, Is there any syntax that I can use to do something like this in Cython: py_object_ = PyList_New(123); ? If not, do you think that this can be added in one way or another? Unfortunately, I can't think of a non-disruptive wa

Re: [Cython] Cython syntax to pre-allocate lists for performance

2013-03-07 Thread Nikita Nemkin
Sorry, accidental early send. Previous mail continued... [None] * N makes an extra pass over the list to assign None to each item (and also incref None n times). This is useless extra work. The larget the list, the worse it gets. Best regards, Nikita Nemkin

[Cython] Minor bug: emitted junk line prevents compilation

2013-03-16 Thread Nikita Nemkin
some .pxd: cdef extern from "Python.h": ctypedef class __builtin__.BaseException [object PyBaseExceptionObject]: pass and cimport it in another .pyx. Best regards, Nikita Nemkin ___ cython-devel mailing list cy

Re: [Cython] Minor bug: emitted junk line prevents compilation

2013-03-16 Thread Nikita Nemkin
* Creating Exception subclasses as cdef classes. It's a hack, but a very useful one. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

[Cython] Minor bun in compile time constant handling

2013-03-18 Thread Nikita Nemkin
=EncodedString(value)) elif isinstance(value, _bytes): return ExprNodes.BytesNode(pos, value=BytesLiteral(value)) Otherwise attempts to use compile-time strings in Python context result in errors like "AttributeError: 'unicode' object has no attribute 'is_unicode'".

Re: [Cython] Bug: Returning real value crashes the code, complex value does not

2013-04-02 Thread Nikita Nemkin
requires a patch to distutils, see http://stackoverflow.com/a/6035864/204882 for details. (You can probably monkey-patch it for production use.) Best regards, Nikita Nemkin On Tue, 26 Mar 2013 15:52:02 +0600, Martin Fiers wrote: Dear Cython developers, I stumbled upon a strange error

Re: [Cython] Add support for the offsetof() C macro

2013-04-03 Thread Nikita Nemkin
lly pasted into the generated code. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] Add support for the offsetof() C macro

2013-04-05 Thread Nikita Nemkin
ase note "(for extern or public structs only)". These are not mangled. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] Shared Cython runtime (was: Upcoming cython/numpy breakage with stride checking)

2013-04-09 Thread Nikita Nemkin
her users of Cython: library bindings, speedups for general purpose modules etc. Another (versioned!) binary dependency will become a liability to them. If memoryviews rely on autogenerated (module-specific) code, how is common runtime supposed to help? The bulk of Cython utility code is also either

Re: [Cython] Shared Cython runtime

2013-04-09 Thread Nikita Nemkin
Name() on Windows, dladdr() on everything else). I'm interested in implementing this feature someday. For now, doing it manually is good enough. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] Shared Cython runtime

2013-04-09 Thread Nikita Nemkin
kily) irrelevant to the Python import system. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] Shared Cython runtime

2013-04-09 Thread Nikita Nemkin
On Wed, 10 Apr 2013 11:24:33 +0600, Stefan Behnel wrote: Nikita Nemkin, 10.04.2013 06:22: The stubs don't have to be shared libraries, pure python would work just fine (and reduce the complexity). Sure. That's actually the most common way to do it. Most C modules in CPython

Re: [Cython] Shared Cython runtime

2013-04-10 Thread Nikita Nemkin
On Wed, 10 Apr 2013 12:57:48 +0600, Stefan Behnel wrote: Nikita Nemkin, 10.04.2013 08:44: Well, here is the workaround Cython can use: https://gist.github.com/nnemkin/5352088 (Warning: I haven't fully tested it yet). Interesting. Looks like that could help here, yes. Do you know

[Cython] bint and autodoc signatures

2013-04-14 Thread Nikita Nemkin
, while int requries something numeric.) Would it be acceptable to change bint display presentation to 'bool' ? Note: other primitive types (short, int, float, long long etc) don't have this problem, because they are all numeric and coerce to/from Python numerics in an obvious

Re: [Cython] [cython] Autodoc improvements (#216)

2013-04-20 Thread Nikita Nemkin
On Sat, 20 Apr 2013 02:11:21 +0600, Stefan Behnel wrote: Nikita Nemkin, 18.04.2013 07:07: 2) Public/readonly cdef attributes can have docstrings attached, using the [PEP 258 attribute docstring syntax](http://www.python.org/dev/peps/pep-0258/#attribute-docstrings). Example: cdef

Re: [Cython] Autodoc improvements (#216)

2013-04-20 Thread Nikita Nemkin
On Sat, 20 Apr 2013 14:27:12 +0600, Stefan Behnel wrote: Nikita Nemkin, 20.04.2013 09:11: On Sat, 20 Apr 2013 02:11:21 +0600, Stefan Behnel wrote: Separating property from the attribute requires mass renaming of the attribute (as was recently descussed here) and bloating the code x4. All

Re: [Cython] Autodoc improvements (#216)

2013-04-20 Thread Nikita Nemkin
On Sat, 20 Apr 2013 17:41:56 +0600, Stefan Behnel wrote: Nikita Nemkin, 20.04.2013 12:43: On Sat, 20 Apr 2013 14:27:12 +0600, Stefan Behnel wrote: I did document them manually at first. It is ugly (function doc in one place, attribute doc in another) As it should be. The attributes are

Re: [Cython] Cython code producing different, incorrect results under Python 2.7 (not 3.x) under Cython 0.19

2013-04-24 Thread Nikita Nemkin
guess that means something is wrong with __Pyx_PyObject_GetSlice utility, although I wasn't able to create a simple repro yet. Best regards, Nikita Nemkin Hi, Josh Warner, 24.04.2013 08:06: Over in scikit-image we have traced an odd problem with a particular Cython file to the 0.19 update

Re: [Cython] Cython code producing different, incorrect results under Python 2.7 (not 3.x) under Cython 0.19

2013-04-24 Thread Nikita Nemkin
On Wed, 24 Apr 2013 13:33:46 +0600, Nikita Nemkin wrote: Update: this is not a Cython bug. _mcp.pyx declares #cython: wraparound=False, any negative index is expected to fail. It worked previously because Cython was using PySequence_GetSlice which of course is not sensitive to Cython directives

Re: [Cython] Autodoc improvements (#216)

2013-04-26 Thread Nikita Nemkin
though the fact that cdef attributes are properties should be considered more of an implementation detail IMHO). I've just found a 4 year old ticket requesting the same feature (2): http://trac.cython.org/cython_trac/ticket/206 Best regards, Nikita Nemkin __

[Cython] A little bugtracker cleanup

2013-04-26 Thread Nikita Nemkin
t/246 http://trac.cython.org/cython_trac/ticket/358 Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] A little bugtracker cleanup

2013-04-26 Thread Nikita Nemkin
ly, but here is the test anyway https://github.com/cython/cython/pull/219 http://trac.cython.org/cython_trac/ticket/113 was fixed here https://github.com/cython/cython/pull/200, tests included. Best regards, Nikita Nemkin ___ cython-devel mailing li

Re: [Cython] any more fixes for 0.19.1 ?

2013-05-04 Thread Nikita Nemkin
s forever). http://trac.cython.org/cython_trac/ticket/775 I'm working on this one and I need an opinion: should utility classes be made internal by default or should they use @cython.internal explicitly? Best regards, Nikita Nemkin ___ cython-devel

Re: [Cython] [cython] Hide Cython utility classes (like memoryview) from Python level module scope. (#222)

2013-05-05 Thread Nikita Nemkin
On Sun, 05 May 2013 17:03:54 +0600, Stefan Behnel wrote: Nikita Nemkin, 04.05.2013 19:52: Two changes included: 1) cdef classes in utility code can have compiler directives attached to them. This is not used anywhere ATM, but memoryviews may benefit from ``@cython.final``. 2) All

[Cython] Compiler crash fix

2013-05-22 Thread Nikita Nemkin
class with errors Makes me wonder if ErrorScope should be introduced to avoid None scope checks. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] How should be C-clobal deletion handled?

2013-05-25 Thread Nikita Nemkin
ion. It would be strange to have global deletion for C++ objects and not for ordinary python objects. There is nothing strange about it. C++ pointers behave differently from Python objects and users are well aware of that. Moreover, C++ deletion is a totally different operation that just happe

[Cython] Exception check optimization

2013-05-26 Thread Nikita Nemkin
7;t bother turning it off and get suboptimal code. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

[Cython] Old style dependency tracking

2013-05-26 Thread Nikita Nemkin
. And cythonize already provides equivalent functionality. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] Core dump when Python is built without debug symbols

2013-05-30 Thread Nikita Nemkin
ython-dev. I think the code you wrote should have never compiled in the first place. cast must be required if you want to reinterpret a C pointer as object or vice versa. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] Exception check optimization

2013-05-30 Thread Nikita Nemkin
On Thu, 30 May 2013 08:25:55 +0600, Robert Bradshaw wrote: On Sun, May 26, 2013 at 10:04 AM, Nikita Nemkin wrote: Hi, I wonder why is __pyx_filename (in exception check blocks) tracked dynamically? AFAIK it's impossible to split function body between multiple files (include only wor

Re: [Cython] Core dump when Python is built without debug symbols

2013-05-30 Thread Nikita Nemkin
interpreted and manipulated as a Python object. It is pure luck that whatever values were there didn't cause a crash. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] C data type and a C function() sharing the same name

2013-06-01 Thread Nikita Nemkin
" (my_jobs *jobs) or the struct: cdef struct my_jobs_t "my_jobs" or both. Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

[Cython] array.array member renaming

2013-06-04 Thread Nikita Nemkin
repetition. What was the reason for ranaming? It would be really nice to reintroduce old names (_i, _d etc). Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] array.array member renaming

2013-06-04 Thread Nikita Nemkin
On Tue, 04 Jun 2013 14:47:47 +0600, Stefan Behnel wrote: Nikita Nemkin, 04.06.2013 10:29: I just wanted to say that this https://github.com/cython/cython/commit/a3ace265e68ad97c24ce2b52d99d45b60b26eda2#L1L73 renaming seems totally unnecessary as it makes any array code verbose and ugly. I

Re: [Cython] array.array member renaming

2013-06-04 Thread Nikita Nemkin
On Tue, 04 Jun 2013 18:27:15 +0600, Stefan Behnel wrote: Nikita Nemkin, 04.06.2013 12:17: On Tue, 04 Jun 2013 14:47:47 +0600, Stefan Behnel wrote: Nikita Nemkin, 04.06.2013 10:29: I just wanted to say that this https://github.com/cython/cython/commit

[Cython] Conditional cast and builtin types

2013-06-07 Thread Nikita Nemkin
Hi, I have just discovered that the following operations do not perform any type checking ("?" is ignored): obj, obj, obj, obj, obj. Can someone please confirm this as a bug? Best regards, Nikita Nemkin ___ cython-devel mailing list cy

[Cython] Feature proposal: conditional cast with None

2013-06-07 Thread Nikita Nemkin
tes unnecessary confusion. Implementation is trivial, all that is necessary is to pass "notnone=False" flag from parser to TypecastNode to PyTypeTestNode. What do you think? Best regards, Nikita Nemkin ___ cython-devel mailing list cython-dev

Re: [Cython] Feature proposal: conditional cast with None

2013-06-07 Thread Nikita Nemkin
On Fri, 07 Jun 2013 19:10:34 +0600, Stefan Behnel wrote: Nikita Nemkin, 07.06.2013 13:24: Currently, conditional casts like obj do not allow None values. This might seem like an inconsistency, because obj does allow None values, just like a normal assignment. However, it's a special

[Cython] Funny idea: interpreted def functions

2013-06-11 Thread Nikita Nemkin
the binary. Together with module bundling and embed/freeze it could make a neat deployment solution. (I have no plans to implement this.) Best regards, Nikita Nemkin ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listi

Re: [Cython] Funny idea: interpreted def functions

2013-06-11 Thread Nikita Nemkin
On Tue, 11 Jun 2013 20:03:45 +0600, Stefan Behnel wrote: Nikita Nemkin, 11.06.2013 13:51: Pure Python functions rarely benefit from compilation. I thought it would be interesting to add an "interpreted" directive (global, module, class, function level + automatic heuristic) that wil

Re: [Cython] Windows Debug build improvement

2013-07-24 Thread Nikita Nemkin
les for the Python release you are using ("program database" links on this page http://www.python.org/getit/releases/2.7.5/) and you will have a comfortable debugging environment. Best regards, Nikita Nemkin ___ cython-devel mailing list cyth

Re: [Cython] Problem with final cdef methods

2013-08-28 Thread Nikita Nemkin
es are incidental to the problem you describe. (Strictly necessary parts are only the lines involving "prev_type"). * There is a disabled bug test named "inherited_final_method", you may want to remove/merge it with the test you modified. I hope this helps. Best regards, Nik

Re: [Cython] Problem with final cdef methods

2013-08-29 Thread Nikita Nemkin
On Thu, 29 Aug 2013 12:57:19 +0600, Stefan Behnel wrote: Nikita Nemkin, 29.08.2013 08:24: I have solved it for myself by storing BOTH types in the method entry (Entry.type for the actual CFuncDef type and Entry.prev_type for the vtable slot type). By using correct types in