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

Fix crash in daemon mode if there is a decode error #6064

Merged
merged 7 commits into from Dec 14, 2018

Conversation

Projects
None yet
2 participants
@JukkaL
Copy link
Collaborator

JukkaL commented Dec 13, 2018

I got a crash after I accidentally inserted a non-ascii
character to a file I was editing.

This also fixes a similar issue when the file can't be
read. I didn't add a test case for this since that
would have required bigger changes to the test support
code.

JukkaL added some commits Dec 9, 2018

Fix crash in daemon mode if there is a decode error
I got a crash after I accidentally inserted a non-ascii
character to a file I was editing.

This also fixes a similar issue when the file can't be
read. I didn't add a test case for this since that
would have required changes to the test support code.
@gvanrossum
Copy link
Member

gvanrossum left a comment

Thanks! I think I encountered this before but didn't know what to do about it.

Can you also add a test for Python 2? (It uses a different parser and the default coding is ascii, so possibly the flows would be different.)

def f(x: int) -> None: ...
[file a.py.2]
# coding: ascii
ä

This comment has been minimized.

@gvanrossum

gvanrossum Dec 13, 2018

Member

I'd make this an assignment (which would be legal with the Py3 default encoding).

==
main:2: error: Argument 1 to "f" has incompatible type "int"; expected "str"

[case testDecodeErrorBlocker-windows]

This comment has been minimized.

@gvanrossum

gvanrossum Dec 13, 2018

Member

What's the difference between the two tests? Why the platform-specific tags?

This comment has been minimized.

@JukkaL

JukkaL Dec 14, 2018

Author Collaborator

The offset in the error message is different due to cr/lf.

@JukkaL JukkaL merged commit beb0dd5 into master Dec 14, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@gvanrossum gvanrossum deleted the decode-error-blocker branch Dec 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment