_auto_called cleanup (GH-22285)

(cherry picked from commit fc23a9483e)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
This commit is contained in:
Miss Islington (bot) 2020-09-16 17:27:09 -07:00 committed by GitHub
parent 48f99250ff
commit 4465df6266
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -104,9 +104,9 @@ class _EnumDict(dict):
# enum overwriting a descriptor?
raise TypeError('%r already defined as: %r' % (key, self[key]))
if isinstance(value, auto):
self._auto_called = True
if value.value == _auto_null:
value.value = self._generate_next_value(key, 1, len(self._member_names), self._last_values[:])
self._auto_called = True
value = value.value
self._member_names.append(key)
self._last_values.append(value)