Opened 6 years ago

Closed 6 years ago

#21027 closed defect (fixed)

Add "check" keyword to _module_constructor for additive abelian groups

Reported by: John Palmieri Owned by:
Priority: major Milestone: sage-7.3
Component: group theory Keywords:
Cc: Merged in:
Authors: John Palmieri Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 49421e2 (Commits, GitHub, GitLab) Commit: 49421e28f7e0220c01f49a0f02a3e85433de6a6c
Dependencies: Stopgaps:

Status badges

Description

Currently running phi.image() on a morphism of additive abelian groups raises an error

TypeError: _module_constructor() got an unexpected keyword argument 'check'

This is because the additive abelian group code (in groups.additive_abelian.additive_abelian_group) wraps the code for finitely generated modules over a PID (in module.fg_pid), and the image method calls _module_constructor with the argument check=fgp_module.DEBUG. The _module_constructor method in fg_pid accepts such a keyword, but not the corresponding method in additive_abelian_group.

Change History (7)

comment:1 Changed 6 years ago by John Palmieri

Branch: u/jhpalmieri/additive_group_module_constructor

comment:2 Changed 6 years ago by John Palmieri

Commit: be968a6e48387a2a335ed5d780ab7334127c7ef0
Status: newneeds_review

New commits:

be968a6Add "check" keyword to _module_constructor for additive abelian groups

comment:3 Changed 6 years ago by Travis Scrimshaw

Reviewers: Travis Scrimshaw
Status: needs_reviewpositive_review

LGTM.

comment:4 Changed 6 years ago by Volker Braun

Status: positive_reviewneeds_work
sage -t --long src/sage/groups/additive_abelian/additive_abelian_group.py
**********************************************************************
File "src/sage/groups/additive_abelian/additive_abelian_group.py", line 314, in sage.groups.additive_abelian.additive_abelian_group.AdditiveAbelianGroup_class._module_constructor
Failed example:
    sage: G = groups.misc.AdditiveAbelian([2,2,2])
Exception raised:
    Traceback (most recent call last):
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 499, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 860, in compile_and_execute
        compiled = compiler(example)
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 497, in <lambda>
        example.source, filename, "single", compileflags, 1)
      File "<doctest sage.groups.additive_abelian.additive_abelian_group.AdditiveAbelianGroup_class._module_constructor[4]>", line 1
        sage: G = groups.misc.AdditiveAbelian([Integer(2),Integer(2),Integer(2)])
            ^
    SyntaxError: invalid syntax
**********************************************************************
File "src/sage/groups/additive_abelian/additive_abelian_group.py", line 315, in sage.groups.additive_abelian.additive_abelian_group.AdditiveAbelianGroup_class._module_constructor
Failed example:
    phi = G.hom([G.0, G.0, G.0])
Exception raised:
    Traceback (most recent call last):
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 499, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 862, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.groups.additive_abelian.additive_abelian_group.AdditiveAbelianGroup_class._module_constructor[5]>", line 1, in <module>
        phi = G.hom([G.gen(0), G.gen(0), G.gen(0)])
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/modules/fg_pid/fgp_module.py", line 1346, in hom
        return self._hom_general(im_gens, check)
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/modules/fg_pid/fgp_module.py", line 1388, in _hom_general
        raise ValueError("Images do not determine a valid homomorphism")
    ValueError: Images do not determine a valid homomorphism
**********************************************************************
File "src/sage/groups/additive_abelian/additive_abelian_group.py", line 316, in sage.groups.additive_abelian.additive_abelian_group.AdditiveAbelianGroup_class._module_constructor
Failed example:
    phi.image()
Exception raised:
    Traceback (most recent call last):
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 499, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 862, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.groups.additive_abelian.additive_abelian_group.AdditiveAbelianGroup_class._module_constructor[6]>", line 1, in <module>
        phi.image()
    NameError: name 'phi' is not defined
**********************************************************************
1 item had failures:
   3 of   8 in sage.groups.additive_abelian.additive_abelian_group.AdditiveAbelianGroup_class._module_constructor

comment:5 Changed 6 years ago by git

Commit: be968a6e48387a2a335ed5d780ab7334127c7ef049421e28f7e0220c01f49a0f02a3e85433de6a6c

Branch pushed to git repo; I updated commit sha1. New commits:

49421e2fix silly doctest error

comment:6 Changed 6 years ago by John Palmieri

Status: needs_workpositive_review

Sorry, that was sloppy of me.

comment:7 Changed 6 years ago by Volker Braun

Branch: u/jhpalmieri/additive_group_module_constructor49421e28f7e0220c01f49a0f02a3e85433de6a6c
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.