diff options
author | Mikhail Borisov <borisov.mikhail@gmail.com> | 2022-02-10 16:45:40 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:40 +0300 |
commit | 5d50718e66d9c037dc587a0211110b7d25a66185 (patch) | |
tree | e98df59de24d2ef7c77baed9f41e4875a2fef972 /library/python/runtime_py3 | |
parent | a6a92afe03e02795227d2641b49819b687f088f8 (diff) | |
download | ydb-5d50718e66d9c037dc587a0211110b7d25a66185.tar.gz |
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/python/runtime_py3')
8 files changed, 45 insertions, 45 deletions
diff --git a/library/python/runtime_py3/importer.pxi b/library/python/runtime_py3/importer.pxi index 643776519e..904f94dea2 100644 --- a/library/python/runtime_py3/importer.pxi +++ b/library/python/runtime_py3/importer.pxi @@ -249,7 +249,7 @@ class ResourceImporter(object): if isinstance(relpath, bytes): relpath = _s(relpath) return relpath or modname - + # PEP-302 extension 3 of 3: packaging introspection. # Used by `linecache` (while printing tracebacks) unless module filename # exists on the filesystem. @@ -265,7 +265,7 @@ class ResourceImporter(object): return _s(file_bytes(abspath)) data = resfs_read(mod_path(fullname)) return _s(data) if data else '' - + def get_code(self, fullname): modname = fullname if self.is_package(fullname): @@ -283,14 +283,14 @@ class ResourceImporter(object): yapyc_data = resfs_read(yapyc_path, builtin=True) if yapyc_data: return marshal.loads(yapyc_data) - else: + else: py_data = resfs_read(path, builtin=True) if py_data: return compile(py_data, _s(relpath), 'exec', dont_inherit=True) else: # This covers packages with no __init__.py in resources. return compile('', modname, 'exec', dont_inherit=True) - + def is_package(self, fullname): if fullname in self.memory: return False @@ -332,7 +332,7 @@ class ResourceImporter(object): if self.arcadia_source_finder: for m in self.arcadia_source_finder.iter_modules(self._package_prefix, prefix): yield m - + def get_resource_reader(self, fullname): try: if not self.is_package(fullname): @@ -393,7 +393,7 @@ class BuiltinSubmoduleImporter(BuiltinImporter): else: return None - + class ArcadiaSourceFinder: """ Search modules and packages in arcadia source tree. @@ -522,17 +522,17 @@ class ArcadiaSourceFinder: paths.add(rel_path) -def excepthook(*args, **kws): - # traceback module cannot be imported at module level, because interpreter - # is not fully initialized yet - - import traceback - - return traceback.print_exception(*args, **kws) - - +def excepthook(*args, **kws): + # traceback module cannot be imported at module level, because interpreter + # is not fully initialized yet + + import traceback + + return traceback.print_exception(*args, **kws) + + importer = ResourceImporter() - + def executable_path_hook(path): if path == executable: @@ -562,10 +562,10 @@ sys.path_importer_cache[executable] = importer # Indicator that modules and resources are built-in rather than on the file system. sys.is_standalone_binary = True sys.frozen = True - + # Set of names of importable modules. sys.extra_modules = importer.memory - -# Use custom implementation of traceback printer. -# Built-in printer (PyTraceBack_Print) does not support custom module loaders -sys.excepthook = excepthook + +# Use custom implementation of traceback printer. +# Built-in printer (PyTraceBack_Print) does not support custom module loaders +sys.excepthook = excepthook diff --git a/library/python/runtime_py3/main/main.c b/library/python/runtime_py3/main/main.c index eaf500eaf2..3159800615 100644 --- a/library/python/runtime_py3/main/main.c +++ b/library/python/runtime_py3/main/main.c @@ -183,9 +183,9 @@ static int pymain(int argc, char** argv) { colon[0] = '\0'; func_name = colon + 1; } - if (module_name[0] == '\0') { - module_name = "library.python.runtime_py3.entry_points"; - } + if (module_name[0] == '\0') { + module_name = "library.python.runtime_py3.entry_points"; + } if (!func_name) { sts = RunModule(module_name); diff --git a/library/python/runtime_py3/main/ya.make b/library/python/runtime_py3/main/ya.make index 1a98366774..f308a93b28 100644 --- a/library/python/runtime_py3/main/ya.make +++ b/library/python/runtime_py3/main/ya.make @@ -1,15 +1,15 @@ -LIBRARY() - +LIBRARY() + OWNER( pg orivej ) - + PEERDIR( contrib/tools/python3/src library/cpp/resource ) - + ADDINCL( contrib/tools/python3/src/Include ) @@ -22,5 +22,5 @@ SRCS( main.c get_py_main.cpp ) - -END() + +END() diff --git a/library/python/runtime_py3/test/canondata/result.json b/library/python/runtime_py3/test/canondata/result.json index b60f372fe3..a7d045fc9c 100644 --- a/library/python/runtime_py3/test/canondata/result.json +++ b/library/python/runtime_py3/test/canondata/result.json @@ -1,7 +1,7 @@ { "test_traceback.test_traceback[custom-default]": { "stderr": { - "checksum": "6c1a9b47baa51cc6903b85fd43c529b5", + "checksum": "6c1a9b47baa51cc6903b85fd43c529b5", "uri": "file://test_traceback.test_traceback_custom-default_/stderr.txt" }, "stdout": { @@ -31,7 +31,7 @@ }, "test_traceback.test_traceback[main-default]": { "stderr": { - "checksum": "6c1a9b47baa51cc6903b85fd43c529b5", + "checksum": "6c1a9b47baa51cc6903b85fd43c529b5", "uri": "file://test_traceback.test_traceback_main-default_/stderr.txt" }, "stdout": { diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt index e5e3607e85..5eb7da170a 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_custom-default_/stderr.txt @@ -1,12 +1,12 @@ Traceback (most recent call last): File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main - one() + one() File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one - modfunc(two) # aaa + modfunc(two) # aaa File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc - f() # call back to caller + f() # call back to caller File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two - three(42) + three(42) File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three - raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) + raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) RuntimeError: Kaboom! I'm dead: 42 diff --git a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt index e5e3607e85..5eb7da170a 100644 --- a/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt +++ b/library/python/runtime_py3/test/canondata/test_traceback.test_traceback_main-default_/stderr.txt @@ -1,12 +1,12 @@ Traceback (most recent call last): File "library/python/runtime_py3/test/traceback/crash.py", line 44, in main - one() + one() File "library/python/runtime_py3/test/traceback/crash.py", line 12, in one - modfunc(two) # aaa + modfunc(two) # aaa File "library/python/runtime_py3/test/traceback/mod/__init__.py", line 3, in modfunc - f() # call back to caller + f() # call back to caller File "library/python/runtime_py3/test/traceback/crash.py", line 16, in two - three(42) + three(42) File "library/python/runtime_py3/test/traceback/crash.py", line 20, in three - raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) + raise RuntimeError('Kaboom! I\'m dead: {}'.format(x)) RuntimeError: Kaboom! I'm dead: 42 diff --git a/library/python/runtime_py3/test/test_traceback.py b/library/python/runtime_py3/test/test_traceback.py index 0504f211c3..82087ce98a 100644 --- a/library/python/runtime_py3/test/test_traceback.py +++ b/library/python/runtime_py3/test/test_traceback.py @@ -33,7 +33,7 @@ def test_traceback(mode, entry_point): filtered_stderr_path = yc.test_output_path('stderr.txt') env = os.environ.copy() - env.pop('PYTHONPATH', None) # Do not let program peek into its sources on filesystem + env.pop('PYTHONPATH', None) # Do not let program peek into its sources on filesystem if entry_point == 'custom': env['Y_PYTHON_ENTRY_POINT'] = 'library.python.runtime_py3.test.traceback.crash:main' diff --git a/library/python/runtime_py3/test/ya.make b/library/python/runtime_py3/test/ya.make index 866f1deeda..4ec3db74f5 100644 --- a/library/python/runtime_py3/test/ya.make +++ b/library/python/runtime_py3/test/ya.make @@ -36,5 +36,5 @@ RESOURCE_FILES( ) END() - -RECURSE_FOR_TESTS(traceback) + +RECURSE_FOR_TESTS(traceback) |