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

add f-string parsing for py3.6+ #42

Merged
merged 3 commits into from
Oct 10, 2018
Merged

add f-string parsing for py3.6+ #42

merged 3 commits into from
Oct 10, 2018

Conversation

zhudotexe
Copy link
Contributor

Includes requested changes from #37.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 99.853% when pulling 0698095 on mommothazaz123:fstrings into 1c29dac on danthedeckie:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 99.853% when pulling 0698095 on mommothazaz123:fstrings into 1c29dac on danthedeckie:master.

@danthedeckie
Copy link
Owner

Looking much better.
However, at +441:

def _eval_joinedstr(self, node):
    evaluated_values = [str(self._eval(n)) for n in node.values]
    if sum(len(v) for v in evaluated_values) > MAX_STRING_LENGTH:
        raise IterableTooLong("Sorry, I will not evaluate something this long.")
    return ''.join(evaluated_values)

Does this evaluate all the nodes anyway, even if they were going to produce a super long string, and simply not join them? Is there a way to safely (but not too slowly...) mitigate this? Or am I being overly paranoid?

@zhudotexe
Copy link
Contributor Author

Hm, I don't know what I was thinking writing that. This should immediately halt evaluation if the resulting string grows too large; the recursive call should raise the same error if any one individual node exceeds the limit.

@danthedeckie danthedeckie merged commit e17c32b into danthedeckie:master Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants