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

Replace str.removesuffix usage in domain_record module #229

Merged
merged 1 commit into from
Nov 8, 2022
Merged

Replace str.removesuffix usage in domain_record module #229

merged 1 commit into from
Nov 8, 2022

Conversation

smkent
Copy link
Contributor

@smkent smkent commented Nov 8, 2022

str.removesuffix is new in Python 3.9:
https://docs.python.org/3/library/stdtypes.html#str.removesuffix

Python 3.7 and 3.8 are still in support:
https://devguide.python.org/versions/

On Python 3.7 or 3.8, the domain_record module fails with failed to get domain record example.com: 'str' object has no attribute 'removesuffix'

Python 3.8 is the default version of Python on Ubuntu 20.04 which is how this issue was discovered.

This change replaces the only usage of str.removesuffix in this repository with a conditional slice to restore compatibility with Python 3.7 and 3.8. This replacement provides the same functionality.

`str.removesuffix` is new in Python 3.9:
https://docs.python.org/3/library/stdtypes.html#str.removesuffix

Python 3.7 and 3.8 are still in support:
https://devguide.python.org/versions/

On Python 3.7 or 3.8, the `domain_record` module fails with `failed to
get domain record example.com: 'str' object has no attribute
'removesuffix'`

Python 3.8 is the default version of Python on Ubuntu 20.04 which is how
this issue was discovered.

This change replaces the only usage of `str.removesuffix` in this
repository with a conditional slice to restore compatibility with Python
3.7 and 3.8. This replacement provides the same functionality.
Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

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

Tested locally and all seems to work as intended. Thanks for the contribution!

Once this is merged, we can cut a patch release to unblock Python 3.7 and 3.8 users.

@lgarber-akamai lgarber-akamai merged commit 6775390 into linode:main Nov 8, 2022
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.

3 participants