Segmentation fault in is_squarefree

143 views
Skip to first unread message

Rolandb

unread,
Mar 3, 2019, 5:44:52 AM3/3/19
to sage-support
Hi, the following result is probably not intended:

Sage 8.6 Windows

aa=109604757131194562205071319966444535807
print is_squarefree(aa)

---------------------------------------------------------------------------
SignalError                               Traceback (most recent call last)
<ipython-input-35-801031bbe3a3> in <module>()
      1 aa=Integer(109604757131194562205071319966444535807)
----> 2 print is_squarefree(aa)

/opt/sagemath-8.6/local/lib/python2.7/site-packages/sage/arith/misc.pyc in is_squarefree(n)
   2850 
   2851     try:
-> 2852         return e.is_squarefree()
   2853     except AttributeError:
   2854         pass

/opt/sagemath-8.6/local/lib/python2.7/site-packages/sage/rings/integer.pyx in sage.rings.integer.Integer.is_squarefree (build/cythonized/sage/rings/integer.c:35954)()
   5857             False
   5858         """
-> 5859         return self.__pari__().issquarefree()
   5860 
   5861     cpdef __pari__(self):

cypari2/gen.pyx in cypari2.gen.Gen.issquarefree()

SignalError: Segmentation fault

Roland

Vincent Delecroix

unread,
Mar 3, 2019, 5:53:17 AM3/3/19
to sage-s...@googlegroups.com
Hi,

I can not reproduce (I am using Linux). Let me copy your traceback
that was a mess because of linebreaks

---------------------------------------------------------------------------
SignalError Traceback (most recent call last)
<ipython-input-35-801031bbe3a3> in <module>()
1 aa=Integer(109604757131194562205071319966444535807)---->
2 print is_squarefree(aa)
/opt/sagemath-8.6/local/lib/python2.7/site-packages/sage/arith/misc.pyc
in is_squarefree(n)
2850
2851 try:->
2852 return e.is_squarefree()
2853 except AttributeError:
2854 pass
/opt/sagemath-8.6/local/lib/python2.7/site-packages/sage/rings/integer.pyx
in sage.rings.integer.Integer.is_squarefree
(build/cythonized/sage/rings/integer.c:35954)()
5857 False
5858 """->
5859 return self.__pari__().issquarefree()
5860
5861 cpdef __pari__(self):
cypari2/gen.pyx in cypari2.gen.Gen.issquarefree()
SignalError: Segmentation fault

This seems to be a problem with cypari2 in cygwin (could you confirm
that you are using cygwin?). If so, you should try to reproduce the
problem without Sage by launching Python inside cygwin and then

>>> import cypari2
>>> pari = cypari2.Pari()
>>> pari(109604757131194562205071319966444535807).issquarefree()

Vincent

Le 03/03/2019 à 11:44, Rolandb a écrit :
> Hi, the following result is probably not intended:
>
> Sage 8.6 Windows
>
> aa=109604757131194562205071319966444535807
> print is_squarefree(aa)
>
> ---------------------------------------------------------------------------SignalError Traceback (most recent call last)<ipython-input-35-801031bbe3a3> in <module>() 1 aa=Integer(109604757131194562205071319966444535807)----> 2 print is_squarefree(aa)

Rolandb

unread,
Mar 3, 2019, 12:48:06 PM3/3/19
to sage-support
Dear Vincent,

Indeed, sagecell gives the correct answer.

I'm not an expert, so whether I use cygwin I do not know. 

Jupyter and Notebook with Windows 8.6 give both segfault.

Notebook 8.6:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_3.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("YWE9MTA5NjA0NzU3MTMxMTk0NTYyMjA1MDcxMzE5OTY2NDQ0NTM1ODA3CnByaW50IGlzX3NxdWFyZWZyZWUoYWEp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpXtAFoN/___code___.py", line 4, in <module>
    exec compile(u'print is_squarefree(aa)
  File "", line 1, in <module>
    
  File "/opt/sagemath-8.6/local/lib/python2.7/site-packages/sage/arith/misc.py", line 2852, in is_squarefree
    return e.is_squarefree()
  File "sage/rings/integer.pyx", line 5859, in sage.rings.integer.Integer.is_squarefree (build/cythonized/sage/rings/integer.c:35954)
  File "cypari2/gen.pyx", line 3347, in cypari2.gen.Gen.issquarefree
cysignals.signals.SignalError: Segmentation fault

Sage 6.9 notebook (via Window, thus 32 bit) yields the correct answer!

Vincent, I hope this information helps.

Roland



Op zondag 3 maart 2019 11:53:17 UTC+1 schreef vdelecroix:

Vincent Delecroix

unread,
Mar 3, 2019, 12:52:16 PM3/3/19
to sage-s...@googlegroups.com
Cher Roland,

Just to be sure, could you try in a *Python* Jupyter notebook to run
a cell with the following content

import cypari2
pari = cypari2.Pari()
pari(109604757131194562205071319966444535807).issquarefree()

(I expect the very same error to occur, but it is better to double
check)

Vincent

Le 03/03/2019 à 18:48, Rolandb a écrit :
> Dear Vincent,
>
> Indeed, sagecell <https://sagecell.sagemath.org/> gives the correct answer.

Rolandb

unread,
Mar 4, 2019, 12:02:18 AM3/4/19
to sage-support
Dear Vincent,

Please find *Python* Jupyter notebook result below:

---------------------------------------------------------------------------

SignalError                               Traceback (most recent call last)

<ipython-input-1-7806d766b198> in <module>()

      1 import cypari2

      2 pari = cypari2.Pari()

----> 3 pari(109604757131194562205071319966444535807).issquarefree()

 

cypari2/gen.pyx in cypari2.gen.Gen.issquarefree()

 

SignalError: Segmentation fault


Roland


Op zondag 3 maart 2019 18:52:16 UTC+1 schreef vdelecroix:
Reply all
Reply to author
Forward
0 new messages