Skip to content
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

Add default message attribute #7

Closed
wants to merge 2 commits into from
Closed

Add default message attribute #7

wants to merge 2 commits into from

Conversation

kstark
Copy link
Contributor

@kstark kstark commented Feb 9, 2022

The message attribute on ValueError has been deprecated since 2.6 and removed in Python 3. Explicitly add it ourselves for our subclasses. Fixes #2

The `message` attribute on ValueError has been deprecated since 2.6 and removed in Python 3. Explicitly add it ourselves for our subclasses. Fixes #2
Comment on lines +29 to 34

def __init__(self, message=None):
self.message = message

def __str__(self):
return self.message
Copy link
Contributor

Choose a reason for hiding this comment

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

This class provides no additional functionality, so we should remove its body entirely so it defers to ValueError for all behavior.

Suggested change
def __init__(self, message=None):
self.message = message
def __str__(self):
return self.message

@kstark
Copy link
Contributor Author

kstark commented Feb 9, 2022

Obsoleted by #8

@kstark kstark closed this Feb 9, 2022
@dargueta dargueta deleted the kstark-patch-1 branch February 9, 2022 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

str() on a FixedLengthError instance crashes with AttributeError
2 participants