Re: [Cython] cython tests and py3k hash randomization

2012-02-24 Thread Stefan Behnel
Vitja Makarov, 24.02.2012 06:24:
> 2012/2/24 mark florisson :
>> On 23 February 2012 20:52, Vitja Makarov  wrote:
>>> Recent py3k version has new feature "hash randomization" it solves
>>> some security issues.
>>> But has some drawbacks, for instance, dict.items() order is now
>>> unknown. So it breaks
>>> randomly some doctests that rely on exact order of dict items.
>>>
>>> vitja@mchome:~/python$ ./py3k/bin/python -c  "print({'a':1, 'b':2})"
>>> {'b': 2, 'a': 1}
>>> vitja@mchome:~/python$ ./py3k/bin/python -c  "print({'a':1, 'b':2})"
>>> {'a': 1, 'b': 2}
>>>
>>> As a workaround we can set PYTHONHASHSEED environment variable to zero
>>> for all cyhon-*-tests targets
>>>
>>> This also affects generated code it internally depends on order of
>>> items returned by dict.items()
>>
>> Any code or test that relies on dictionary order is wrong, really. So
>> I assume any pyregr issues will be fixed by the CPython test suite?

Definitely.


>> If there are any such failing tests in Cython we should simply fix them.
> 
> Yes, you're right but I'm not sure how many tests may be broken. I
> don't think we want to fix them before release. Now I've added
> 
> # Disable python hash randomization
> export PYTHONHASHSEED=0
> 
> to cython-devel-tests and it worked.

That should only be a work-around until all tests are fixed, though.


> It's not that easy to fix, here is simple doctest:
> 
> def test_foo():
> """
> >>> test_foo()
> {'a': 1, 'b': 2}
> """
> return {'a': 1, 'b': 2}
> 
> You can't use dicts in doctests anymore there are few options instead:
> 1. Compare sorted items(), e.g. sorted(test_foo().items())
> 2. Inplace compare test_foo() == {...}

I always use 1) because it gives you better test failure output in doctests.

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


Re: [Cython] cython tests and py3k hash randomization

2012-02-24 Thread Vitja Makarov
2012/2/24 Stefan Behnel :
> Vitja Makarov, 24.02.2012 06:24:
>> 2012/2/24 mark florisson :
>>> On 23 February 2012 20:52, Vitja Makarov  wrote:
 Recent py3k version has new feature "hash randomization" it solves
 some security issues.
 But has some drawbacks, for instance, dict.items() order is now
 unknown. So it breaks
 randomly some doctests that rely on exact order of dict items.

 vitja@mchome:~/python$ ./py3k/bin/python -c  "print({'a':1, 'b':2})"
 {'b': 2, 'a': 1}
 vitja@mchome:~/python$ ./py3k/bin/python -c  "print({'a':1, 'b':2})"
 {'a': 1, 'b': 2}

 As a workaround we can set PYTHONHASHSEED environment variable to zero
 for all cyhon-*-tests targets

 This also affects generated code it internally depends on order of
 items returned by dict.items()
>>>
>>> Any code or test that relies on dictionary order is wrong, really. So
>>> I assume any pyregr issues will be fixed by the CPython test suite?
>
> Definitely.
>

Ok, I'll take a look.

>
>>> If there are any such failing tests in Cython we should simply fix them.
>>
>> Yes, you're right but I'm not sure how many tests may be broken. I
>> don't think we want to fix them before release. Now I've added
>>
>> # Disable python hash randomization
>> export PYTHONHASHSEED=0
>>
>> to cython-devel-tests and it worked.
>
> That should only be a work-around until all tests are fixed, though.
>
>
>> It's not that easy to fix, here is simple doctest:
>>
>> def test_foo():
>>     """
>>     >>> test_foo()
>>     {'a': 1, 'b': 2}
>>     """
>>     return {'a': 1, 'b': 2}
>>
>> You can't use dicts in doctests anymore there are few options instead:
>> 1. Compare sorted items(), e.g. sorted(test_foo().items())
>> 2. Inplace compare test_foo() == {...}
>
> I always use 1) because it gives you better test failure output in doctests.
>



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


Re: [Cython] 0.16 release

2012-02-24 Thread Sébastien Sablé Sablé
Hi,

could you please also look at incorporating the following patch before
releasing 0.16? (if it has not already been merged)

https://github.com/cython/cython/pull/67

It has been more or less validated, but a test case is needed.

This patch makes using C++ templates much more convenient with Cython.

Currently I have to use hacks like the following which looks ugly and make
the code less readable:
ctypedef TCacheVarData[float] TCacheVarData_float "TCacheVarData"

Also thank you for all the work done on Cython, I have been using it (and
Pyrex before) intensively  for more than 6 years now, and it makes
integrating Python and C/C++ really convenient.

Thanks in advance

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


Re: [Cython] Broken C-API generation for ext modules

2012-02-24 Thread Stefan Behnel
Lisandro Dalcin, 23.02.2012 22:00:
> The commit below from Stefan broke C-API generation for extension
> modules. The problem is that the code of __Pyx_ImportModule() and
> __Pyx_ImportType() depeds on the #definition of
> __Pyx_PyIdentifier_FromString , and such #define is not emitted in
> C-API headers.
> 
> Stefan, given that __Pyx_PyIdentifier_FromString() is only used in
> __Pyx_ImportModule() and __Pyx_ImportType(), what's your opinion about
> just rolling back your commit?
> 
> 
> commit 500f9a40f5ad441c2c204d076cfc4f82a41d531b
> Author: Stefan Behnel
> Date:   Sat Sep 10 00:14:05 2011 +0200

That's impressively old for a broken feature.


> minor code simplification in utility functions by using macro for
> Py2/3 dependent PyString/PyUnicode_FromString() calls

https://github.com/cython/cython/commit/5a31a3d8d38d9d266886916432f1ebe621a2bc69

I pushed a fix here. Looks like the capi tests didn't detect this, though...

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


Re: [Cython] Broken C-API generation for ext modules

2012-02-24 Thread Lisandro Dalcin
On 24 February 2012 08:00, Stefan Behnel  wrote:
> Lisandro Dalcin, 23.02.2012 22:00:
>> The commit below from Stefan broke C-API generation for extension
>> modules. The problem is that the code of __Pyx_ImportModule() and
>> __Pyx_ImportType() depeds on the #definition of
>> __Pyx_PyIdentifier_FromString , and such #define is not emitted in
>> C-API headers.
>>
>> Stefan, given that __Pyx_PyIdentifier_FromString() is only used in
>> __Pyx_ImportModule() and __Pyx_ImportType(), what's your opinion about
>> just rolling back your commit?
>>
>>
>> commit 500f9a40f5ad441c2c204d076cfc4f82a41d531b
>> Author: Stefan Behnel
>> Date:   Sat Sep 10 00:14:05 2011 +0200
>
> That's impressively old for a broken feature.
>

Indeed. I do not test for this feature on a regular basis in my
projects, and I've been using latest Cython release in production
runs.

>
>>     minor code simplification in utility functions by using macro for
>> Py2/3 dependent PyString/PyUnicode_FromString() calls
>
> https://github.com/cython/cython/commit/5a31a3d8d38d9d266886916432f1ebe621a2bc69
>
> I pushed a fix here. Looks like the capi tests didn't detect this, though...
>

Thanks, I've improved the tests here:
https://github.com/cython/cython/commit/6f343d9c82e611af5e437641583bdb88a926af93

BTW, if you run

$ python runtests.py --no-cleanup module_api

and next look at the generated api header:

$ emacs BUILD/build/module_api/a_api.h

you will notice that there are a lot of blank lines between groups of
declarations and definitions. I guess this originates at
UtilityCodeBase.load_utilities_from_file(), but could not figure out
how to fix it... could you take a look?


-- 
Lisandro Dalcin
---
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] jenkins is down

2012-02-24 Thread Vitja Makarov
Jenkins app is down now. Before it got down it was raising exceptions.

Can some one restart jenkins?

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


Re: [Cython] jenkins is down

2012-02-24 Thread Stefan Behnel
Vitja Makarov, 24.02.2012 17:56:
> Jenkins app is down now. Before it got down it was raising exceptions.

Ah, sorry, should have posted a short message. The machine it's running on
(sage.math) has serious problems at the moment, so Jenkins will be down
until someone over there manages to fix the server.

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


Re: [Cython] jenkins is down

2012-02-24 Thread Stefan Behnel
Stefan Behnel, 24.02.2012 18:11:
> Vitja Makarov, 24.02.2012 17:56:
>> Jenkins app is down now. Before it got down it was raising exceptions.
> 
> Ah, sorry, should have posted a short message. The machine it's running on
> (sage.math) has serious problems at the moment, so Jenkins will be down
> until someone over there manages to fix the server.

Jenkins is up and running again.

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