diff options
| author | Georg Brandl <georg@python.org> | 2006-02-22 11:30:06 +0000 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2006-02-22 11:30:06 +0000 |
| commit | 418a1ef0895e826c65d4113be5d86891c199e15d (patch) | |
| tree | 49980d54ed56d5d1a12e0e65b7ac02eb8ce8ac40 | |
| parent | df431657fd71f8f42becba9444dd73eab7dadfac (diff) | |
| download | cpython-git-418a1ef0895e826c65d4113be5d86891c199e15d.tar.gz | |
RFE #1436243: make integers in [0..256] preallocated.
| -rw-r--r-- | Lib/test/test_types.py | 4 | ||||
| -rw-r--r-- | Objects/intobject.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index 4abc7caafb..c575c0c931 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -90,6 +90,10 @@ else: raise TestFailed, 'long() does not round properly' if float(1) == 1.0 and float(-1) == -1.0 and float(0) == 0.0: pass else: raise TestFailed, 'float() does not work properly' print '6.4.1 32-bit integers' +# Ensure the first 256 integers are shared +a = 256 +b = 128*2 +if a is not b: raise TestFailed, '256 is not shared' if 12 + 24 != 36: raise TestFailed, 'int op' if 12 + (-24) != -12: raise TestFailed, 'int op' if (-12) + 24 != 12: raise TestFailed, 'int op' diff --git a/Objects/intobject.c b/Objects/intobject.c index 232b2d234a..352210c819 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -62,7 +62,7 @@ fill_free_list(void) } #ifndef NSMALLPOSINTS -#define NSMALLPOSINTS 100 +#define NSMALLPOSINTS 257 #endif #ifndef NSMALLNEGINTS #define NSMALLNEGINTS 5 |
