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

bugfix parsing error #20

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

bugfix parsing error #20

wants to merge 4 commits into from

Conversation

erzoe
Copy link

@erzoe erzoe commented Feb 18, 2020

I think this resolves #16.

Please see the commit messages for 3c86dd6 and 7e58cff.

`index` was counting lines, not just of the traceback but of leading
outputs as well (which are collected in `all_else`).
Wether a line contained the location data or the corresponding source
code was determined by checking if `index` was odd or even.
This worked if there was an odd number of lines before the stacktrace
but if there was no output before the stacktrace it skipped the first
line of location info, interpreted the corresponding source code line
as location info and the location info of the next entry as it's source
code.
Depending on the number of commas in the corresponding source code line
this problem was more or less obvious.
I have solved this by toggling a boolean variable called `location_info`
instead of using `index`.

The last entry of the stack trace is skipped because the 2nd for loop
in _extract_traceback iterates over `entries[:-2]` where `entries[-1]`
is the error message and `entries[-2]` is the last entry of the stack
trace.
This comment seems wrong to me. This block is executed if capture
is False. capture is set to True when starting to parse the stack
trace and never reset to False. Therefore it is executed for each
line *before* the stack trace.
Also, there should be nothing after the stack trace.
strip() removes all white space, including linebreaks.
Therefore there was nothing left to do for the strip('\n').

https://docs.python.org/3/library/stdtypes.html#str.strip
AssertionErrors don't need to have an error message.
@erzoe
Copy link
Author

erzoe commented Feb 18, 2020

Travis failed for Python 3.4 with the message

colorama requires Python '>=2.7, !=3.0., !=3.1., !=3.2., !=3.3., !=3.4.*' but the running Python is 3.4.8

I'm afraid there is not much I can do about that.

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.

potential parsing error
1 participant