Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: generator raised StopIteration #1285

Closed
jaraco opened this issue Mar 5, 2018 · 2 comments
Closed

RuntimeError: generator raised StopIteration #1285

jaraco opened this issue Mar 5, 2018 · 2 comments

Comments

@jaraco
Copy link
Member

@jaraco jaraco commented Mar 5, 2018

I see this error when running Setuptools' tests on Python 3.7:

==================================================================================== FAILURES =====================================================================================
_______________________________________________________________________ TestParsing.testSimpleRequirements ________________________________________________________________________

strs = 'x\\'

    def parse_requirements(strs):
        """Yield ``Requirement`` objects for each specification in `strs`

        `strs` must be a string, or a (possibly-nested) iterable thereof.
        """
        # create a steppable iterator, so we can handle \-continuations
        lines = iter(yield_lines(strs))

        for line in lines:
            # Drop comments -- a hash without a space may be in a URL.
            if ' #' in line:
                line = line[:line.find(' #')]
            # If there is a line continuation, drop it, and append the next line.
            if line.endswith('\\'):
                line = line[:-2].strip()
>               line += next(lines)
E               StopIteration

pkg_resources/__init__.py:3038: StopIteration

The above exception was the direct cause of the following exception:

self = <pkg_resources.tests.test_resources.TestParsing object at 0x1059e1da0>

    def testSimpleRequirements(self):
        assert (
            list(parse_requirements('Twis-Ted>=1.2-1'))
            ==
            [Requirement('Twis-Ted>=1.2-1')]
        )
        assert (
            list(parse_requirements('Twisted >=1.2, \\ # more\n<2.0'))
            ==
            [Requirement('Twisted>=1.2,<2.0')]
        )
        assert (
            Requirement.parse("FooBar==1.99a3")
            ==
            Requirement("FooBar==1.99a3")
        )
        with pytest.raises(ValueError):
            Requirement.parse(">=2.3")
        with pytest.raises(ValueError):
>           Requirement.parse("x\\")

pkg_resources/tests/test_resources.py:600:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

s = 'x\\'

    @staticmethod
    def parse(s):
>       req, = parse_requirements(s)
E       RuntimeError: generator raised StopIteration

pkg_resources/__init__.py:3092: RuntimeError
@jaraco
Copy link
Member Author

@jaraco jaraco commented Mar 5, 2018

The issue is an intentional regression introduced in Python 3.7 as part of PEP 479.

@jaraco jaraco closed this in 0a6264d Mar 5, 2018
@seekun
Copy link

@seekun seekun commented Jul 10, 2018

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants