Author simon.percivall
Recipients ethan.furman, simon.percivall
Date 2017-01-07.18:39:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483814394.92.0.80531432637.issue29167@psf.upfronthosting.co.za>
In-reply-to
Content
Run this a couple of times (it fails for me the first time, but it's a race, so YMMV):

```
import enum
from concurrent.futures import ThreadPoolExecutor


class MyEnum(enum.IntFlag):
    one = 1


with ThreadPoolExecutor() as executor:
    print(list(executor.map(MyEnum.one.__or__, range(1000))))
```

An easy fix would be:

```
diff --git a/Lib/enum.py b/Lib/enum.py
index e79b0382eb..eca56ec3a7 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -846,7 +846,7 @@ def _decompose(flag, value):
         # check for named flags and powers-of-two flags
         flags_to_check = [
                 (m, v)
-                for v, m in flag._value2member_map_.items()
+                for v, m in list(flag._value2member_map_.items())
                 if m.name is not None or _power_of_two(v)
                 ]
     members = []
```
History
Date User Action Args
2017-01-07 18:39:55simon.percivallsetrecipients: + simon.percivall, ethan.furman
2017-01-07 18:39:54simon.percivallsetmessageid: <1483814394.92.0.80531432637.issue29167@psf.upfronthosting.co.za>
2017-01-07 18:39:54simon.percivalllinkissue29167 messages
2017-01-07 18:39:54simon.percivallcreate