Re: [Cython] 0.18 beta 1 released

2013-01-20 Thread Arfrever Frehtes Taifersar Arahesis
There are 6 test failures.
Failures in builtin_abs.__test__.int_abs might be related to new versions of 
GCC or glibc. I use GCC 4.7.2 and glibc 2.16.0.
Failures in NumPy-related tests are probably related to new version of NumPy. I 
use NumPy 1.7.0rc1.
Failures are identical with CPython 2.6, 2.7, 3.1, 3.2 and 3.3.

Results with CPython 2.7:

==
FAIL: int_abs (line 35) (builtin_abs.__test__)
Doctest: builtin_abs.__test__.int_abs (line 35)
--
Traceback (most recent call last):
  File "/usr/lib64/python2.7/doctest.py", line 2201, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for builtin_abs.__test__.int_abs (line 35)
  File 
"/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/builtin_abs/builtin_abs.so",
 line unknown line number, in int_abs (line 35)

--
File 
"/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/builtin_abs/builtin_abs.so",
 line ?, in builtin_abs.__test__.int_abs (line 35)
Failed example:
int_abs(-max_int-1) == abs(-max_int-1)
Expected:
True
Got:
False


==
FAIL: int_abs (line 35) (builtin_abs.__test__)
Doctest: builtin_abs.__test__.int_abs (line 35)
--
Traceback (most recent call last):
  File "/usr/lib64/python2.7/doctest.py", line 2201, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for builtin_abs.__test__.int_abs (line 35)
  File 
"/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/cpp/builtin_abs/builtin_abs.so",
 line unknown line number, in int_abs (line 35)

--
File 
"/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/cpp/builtin_abs/builtin_abs.so",
 line ?, in builtin_abs.__test__.int_abs (line 35)
Failed example:
int_abs(-max_int-1) == abs(-max_int-1)
Expected:
True
Got:
False


==
FAIL: numpy_test ()
Doctest: numpy_test
--
Traceback (most recent call last):
  File "/usr/lib64/python2.7/doctest.py", line 2201, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for numpy_test
  File 
"/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/numpy_test/numpy_test.so",
 line 518, in numpy_test

--
File 
"/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/numpy_test/numpy_test.so",
 line 539, in numpy_test
Failed example:
obj_array()
Expected:
[a 1 {}]
a 1 {}
Got:
['a' 1 {}]
a 1 {}


==
FAIL: numpy_test (numpy_test.__test__)
Doctest: numpy_test.__test__.numpy_test
--
Traceback (most recent call last):
  File "/usr/lib64/python2.7/doctest.py", line 2201, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for numpy_test.__test__.numpy_test
  File 
"/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/numpy_test/numpy_test.so",
 line unknown line number, in numpy_test

--
File 
"/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/numpy_test/numpy_test.so",
 line ?, in numpy_test.__test__.numpy_test
Failed example:
obj_array()
Expected:
[a 1 {}]
a 1 {}
Got:
['a' 1 {}]
a 1 {}


==
FAIL: numpy_test ()
Doctest: numpy_test
--
Traceback (most recent call last):
  File "/usr/lib64/python2.7/doctest.py", line 2201, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for numpy_test
  File 
"/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/cpp/numpy_test/numpy_test.so",
 line 844, in numpy_test

--
File 
"/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/cpp/numpy_test/numpy_test.so",
 line 865, in numpy_test
Failed example:
obj_array()
Expected:
[a 1 {}]
  

Re: [Cython] 0.18 beta 1 released

2013-01-20 Thread Christoph Gohlke

On 1/20/2013 4:59 AM, Arfrever Frehtes Taifersar Arahesis wrote:

There are 6 test failures.
Failures in builtin_abs.__test__.int_abs might be related to new versions of 
GCC or glibc. I use GCC 4.7.2 and glibc 2.16.0.
Failures in NumPy-related tests are probably related to new version of NumPy. I 
use NumPy 1.7.0rc1.
Failures are identical with CPython 2.6, 2.7, 3.1, 3.2 and 3.3.




The test failures with numpy 1.7.x were reported at 
. They are due to the 
difference in printing numpy arrays containing str objects:


# numpy 1.6.2:

print(np.array(["a"], object))

[a]

# numpy 1.7.0rc1:

print(np.array(["a"], object))

['a']

According to numpy developers "reprs are not required to be the same 
across numpy versions".


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


Re: [Cython] 0.18 beta 1 released

2013-01-20 Thread Stefan Behnel
Hi,

thanks for testing!

Arfrever Frehtes Taifersar Arahesis, 20.01.2013 13:59:
> There are 6 test failures.
> Failures in builtin_abs.__test__.int_abs might be related to new versions of 
> GCC or glibc. I use GCC 4.7.2 and glibc 2.16.0.
> Failures in NumPy-related tests are probably related to new version of NumPy. 
> I use NumPy 1.7.0rc1.
> Failures are identical with CPython 2.6, 2.7, 3.1, 3.2 and 3.3.
> 
> Results with CPython 2.7:
> 
> ==
> FAIL: int_abs (line 35) (builtin_abs.__test__)
> Doctest: builtin_abs.__test__.int_abs (line 35)
> --
> Traceback (most recent call last):
>   File "/usr/lib64/python2.7/doctest.py", line 2201, in runTest
> raise self.failureException(self.format_failure(new.getvalue()))
> AssertionError: Failed doctest test for builtin_abs.__test__.int_abs (line 35)
>   File 
> "/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/builtin_abs/builtin_abs.so",
>  line unknown line number, in int_abs (line 35)
> 
> --
> File 
> "/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/builtin_abs/builtin_abs.so",
>  line ?, in builtin_abs.__test__.int_abs (line 35)
> Failed example:
> int_abs(-max_int-1) == abs(-max_int-1)
> Expected:
> True
> Got:
> False

Ok, from the file system paths, this looks like 64bit Gentoo Linux.

Could you apply the attached patch and report the result for this test
again? Just pass "--no-cpp builtin_abs" to the test runner.

The test was originally written this way because the actual values change
depending on the system they run on, but it would still be good to see them
in the output in case of a failure.

Since you mentioned your recent GCC version, do you see any C compiler
warnings in the output of this particular test (i.e. during the actual test
run, not in the final summary)? Maybe with "-Wall" in your CFLAGS?

Stefan

diff -r 4fe5df9c6c53 tests/run/builtin_abs.pyx
--- a/tests/run/builtin_abs.pyx	Sun Jan 20 08:08:15 2013 +0100
+++ b/tests/run/builtin_abs.pyx	Sun Jan 20 16:30:53 2013 +0100
@@ -40,9 +40,9 @@
 True
 >>> long_abs(-max_int-1) > 0
 True
->>> int_abs(-max_int-1) == abs(-max_int-1)
+>>> int_abs(-max_int-1) == abs(-max_int-1)   or (max_int, int_abs(-max_int-1), abs(-max_int-1))
 True
->>> int_abs(max_int) == abs(max_int)
+>>> int_abs(max_int) == abs(max_int) or (max_int, int_abs(max_int), abs(max_int))
 True
 """
 return abs(a)
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] 0.18 beta 1 released

2013-01-20 Thread Arfrever Frehtes Taifersar Arahesis
2013-01-20 16:48:35 Stefan Behnel napisał(a):
> Hi,
> 
> thanks for testing!
> 
> Arfrever Frehtes Taifersar Arahesis, 20.01.2013 13:59:
> > There are 6 test failures.
> > Failures in builtin_abs.__test__.int_abs might be related to new versions 
> > of GCC or glibc. I use GCC 4.7.2 and glibc 2.16.0.
> > Failures in NumPy-related tests are probably related to new version of 
> > NumPy. I use NumPy 1.7.0rc1.
> > Failures are identical with CPython 2.6, 2.7, 3.1, 3.2 and 3.3.
> > 
> > Results with CPython 2.7:
> > 
> > ==
> > FAIL: int_abs (line 35) (builtin_abs.__test__)
> > Doctest: builtin_abs.__test__.int_abs (line 35)
> > --
> > Traceback (most recent call last):
> >   File "/usr/lib64/python2.7/doctest.py", line 2201, in runTest
> > raise self.failureException(self.format_failure(new.getvalue()))
> > AssertionError: Failed doctest test for builtin_abs.__test__.int_abs (line 
> > 35)
> >   File 
> > "/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/builtin_abs/builtin_abs.so",
> >  line unknown line number, in int_abs (line 35)
> > 
> > --
> > File 
> > "/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/builtin_abs/builtin_abs.so",
> >  line ?, in builtin_abs.__test__.int_abs (line 35)
> > Failed example:
> > int_abs(-max_int-1) == abs(-max_int-1)
> > Expected:
> > True
> > Got:
> > False
> 
> Ok, from the file system paths, this looks like 64bit Gentoo Linux.
> 
> Could you apply the attached patch and report the result for this test
> again? Just pass "--no-cpp builtin_abs" to the test runner.
> 
> The test was originally written this way because the actual values change
> depending on the system they run on, but it would still be good to see them
> in the output in case of a failure.
> 
> Since you mentioned your recent GCC version, do you see any C compiler
> warnings in the output of this particular test (i.e. during the actual test
> run, not in the final summary)? Maybe with "-Wall" in your CFLAGS?

No warnings for this particular test.

I have now tested with GCC 4.6.3 (by exporting 
CC="x86_64-pc-linux-gnu-gcc-4.6.3" and CXX="x86_64-pc-linux-gnu-g++-4.6.3")
and builtin_abs.__test__.int_abs tests pass with GCC 4.6.3.

Result with GCC 4.7.2 after applying your patch:

==
FAIL: int_abs (line 35) (builtin_abs.__test__)
Doctest: builtin_abs.__test__.int_abs (line 35)
--
Traceback (most recent call last):
  File "/usr/lib64/python2.7/doctest.py", line 2201, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for builtin_abs.__test__.int_abs (line 35)
  File "/tmp/Cython-0.18b1/BUILD/run/c/builtin_abs/builtin_abs.so", line 
unknown line number, in int_abs (line 35)

--
File "/tmp/Cython-0.18b1/BUILD/run/c/builtin_abs/builtin_abs.so", line ?, in 
builtin_abs.__test__.int_abs (line 35)
Failed example:
int_abs(-max_int-1) == abs(-max_int-1)   or (max_int, int_abs(-max_int-1), 
abs(-max_int-1))
Expected:
True
Got:
(2147483647, 18446744071562067968L, 2147483648)

-- 
Arfrever Frehtes Taifersar Arahesis


signature.asc
Description: This is a digitally signed message part.
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] Compiler crash in AnalyseDeclarationsTransform with binding=True

2013-01-20 Thread Matěj Laitl
Heya Cython folks,
I face a compiler crash (full log at the bottom of the mail) with Cython 
0.17.1-392-g81d3d10 (today's git). This only happens if Cython directive 
binding is left to True, if set to False, the project builds and runs fine.

Steps to reproduce:
# git clone git://github.com/strohel/PyBayes.git
# cd PyBayes
# git submodule update --init
Open support/dist_cmd_build_prepare.py, set binding to True on line 35
# ./setup.py build

Note that this bug is not at all a recent regression - it exists at least 
since binding=True has been made default (commit 621dbe6403) - sorry for being 
that late reporting it.

On a related note, what does the binding directive mean? I was unable to find 
any info at [1] or [2]. What are the consequences of disabling it to work-
around this crash?

[1] http://wiki.cython.org/enhancements/compilerdirectives
[2] http://docs.cython.org/src/reference/compilation.html

Regards,
Matěj Laitl


=== Full Crash Log ===
running build_ext
cythoning pybayes/filters.py to build/temp.linux-
x86_64-2.7/pyrex/pybayes/filters.c

Error compiling Cython file:

...
cpdef Pdf posterior(self)
cpdef double evidence_log(self, np.ndarray yt) except? -1


cdef class KalmanFilter(Filter):
cdef readonly np.ndarray A, B, C, D, Q, R
^


pybayes/filters.pxd:22:29: Compiler crash in AnalyseDeclarationsTransform

ModuleNode.body = StatListNode(filters.py:13:0)
StatListNode.stats[6] = StatListNode(filters.py:62:0)
StatListNode.stats[0] = CClassDefNode(filters.py:62:0,
base_class_name = u'Filter',
class_name = u'KalmanFilter',
doc = u'Implementation of standard Kalman filter. **cond** in :meth:`bayes` 
is interpreted as\ncontrol (intervention) input :math:`u_t` to the system.
\n\nKalman filter forms *optimal Bayesian solution* for the following 
system:\n\n.. math::\n\nx_t &= A_t x_{t-1} + B_t u_t + v_{t-1} 
\\quad \\quad\nA_t \\in \\mathbb{R}^{n,n} \\;\\;\nB_t 
\\in \\mathbb{R}^{n,k} \\;\\;\n\\;\\; n \\in \\mathbb{N}\n  
  
\\;\\; k \\in \\mathbb{N}_0 \\text{ (may be zero)}\n\n
y_t &= C_t x_t + D_t u_t + w_t \\quad \\quad \\quad \\;\\;\nC_t 
\\in \\mathbb{R}^{j,n} \\;\\;\nD_t \\in \\mathbb{R}^{j,k} \\;\\;\n  
  
j \\in \\mathbb{N} \\;\\; j \\leq n\n\nwhere :math:`x_t \\in 
\\mathbb{R}^n` is hidden state vector, :math:`y_t \\in \\mathbb{R}^j` is\n
observation vector and :math:`u_t \\in \\mathbb{R}^k` is control vector. 
:math:`v_t` is normally\ndistributed zero-mean process noise with 
covariance matrix :math:`Q_t`, :math:`w_t` is normally\ndistributed zero-
mean observation noise with covariance matrix :math:`R_t`. Additionally, 
intial\npdf (**state_pdf**) has to be Gaussian.\n',
visibility = 'private')

Compiler crash traceback from this point on:
  File "Visitor.py", line 168, in Cython.Compiler.Visitor.TreeVisitor._visit 
(/var/tmp/portage/dev-python/cython-/work/Cython/Compiler/Visitor.c:3840)
  File "Visitor.py", line 284, in 
Cython.Compiler.Visitor.CythonTransform.visit_Node (/var/tmp/portage/dev-
python/cython-/work/Cython/Compiler/Visitor.c:5756)
  File "Visitor.py", line 236, in 
Cython.Compiler.Visitor.VisitorTransform.visitchildren (/var/tmp/portage/dev-
python/cython-/work/Cython/Compiler/Visitor.c:4813)
  File "Visitor.py", line 210, in 
Cython.Compiler.Visitor.TreeVisitor._visitchildren (/var/tmp/portage/dev-
python/cython-/work/Cython/Compiler/Visitor.c:4591)
AssertionError: Cannot insert list here: body in 

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


Re: [Cython] 0.18 beta 1 released

2013-01-20 Thread Stefan Behnel
Arfrever Frehtes Taifersar Arahesis, 20.01.2013 18:07:
> 2013-01-20 16:48:35 Stefan Behnel napisał(a):
>> Arfrever Frehtes Taifersar Arahesis, 20.01.2013 13:59:
>>> There are 6 test failures.
>>> Failures in builtin_abs.__test__.int_abs might be related to new versions 
>>> of GCC or glibc. I use GCC 4.7.2 and glibc 2.16.0.
>>> Failures in NumPy-related tests are probably related to new version of 
>>> NumPy. I use NumPy 1.7.0rc1.
>>> Failures are identical with CPython 2.6, 2.7, 3.1, 3.2 and 3.3.
>>>
>>> Results with CPython 2.7:
>>>
>>> ==
>>> FAIL: int_abs (line 35) (builtin_abs.__test__)
>>> Doctest: builtin_abs.__test__.int_abs (line 35)
>>> --
>>> Traceback (most recent call last):
>>>   File "/usr/lib64/python2.7/doctest.py", line 2201, in runTest
>>> raise self.failureException(self.format_failure(new.getvalue()))
>>> AssertionError: Failed doctest test for builtin_abs.__test__.int_abs (line 
>>> 35)
>>>   File 
>>> "/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/builtin_abs/builtin_abs.so",
>>>  line unknown line number, in int_abs (line 35)
>>>
>>> --
>>> File 
>>> "/var/tmp/portage/dev-python/cython-0.18_beta1-r1000/work/Cython-0.18b1/tests-2.7/run/c/builtin_abs/builtin_abs.so",
>>>  line ?, in builtin_abs.__test__.int_abs (line 35)
>>> Failed example:
>>> int_abs(-max_int-1) == abs(-max_int-1)
>>> Expected:
>>> True
>>> Got:
>>> False
>>
>> Ok, from the file system paths, this looks like 64bit Gentoo Linux.
>>
>> Could you apply the attached patch and report the result for this test
>> again? Just pass "--no-cpp builtin_abs" to the test runner.
>>
>> The test was originally written this way because the actual values change
>> depending on the system they run on, but it would still be good to see them
>> in the output in case of a failure.
>>
>> Since you mentioned your recent GCC version, do you see any C compiler
>> warnings in the output of this particular test (i.e. during the actual test
>> run, not in the final summary)? Maybe with "-Wall" in your CFLAGS?
> 
> No warnings for this particular test.
> 
> I have now tested with GCC 4.6.3 (by exporting 
> CC="x86_64-pc-linux-gnu-gcc-4.6.3" and CXX="x86_64-pc-linux-gnu-g++-4.6.3")
> and builtin_abs.__test__.int_abs tests pass with GCC 4.6.3.

Thanks, I could reproduce it now.


> Result with GCC 4.7.2 after applying your patch:
> 
> ==
> FAIL: int_abs (line 35) (builtin_abs.__test__)
> Doctest: builtin_abs.__test__.int_abs (line 35)
> --
> Traceback (most recent call last):
>   File "/usr/lib64/python2.7/doctest.py", line 2201, in runTest
> raise self.failureException(self.format_failure(new.getvalue()))
> AssertionError: Failed doctest test for builtin_abs.__test__.int_abs (line 35)
>   File "/tmp/Cython-0.18b1/BUILD/run/c/builtin_abs/builtin_abs.so", line 
> unknown line number, in int_abs (line 35)
> 
> --
> File "/tmp/Cython-0.18b1/BUILD/run/c/builtin_abs/builtin_abs.so", line ?, in 
> builtin_abs.__test__.int_abs (line 35)
> Failed example:
> int_abs(-max_int-1) == abs(-max_int-1)   or (max_int, 
> int_abs(-max_int-1), abs(-max_int-1))
> Expected:
> True
> Got:
> (2147483647, 18446744071562067968L, 2147483648)

This should fix it:

https://github.com/cython/cython/commit/43fe5b88813bb051e89d9be61373cdc3b098d624

Thanks again!

Stefan

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


Re: [Cython] Compiler crash in AnalyseDeclarationsTransform with binding=True

2013-01-20 Thread Stefan Behnel
Hi,

thanks for the report.

Matěj Laitl, 21.01.2013 00:16:
> Heya Cython folks,
> I face a compiler crash (full log at the bottom of the mail) with Cython 
> 0.17.1-392-g81d3d10 (today's git). This only happens if Cython directive 
> binding is left to True, if set to False, the project builds and runs fine.
> 
> Steps to reproduce:
> # git clone git://github.com/strohel/PyBayes.git
> # cd PyBayes
> # git submodule update --init
> Open support/dist_cmd_build_prepare.py, set binding to True on line 35
> # ./setup.py build
> 
> Note that this bug is not at all a recent regression - it exists at least 
> since binding=True has been made default (commit 621dbe6403) - sorry for 
> being 
> that late reporting it.
> 
> On a related note, what does the binding directive mean? I was unable to find 
> any info at [1] or [2]. What are the consequences of disabling it to work-
> around this crash?
> 
> [1] http://wiki.cython.org/enhancements/compilerdirectives
> [2] http://docs.cython.org/src/reference/compilation.html

"Binding" is a historically grown name that means that Cython uses its own
Python function type instead of the one that CPython provides for C
functions. That allows Cython implemented functions to support binding as
methods in classes (thus the name), but generally provides them with a much
more Python-like function interface, e.g. for introspection.


> === Full Crash Log ===
> running build_ext
> cythoning pybayes/filters.py to build/temp.linux-
> x86_64-2.7/pyrex/pybayes/filters.c
> 
> Error compiling Cython file:
> 
> ...
> cpdef Pdf posterior(self)
> cpdef double evidence_log(self, np.ndarray yt) except? -1
> 
> 
> cdef class KalmanFilter(Filter):
> cdef readonly np.ndarray A, B, C, D, Q, R
> ^
> 
> 
> pybayes/filters.pxd:22:29: Compiler crash in AnalyseDeclarationsTransform
> [...]
> AssertionError: Cannot insert list here: body in 
> 

I'm puzzled how this comes to be triggered by the "binding" directive.
Anyway, just as a stab in the dark, does the attached patch fix it for you?

Stefan

diff -r b75ae05c8584 Cython/Compiler/Parsing.py
--- a/Cython/Compiler/Parsing.py	Mon Jan 21 07:50:23 2013 +0100
+++ b/Cython/Compiler/Parsing.py	Mon Jan 21 08:21:40 2013 +0100
@@ -2982,7 +2982,8 @@
 s.next() # 'property'
 name = p_ident(s)
 doc, body = p_suite(s, Ctx(level = 'property'), with_doc = 1)
-return Nodes.PropertyNode(pos, name = name, doc = doc, body = body)
+return Nodes.PropertyNode(pos, name = name, doc = doc,
+  body = Nodes.StatListNode(pos, stats=[body]))
 
 def p_doc_string(s):
 if s.sy == 'BEGIN_STRING':
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel