homepage

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 BreamoreBoy, David MacIver, Kevin Shweh, Tijs Van Oevelen, abarry, arigo, donmez, ezio.melotti, fijall, ncoghlan, r.david.murray, rhettinger, serhiy.storchaka, torsten, vstinner
Date 2015年12月14日.16:55:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1450112130.82.0.935418762227.issue25843@psf.upfronthosting.co.za>
In-reply-to
Content
compiler_add_o() uses an heuristic to compare and merge duplicated constants. It has special cases for float and complex numbers, but it's not designed to handle more types.
Funny, I had the same isue last week why I added support for tuple and frozenset "constants" in AST. I had to explicitly support these types in compiler_add_o().
I see two options:
(1) share code between compiler_add_o() and code_richcompare() to ensure that 1 and 1.0 constants are not seen as equal
(2) modify compiler_add_o() to never merge code objects, always considere them as unequal
For (2), there is a minor technical issue: you have to generate an unique key for the dictionary.
I prefer option (1) for consistency.
History
Date User Action Args
2015年12月14日 16:55:30vstinnersetrecipients: + vstinner, arigo, rhettinger, ncoghlan, donmez, ezio.melotti, r.david.murray, torsten, BreamoreBoy, fijall, serhiy.storchaka, David MacIver, abarry, Kevin Shweh, Tijs Van Oevelen
2015年12月14日 16:55:30vstinnersetmessageid: <1450112130.82.0.935418762227.issue25843@psf.upfronthosting.co.za>
2015年12月14日 16:55:30vstinnerlinkissue25843 messages
2015年12月14日 16:55:30vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /