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 brett.cannon
Recipients brett.cannon, eli.bendersky, ethan.furman, gvanrossum, ncoghlan, rhettinger
Date 2013-05-12.16:32:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1368376369.6.0.450829809769.issue17963@psf.upfronthosting.co.za>
In-reply-to
Content
If you read the docs for sys._getframe() (http://docs.python.org/3/library/sys.html#sys._getframe) we explicitly state that the function should be considered an implementation detail for CPython. While Nick doesn't want to argue from the VM angle, I will.

I would prefer to not rely on this hack in the stdlib to not put the other VMs at a disadvantage. Nick also has a good point that it is at best a heuristic as you can fool it into using the wrong result.

At minimum I think the keyword argument for the module being used should be provided and documented that if it isn't provided then pickling is wishy-washy based on how you call the function and that it is not cross-VM compatible. But knowing that users won't clearly read the docs if it just happens to work in the interpreter and that is partial luck because of the possible indirection issue Nick pointed out, I think it would be better to not rely upon sys._getframe() and just ask people to explicitly specify the module if they happen to care about pickling *and* are using the functional API for enums.
History
Date User Action Args
2013-05-12 16:32:49brett.cannonsetrecipients: + brett.cannon, gvanrossum, rhettinger, ncoghlan, eli.bendersky, ethan.furman
2013-05-12 16:32:49brett.cannonsetmessageid: <1368376369.6.0.450829809769.issue17963@psf.upfronthosting.co.za>
2013-05-12 16:32:49brett.cannonlinkissue17963 messages
2013-05-12 16:32:49brett.cannoncreate