mirror of
https://github.com/davidhalter/parso.git
synced 2026-09-27 13:42:22 +08:00
Compare commits
5
Commits
23b1cdf73d
...
v0.8.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be9f5a401f | ||
|
|
7e4777b775 | ||
|
|
e99dbdd536 | ||
|
|
e22dc67aa1 | ||
|
|
baa3c90d85 |
@@ -6,6 +6,11 @@ Changelog
|
|||||||
Unreleased
|
Unreleased
|
||||||
++++++++++
|
++++++++++
|
||||||
|
|
||||||
|
0.8.5 (2025-08-23)
|
||||||
|
++++++++++++++++++
|
||||||
|
|
||||||
|
- Add a fallback grammar for Python 3.14+
|
||||||
|
|
||||||
0.8.4 (2024-04-05)
|
0.8.4 (2024-04-05)
|
||||||
++++++++++++++++++
|
++++++++++++++++++
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ from parso.grammar import Grammar, load_grammar
|
|||||||
from parso.utils import split_lines, python_bytes_to_unicode
|
from parso.utils import split_lines, python_bytes_to_unicode
|
||||||
|
|
||||||
|
|
||||||
__version__ = '0.8.4'
|
__version__ = '0.8.5'
|
||||||
|
|
||||||
|
|
||||||
def parse(code=None, **kwargs):
|
def parse(code=None, **kwargs):
|
||||||
|
|||||||
+10
-1
@@ -239,7 +239,16 @@ def load_grammar(*, version: str = None, path: str = None):
|
|||||||
:param str version: A python version string, e.g. ``version='3.8'``.
|
:param str version: A python version string, e.g. ``version='3.8'``.
|
||||||
:param str path: A path to a grammar file
|
:param str path: A path to a grammar file
|
||||||
"""
|
"""
|
||||||
version_info = parse_version_string(version)
|
# NOTE: this (3, 14) should be updated to the latest version parso supports.
|
||||||
|
# (if this doesn't happen, users will get older syntaxes and spurious warnings)
|
||||||
|
passed_version_info = parse_version_string(version)
|
||||||
|
version_info = min(passed_version_info, PythonVersionInfo(3, 14))
|
||||||
|
|
||||||
|
# # NOTE: this is commented out until parso properly supports newer Python grammars.
|
||||||
|
# if passed_version_info != version_info:
|
||||||
|
# warnings.warn('parso does not support %s.%s yet.' % (
|
||||||
|
# passed_version_info.major, passed_version_info.minor
|
||||||
|
# ))
|
||||||
|
|
||||||
file = path or os.path.join(
|
file = path or os.path.join(
|
||||||
'python',
|
'python',
|
||||||
|
|||||||
@@ -10,3 +10,6 @@ norecursedirs = .* docs scripts normalizer_issue_files build
|
|||||||
# fine as long as we are using `clean_jedi_cache` as a session scoped
|
# fine as long as we are using `clean_jedi_cache` as a session scoped
|
||||||
# fixture.
|
# fixture.
|
||||||
usefixtures = clean_parso_cache
|
usefixtures = clean_parso_cache
|
||||||
|
|
||||||
|
# Disallow warnings
|
||||||
|
filterwarnings = error
|
||||||
|
|||||||
@@ -4,15 +4,20 @@ from parso import utils
|
|||||||
|
|
||||||
|
|
||||||
def test_load_inexisting_grammar():
|
def test_load_inexisting_grammar():
|
||||||
# This version shouldn't be out for a while, but if we ever do, wow!
|
# We support future grammars assuming future compatibility,
|
||||||
with pytest.raises(NotImplementedError):
|
# but we don't know how to parse old grammars.
|
||||||
load_grammar(version='15.8')
|
|
||||||
# The same is true for very old grammars (even though this is probably not
|
|
||||||
# going to be an issue.
|
|
||||||
with pytest.raises(NotImplementedError):
|
with pytest.raises(NotImplementedError):
|
||||||
load_grammar(version='1.5')
|
load_grammar(version='1.5')
|
||||||
|
|
||||||
|
|
||||||
|
def test_load_grammar_uses_older_syntax():
|
||||||
|
load_grammar(version='4.0')
|
||||||
|
|
||||||
|
|
||||||
|
def test_load_grammar_doesnt_warn(each_version):
|
||||||
|
load_grammar(version=each_version)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(('string', 'result'), [
|
@pytest.mark.parametrize(('string', 'result'), [
|
||||||
('2', (2, 7)), ('3', (3, 6)), ('1.1', (1, 1)), ('1.1.1', (1, 1)), ('300.1.31', (300, 1))
|
('2', (2, 7)), ('3', (3, 6)), ('1.1', (1, 1)), ('1.1.1', (1, 1)), ('300.1.31', (300, 1))
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user