Skip to content

Commit 6f93fd3

Browse files
committed
Add typing literals for older Python versions
1 parent 8ff5613 commit 6f93fd3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

fortls/parse_fortran.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
import os
66
import re
77
import sys
8-
from typing import Literal
8+
9+
# Python < 3.8 does not have typing.Literals
10+
try:
11+
from typing import Literal
12+
except ImportError:
13+
from typing_extensions import Literal
914

1015
from fortls.constants import (
1116
DO_TYPE_ID,

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ packages = find:
3333
python_requires = >= 3.7
3434
install_requires =
3535
importlib-metadata; python_version < "3.8"
36+
typing-extensions; python_version < "3.8"
3637

3738
[options.package_data]
3839
fortls = *.json

0 commit comments

Comments
 (0)