aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/parso/py3/patches/01-arcadia.patch
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/python/parso/py3/patches/01-arcadia.patch
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/parso/py3/patches/01-arcadia.patch')
-rw-r--r--contrib/python/parso/py3/patches/01-arcadia.patch222
1 files changed, 111 insertions, 111 deletions
diff --git a/contrib/python/parso/py3/patches/01-arcadia.patch b/contrib/python/parso/py3/patches/01-arcadia.patch
index adabd429a1..220d1264d6 100644
--- a/contrib/python/parso/py3/patches/01-arcadia.patch
+++ b/contrib/python/parso/py3/patches/01-arcadia.patch
@@ -1,111 +1,111 @@
---- contrib/python/parso/py3/parso/cache.py (index)
-+++ contrib/python/parso/py3/parso/cache.py (working tree)
-@@ -135,6 +135,8 @@ def load_module(hashed_grammar, file_io, cache_path=None):
- def _load_from_file_system(hashed_grammar, path, p_time, cache_path=None):
- cache_path = _get_hashed_path(hashed_grammar, path, cache_path=cache_path)
- try:
-+ # SUBBOTNIK-2721 - Для безопасности отключаем загрузку с диска
-+ raise FileNotFoundError
- if p_time > os.path.getmtime(cache_path):
- # Cache is outdated
- return None
---- contrib/python/parso/py3/parso/file_io.py (index)
-+++ contrib/python/parso/py3/parso/file_io.py (working tree)
-@@ -2,6 +2,8 @@ import os
- from pathlib import Path
- from typing import Union
-
-+import __res as res
-+
-
- class FileIO:
- def __init__(self, path: Union[os.PathLike, str]):
-@@ -13,6 +15,9 @@ class FileIO:
- # We would like to read unicode here, but we cannot, because we are not
- # sure if it is a valid unicode file. Therefore just read whatever is
- # here.
-+ data = res.resfs_read(self.path)
-+ if data:
-+ return data
- with open(self.path, 'rb') as f:
- return f.read()
-
---- contrib/python/parso/py3/parso/grammar.py (index)
-+++ contrib/python/parso/py3/parso/grammar.py (working tree)
-@@ -1,5 +1,6 @@
- import hashlib
- import os
-+import pkgutil
- from typing import Generic, TypeVar, Union, Dict, Optional, Any
- from pathlib import Path
-
-@@ -252,12 +253,13 @@ def load_grammar(*, version: str = None, path: str = None):
- return _loaded_grammars[path]
- except KeyError:
- try:
-- with open(path) as f:
-- bnf_text = f.read()
-+ bnf_text = pkgutil.get_data("parso", file).decode("utf-8")
-+ if bnf_text is None:
-+ raise FileNotFoundError
-
- grammar = PythonGrammar(version_info, bnf_text)
- return _loaded_grammars.setdefault(path, grammar)
-- except FileNotFoundError:
-+ except (FileNotFoundError, IOError):
- message = "Python version %s.%s is currently not supported." % (
- version_info.major, version_info.minor
- )
---- contrib/python/parso/py3/tests/conftest.py (index)
-+++ contrib/python/parso/py3/tests/conftest.py (working tree)
-@@ -6,6 +6,7 @@ import os
- from pathlib import Path
-
- import pytest
-+import yatest.common
-
- import parso
- from parso import cache
-@@ -42,7 +43,7 @@ def pytest_addoption(parser):
-
- def pytest_generate_tests(metafunc):
- if 'normalizer_issue_case' in metafunc.fixturenames:
-- base_dir = os.path.join(os.path.dirname(__file__), 'test', 'normalizer_issue_files')
-+ base_dir = os.path.join(yatest.common.test_source_path(), 'normalizer_issue_files')
-
- cases = list(colllect_normalizer_tests(base_dir))
- metafunc.parametrize(
---- contrib/python/parso/py3/tests/test_cache.py (index)
-+++ contrib/python/parso/py3/tests/test_cache.py (working tree)
-@@ -34,6 +34,7 @@ def isolated_parso_cache(monkeypatch, tmpdir):
- return cache_path
-
-
-+@pytest.mark.skip("SUBBOTNIK-2721 Disable load cache from disk")
- def test_modulepickling_change_cache_dir(tmpdir):
- """
- ParserPickling should not save old cache when cache_directory is changed.
-@@ -99,6 +100,7 @@ def test_modulepickling_simulate_deleted_cache(tmpdir):
- assert cached2 is None
-
-
-+@pytest.mark.skip
- def test_cache_limit():
- def cache_size():
- return sum(len(v) for v in parser_cache.values())
-@@ -129,6 +131,7 @@ class _FixedTimeFileIO(file_io.KnownContentFileIO):
- return self._last_modified
-
-
-+@pytest.mark.skip
- @pytest.mark.parametrize('diff_cache', [False, True])
- @pytest.mark.parametrize('use_file_io', [False, True])
- def test_cache_last_used_update(diff_cache, use_file_io):
-@@ -175,6 +178,7 @@ def test_inactive_cache(tmpdir, isolated_parso_cache):
- assert not old_paths.intersection(os.listdir(raw_cache_path))
-
-
-+@pytest.mark.skip
- @skip_pypy
- def test_permission_error(monkeypatch):
- def save(*args, **kwargs):
+--- contrib/python/parso/py3/parso/cache.py (index)
++++ contrib/python/parso/py3/parso/cache.py (working tree)
+@@ -135,6 +135,8 @@ def load_module(hashed_grammar, file_io, cache_path=None):
+ def _load_from_file_system(hashed_grammar, path, p_time, cache_path=None):
+ cache_path = _get_hashed_path(hashed_grammar, path, cache_path=cache_path)
+ try:
++ # SUBBOTNIK-2721 - Для безопасности отключаем загрузку с диска
++ raise FileNotFoundError
+ if p_time > os.path.getmtime(cache_path):
+ # Cache is outdated
+ return None
+--- contrib/python/parso/py3/parso/file_io.py (index)
++++ contrib/python/parso/py3/parso/file_io.py (working tree)
+@@ -2,6 +2,8 @@ import os
+ from pathlib import Path
+ from typing import Union
+
++import __res as res
++
+
+ class FileIO:
+ def __init__(self, path: Union[os.PathLike, str]):
+@@ -13,6 +15,9 @@ class FileIO:
+ # We would like to read unicode here, but we cannot, because we are not
+ # sure if it is a valid unicode file. Therefore just read whatever is
+ # here.
++ data = res.resfs_read(self.path)
++ if data:
++ return data
+ with open(self.path, 'rb') as f:
+ return f.read()
+
+--- contrib/python/parso/py3/parso/grammar.py (index)
++++ contrib/python/parso/py3/parso/grammar.py (working tree)
+@@ -1,5 +1,6 @@
+ import hashlib
+ import os
++import pkgutil
+ from typing import Generic, TypeVar, Union, Dict, Optional, Any
+ from pathlib import Path
+
+@@ -252,12 +253,13 @@ def load_grammar(*, version: str = None, path: str = None):
+ return _loaded_grammars[path]
+ except KeyError:
+ try:
+- with open(path) as f:
+- bnf_text = f.read()
++ bnf_text = pkgutil.get_data("parso", file).decode("utf-8")
++ if bnf_text is None:
++ raise FileNotFoundError
+
+ grammar = PythonGrammar(version_info, bnf_text)
+ return _loaded_grammars.setdefault(path, grammar)
+- except FileNotFoundError:
++ except (FileNotFoundError, IOError):
+ message = "Python version %s.%s is currently not supported." % (
+ version_info.major, version_info.minor
+ )
+--- contrib/python/parso/py3/tests/conftest.py (index)
++++ contrib/python/parso/py3/tests/conftest.py (working tree)
+@@ -6,6 +6,7 @@ import os
+ from pathlib import Path
+
+ import pytest
++import yatest.common
+
+ import parso
+ from parso import cache
+@@ -42,7 +43,7 @@ def pytest_addoption(parser):
+
+ def pytest_generate_tests(metafunc):
+ if 'normalizer_issue_case' in metafunc.fixturenames:
+- base_dir = os.path.join(os.path.dirname(__file__), 'test', 'normalizer_issue_files')
++ base_dir = os.path.join(yatest.common.test_source_path(), 'normalizer_issue_files')
+
+ cases = list(colllect_normalizer_tests(base_dir))
+ metafunc.parametrize(
+--- contrib/python/parso/py3/tests/test_cache.py (index)
++++ contrib/python/parso/py3/tests/test_cache.py (working tree)
+@@ -34,6 +34,7 @@ def isolated_parso_cache(monkeypatch, tmpdir):
+ return cache_path
+
+
++@pytest.mark.skip("SUBBOTNIK-2721 Disable load cache from disk")
+ def test_modulepickling_change_cache_dir(tmpdir):
+ """
+ ParserPickling should not save old cache when cache_directory is changed.
+@@ -99,6 +100,7 @@ def test_modulepickling_simulate_deleted_cache(tmpdir):
+ assert cached2 is None
+
+
++@pytest.mark.skip
+ def test_cache_limit():
+ def cache_size():
+ return sum(len(v) for v in parser_cache.values())
+@@ -129,6 +131,7 @@ class _FixedTimeFileIO(file_io.KnownContentFileIO):
+ return self._last_modified
+
+
++@pytest.mark.skip
+ @pytest.mark.parametrize('diff_cache', [False, True])
+ @pytest.mark.parametrize('use_file_io', [False, True])
+ def test_cache_last_used_update(diff_cache, use_file_io):
+@@ -175,6 +178,7 @@ def test_inactive_cache(tmpdir, isolated_parso_cache):
+ assert not old_paths.intersection(os.listdir(raw_cache_path))
+
+
++@pytest.mark.skip
+ @skip_pypy
+ def test_permission_error(monkeypatch):
+ def save(*args, **kwargs):