Author vstinner
Recipients brett.cannon, lemburg, ncoghlan, pitrou, python-dev, serhiy.storchaka, vstinner, zach.ware
Date 2014-09-15.13:19:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1410787150.57.0.644026653048.issue22166@psf.upfronthosting.co.za>
In-reply-to
Content
IMO test_codecs_fix1.patch is still needed.

Review of Nick's change:

+    interp = PyThreadState_GET()->interp;
+    if (interp->codec_search_path == NULL) {
+        return -1;
+    }

I don't think that this line raises an exception. You should use an assertion here (or raises an exception, but it would be overkill).

+        encodings._cache.pop(self.codec_name, None)
+        try:
+            _forget_codec(self.codec_name)
+        except KeyError:
+            pass

You may move these lines to a private encoding._forget() function.

By the way, codecs._forget() should maybe catch and ignore KeyError?

>          _TEST_CODECS.pop(self.codec_name, None)

This line may be moved to set_codec() using self.addCleanup(). (Well, it's not directly related to your change.)
History
Date User Action Args
2014-09-15 13:19:10vstinnersetrecipients: + vstinner, lemburg, brett.cannon, ncoghlan, pitrou, python-dev, zach.ware, serhiy.storchaka
2014-09-15 13:19:10vstinnersetmessageid: <1410787150.57.0.644026653048.issue22166@psf.upfronthosting.co.za>
2014-09-15 13:19:10vstinnerlinkissue22166 messages
2014-09-15 13:19:10vstinnercreate