Skip to content

BUG: Make docscrape ParseError Python 3 compatible. #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2017

Conversation

ehebert
Copy link
Contributor

@ehebert ehebert commented Apr 4, 2017

Fix __str__ for ParseError in Python 3, which was resulting in error
messages with numpydoc.docscrape.ParseError: <unprintable ParseError object>
instead of the intended descriptive message.

Use args[0] instead of Exception's message member, which had been removed
in Python 3. args is available to both Python 2 and 3. The __str__ method
had been failing on an AttributeError when using self.message, resulting in
an unprintable Exception, which occluded the offending typo in a function name
which triggered theParseError.

Fix `__str__` for `ParseError` in Python 3, which was resulting in error
messages with `numpydoc.docscrape.ParseError: <unprintable ParseError object>`
instead of the intended descriptive message.

Use `args[0]` instead of `Exception`'s `message` member, which had been removed
in Python 3. `args` is available to both Python 2 and 3. The `__str__` method
had been failing on an `AttributeError` when using `self.message`, resulting in
an unprintable Exception, which occluded the offending typo in a function name
which triggered the`ParseError`.
@stefanv
Copy link
Contributor

stefanv commented Apr 4, 2017

I'm probably not the right person to review this. @Carreau, can you give a hand?

Copy link
Contributor

@jschueller jschueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rgommers rgommers merged commit 62cb39d into numpy:master Jun 18, 2017
@rgommers
Copy link
Member

LGTM, merged. Thanks @ehebert

@ehebert ehebert deleted the fix-parser-error-message branch June 19, 2017 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants