Re: [Cython] Cython alpha 0.24

2016-03-19 Thread Joshua


On Friday, March 11, 2016 at 3:24:26 AM UTC-5, Robert Bradshaw wrote:
>
> We are getting ready to push a new major release. A first alpha is up 
> at http://cython.org/release/Cython-0.24a0.tar.gz 
>
> To avoid surprises, please test and report. 
>
> Thanks, 
> Robert 
>


I ran across a compilation error using 0.24a1. It's actually the same error 
that I posted to the list a while back 
(https://groups.google.com/d/msg/cython-users/_ShPVfZAuKA/RxiS0dfRDwAJ), 
but at the time, I didn't have a minimal working example that had been 
extracted from a much more complicated project that I couldn't post 
publicly. 

I now have a minimal demonstration that I've posted here:
https://gist.github.com/synapticarbors/c6268e25ce22e4d04b4d

It fails on both OSX and Windows (using mingw) with traceback:

$ python setup.py build_ext -i
Compiling factors.pyx because it changed.
Compiling xlib.pyx because it changed.
[1/2] Cythonizing factors.pyx
[2/2] Cythonizing xlib.pyx
running build_ext
building 'factors' extension
creating build
creating build/temp.macosx-10.5-x86_64-2.7
gcc -fno-strict-aliasing -I/Users/lev/anaconda/envs/test-cython/include -arch 
x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -I/Users/lev/
anaconda/envs/test-cython/lib/python2.7/site-packages/numpy/core/include -I/
Users/lev/anaconda/envs/test-cython/include/python2.7 -c factors.c -o build/
temp.macosx-10.5-x86_64-2.7/factors.o -O3 -w
gcc -bundle -undefined dynamic_lookup -L/Users/lev/anaconda/envs/test-cython
/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/factors.o -
L/Users/lev/anaconda/envs/test-cython/lib -o /Users/lev/Desktop/av4tmp/
cython-test/factors.so
building 'xlib' extension
gcc -fno-strict-aliasing -I/Users/lev/anaconda/envs/test-cython/include -arch 
x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -I/Users/lev/
anaconda/envs/test-cython/lib/python2.7/site-packages/numpy/core/include -I/
Users/lev/anaconda/envs/test-cython/include/python2.7 -c xlib.c -o build/
temp.macosx-10.5-x86_64-2.7/xlib.o -O3 -w
xlib.c:17371:63: error: too few arguments to function call, expected 3, 
have 1
__pyx_v_7factors_xarr0 = __Pyx_carray_from_py_xarr__type(o); if (
PyErr_Occurred()) __PYX_ERR(1, 13, __pyx_L2_error);
 ~~~  ^
xlib.c:4726:1: note: '__Pyx_carray_from_py_xarr__type' declared here
static int __Pyx_carray_from_py_xarr__type(PyObject *__pyx_v_o, struct 
__pyx_t_15data_structures_xarr_type *__py...
^
xlib.c:20424:13: error: static declaration of '__Pyx_BufFmt_Init' follows 
non-static declaration
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
^
xlib.c:20295:9: note: previous implicit declaration is here
__Pyx_BufFmt_Init(&ctx, stack, dtype);
^
xlib.c:20789:20: error: static declaration of '__Pyx_BufFmt_CheckString' 
follows non-static declaration
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const 
char* ts) {
   ^
xlib.c:20296:14: note: previous implicit declaration is here
if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
 ^
3 errors generated.
error: command 'gcc' failed with exit status 1

It fails similarly with Cython 0.23.4. It compiles without error using 
Cython 0.22.1, which is what I'm using in production. 

It looks like a possible codegen error to me since the function call 
doesn't match the prototype, but it's deep enough in the cython internals 
that I'll defer to a Cython developer.

Any help with this would be very much appreciated.

Thanks,
Josh
 
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython 0.25 alpha0

2016-09-25 Thread Joshua


On Sunday, September 25, 2016 at 12:48:17 AM UTC-4, Robert Bradshaw wrote:
>
> Please download and test the upcoming release of Cython: 
>
> https://github.com/cython/cython/archive/0.25a0.tar.gz 
>
> This is not the final release (more pull requests and bug fixes may 
> still go in) but a lot has changed since the last release so it'd be 
> good to get feedback early. 
>
> https://github.com/cython/cython/blob/master/CHANGES.rst 
>
> Thanks, 
> Robert 
>


I can confirm the BUILD issue on OSX mentioned by Matthew. I ended up 
running `mv BUILD{,.bak}` to get cython to compile. 

Also 0.25a0 still suffers from the regression reported in this issue:
https://github.com/cython/cython/issues/1466

I'd be thrilled if a fix could make it into the 0.25 release since I'm 
effectively stuck at 0.22.1 due to the combination of this bug and another 
regression that was fixed in 0.24. 

Thanks again for all of the hard work the Cython devs put into this project.

Josh 
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython 0.25 beta

2016-10-10 Thread Joshua


On Monday, October 10, 2016 at 3:51:37 PM UTC-4, Robert Bradshaw wrote:
>
> Thanks for all of those to tested the alpha release. I think we've managed 
> to fix all the issues and regressions raised in that thread; here's a beta 
> that's likely to turn into a release candidate. 
>
> https://github.com/cython/cython/archive/0.25b0.zip
>

Hi Robert, 

I just wanted to report that I continue to get the same error reported in 
the following issue in this release:
https://github.com/cython/cython/issues/1466

Thanks,
Josh 
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


[Cython] Bug: Memoryview of struct with adjacent string fields does not detect string boundaries

2014-02-06 Thread Joshua Adelman
This discussion was initially started on the cython user google group, but I 
wanted to move the issue over to the dev list, as per the suggestion on 
cython_trac. 

Given a numpy recarray containing two or more fixed-length string fields, if 
those string fields are adjacent to one another cython does not properly detect 
the boundary between the string fields. A concise test case demonstrating the 
problem is:

```cython
cimport numpy as np

cdef packed struct tstruct:
np.float32_t a
np.int16_t b
char[6] c
char[4] d

def test_struct(tstruct[:] x):
pass
```

We then define some data on the python side:

```python
import numpy as np

a = np.recarray(3, dtype=[('a', np.float32),  ('b', np.int16), ('c', '|S6'), 
('d', '|S4')])
a[0] = (1.1, 1, 'abcde', 'fgh')
a[1] = (2.1, 2, 'ijklm', 'nop')
a[2] = (3.1, 3, 'qrstu', 'vwx')

test_struct(a)
```

This results in the error:

---
ValueError   Traceback (most recent call last)

 in ()
> 1 test_struct(a)

ValueError: Expected a dimension of size 6, got 10


If we swap the order of the fields in the recarray and `tstruct` to (a,c,b,d) 
so that there is a numerical field between the string fields, then the function 
can parse the memory view correctly. 

The relevant line of code that catches the incorrect value of `enc_count` is: 
https://github.com/cython/cython/blob/master/Cython/Utility/Buffer.c#L468 

``` 
if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { 
PyErr_Format(PyExc_ValueError, 
 "Expected a dimension of size %zu, got %zu", 
 ctx->head->field->type->arraysize[0], ctx->enc_count); 
return -1; 
} 
``` 

My naive guess is that there is something going on in: 
https://github.com/cython/cython/blob/master/Cython/Utility/Buffer.c#L738 

since that appears to be the only place where `enc_count` is being incremented. 
That would seem like the place where a boundary between two string fields might 
not be properly handled (the comment in the line above "Continue pooling same 
type" is suggestive.

I'll cross-post this on the cython trac once I have access and will then submit 
a pull request on Github of a test case once I have the trac issue number.

Josh




___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


[Cython] undefined reference to `__Pyx_PyInt_As_unsigned_int error

2014-05-20 Thread Joshua Adelman
Hello all,

I wanted to try to get some traction on this issue that I raised on the 
Cython-user google group list:
https://groups.google.com/forum/#!topic/cython-users/l9wD4w2lcw8

The basic issue is that I get an error of "undefined reference to 
`__Pyx_PyInt_As_unsigned_int". The strange part is I then get non-deterministic 
codegen, wherein the first time I compile the code it fails, but if I delete 
the .c file and try again, it will then compile without errors. A minimal 
example is provided here:
https://gist.github.com/synapticarbors/11060931

This issue seems to have cropped up somewhere between 0.19.2 (where it's fine) 
and 0.20.1. It also is still present in 0.21dev from github. The error seems to 
happen when running on a Windows machine (Windows 2008 server), but I can't 
reproduce the error on Mac OSX (running the same version of the Continuum 
Anaconda distribution).

Any suggestions or confirmation of this issue would be appreciated.

Thanks,
Josh___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel