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 terry.reedy
Recipients Saimadhav.Heblikar, jesstess, python-dev, taleinat, terry.reedy
Date 2014-07-10.07:58:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1404979121.85.0.00516013376996.issue21940@psf.upfronthosting.co.za>
In-reply-to
Content
Attached is the 3.4 code I plan to commit after a trivial 2.7 backport. 

In the existing htest, 'global previous_tcl_fcn' is unnecessary because of Python's late binding of function locals. No forward definitions are needed. Already deleted in the first patch.

Adding this test:
    def test_unregister_no_attribute(self):
        del self.text.insert
        self.assertEqual(self.redir.unregister('insert'), self.func)
revealed that this code in .unregister
            if hasattr(self.widget, operation):
                delattr(self.widget, operation)
is buggy because hasattr looks up the class tree for an attribute whereas delattr does not. Hence the former can be true, and will be after text.insert in deleted to unmask Text.insert, while delattr raises AttributeError. The if check is useless, and replaced by 'try...' in the new patch.

I modified a few tests and added a few more. Coverage is now 100%.
History
Date User Action Args
2014-07-10 07:58:41terry.reedysetrecipients: + terry.reedy, taleinat, jesstess, python-dev, Saimadhav.Heblikar
2014-07-10 07:58:41terry.reedysetmessageid: <1404979121.85.0.00516013376996.issue21940@psf.upfronthosting.co.za>
2014-07-10 07:58:41terry.reedylinkissue21940 messages
2014-07-10 07:58:41terry.reedycreate