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
code.runsource() parsing bug #50729
Comments
I'm writing a little pre-processor that just parses python snippets out sys.version: Doesn't work: Works: Doesn't work: Exact output:
>>> interpreter.runsource('print("Foo")\nprint "Bar"')
Foo
False
>>> interpreter.runsource('print("Foo");print "Bar"')
Foo
Bar
False
>>> interpreter.runsource('print("Foo");\nprint "Bar"')
Foo
False
>>> Is this a known issue? I didn't see it while searching the bug database... |
Seems to me it's probably an issue with the newlines, but from
|
code.runsource() uses the "single" start symbol by default, which will parse only a single statement. Only your second snippet is a single statement, while the others are two statements. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: