Re: [sage-devel] failing doctest in function_field

2018-08-29 Thread Daniel Krenn
On 08/29/2018 01:14 PM, Jeroen Demeyer wrote:
> On 2018-08-29 13:11, Daniel Krenn wrote:
>> Shouldn't we simply use
>>    https://trac.sagemath.org/ticket/26150
>> ?
> 
> How is conversion from the symbolic related to evaluating "r" as the R
> interpreter?

Fair enough, this is now
  https://trac.sagemath.org/ticket/26155

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] failing doctest in function_field

2018-08-29 Thread Jeroen Demeyer

On 2018-08-29 13:11, Daniel Krenn wrote:

Shouldn't we simply use
   https://trac.sagemath.org/ticket/26150
?


How is conversion from the symbolic related to evaluating "r" as the R 
interpreter?


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] failing doctest in function_field

2018-08-29 Thread Daniel Krenn
On 08/29/2018 12:59 PM, Jeroen Demeyer wrote:
> Can you create a ticket for this such that we can discuss it there?

Shouldn't we simply use
  https://trac.sagemath.org/ticket/26150
?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] failing doctest in function_field

2018-08-29 Thread Jeroen Demeyer

Can you create a ticket for this such that we can discuss it there?

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] failing doctest in function_field

2018-08-29 Thread Daniel Krenn
On 08/29/2018 12:39 PM, Daniel Krenn wrote:
> In the element_constructor, there is the following (extracted):
>   sage: sage_eval('r', QQ['x'].fraction_field().gens_dict_recursive())
>   R Interpreter
> My intuition says that this should fail. 

For clearification, not the paricular command above, but in
element_constructor, the input 'r' should fail at this stage of the code.

> Can anyone tell me, where in
> the element constructor of fraction_field.py (sage.rings.fraction_field,
> L.593) is it best to catch the input 'r'?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] failing doctest in function_field

2018-08-29 Thread Daniel Krenn
On 08/29/2018 10:13 AM, Daniel Krenn wrote:
> A simple fix in
>   https://trac.sagemath.org/ticket/26150
> (fraction field: fix conversion from symbolic ring)
> turns out to have an side effect in function_field:
> 
> File "src/sage/rings/function_field/function_field.py", line 1602, in
> sage.rings.function_field.function_field.FunctionField_polymod.hom
> Failed example:
> L.hom(r, base_morphism=phi)
> Exception raised:
> Traceback (most recent call last):
> ...
> ValueError: invalid literal for int() with base 10: "Error in
> dput(length(sage1)) : object 'sage1' not foun"
> 
> This seems like a weird error message (not only because of the "not
> foun" ;) )
> Does anyone have any glue what is going on here?

So, I did some digging and found out that the coercion model at some
point tries to create an element of

  Fraction Field of Univariate Polynomial Ring in x over Rational Field

out of the string 'r'. Due the changes on the ticket, this is now

  ValueError: invalid literal for int() with base 10: "Error in
dput(length(sage2)) : object 'sage2' not foun"

and was

  TypeError: unable to convert '[1] 0' to a rational

before.

Behind the scenes, this is a MWE reproducing the error:
  sage: QQ['x'].fraction_field()('r')
In the element_constructor, there is the following (extracted):
  sage: sage_eval('r', QQ['x'].fraction_field().gens_dict_recursive())
  R Interpreter
My intuition says that this should fail. Can anyone tell me, where in
the element constructor of fraction_field.py (sage.rings.fraction_field,
L.593) is it best to catch the input 'r'?

Best,

Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] failing doctest in function_field

2018-08-29 Thread Daniel Krenn
A simple fix in
  https://trac.sagemath.org/ticket/26150
(fraction field: fix conversion from symbolic ring)
turns out to have an side effect in function_field:

File "src/sage/rings/function_field/function_field.py", line 1602, in
sage.rings.function_field.function_field.FunctionField_polymod.hom
Failed example:
L.hom(r, base_morphism=phi)
Exception raised:
Traceback (most recent call last):
...
ValueError: invalid literal for int() with base 10: "Error in
dput(length(sage1)) : object 'sage1' not foun"

This seems like a weird error message (not only because of the "not
foun" ;) )
Does anyone have any glue what is going on here?

Best

Daniel


full traceback (from the ticket patchbot log):

File "src/sage/rings/function_field/function_field.py", line 1602, in
sage.rings.function_field.function_field.FunctionField_polymod.hom
Failed example:
L.hom(r, base_morphism=phi)
Exception raised:
Traceback (most recent call last):
  File
"/opt/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py",
line 614, in _run
self.compile_and_execute(example, compiler, test.globs)
  File
"/opt/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py",
line 1025, in compile_and_execute
exec(compiled, globs)
  File "",
line 1, in 
L.hom(r, base_morphism=phi)
  File
"/opt/sage/local/lib/python2.7/site-packages/sage/rings/function_field/function_field.py",
line 1657, in hom
codomain = pushout(codomain, base_morphism.codomain())
  File
"/opt/sage/local/lib/python2.7/site-packages/sage/categories/pushout.py",
line 3917, in pushout
elif S.has_coerce_map_from(Rs[-1]):
  File "sage/structure/parent.pyx", line 2015, in
sage.structure.parent.Parent.has_coerce_map_from
(build/cythonized/sage/structure/parent.c:17788)
cpdef bint has_coerce_map_from(self, S) except -2:
  File "sage/structure/parent.pyx", line 2037, in
sage.structure.parent.Parent.has_coerce_map_from
(build/cythonized/sage/structure/parent.c:17738)
return self._internal_coerce_map_from(S) is not None
  File "sage/structure/parent.pyx", line 2179, in
sage.structure.parent.Parent._internal_coerce_map_from
(build/cythonized/sage/structure/parent.c:18750)
mor = self.discover_coerce_map_from(S)
  File "sage/structure/parent.pyx", line 2316, in
sage.structure.parent.Parent.discover_coerce_map_from
(build/cythonized/sage/structure/parent.c:19204)
user_provided_mor = self._coerce_map_from_(S)
  File "sage/structure/parent_old.pyx", line 354, in
sage.structure.parent_old.Parent._coerce_map_from_
(build/cythonized/sage/structure/parent_old.c:7094)
cpdef _coerce_map_from_(self, S):
  File
"/opt/sage/local/lib/python2.7/site-packages/sage/rings/function_field/function_field.py",
line 506, in _coerce_map_from_
sourcegen_in_self = self(source.variable_name())
  File "sage/structure/parent.pyx", line 921, in
sage.structure.parent.Parent.__call__
(build/cythonized/sage/structure/parent.c:9679)
return mor._call_(x)
  File "sage/structure/coerce_maps.pyx", line 145, in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(build/cythonized/sage/structure/coerce_maps.c:4574)
raise
  File "sage/structure/coerce_maps.pyx", line 140, in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(build/cythonized/sage/structure/coerce_maps.c:4442)
return C._element_constructor(x)
  File
"/opt/sage/local/lib/python2.7/site-packages/sage/rings/function_field/function_field.py",
line 2409, in _element_constructor_
x = self._field(x)
  File "sage/structure/parent.pyx", line 921, in
sage.structure.parent.Parent.__call__
(build/cythonized/sage/structure/parent.c:9679)
return mor._call_(x)
  File "sage/structure/coerce_maps.pyx", line 145, in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(build/cythonized/sage/structure/coerce_maps.c:4574)
raise
  File "sage/structure/coerce_maps.pyx", line 140, in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(build/cythonized/sage/structure/coerce_maps.c:4442)
return C._element_constructor(x)
  File
"/opt/sage/local/lib/python2.7/site-packages/sage/rings/fraction_field.py",
line 634, in _element_constructor_
x = x0.numerator()*y0.denominator()
  File "sage/structure/element.pyx", line 1536, in
sage.structure.element.Element.__mul__
(build/cythonized/sage/structure/element.c:12263)
return coercion_model.bin_op(left, right, mul)
  File "sage/structure/coerce.pyx", line 1173, in
sage.structure.coerce.CoercionModel_cache_maps.bin_op
(build/cythonized/sage/structure/coerce.c:9733)
action = self.get_action(xp, yp, op, x, y)
  File "sage/structure/coerce.pyx", line 1716, in
sage.structure.coerce.CoercionModel_cache_maps.get_action
(build/cythonized/sage/structure/coerce.c:16903)
action = self.discover_action(R, S, op, r, s)
  File