Skip to content

Commit

Permalink
Merge pull request #443 from pbehnke/main
Browse files Browse the repository at this point in the history
Fix python3.9 support
  • Loading branch information
MatthieuDartiailh authored Feb 22, 2021
2 parents 23a5633 + 5a60fd3 commit c821935
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion enaml/core/parser/base_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2652,7 +2652,7 @@ def p_subscript1(self, p):
''' subscript : ELLIPSIS '''
p[0] = ast.Ellipsis()

def p_subcript2(self, p):
def p_subscript2(self, p):
''' subscript : test '''
p[0] = ast.Index(value=p[1])

Expand Down
21 changes: 14 additions & 7 deletions enaml/core/parser/parser39.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#------------------------------------------------------------------------------
# Copyright (c) 2020, Nucleic Development Team.
# Copyright (c) 2020-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
import ast

from .base_parser import FakeToken, Store, ast_for_testlist, syntax_error
from .base_parser import Load
from .parser38 import Python38EnamlParser


Expand All @@ -22,25 +22,32 @@ class Python39EnamlParser(Python38EnamlParser):
"""
parser_id = '39'

# PEP 614, relaxed grammar restrictions on decorators.

def p_decorator4(self, p):
''' decorator : AT namedexpr_test NEWLINE '''
p[0] = namedexpr_test
p[0] = p[1]

# slice, Index and ExtSlice are considered deprecated and will be removed
# in future Python versions. value itself should be used instead of
# Index(value). Tuple(slices, Load()) should be used instead of
# ExtSlice(slices).

def p_subcript2(self, p):
def p_subscript2(self, p):
''' subscript : test '''
p[0] = p[1]

def p_subscriptlist2(self, p):
''' subscriptlist : subscript COMMA '''
dims = [p[1]]
p[0] = ast.Tuple(dims, Load())
p[0] = ast.Tuple(dims, Load)

def p_subscriptlist3(self, p):
''' subscriptlist : subscript subscriptlist_list '''
dims = [p[1]] + p[2]
p[0] = ast.Tuple(dims, Load())
p[0] = ast.Tuple(dims, Load)

def p_subscriptlist4(self, p):
''' subscriptlist : subscript subscriptlist_list COMMA '''
dims = [p[1]] + p[2]
p[0] = ast.Tuple(dims, Load())
p[0] = ast.Tuple(dims, Load)
1 change: 1 addition & 0 deletions releasenotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Dates are written as DD/MM/YYYY

0.13.0 - unreleased
-------------------
- fix Python 3.9 only syntax issue PR #443
- make app editor more resilient to errors PR #440
- fixes to vim synatx highlighting PR #439
- fix documentation of ScrollArea example PR #438
Expand Down

0 comments on commit c821935

Please sign in to comment.