Skip to content

Simplify PackageLoader.load() using goto

https://xkcd.com/292/

Test Plan

It does not work (because of pytest?) :(

../../.local/lib/python3.7/site-packages/_pytest/assertion/rewrite.py:170: in exec_module
    exec(co, module.__dict__)
swh/loader/package/loader.py:144: in <module>
    class PackageLoader(BaseLoader, Generic[TPackageInfo]):
swh/loader/package/loader.py:469: in PackageLoader
    def load(self) -> Dict:
../../.local/lib/python3.7/site-packages/goto.py:184: in with_goto
    _patch_code(func_or_code.__code__),
../../.local/lib/python3.7/site-packages/goto.py:156: in _patch_code
    raise SyntaxError('Unknown label {0!r}'.format(code.co_names[label]))
E     File "<string>", line None
E   SyntaxError: Unknown label 'fail'

Migrated from D5351 (view on Phabricator)

Merge request reports