Skip to content

Commit

Permalink
sagemathgh-38392: get rid of sage_eval in grobner_fan
Browse files Browse the repository at this point in the history
    
parsing the input by hand instead of using the big hammer `sage_eval`

### 📝 Checklist

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#38392
Reported by: Frédéric Chapoton
Reviewer(s): Matthias Köppe
  • Loading branch information
Release Manager committed Jul 24, 2024
2 parents f718ac1 + 480e3e4 commit 5c8f3f9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sage/rings/polynomial/groebner_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@
"""

import string
import re
import pexpect
from subprocess import PIPE, Popen

from sage.misc.sage_eval import sage_eval

from sage.structure.sage_object import SageObject
from sage.interfaces.gfan import gfan
from .multi_polynomial_ideal import MPolynomialIdeal
Expand Down Expand Up @@ -983,8 +982,9 @@ def weight_vectors(self):
stdin=PIPE, stdout=PIPE, stderr=PIPE)
ans, err = gfan_processes.communicate(input=str_to_bytes(self.gfan()))
ans = bytes_to_str(ans)
ans = sage_eval(ans.replace('{', '').replace('}', '').replace('\n', ''))
return [vector(QQ, x) for x in ans]
vect = re.compile(r"\([0-9,/\s]*\)")
ans = (tup[1:-1].split(',') for tup in vect.findall(ans))
return [vector(QQ, [QQ(y) for y in x]) for x in ans]

def ring(self):
"""
Expand Down

0 comments on commit 5c8f3f9

Please sign in to comment.