-
Notifications
You must be signed in to change notification settings - Fork 2
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 compatibility to python 3.8 #2
Conversation
Why not add a simple |
Sounds good. I adapted the PR. Thanks! |
@@ -39,7 +40,8 @@ def _clone_function(self, function): | |||
|
|||
trait["co_argcount"] = function.__code__.co_argcount | |||
trait["co_kwonlyargcount"] = function.__code__.co_kwonlyargcount | |||
trait["co_posonlyargcount"] = function.__code__.co_posonlyargcount | |||
if sys.version_info[0] == 3 and sys.version_info[1] >= 8: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sys.version_info[:2] >= (3, 8)
is more common, because way more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, this is a nice and compact test.
@@ -40,7 +40,7 @@ def _clone_function(self, function): | |||
|
|||
trait["co_argcount"] = function.__code__.co_argcount | |||
trait["co_kwonlyargcount"] = function.__code__.co_kwonlyargcount | |||
if sys.version_info[0] == 3 and sys.version_info[1] >= 8: | |||
if sys.version_info[:1] >= (3, 8) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
must be :2 sorry I thought I had fixed that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I thought the slice indices to be inclusive, which is apparently not true. (Your suggestion above was correct.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh dear... this been here a while. Thank you a lot, I appreciate the effort! I stumbled similar error yesterday in different context.
py3traits stops working for python 3.8. With the change proposed in this PR py3traits works for 3.8 again.