diff options
author | Ben Bangert <ben@groovie.org> | 2020-10-13 19:24:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-13 19:24:22 -0700 |
commit | d3fc41c3c89b55082530dc275ffdbfdfaadf1a2f (patch) | |
tree | bb2a0368a07f18e3a1f003a692b2ad547e955458 | |
parent | 620045e761f9b967026538ffb00fdd2e8216618c (diff) | |
parent | 723b071f26bdd62fb2e13e1226cef126c30fa18f (diff) | |
download | routes-d3fc41c3c89b55082530dc275ffdbfdfaadf1a2f.tar.gz |
Merge pull request #99 from bbangert/feat/python-3-compats
feat: add python 3.6+ compat
-rw-r--r-- | .github/workflows/python-package.yml | 4 | ||||
-rw-r--r-- | routes/route.py | 9 | ||||
-rw-r--r-- | setup.py | 5 |
3 files changed, 15 insertions, 3 deletions
diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 52a7118..96dcc11 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -18,7 +18,11 @@ jobs: - 2.7 - 3.5 - 3.6 + - 3.7 + - 3.8 + - 3.9 - pypy2 + - pypy3 env: TOX_PARALLEL_NO_SPINNER: 1 diff --git a/routes/route.py b/routes/route.py index cf6df10..719636a 100644 --- a/routes/route.py +++ b/routes/route.py @@ -364,7 +364,6 @@ class Route(object): self.prior = part (rest, noreqs, allblank) = self.buildnextreg(path[1:], clist, include_names) - if isinstance(part, dict) and part['type'] in (':', '.'): var = part['name'] typ = part['type'] @@ -502,7 +501,13 @@ class Route(object): reg += ')?' else: allblank = False - reg = re.escape(part) + rest + # Starting in Python 3.7, the / is no longer escaped, however quite a bit of + # route generation code relies on it being escaped. This forces the escape in + # Python 3.7+ so that the remainder of the code functions as intended. + if part == '/': + reg = r'\/' + rest + else: + reg = re.escape(part) + rest # We have a normal string here, this is a req, and it prevents us from # being all blank @@ -46,7 +46,10 @@ setup(name="Routes", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6" + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9" ], keywords='routes webob dispatch', author="Ben Bangert", |