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 soupytwist
Recipients soupytwist
Date 2018-02-02.18:37:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1517596667.28.0.467229070634.issue32750@psf.upfronthosting.co.za>
In-reply-to
Content
The log_error method in refactor.RefactoringTool raises the exception:

    def log_error(self, msg, *args, **kwds):
        """Called when an error occurs."""
        raise

but every usage of it implies that it does not, e.g:

    def refactor_string(self, data, name):
        """Refactor a given input string.
        Args:
            data: a string holding the code to be refactored.
            name: a human-readable name for use in error/log messages.
        Returns:
            An AST corresponding to the refactored input stream; None if
            there were errors during the parse.
        """
        # [..]
        try:
            tree = self.driver.parse_string(data)
        except Exception as err:
            self.log_error("Can't parse %s: %s: %s",
                           name, err.__class__.__name__, err)
            return
        finally:
        # [..]

This is the only explicit conflict I found in the documentation. From looking at the refactor_string function, it seems it should never raise on parse errors. Other uses of it are followed immediately by a return.

I'd like to see log_error only log the exception and continue.
History
Date User Action Args
2018-02-02 18:37:47soupytwistsetrecipients: + soupytwist
2018-02-02 18:37:47soupytwistsetmessageid: <1517596667.28.0.467229070634.issue32750@psf.upfronthosting.co.za>
2018-02-02 18:37:47soupytwistlinkissue32750 messages
2018-02-02 18:37:47soupytwistcreate