◐ Shell
clean mode source ↗

Message 209376 - Python tracker

Question:

What is the point of the

        old_encoding = codecs.lookup(self._encoding).name
        encoding = codecs.lookup(encoding).name
        if encoding == old_encoding and errors == self._errors:
            # no change
            return

dance? Isn't this equivalent to

        if encoding == self.encoding and errors == self._errors:
            # no change
            return

except that it doesn't validate the given encoding? But if the encoding is invalid, isn't it enough that the exception is raised a few lines further down?