Skip to content

Fix enum py310 - #985

Closed
tacaswell wants to merge 3 commits into
bluesky:masterfrom
tacaswell:fix_enum_py310
Closed

tacaswell wants to merge 3 commits into
bluesky:masterfrom
tacaswell:fix_enum_py310

Conversation

@tacaswell

@tacaswell tacaswell commented May 4, 2021 •

Copy link
Copy Markdown
Contributor

We may want to take this as an opportunity to re-think the Kind enum?

Python 3.10 makes a number of changes to Enum and its sub-classes. Under the new default behavior of IntFlag the fact that we have 0b1b1 as a flag, but not 0b100 is considered a class definition time error (preventing import of ophyd).

This opts back into allowing our (unorthodox) definition to import again and hides the new features behind a version gate.

python/cpython#24215

tacaswell added 2 commits May 3, 2021 21:41
Python 3.10 makes a number of changes to Enum and its sub-classes.  Under
the new default behavior of IntFlag the fact that we have `0b1b1` as a
flag, but not `0b100` is considered a class definition time error (preventing
import of ophyd).

This opts back into allowing our (unorthodox) definition to import again and
hides the new features behind a version gate.

python/cpython#24215
@tacaswell
tacaswell requested review from klauer and prjemian May 4, 2021 01:50
@klauer

klauer commented May 4, 2021

Copy link
Copy Markdown
Contributor

Some rethinking of the enum will indeed be necessary (see previous PR/issue attempting to change the values), but agreement on what should be done will be the tough part.

@tacaswell

Copy link
Copy Markdown
Contributor Author

...but agreement on what should be done will be the tough part.

Is that not always the case ?

@prjemian prjemian left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Anything that makes Kind easier to understand will be welcome. I am not committed to anything other than the single name use cases (omitted, config, normal, hinted, and not the multiple cases such as this contrived example: omitted | config).

@tacaswell

Copy link
Copy Markdown
Contributor Author

In practice we seem to have a simple ordering of OMITTED < CONFIG < NORMAL < HINTED, maybe we can switch from intflag to a normal enum?

@tacaswell
tacaswell marked this pull request as draft June 4, 2021 22:39
@tacaswell

Copy link
Copy Markdown
Contributor Author

It looks like upstream is going to back off of this change (by default) https://bugs.python.org/issue44242#msg394593 so this should be put on hold.

@tacaswell

Copy link
Copy Markdown
Contributor Author

This did get reverted upstream, closing.

@tacaswell tacaswell closed this Aug 31, 2021
@tacaswell
tacaswell deleted the fix_enum_py310 branch August 31, 2021 16:42
@tacaswell
tacaswell restored the fix_enum_py310 branch April 5, 2022 22:45
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