Re: [Cython] (no subject)

2012-12-10 Thread Yaroslav Halchenko

On Wed, 05 Dec 2012, Yaroslav Halchenko wrote:


> On Wed, 05 Dec 2012, mark florisson wrote:
> > > Thanks, I merged it.

> > It'd be nice if you could add this as a testcase in the tests/run
> > directory as a "don't segfault" kind of test.

> I would be happy to extend the test battery but my blunt attempt failed,
> i.e. the test doesn't cause the failure:

> (git)novo:~deb/cython[remotes/upstream/master~1]git
> $> rm -rf ~/.pyxbld ; python-dbg ./runtests.py -v -v weakfail; cat 
> tests/run/weakfail.pyx 
> Python 2.7.3 (default, Sep  9 2012, 17:05:18) 
>
> [GCC 4.7.1]

> Running tests against Cython 0.18-pre 73895001642d4531d32cac5ad2499f4ed5f3b286
> Backends: c,cpp

> runTest (__main__.CythonRunTestCase)
> compiling (c) and running weakfail ... test_weakref (line 8) 
> (weakfail.__test__)
> Doctest: weakfail.__test__.test_weakref (line 8) ... ok
> runTest (__main__.CythonRunTestCase)
> compiling (cpp) and running weakfail ... test_weakref (line 8) 
> (weakfail.__test__)
> Doctest: weakfail.__test__.test_weakref (line 8) ... ok

> --
> Ran 4 tests in 2.015s

> OK
> ALL DONE
> [193903 refs]
> import weakref

> foo_dict = weakref.WeakValueDictionary()

> cdef class Foo:
> cdef object __weakref__

> def test_weakref(key):
> """
> >>> _ = test_weakref(48)
> """
> obj = Foo()
> foo_dict[key] = obj
> return obj


> whenever if I do it manually then -- yeap:

> (git)novo:~deb/cython[remotes/upstream/master~1]tests/run
> $> rm -rf ~/.pyxbld ; PYTHONPATH=../../ python-dbg -c 'import pyximport as 
> pi; pi.install(); import weakfail; s=weakfail.test_weakref(42)'
> python-dbg: ../Modules/gcmodule.c:366: visit_decref: Assertion 
> `gc->gc.gc_refs != 0' failed.
> [1]5508 abort  PYTHONPATH=../../ python-dbg -c 

> so  how to make it 'effective'?

no hints from the experts? ;)
-- 
Yaroslav O. Halchenko
Postdoctoral Fellow,   Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834   Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] (no subject)

2012-12-10 Thread Stefan Behnel
Yaroslav Halchenko, 10.12.2012 14:55:
> On Wed, 05 Dec 2012, Yaroslav Halchenko wrote:
>> On Wed, 05 Dec 2012, mark florisson wrote:
 Thanks, I merged it.
> 
>>> It'd be nice if you could add this as a testcase in the tests/run
>>> directory as a "don't segfault" kind of test.
> 
>> I would be happy to extend the test battery but my blunt attempt failed,
>> i.e. the test doesn't cause the failure:
> 
>> (git)novo:~deb/cython[remotes/upstream/master~1]git
>> $> rm -rf ~/.pyxbld ; python-dbg ./runtests.py -v -v weakfail; cat 
>> tests/run/weakfail.pyx 
>> Python 2.7.3 (default, Sep  9 2012, 17:05:18)
>> 
>> [GCC 4.7.1]
> 
>> Running tests against Cython 0.18-pre 
>> 73895001642d4531d32cac5ad2499f4ed5f3b286
>> Backends: c,cpp
> 
>> runTest (__main__.CythonRunTestCase)
>> compiling (c) and running weakfail ... test_weakref (line 8) 
>> (weakfail.__test__)
>> Doctest: weakfail.__test__.test_weakref (line 8) ... ok
>> runTest (__main__.CythonRunTestCase)
>> compiling (cpp) and running weakfail ... test_weakref (line 8) 
>> (weakfail.__test__)
>> Doctest: weakfail.__test__.test_weakref (line 8) ... ok
> 
>> --
>> Ran 4 tests in 2.015s
> 
>> OK
>> ALL DONE
>> [193903 refs]
>> import weakref
> 
>> foo_dict = weakref.WeakValueDictionary()
> 
>> cdef class Foo:
>> cdef object __weakref__
> 
>> def test_weakref(key):
>> """
>> >>> _ = test_weakref(48)
>> """
>> obj = Foo()
>> foo_dict[key] = obj
>> return obj
> 
> 
>> whenever if I do it manually then -- yeap:
> 
>> (git)novo:~deb/cython[remotes/upstream/master~1]tests/run
>> $> rm -rf ~/.pyxbld ; PYTHONPATH=../../ python-dbg -c 'import pyximport as 
>> pi; pi.install(); import weakfail; s=weakfail.test_weakref(42)'
>> python-dbg: ../Modules/gcmodule.c:366: visit_decref: Assertion 
>> `gc->gc.gc_refs != 0' failed.
>> [1]5508 abort  PYTHONPATH=../../ python-dbg -c 
> 
>> so  how to make it 'effective'?
> 
> no hints from the experts? ;)

Usually, running gc.collect() after this kind of test (i.e. as part of the
doctest) is a good way to provoke a crash in time.

Stefan

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


Re: [Cython] (no subject)

2012-12-10 Thread Yaroslav Halchenko

On Mon, 10 Dec 2012, Stefan Behnel wrote:

> >> so  how to make it 'effective'?

> > no hints from the experts? ;)

> Usually, running gc.collect() after this kind of test (i.e. as part of the
> doctest) is a good way to provoke a crash in time.

wasn't it obvious ? ;-) Thanks!

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

-- 
Yaroslav O. Halchenko
Postdoctoral Fellow,   Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834   Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] unused function '__pyx_pw_5numpy_7ndarray_1__getbuffer__'

2012-12-10 Thread Bradley M. Froehle
I've been noticing some unused function warnings of the following variety:

test.cpp:1189:12: warning: unused function
> '__pyx_pw_5numpy_7ndarray_1__getbuffer__' [-Wunused-function]
> static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self,
> Py_buffer *__pyx_v_info, int __pyx_v_flags) {
>^
> test.cpp:2008:13: warning: unused function
> '__pyx_pw_5numpy_7ndarray_3__releasebuffer__' [-Wunused-function]
> static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject
> *__pyx_v_self, Py_buffer *__pyx_v_info) {
> ^
> 2 warnings generated.


 test.pyx 
from numpy cimport import_array, import_ufunc
import_array(); import_ufunc()

These warnings were once silenced by some code introduced in a previous
commit:

commit 6cc61605a91c8ebf16318a07439a206118d81614
> Author: Lisandro Dalcin 
> Date:   Wed Apr 28 16:18:43 2010 -0300
> introduce CYTHON_UNUSED macro to annotate functions and parametes
> - Silent compiler warnings about unused function/parametes
> - Defined to __attribute__((__unused__)) for GCC(>3.4) and ICC
> - Applied to a __{get|release}buffer__ special methods
> - Applied to a couple of (self,unused) parameter pairs


But later reappeared:

commit 519a19a9006494c6165ea481553a298d9bf9a008
> Author: Vitja Makarov 
> Date:   Sun Jan 8 19:22:38 2012 +0400
> DefNode: split into function and python wrapper


I've introduced a pull request to re-silence these warnings:
https://github.com/cython/cython/pull/168

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


Re: [Cython] unused function '__pyx_pw_5numpy_7ndarray_1__getbuffer__'

2012-12-10 Thread Robert Bradshaw
Thanks! Merged.

On Mon, Dec 10, 2012 at 12:08 PM, Bradley M. Froehle
 wrote:
> I've been noticing some unused function warnings of the following variety:
>
>> test.cpp:1189:12: warning: unused function
>> '__pyx_pw_5numpy_7ndarray_1__getbuffer__' [-Wunused-function]
>> static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self,
>> Py_buffer *__pyx_v_info, int __pyx_v_flags) {
>>^
>> test.cpp:2008:13: warning: unused function
>> '__pyx_pw_5numpy_7ndarray_3__releasebuffer__' [-Wunused-function]
>> static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject
>> *__pyx_v_self, Py_buffer *__pyx_v_info) {
>> ^
>> 2 warnings generated.
>
>
>  test.pyx 
> from numpy cimport import_array, import_ufunc
> import_array(); import_ufunc()
>
> These warnings were once silenced by some code introduced in a previous
> commit:
>
>> commit 6cc61605a91c8ebf16318a07439a206118d81614
>> Author: Lisandro Dalcin 
>> Date:   Wed Apr 28 16:18:43 2010 -0300
>> introduce CYTHON_UNUSED macro to annotate functions and parametes
>> - Silent compiler warnings about unused function/parametes
>> - Defined to __attribute__((__unused__)) for GCC(>3.4) and ICC
>> - Applied to a __{get|release}buffer__ special methods
>> - Applied to a couple of (self,unused) parameter pairs
>
>
> But later reappeared:
>
>> commit 519a19a9006494c6165ea481553a298d9bf9a008
>> Author: Vitja Makarov 
>> Date:   Sun Jan 8 19:22:38 2012 +0400
>> DefNode: split into function and python wrapper
>
>
> I've introduced a pull request to re-silence these warnings:
> https://github.com/cython/cython/pull/168
>
> -Brad
>
> ___
> 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