Skip to content

Commit f43e339

Browse files
committed
update docs
1 parent aaf84e1 commit f43e339

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/sage/repl/preparse.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,8 +1124,9 @@ def preparse_numeric_literals(code, extract=False, quotes="'"):
11241124
name-construction pairs
11251125
11261126
- ``quotes`` -- string (default: ``"'"``); used to surround string
1127-
arguments to RealNumber and ComplexNumber. If ``None``, will rebuild
1128-
the string using a list of its Unicode code-points.
1127+
arguments to RealNumber and ComplexNumber, and Integer when the
1128+
number is longer than 4300 digits. If ``None``, will rebuild the
1129+
string using a list of its Unicode code-points.
11291130
11301131
OUTPUT:
11311132
@@ -1188,6 +1189,12 @@ def preparse_numeric_literals(code, extract=False, quotes="'"):
11881189
'Integer(42)'
11891190
sage: preparse_numeric_literals('000042')
11901191
'Integer(42)'
1192+
sage: preparse_numeric_literals("1" * 4300) == f"Integer({"1" * 4300})"
1193+
True
1194+
sage: preparse_numeric_literals("1" * 4301) == f"Integer({"1" * 4301})"
1195+
False
1196+
sage: preparse_numeric_literals("1" * 4301) == f"Integer('{"1" * 4301}')"
1197+
True
11911198
11921199
Test underscores as digit separators (PEP 515,
11931200
https://www.python.org/dev/peps/pep-0515/)::
@@ -1253,6 +1260,10 @@ def preparse_numeric_literals(code, extract=False, quotes="'"):
12531260
'RealNumber(str().join(map(chr, [51, 46, 49, 52])))'
12541261
sage: preparse_numeric_literals('5j', quotes=None)
12551262
'ComplexNumber(0, str().join(map(chr, [53])))'
1263+
sage: preparse_numeric_literals("1" * 4301, quotes=None) == f'Integer(str().join(map(chr, {[49] * 4301})))'
1264+
True
1265+
sage: preparse_numeric_literals("1" * 4301, quotes="'''") == f"Integer('''{"1" * 4301}''')"
1266+
True
12561267
"""
12571268
literals = {}
12581269
last = 0

0 commit comments

Comments
 (0)