Opened 8 years ago

Closed 8 years ago

#13600 closed defect (fixed)

pAdicZZpXCAElement can not be initialized from fraction field element

Reported by: saraedum Owned by: roed
Priority: trivial Milestone: sage-5.8
Component: padics Keywords:
Cc: Merged in: sage-5.8.beta1
Authors: Julian Rueth Reviewers: David Roe
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Currently, the following code fails:

sage: R = ZpCA(3,5)
sage: S.<T> = R[]
sage: W.<a> = R.extension(T^2-3)
sage: W(W.fraction_field().zero())
TypeError: Cannot convert sage.rings.padics.padic_ZZ_pX_CR_element.pAdicZZpXCRElement to sage.rings.padics.padic_ZZ_pX_CA_element.pAdicZZpXCAElement

The attached patch fixes this.

Attachments (1)

trac_13600.patch (5.3 KB) - added by saraedum 8 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 8 years ago by saraedum

The following two lines cause the problem:

        cdef pAdicZZpXCAElement _x
[...] 
                _x = <pAdicZZpXCRElement>x 

comment:2 Changed 8 years ago by saraedum

I also did a little bit of cleanup regarding traling whitespace. Tried to make the AUTHORS conform to the developer's guide. I hope the reviewer doesn't mind that I put these things into the patch.

Last edited 8 years ago by saraedum (previous) (diff)

comment:3 Changed 8 years ago by roed

Looks good to me. I'm happy to give it a positive review once it passes doctests.

Changed 8 years ago by saraedum

comment:4 Changed 8 years ago by roed

Is this ready for review?

comment:5 Changed 8 years ago by roed

  • Reviewers set to David Roe

comment:6 Changed 8 years ago by tscrim

If this is ready for review, please set it to needs_review.

comment:7 Changed 8 years ago by saraedum

  • Status changed from new to needs_review

comment:8 Changed 8 years ago by roed

  • Status changed from needs_review to positive_review

Looks good.

comment:9 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.7 to sage-5.8

comment:10 Changed 8 years ago by jdemeyer

  • Status changed from positive_review to needs_work

This causes a doctest failure (possibly related to #12313 and #13904):

sage -t  -force_lib devel/sage/sage/rings/padics/padic_generic_element.pyx
**********************************************************************
File "/release/merger/sage-5.8.beta1/devel/sage-main/sage/rings/padics/padic_generic_element.pyx", line 1005:
    sage: R2 = Qp(2,20,'capped-rel')
Exception raised:
    Traceback (most recent call last):
      File "/release/merger/sage-5.8.beta1/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/release/merger/sage-5.8.beta1/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/release/merger/sage-5.8.beta1/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_24[24]>", line 1, in <module>
        R2 = Qp(Integer(2),Integer(20),'capped-rel')###line 1005:
    sage: R2 = Qp(2,20,'capped-rel')
      File "factory.pyx", line 143, in sage.structure.factory.UniqueFactory.__call__ (sage/structure/factory.c:1119)
      File "factory.pyx", line 170, in sage.structure.factory.UniqueFactory.get_object (sage/structure/factory.c:1311)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/rings/padics/factory.py", line 493, in create_object
        return pAdicFieldCappedRelative(p, prec, {'mode': print_mode, 'pos': print_pos, 'sep': print_sep, 'alphabet': print_alphabet, 'ram_name': name, 'max_ram_terms': print_max_terms}, name)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/rings/padics/padic_base_leaves.py", line 457, in __init__
        pAdicFieldBaseGeneric.__init__(self, p, prec, print_mode, names, pAdicCappedRelativeElement)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/rings/padics/padic_base_generic.py", line 27, in __init__
        coerce_list = [pAdicCoercion_ZZ_CR(self), pAdicCoercion_QQ_CR(self)]
      File "padic_base_coercion.pyx", line 79, in sage.rings.padics.padic_base_coercion.pAdicCoercion_ZZ_CR.__init__ (sage/rings/padics/padic_base_coercion.c:5839)
        RingHomomorphism_coercion.__init__(self, ZZ.Hom(R), check=False)
      File "parent_base.pyx", line 128, in sage.structure.parent_base.ParentWithBase.Hom (sage/structure/parent_base.c:1870)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/categories/homset.py", line 266, in Hom
        _cache[key] = KeyedRef(H, _cache.eraser, (id(X),id(Y),id(category)))
      File "coerce_dict.pyx", line 1059, in sage.structure.coerce_dict.TripleDict.__setitem__ (sage/structure/coerce_dict.c:6614)
      File "coerce_dict.pyx", line 1079, in sage.structure.coerce_dict.TripleDict.set (sage/structure/coerce_dict.c:6880)
    KeyError: (17671424, 87123360, 20657216)
**********************************************************************
File "/release/merger/sage-5.8.beta1/devel/sage-main/sage/rings/padics/padic_generic_element.pyx", line 1068:
    sage: Qp(7)(0).abs()
Exception raised:
    Traceback (most recent call last):
      File "/release/merger/sage-5.8.beta1/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/release/merger/sage-5.8.beta1/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/release/merger/sage-5.8.beta1/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_25[4]>", line 1, in <module>
        Qp(Integer(7))(Integer(0)).abs()###line 1068:
    sage: Qp(7)(0).abs()
      File "factory.pyx", line 143, in sage.structure.factory.UniqueFactory.__call__ (sage/structure/factory.c:1119)
      File "factory.pyx", line 170, in sage.structure.factory.UniqueFactory.get_object (sage/structure/factory.c:1311)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/rings/padics/factory.py", line 493, in create_object
        return pAdicFieldCappedRelative(p, prec, {'mode': print_mode, 'pos': print_pos, 'sep': print_sep, 'alphabet': print_alphabet, 'ram_name': name, 'max_ram_terms': print_max_terms}, name)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/rings/padics/padic_base_leaves.py", line 457, in __init__
        pAdicFieldBaseGeneric.__init__(self, p, prec, print_mode, names, pAdicCappedRelativeElement)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/rings/padics/padic_base_generic.py", line 27, in __init__
        coerce_list = [pAdicCoercion_ZZ_CR(self), pAdicCoercion_QQ_CR(self)]
      File "padic_base_coercion.pyx", line 79, in sage.rings.padics.padic_base_coercion.pAdicCoercion_ZZ_CR.__init__ (sage/rings/padics/padic_base_coercion.c:5839)
        RingHomomorphism_coercion.__init__(self, ZZ.Hom(R), check=False)
      File "parent_base.pyx", line 128, in sage.structure.parent_base.ParentWithBase.Hom (sage/structure/parent_base.c:1870)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/categories/homset.py", line 266, in Hom
        _cache[key] = KeyedRef(H, _cache.eraser, (id(X),id(Y),id(category)))
      File "coerce_dict.pyx", line 1059, in sage.structure.coerce_dict.TripleDict.__setitem__ (sage/structure/coerce_dict.c:6614)
      File "coerce_dict.pyx", line 1079, in sage.structure.coerce_dict.TripleDict.set (sage/structure/coerce_dict.c:6880)
    KeyError: (17671424, 87232416, 20657216)
**********************************************************************
File "/release/merger/sage-5.8.beta1/devel/sage-main/sage/rings/padics/padic_generic_element.pyx", line 1070:
    sage: Qp(7)(0).abs(prec=20)
Exception raised:
    Traceback (most recent call last):
      File "/release/merger/sage-5.8.beta1/local/bin/ncadoctest.py", line 1231, in run_one_test
        self.run_one_example(test, example, filename, compileflags)
      File "/release/merger/sage-5.8.beta1/local/bin/sagedoctest.py", line 38, in run_one_example
        OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
      File "/release/merger/sage-5.8.beta1/local/bin/ncadoctest.py", line 1172, in run_one_example
        compileflags, 1) in test.globs
      File "<doctest __main__.example_25[5]>", line 1, in <module>
        Qp(Integer(7))(Integer(0)).abs(prec=Integer(20))###line 1070:
    sage: Qp(7)(0).abs(prec=20)
      File "factory.pyx", line 143, in sage.structure.factory.UniqueFactory.__call__ (sage/structure/factory.c:1119)
      File "factory.pyx", line 170, in sage.structure.factory.UniqueFactory.get_object (sage/structure/factory.c:1311)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/rings/padics/factory.py", line 493, in create_object
        return pAdicFieldCappedRelative(p, prec, {'mode': print_mode, 'pos': print_pos, 'sep': print_sep, 'alphabet': print_alphabet, 'ram_name': name, 'max_ram_terms': print_max_terms}, name)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/rings/padics/padic_base_leaves.py", line 457, in __init__
        pAdicFieldBaseGeneric.__init__(self, p, prec, print_mode, names, pAdicCappedRelativeElement)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/rings/padics/padic_base_generic.py", line 27, in __init__
        coerce_list = [pAdicCoercion_ZZ_CR(self), pAdicCoercion_QQ_CR(self)]
      File "padic_base_coercion.pyx", line 79, in sage.rings.padics.padic_base_coercion.pAdicCoercion_ZZ_CR.__init__ (sage/rings/padics/padic_base_coercion.c:5839)
        RingHomomorphism_coercion.__init__(self, ZZ.Hom(R), check=False)
      File "parent_base.pyx", line 128, in sage.structure.parent_base.ParentWithBase.Hom (sage/structure/parent_base.c:1870)
      File "/release/merger/sage-5.8.beta1/local/lib/python/site-packages/sage/categories/homset.py", line 266, in Hom
        _cache[key] = KeyedRef(H, _cache.eraser, (id(X),id(Y),id(category)))
      File "coerce_dict.pyx", line 1059, in sage.structure.coerce_dict.TripleDict.__setitem__ (sage/structure/coerce_dict.c:6614)
      File "coerce_dict.pyx", line 1079, in sage.structure.coerce_dict.TripleDict.set (sage/structure/coerce_dict.c:6880)
    KeyError: (17671424, 82669344, 20657216)
**********************************************************************

comment:11 Changed 8 years ago by jdemeyer

  • Status changed from needs_work to positive_review

Never mind, the error occurs even when this patch is not applied.

comment:12 Changed 8 years ago by jdemeyer

  • Merged in set to sage-5.8.beta1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.