[Bug 21024] New: "import gtk" changes sys.getdefaultencoding()

bugzilla-daemon at bugzilla.ubuntu.com bugzilla-daemon at bugzilla.ubuntu.com
Thu Dec 15 00:54:14 UTC 2005

Please do not reply to this email.  You can add comments at
Ubuntu | python-gtk2

           Summary: "import gtk" changes sys.getdefaultencoding()
           Product: Ubuntu
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python-gtk2
        AssignedTo: seb128 at ubuntu.com
        ReportedBy: andrew at canonical.com
         QAContact: desktop-bugs at lists.ubuntu.com

>>> import sys
>>> print sys.getdefaultencoding()
>>> import gtk
>>> print sys.getdefaultencoding()

This is bad.  It is generally a bad idea for a library to change global state
that may break other libraries; it's worse that it does this as a side-effect of
merely being imported.  sys.setdefaultencoding is also generally considered a
misfeature by the Python developers, and changing the default encoding from
'ascii' (except perhaps to 'undefined') is asking for potential bugs to be
hidden, rather than raising exceptions when you'd expect.  There's a reason
sys.setdefaultencoding is not accessible by default.

Configure bugmail: http://bugzilla.ubuntu.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.

More information about the desktop-bugs mailing list