Skip to content

Commit b68db2a

Browse files
committed
Fix test and a typo
1 parent e3567f5 commit b68db2a

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/sage/arith/misc.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2560,7 +2560,7 @@ def trial_division(n, bound=None):
25602560
return ZZ(n).trial_division(bound)
25612561

25622562

2563-
def factor(n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds):
2563+
def factor(n, proof=None, int_=False, algorithm=None, verbose=0, **kwds):
25642564
"""
25652565
Return the factorization of ``n``. The result depends on the
25662566
type of ``n``.
@@ -2734,6 +2734,11 @@ def factor(n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds):
27342734
27352735
sage: len(factor(2^2203-1,proof=false))
27362736
1
2737+
2738+
Test ``limit``::
2739+
2740+
sage: factor(2990, limit=10)
2741+
2 * 5 * 299
27372742
"""
27382743
try:
27392744
m = n.factor

src/sage/misc/sageinspect.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ def sage_getargspec(obj):
14481448
annotations={})
14491449
sage: sage_getargspec(factor)
14501450
FullArgSpec(args=['n', 'proof', 'int_', 'algorithm', 'verbose'],
1451-
varargs=None, varkw='kwds', defaults=(None, False, 'pari', 0),
1451+
varargs=None, varkw='kwds', defaults=(None, False, None, 0),
14521452
kwonlyargs=[], kwonlydefaults=None, annotations={})
14531453
14541454
In the case of a class or a class instance, the :class:`FullArgSpec` of the
@@ -1808,7 +1808,7 @@ def sage_signature(obj):
18081808
sage: sage_signature(identity_matrix) # needs sage.modules
18091809
<Signature (ring, n=0, sparse=False)>
18101810
sage: sage_signature(factor)
1811-
<Signature (n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds)>
1811+
<Signature (n, proof=None, int_=False, algorithm=None, verbose=0, **kwds)>
18121812
18131813
In the case of a class or a class instance, the :class:`Signature` of the
18141814
``__new__``, ``__init__`` or ``__call__`` method is returned::
@@ -2671,8 +2671,8 @@ def __internal_tests():
26712671
26722672
A cython function with default arguments (one of which is a string)::
26732673
2674-
sage: sage_getdef(sage.rings.integer.Integer.factor, obj_name='factor')
2675-
"factor(algorithm='pari', proof=None, limit=None, int_=False, verbose=0)"
2674+
sage: sage_getdef(sage.rings.integer.Integer.binomial, obj_name='binomial')
2675+
"binomial(m, algorithm='gmp')"
26762676
26772677
This used to be problematic, but was fixed in :issue:`10094`::
26782678

src/sage/rings/integer.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3877,7 +3877,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
38773877
return x
38783878

38793879
def factor(self, algorithm=None, proof=None, limit=None, int_=False,
3880-
verbose=0, flint_bits=None):
3880+
verbose=0, *, flint_bits=None):
38813881
"""
38823882
Return the prime factorization of this integer as a
38833883
formal Factorization object.
@@ -4016,7 +4016,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
40164016

40174017
if limit is not None:
40184018
if algorithm is not None:
4019-
raise ValueError('trial division will always be used when when limit is provided')
4019+
raise ValueError('trial division will always be used when limit is provided')
40204020
from sage.rings.factorint import factor_trial_division
40214021
return factor_trial_division(self, limit)
40224022

0 commit comments

Comments
 (0)