Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d72c7b6

Browse files
committed
Add ..versionadded for sys.int_info, update py3k version of
whatsnew/2.7.rst to keep it in sync with the trunk version, and replace SHIFT with PyLong_SHIFT in #error message
1 parent 0ef2cf6 commit d72c7b6

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

Doc/library/sys.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ always available.
429429
| | represent a digit |
430430
+-------------------------+----------------------------------------------+
431431

432+
.. versionadded:: 3.1
433+
432434

433435
.. function:: intern(string)
434436

Doc/whatsnew/2.7.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,30 @@ Some smaller changes made to the core Python language are:
8686
(Contributed by Fredrik Johansson and Victor Stinner; :issue:`3439`.)
8787

8888

89+
* Integers are now stored internally either in base 2**15 or in base
90+
2**30, the base being determined at build time. Previously, they
91+
were always stored in base 2**15. Using base 2**30 gives
92+
significant performance improvements on 64-bit machines, but
93+
benchmark results on 32-bit machines have been mixed. Therefore,
94+
the default is to use base 2**30 on 64-bit machines and base 2**15
95+
on 32-bit machines; on Unix, there's a new configure option
96+
--enable-big-digits that can be used to override this default.
97+
98+
Apart from the performance improvements this change should be
99+
invisible to end users, with one exception: for testing and
100+
debugging purposes there's a new structseq ``sys.long_info`` that
101+
provides information about the internal format, giving the number of
102+
bits per digit and the size in bytes of the C type used to store
103+
each digit::
104+
105+
>>> import sys
106+
>>> sys.long_info
107+
sys.long_info(bits_per_digit=30, sizeof_digit=4)
108+
109+
110+
(Contributed by Mark Dickinson; :issue:`4258`.)
111+
112+
89113
.. ======================================================================
90114
91115

Include/longintrepr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ typedef long stwodigits; /* signed variant of twodigits */
6767
#define PyLong_MASK ((digit)(PyLong_BASE - 1))
6868

6969
#if PyLong_SHIFT % 5 != 0
70-
#error "longobject.c requires that SHIFT be divisible by 5"
70+
#error "longobject.c requires that PyLong_SHIFT be divisible by 5"
7171
#endif
7272

7373
/* Long integer representation.

0 commit comments

Comments
 (0)