Skip to content

Fix error on importing Events in python3.11#2907

Merged
vfdev-5 merged 5 commits intopytorch:masterfrom
sadra-barikbin:Fix-event-enum-instance-creation-for-python311-issue-2904
Apr 14, 2023
Merged

Fix error on importing Events in python3.11#2907
vfdev-5 merged 5 commits intopytorch:masterfrom
sadra-barikbin:Fix-event-enum-instance-creation-for-python311-issue-2904

Conversation

@sadra-barikbin
Copy link
Copy Markdown
Collaborator

Fixes #2904

@github-actions github-actions bot added the module: engine Engine module label Apr 1, 2023
@vfdev-5 vfdev-5 marked this pull request as draft April 6, 2023 17:11
obj._value_ = value
return obj

def __repr__(self) -> str:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@sadra-barikbin is this really necesary ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

__repr__ wasn't necessary. I removed it. But __new__ is.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@vfdev-5 , from #2997 turns out it was necessary. Shall I add it as a follow-up or we should ask 3.11 users to update to 3.11.4?

vfdev-5 and others added 3 commits April 12, 2023 12:14
@vfdev-5 vfdev-5 marked this pull request as ready for review April 13, 2023 05:37
@vfdev-5
Copy link
Copy Markdown
Collaborator

vfdev-5 commented Apr 14, 2023

Thanks @sadra-barikbin !

From a discussion on discord:

As of python3.11's next release we could remove new from EventEnum, python/cpython#103479

@vfdev-5 vfdev-5 merged commit 95d3a38 into pytorch:master Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: engine Engine module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with Enum on Python3.11

2 participants