Skip to content

Fix for Python 3.10: don't compare to sys.version string #2076

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/python/plotly/_plotly_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def iso_to_plotly_time_string(iso_string):

def template_doc(**names):
def _decorator(func):
if sys.version[:3] != "3.2":
if not sys.version_info[:2] == (3, 2):
Copy link
Contributor

Choose a reason for hiding this comment

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

should there be a [:2] in there? None of the changes in https://github.com/plotly/plotly.py/pull/2078/files include this index...

In fact, I think it might be nice to add this commit to #2078 and close this PR so we can merge it all at once, if you don't mind :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The [:2] is needed for == comparisons. It can be used but isn't required for >, >=, <, <= etc.

>>> sys.version_info
sys.version_info(major=3, minor=8, micro=1, releaselevel='final', serial=0)
>>> sys.version_info[:2]
(3, 8)
>>> sys.version_info[:2] == (3, 8)
True
>>> sys.version_info == (3, 8)
False
>>> sys.version_info >= (3, 8)
True
>>> sys.version_info[:2] >= (3, 8)
True
>>> sys.version_info >= (3, 9)
False
>>> sys.version_info[:2] >= (3, 9)
False

Yep, will combine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact, I think it might be nice to add this commit to #2078 and close this PR so we can merge it all at once, if you don't mind :)

Added, closing.

if func.__doc__ is not None:
func.__doc__ = func.__doc__.format(**names)
return func
Expand Down