fritzy/SleekXMPP — pull request #201 by elrond79 (2012-10-24 18:32:07+00:00)
Title: added setdefaultencoding method so reload(sys) not needed

This commit adds sleekxmpp.utils.misc_ops.setdefaultencoding, which allows setting of default encoding WITHOUT needing a reload(sys)

reload(sys) was causing problems for us in some applications, because it will reset sys.stdout, excepthook, displayhook, etc.

The new setdefaultencoding find the "original" sys.setdefaultencoding by searching through the list of objects kept by the garbage collector. The function is never actually garbage collected, so it works... presumably because it's a builtin function?