[sage-support] Re: Reserved words (Sage + Cython)

2012-02-18 Thread Simon King
Hi Oleksandr,

On 17 Feb., 21:52, Oleksandr Kazymyrov vrona.aka.ham...@gmail.com
wrote:
 Can anyone reproduce the same bug on Ubuntu?

The situation somehow reminds me a problem that I once had with a
wrapper of the C-MeatAxe (an implementation of matrices that I use it
in an optional Sage package). There was a C-function (I think it was
called matid), but in order to make it work on Solaris, I had to
rename the function. It turned out that the linker was mistaking the
function with another function of the same name in a totally different
package. So, that should probably be called a Solaris bug, not a Sage
bug.

If a similar thing is happening here as well, I suggest to be
practical: Rename it, if that solves the problem.

Cheers,
Simon

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Reserved words (Sage + Cython)

2012-02-18 Thread Oleksandr Kazymyrov
Hi Simon,

 Rename it, if that solves the problem. 

I have done it. But I wonder why has that happened after upgrade from 4.7.2 
to 4.8 (5.0beta4)?

Best regards,
Oleksandr

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Reserved words (Sage + Cython)

2012-02-17 Thread Dima Pasechnik
In gmane.comp.mathematics.sage.support, you wrote:
 After upgrading from version 4.7.2 to 4.8, one function of dozen is stopped 
 working. I use a combination of Sage + Cython. You can find examples in the 
 attachments.

 The main problem is: when you use PC as the function name in *.c file 
 sage gives an error

 /home/hamsin/bin/sage/local/lib/libcsage.so(print_backtrace+0x31)[0x7f3c8b89e3a3]
 /home/hamsin/bin/sage/local/lib/libcsage.so(sigdie+0x14)[0x7f3c8b89e3d5]
 /home/hamsin/bin/sage/local/lib/libcsage.so(sage_signal_handler+0x20e)[0x7f3c8b89e000]
 /lib/x86_64-linux-gnu/libpthread.so.0(+0x10060)[0x7f3c8dc93060]
 /home/hamsin/bin/sage/local/lib/libreadline.so.6(PC+0x0)[0x7f3c861f83cc]

 
 Unhandled SIGSEGV: A segmentation fault occurred in Sage.
 This probably occurred because a *compiled* component of Sage has a bug
 in it and is not properly wrapped with sig_on(), sig_off(). You might
 want to run Sage under gdb with 'sage -gdb' to debug this.
 Sage will now terminate.
 
 local/bin/sage-sage: line 460: 10163 Segmentation fault  python $@

 If I use PCc or PC_1, then there are no problems. So this is a bug, 
 feature or Cython has limitations on function names. If the last point, 
 then where I can see this limitations.

I imagine the behaviour is similar to Python's, where it's jolly possible
to do list=2 and see stuff beginning to happen...

Just in case,
Dima


 Best regards,
 Oleksandr

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Reserved words (Sage + Cython)

2012-02-17 Thread Simon King
Hi Dima, hi Oleksandr,

On 17 Feb., 14:07, Dima Pasechnik dimp...@gmail.com wrote:
 I imagine the behaviour is similar to Python's, where it's jolly possible
 to do list=2 and see stuff beginning to happen...

But the only difference between the good and the bad version is that
some function is called PC in the bad file and PCc in the good file. I
guess that PC is not a reserved word.

However, Oleksandr: What is one supposed to do in order to reproduce
the error? When I start a sage session and attach Main.sage, then it
fails with both the bad and the good version.

Cheers,
Simon

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Reserved words (Sage + Cython)

2012-02-17 Thread Oleksandr Kazymyrov
Dear Simon,

 But the only difference between the good and the bad version is that some 
function is called PC in the bad file and PCc in the good file
Yes, exactly.

 However, Oleksandr: What is one supposed to do in order to reproduce the 
error? When I start a sage session and attach Main.sage, then it fails with 
both the bad and the good version.
You should replace:

if __name__ == __main__:
sys.exit(main())
by

main()

Or just run Main.sage from a shell (in this case, variable PATH should 
has a path to the sage directory, like this one 
PATH=/home/user/bin/sage/:$PATH). 

Best regards,
Oleksandr

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Reserved words (Sage + Cython)

2012-02-17 Thread Simon King
Dear Oleksandr,

On 17 Feb., 15:32, Oleksandr Kazymyrov vrona.aka.ham...@gmail.com
wrote:
 Or just run Main.sage from a shell (in this case, variable PATH should
 has a path to the sage directory, like this one
 PATH=/home/user/bin/sage/:$PATH).

Then I can not reproduce it.

I started a Sage shell, and did

%%%
(sage subshell) linux-sqwp:CythonBad simon$ PATH=/home/simon/SAGE/work/
cython_change/CythonBad/:$PATH
SAGE_ROOT=/home/simon/SAGE/sage-5.0.prealpha0
(sage subshell) linux-sqwp:CythonBad simon$ ls
CFunc.spyx  CSbox.sage  Functions.c  Main.py  Main.sage  Sbox.sage
SAGE_ROOT=/home/simon/SAGE/sage-5.0.prealpha0
(sage subshell) linux-sqwp:CythonBad simon$ ./Main.sage
Compiling ./CFunc.spyx...
in c_PC

in PC

out in_PC
PC  = 0
(sage subshell) linux-sqwp:CythonBad simon$ cat Functions.c
int PC()
{
printf(in PC\n);
return 0;
}

%

So, it is indeed the bad version, but there is no segmentation
fault.

As you can see, this is with a recent development version of Sage. The
machine:

simon@linux-sqwp:~ uname -a
Linux linux-sqwp.site 3.1.9-1.4-desktop #1 SMP PREEMPT Fri Jan 27
08:55:10 UTC 2012 (efb5ff4) x86_64 x86_64 x86_64 GNU/Linux
simon@linux-sqwp:~ cat /etc/issue
Welcome to openSUSE 12.1 Asparagus - Kernel \r (\l).


simon@linux-sqwp:~ gcc --version
gcc (SUSE Linux) 4.6.2
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.


Best regards,
Simon

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org