File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments