reimplement enum.auto() for compatibility with older python 3 versions

This commit is contained in:
Pavel Demin 2019-10-05 11:46:05 +02:00
parent 3f5db406eb
commit ff1cf81380
1 changed files with 15 additions and 1 deletions

16
ast.py
View File

@ -1,6 +1,20 @@
# fx-92 Scientifique Collège+ language interpreter: AST definition
import aenum as enum
import enum
def auto_builder():
number = 0
def auto():
nonlocal number
number += 1
return number
return auto
try:
enum.auto()
except AttributeError:
enum.auto = auto_builder()
del auto_builder
#---
# Internal AST node representation