Re: [Cython] Cython 0.15 release

2011-07-31 Thread Robert Bradshaw
On Sat, Jul 30, 2011 at 11:35 PM, Vitja Makarov  wrote:
> 2011/7/20 Robert Bradshaw :
>> We're long overdue for a release, and this week would be a good one
>> for me to push one out. Hudson
>> https://sage.math.washington.edu:8091/hudson is looking in pretty good
>> shape, and though I know we've got a big pile of stuff currently in
>> progress, we've also got a big backlog of stuff to get out. I'd like
>> to finish looking at https://github.com/cython/cython/pull/38 , are
>> there any other changes that people want to urgently get in? Also,
>> I've started http://wiki.cython.org/ReleaseNotes-0.15 , feel free to
>> edit if you think anything should be highlighted.
>>
>
> Anybody noticed problem with py3k:
>
> doctest.DocTestCase.Doctest: tp_new.__test__.make_new_untyped (line 132)
>
> It seems that error message have changed in new python version,
> may be it's better to use #doctest: +ELLIPSIS there?

Yes, that'd make sense.
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython 0.15 release candidate

2011-07-31 Thread Robert Bradshaw
On Sat, Jul 30, 2011 at 10:57 AM, Arfrever Frehtes Taifersar Arahesis
 wrote:
> 2011-07-29 23:23:46 Dag Sverre Seljebotn napisał(a):
>> Looks very much like a numpy-on-py3 bug to me.
>
> I have reported:
> http://projects.scipy.org/numpy/ticket/1919
> (NumPy-related tests in Cython pass with Python 3.*, when NumPy has been 
> built with the patch
> from this ticket applied.)

Thanks for looking into this.
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython 0.15 release candidate

2011-07-31 Thread Robert Bradshaw
On Thu, Jul 21, 2011 at 4:14 PM, Robert Bradshaw
 wrote:
> Cython has seen an enormous amount of development since 0.14.1. If you
> are not already using the latest version from the development
> repository, we encourage you to try out the release candidate:
> http://cython.org/release/Cython-0.15rc0.tar.gz

Thanks for all the feedback. Here's another release candidate:
http://cython.org/release/Cython-0.15rc0.tar.gz Unless something major
is found, this is likely to be the release.

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


Re: [Cython] Cython 0.15 release

2011-07-31 Thread Stefan Behnel

Vitja Makarov, 31.07.2011 08:35:

Anybody noticed problem with py3k:

doctest.DocTestCase.Doctest: tp_new.__test__.make_new_untyped (line 132)

It seems that error message have changed in new python version,


That happens from time to time, yes. In case we provide a similar error 
message for optimised cases, it would be good to check if it makes sense to 
adapt it accordingly. Error messages in CPython tend to get better over 
time, so it's sometimes a good idea to follow.




may be it's better to use #doctest: +ELLIPSIS there?


Yes, we already do that in lots of similar places.

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


[Cython] problematic code in C++ pyregr tests

2011-07-31 Thread Stefan Behnel

Hi,

I noticed a couple of problems in the latest pyregr test run for py3k.

https://sage.math.washington.edu:8091/hudson/job/cython-devel-tests-pyregr-py3k-cpp/951/consoleFull

1) test_contextlib.cpp:16926: warning: deprecated conversion from string 
constant to ‘char*’


This repeated warning refers (I assume) to each literal in this code:

"""
char* __pyx_import_star_type_names[] = {
  "__pyx_scope_struct_2_test_contextmanager_finally",
  "__pyx_scope_struct_19_test_contextmanager_as_decorator",
  [...]
  "__pyx_scope_struct_6_test_contextmanager_except",
  "__pyx_scope_struct_12_testWithCondition",
  0
};
"""

This looks like a standard C++ WTF to me. I noticed that Lisandro keeps 
casting string literals in his code, so I wonder if that's something we 
need to do here as well?


2) test_cgi.cpp:2494: error: ‘None’ was not declared in this scope

There seems to be a problem with the dict-loop optimisation. This is how 
the following code gets translated:


"""
 * for k, v in dict(form).items(): # <<

  __Pyx_INCREF(None);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = None;
  __pyx_t_5 = 0;
  __pyx_t_6 = PyDict_Size(__pyx_t_1);
  while (1) {
/* __pyx_t_7 allocated */
/* __pyx_t_8 allocated */
if (unlikely(__pyx_t_6 != PyDict_Size(__pyx_t_1))) {
  PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during 
iteration"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114;

"""

Looks like the literal doesn't get evaluated. I'll look into this.

3) warning: TestClassUtilityCode:18:10: 'cpdef_method' redeclared
warning: TestClassUtilityCode:29:10: 'cpdef_cname_method' redeclared

4) test_pep263.cpp:520: error: redefinition of ‘PyObject* __pyx_kp_b_1’
test_pep263.cpp:519: error: ‘PyObject* __pyx_kp_b_1’ previously declared here
test_pep263.cpp:526: error: redefinition of ‘PyObject* __pyx_kp_b_2’
test_pep263.cpp:525: error: ‘PyObject* __pyx_kp_b_2’ previously declared here

Triggered by this code, which refers to the same byte string literals twice 
in both cases:


"""
 * self.assertEqual( # <<
 * "".encode("utf-8"),
 * b'\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd'
 */
  /* __pyx_t_1 allocated */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__assertEqual); if 
(unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; 
__pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __Pyx_GOTREF(__pyx_t_1);
  /* __pyx_t_2 allocated */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = 
__pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_1));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_b_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_1));
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_1));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_b_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_1));

 * self.assertEqual( # <<
 * "\".encode("utf-8"),
 * b'\\\xd0\x9f'
 */
  /* __pyx_t_3 allocated */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__assertEqual); if 
(unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; 
__pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __Pyx_GOTREF(__pyx_t_3);
  /* __pyx_t_2 allocated */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = 
__pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_b_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_2));
  __Pyx_INCREF(((PyObject *)__pyx_kp_b_2));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_b_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_b_2));
"""

5) there are also several compiler crashes in that log

6) several tests bail out with

"""
File "runtests.py", line 900, in run_test
except (unittest.SkipTest, support.ResourceDenied):
AttributeError: 'module' object has no attribute 'ResourceDenied'
"""

I guess that's an incompatibility of our test runner with the latest Py3k.

7) g++: /.../workspace/BUILD/pyregr/cpp/test_inspect.o: No such file or 
directory

g++: no input files

There are loads of these - not sure what might trigger them.


As I said, I'll look into the dict looping bug. If any of the other bugs is 
obvious to someone and not too hard to fix, it would be nice to get it done 
for the release. However, I think none of them is a real blocker.


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


Re: [Cython] problematic code in C++ pyregr tests

2011-07-31 Thread Vitja Makarov
2011/7/31 Stefan Behnel :
> Hi,
>
> I noticed a couple of problems in the latest pyregr test run for py3k.
>
> https://sage.math.washington.edu:8091/hudson/job/cython-devel-tests-pyregr-py3k-cpp/951/consoleFull
>
> 1) test_contextlib.cpp:16926: warning: deprecated conversion from string
> constant to ‘char*’
>
> This repeated warning refers (I assume) to each literal in this code:
>
> """
> char* __pyx_import_star_type_names[] = {
>  "__pyx_scope_struct_2_test_contextmanager_finally",
>  "__pyx_scope_struct_19_test_contextmanager_as_decorator",
>  [...]
>  "__pyx_scope_struct_6_test_contextmanager_except",
>  "__pyx_scope_struct_12_testWithCondition",
>  0
> };
> """
>
> This looks like a standard C++ WTF to me. I noticed that Lisandro keeps
> casting string literals in his code, so I wonder if that's something we need
> to do here as well?
>

That's really annoying. I was bothering this in CyFunction branch. I
think we should introduce new macro here:

#define __Pyx_STRCONST(x) ((char *) (x))

>
> 6) several tests bail out with
>
> """
> File "runtests.py", line 900, in run_test
>    except (unittest.SkipTest, support.ResourceDenied):
> AttributeError: 'module' object has no attribute 'ResourceDenied'
> """
>
> I guess that's an incompatibility of our test runner with the latest Py3k.
>

That's because latest py3k has test_support module again:

try:
from test import test_support as support
except ImportError: # Py3k
from test import support

Think I should change the order

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


[Cython] Entry.is_arg question

2011-07-31 Thread Vitja Makarov
What is the meaning of Entry.is_arg flag?

For generic python arguments it's set to 0, it makes it very tricky to
determinate whether entry is argument:

https://github.com/cython/cython/blob/master/Cython/Compiler/FlowControl.py#L515

Can we have is_args flag set for all kind of args? And have all the
args inside scope.arg_entries?

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


[Cython] OpenMP problem

2011-07-31 Thread Vitja Makarov
I've tried openmp support with simple example:

from cython.parallel cimport prange

def mul(values):
ret = 1
for i in prange(values):
ret *= i
return ret

And cython crashes:

((b04e040...)) vitja@vitja-laptop:~/work/cython-vitek/zzz$ make mul.so
/usr//bin/python  ../cython.py --gdb -v  mul.pyx -o mul.c
Compiling /home/vitja/work/cython-vitek/zzz/mul.pyx

Error compiling Cython file:

...
from cython.parallel cimport prange

def mul(values):
ret = 1
for i in prange(values):
 ^


mul.pyx:5:26: stop argument must be numeric or a pointer (perhaps if a
numeric literal is too big, use 1000LL)

Error compiling Cython file:

...
from cython.parallel cimport prange

def mul(values):
ret = 1
for i in prange(values):
  ^


mul.pyx:5:19: Compiler crash in AnalyseExpressionsTransform

ModuleNode.body = StatListNode(mul.pyx:1:0)
StatListNode.stats[0] = DefNode(mul.pyx:3:0,
modifiers = [...]/0,
name = u'mul',
num_required_args = 1,
reqd_kw_flags_cname = '0',
used = True)
File 'Nodes.py', line 337, in analyse_expressions: StatListNode(mul.pyx:4:4,
is_terminator = True)
File 'Nodes.py', line 6553, in analyse_expressions:
ParallelRangeNode(mul.pyx:5:19,
assigned_nodes = [...]/1,
is_parallel = True,
is_prange = True,
valid_keyword_arguments = [...]/3)

Compiler crash traceback from this point on:
  File "/home/vitja/work/cython-vitek/Cython/Compiler/Nodes.py", line
6553, in analyse_expressions
self.index_type, node.type)
  File "/home/vitja/work/cython-vitek/Cython/Compiler/PyrexTypes.py",
line 2624, in widest_numeric_type
elif type1.rank < type2.rank:
AttributeError: 'PyObjectType' object has no attribute 'rank'
make: *** [mul.c] Ошибка 1
rm mul.c
((b04e040...)) vitja@vitja-laptop:~/work/cython-vitek/zzz$



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


Re: [Cython] OpenMP problem

2011-07-31 Thread mark florisson
2011/7/31 Vitja Makarov :
> I've tried openmp support with simple example:
>
> from cython.parallel cimport prange
>
> def mul(values):
>    ret = 1
>    for i in prange(values):
>        ret *= i
>    return ret
>
> And cython crashes:
>
> ((b04e040...)) vitja@vitja-laptop:~/work/cython-vitek/zzz$ make mul.so
> /usr//bin/python  ../cython.py --gdb -v  mul.pyx -o mul.c
> Compiling /home/vitja/work/cython-vitek/zzz/mul.pyx
>
> Error compiling Cython file:
> 
> ...
> from cython.parallel cimport prange
>
> def mul(values):
>    ret = 1
>    for i in prange(values):
>                         ^
> 
>
> mul.pyx:5:26: stop argument must be numeric or a pointer (perhaps if a
> numeric literal is too big, use 1000LL)
>
> Error compiling Cython file:
> 
> ...
> from cython.parallel cimport prange
>
> def mul(values):
>    ret = 1
>    for i in prange(values):
>                  ^
> 
>
> mul.pyx:5:19: Compiler crash in AnalyseExpressionsTransform
>
> ModuleNode.body = StatListNode(mul.pyx:1:0)
> StatListNode.stats[0] = DefNode(mul.pyx:3:0,
>    modifiers = [...]/0,
>    name = u'mul',
>    num_required_args = 1,
>    reqd_kw_flags_cname = '0',
>    used = True)
> File 'Nodes.py', line 337, in analyse_expressions: StatListNode(mul.pyx:4:4,
>    is_terminator = True)
> File 'Nodes.py', line 6553, in analyse_expressions:
> ParallelRangeNode(mul.pyx:5:19,
>    assigned_nodes = [...]/1,
>    is_parallel = True,
>    is_prange = True,
>    valid_keyword_arguments = [...]/3)
>
> Compiler crash traceback from this point on:
>  File "/home/vitja/work/cython-vitek/Cython/Compiler/Nodes.py", line
> 6553, in analyse_expressions
>    self.index_type, node.type)
>  File "/home/vitja/work/cython-vitek/Cython/Compiler/PyrexTypes.py",
> line 2624, in widest_numeric_type
>    elif type1.rank < type2.rank:
> AttributeError: 'PyObjectType' object has no attribute 'rank'
> make: *** [mul.c] Ошибка 1
> rm mul.c
> ((b04e040...)) vitja@vitja-laptop:~/work/cython-vitek/zzz$
>
>
>
> --
> vitja.
> ___
> cython-devel mailing list
> cython-devel@python.org
> http://mail.python.org/mailman/listinfo/cython-devel
>

Thanks for the report, I pushed a fix:
https://github.com/cython/cython/commit/e9f9fde70d5d96f418244a0640a63a966a2457c1
. Seems like I forgot an error test for that.
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] OpenMP problem

2011-07-31 Thread mark florisson
On 31 July 2011 21:49, mark florisson  wrote:
> 2011/7/31 Vitja Makarov :
>> I've tried openmp support with simple example:
>>
>> from cython.parallel cimport prange
>>
>> def mul(values):
>>    ret = 1
>>    for i in prange(values):
>>        ret *= i
>>    return ret
>>
>> And cython crashes:
>>
>> ((b04e040...)) vitja@vitja-laptop:~/work/cython-vitek/zzz$ make mul.so
>> /usr//bin/python  ../cython.py --gdb -v  mul.pyx -o mul.c
>> Compiling /home/vitja/work/cython-vitek/zzz/mul.pyx
>>
>> Error compiling Cython file:
>> 
>> ...
>> from cython.parallel cimport prange
>>
>> def mul(values):
>>    ret = 1
>>    for i in prange(values):
>>                         ^
>> 
>>
>> mul.pyx:5:26: stop argument must be numeric or a pointer (perhaps if a
>> numeric literal is too big, use 1000LL)
>>
>> Error compiling Cython file:
>> 
>> ...
>> from cython.parallel cimport prange
>>
>> def mul(values):
>>    ret = 1
>>    for i in prange(values):
>>                  ^
>> 
>>
>> mul.pyx:5:19: Compiler crash in AnalyseExpressionsTransform
>>
>> ModuleNode.body = StatListNode(mul.pyx:1:0)
>> StatListNode.stats[0] = DefNode(mul.pyx:3:0,
>>    modifiers = [...]/0,
>>    name = u'mul',
>>    num_required_args = 1,
>>    reqd_kw_flags_cname = '0',
>>    used = True)
>> File 'Nodes.py', line 337, in analyse_expressions: StatListNode(mul.pyx:4:4,
>>    is_terminator = True)
>> File 'Nodes.py', line 6553, in analyse_expressions:
>> ParallelRangeNode(mul.pyx:5:19,
>>    assigned_nodes = [...]/1,
>>    is_parallel = True,
>>    is_prange = True,
>>    valid_keyword_arguments = [...]/3)
>>
>> Compiler crash traceback from this point on:
>>  File "/home/vitja/work/cython-vitek/Cython/Compiler/Nodes.py", line
>> 6553, in analyse_expressions
>>    self.index_type, node.type)
>>  File "/home/vitja/work/cython-vitek/Cython/Compiler/PyrexTypes.py",
>> line 2624, in widest_numeric_type
>>    elif type1.rank < type2.rank:
>> AttributeError: 'PyObjectType' object has no attribute 'rank'
>> make: *** [mul.c] Ошибка 1
>> rm mul.c
>> ((b04e040...)) vitja@vitja-laptop:~/work/cython-vitek/zzz$
>>
>>
>>
>> --
>> vitja.
>> ___
>> cython-devel mailing list
>> cython-devel@python.org
>> http://mail.python.org/mailman/listinfo/cython-devel
>>
>
> Thanks for the report, I pushed a fix:
> https://github.com/cython/cython/commit/e9f9fde70d5d96f418244a0640a63a966a2457c1
> . Seems like I forgot an error test for that.
>

I pushed it to release, should I rebase master on release now?
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] OpenMP problem

2011-07-31 Thread Dag Sverre Seljebotn
That sounds risky; I think we should consider master as non-rebaseable except 
in emergencies. So fixes should be pushed to release and then merged into 
master. Of course, for something like this with no development depending on it 
one can just delay the merge for a day or two in case more fixes show up.
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

mark florisson  wrote:

On 31 July 2011 21:49, mark florisson  wrote: > 
2011/7/31 Vitja Makarov : >> I've tried openmp support 
with simple example: >> >> from cython.parallel cimport prange >> >> def 
mul(values): >>ret = 1 >>for i in prange(values): >>ret *= i >> 
   return ret >> >> And cython crashes: >> >> ((b04e040...)) 
vitja@vitja-laptop:~/work/cython-vitek/zzz$ make mul.so >> /usr//bin/python  
../cython.py --gdb -v  mul.pyx -o mul.c >> Compiling 
/home/vitja/work/cython-vitek/zzz/mul.pyx >> >> Error compiling Cython file: 
>>_
>> ... >> from cython.parallel cimport prange >> >> def mul(values): >>ret 
>> = 1 >>for i in prange(values): >> ^ 
>> >>_
>> >> mul.pyx:5:26: stop argument must be numeric or a pointer (perhaps if a >> 
>> >> numeric literal is too big, use 1000LL) >> >> Error compiling Cython 
>> >> file: >>_
>> ... >> from cython.parallel cimport prange >> >> def mul(values): >>ret 
>> = 1 >>for i in prange(values): >>  ^ 
>> >>_
>> >> mul.pyx:5:19: Compiler crash in AnalyseExpressionsTransform >> >> 
>> >> ModuleNode.body = StatListNode(mul.pyx:1:0) >> StatListNode.stats[0] = 
>> >> DefNode(mul.pyx:3:0, >>modifiers = [...]/0, >>name = u'mul', >>   
>> >>  num_required_args = 1, >>reqd_kw_flags_cname = '0', >>used = 
>> >> True) >> File 'Nodes.py', line 337, in analyse_expressions: 
>> >> StatListNode(mul.pyx:4:4, >>is_terminator = True) >> File 'Nodes.py', 
>> >> line 6553, in analyse_expressions: >> ParallelRangeNode(mul.pyx:5:19, >>  
>> >>   assigned_nodes = [...]/1, >>is_parallel = True, >>is_prange = 
>> >> True, >>valid_keyword_arguments = [...]/3) >> >> Compiler crash 
>> >> traceback from this point on: >>  File 
>> >> "/home/vitja/work/cython-vitek/Cython/Compiler/Nodes.py", line >> 6553, 
>> >> in analyse_expressions >>self.index_type, node.type) >>  File 
>> >> "/home/vitja/work/cython-vitek/Cython/Compiler/PyrexTypes.py", >> line 
>> >> 2624, in widest_numeric_type >>elif type1.rank < type2.rank: >> 
>> >> AttributeError: 'PyObjectType' object h
 as no
attribute 'rank' >> make: *** [mul.c] Ошибка 1 >> rm mul.c >> ((b04e040...)) 
vitja@vitja-laptop:~/work/cython-vitek/zzz$ >> >> >> >> -- >> vitja. 
>>_
>> cython-devel mailing list >> cython-devel@python.org >> 
>> http://mail.python.org/mailman/listinfo/cython-devel >> > > Thanks for the 
>> report, I pushed a fix: > 
>> https://github.com/cython/cython/commit/e9f9fde70d5d96f418244a0640a63a966a2457c1
>>  > . Seems like I forgot an error test for that. > I pushed it to release, 
>> should I rebase master on release 
>> now?_
cython-devel mailing list cython-devel@python.org 
http://mail.python.org/mailman/listinfo/cython-devel 

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


Re: [Cython] OpenMP problem

2011-07-31 Thread Stefan Behnel

mark florisson, 31.07.2011 22:08:

I pushed it to release, should I rebase master on release now?


Well, so far, the release branch hasn't been used and rc1 was created from 
master. All current changes in master are either considered safe (by me :) 
or just fixes that should go into the release. So I think it's best to just 
rebase your single commit in the current release branch back on the master, 
delete the release branch and recreate it from the tip of the master branch.


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