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 josh.r
Recipients arigo, brandtbucher, josh.r, pablogsal, rhettinger, serhiy.storchaka, tim.peters
Date 2019-03-13.23:44:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1552520692.48.0.873982851219.issue36229@roundup.psfhosted.org>
In-reply-to
Content
I believe Tim Peters's concern with:

    Set1 = Set1 & Set2

is misplaced, because he's drawn an analogy with the string concatenation optimization, which *does* handle:

    Str1 = Str1 + Str2

because the optimization is in the ceval loop and can check the subsequent instruction for a "simple store", clearing the target's reference if the target and the left operand are the same thing. This change doesn't try to handle this case, so the only time the optimization takes place is when the only reference to the left hand operand is on the stack (not in any named variable at all).

Tim's concern *would* make it unsafe to extend this patch to apply the target clearing optimization, because at global scope, clearing the target would be observable from __hash__/__eq__ (and from other threads); str is safe because it holds the GIL the whole time, and can't invoke arbitrary Python level code that might release it, set doesn't have that guarantee.
History
Date User Action Args
2019-03-13 23:44:52josh.rsetrecipients: + josh.r, tim.peters, arigo, rhettinger, serhiy.storchaka, pablogsal, brandtbucher
2019-03-13 23:44:52josh.rsetmessageid: <1552520692.48.0.873982851219.issue36229@roundup.psfhosted.org>
2019-03-13 23:44:52josh.rlinkissue36229 messages
2019-03-13 23:44:52josh.rcreate