Skip to content

Commit

Permalink
add Final to enum parent
Browse files Browse the repository at this point in the history
Summary: Similar to union, lack of `Final` on the `.value` and `.name` attributes of py3 Enum seems to cause pyre bug in "heap refinement" where pyre assumes some other thread changes the value.

Reviewed By: yfeldblum

Differential Revision: D64157394

fbshipit-source-id: 3be7f0dac23a38394d6af1fb74d102c3f35eae28
  • Loading branch information
ahilger authored and facebook-github-bot committed Oct 10, 2024
1 parent 1c5bb41 commit 672485f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions thrift/lib/py3/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import enum
from typing import (
Any,
Final,
Iterable,
Iterator,
Mapping,
Expand Down Expand Up @@ -83,8 +84,8 @@ class EnumMeta(type):
def __members__(self: Type[_T]) -> Mapping[str, _T]: ...

class Enum(metaclass=EnumMeta):
name: str
value: int
name: Final[str]
value: Final[int]
def __getattr__(self: eT, name: str) -> eT: ...
def __init__(self: eT, value: tUnion[eT, int]) -> None: ... # __call__ for meta
def __repr__(self) -> str: ...
Expand Down

0 comments on commit 672485f

Please sign in to comment.