reimplement enum.auto() for compatibility with older python 3 versions
This commit is contained in:
parent
3f5db406eb
commit
ff1cf81380
16
ast.py
16
ast.py
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue