This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients brett.cannon, pitrou, vstinner, zach.ware
Date 2017-09-01.00:58:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1504227538.45.0.559234534715.issue31217@psf.upfronthosting.co.za>
In-reply-to
Content
+    int_pool = {i: i for i in range(-1000, 1000)}
+    def get_pooled_int(v):
+        return int_pool.setdefault(v, v)

I'm not sure that I understand this code. It makes sure that you get a single object in memory for the same integer, and not only for Python "small integer singletons"?

About the -1000..1000 range: if a function leaks more than 1 memory block or more than 1 reference, there is already something wrong no?

Maybe it's ok to only care of values -1, 0 and 1 :-) My code only cares of Python small integer singletons.

I have no strong preference between my code or yours. I only care of fixing the buildbot :-) What do you prefer, Antoine?
History
Date User Action Args
2017-09-01 00:58:58vstinnersetrecipients: + vstinner, brett.cannon, pitrou, zach.ware
2017-09-01 00:58:58vstinnersetmessageid: <1504227538.45.0.559234534715.issue31217@psf.upfronthosting.co.za>
2017-09-01 00:58:58vstinnerlinkissue31217 messages
2017-09-01 00:58:58vstinnercreate