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

Catch errors filling readline history on startup #3854

Merged
merged 1 commit into from Jul 31, 2013

Conversation

takluyver
Copy link
Member

In some cases, the history db can be a valid SQLite database, but contain strings with null bytes, which readline refuses to accept. This catches and ignores the resulting error.

At present, it leaves the history database untouched, and keeps trying to load readline history: if just one entry is invalid, the rest of the history may still be useful to the user.

Closes #2431

@takluyver
Copy link
Member Author

If anyone wants to test this, there's a history database at http://harts.net/reece/tmp/ipython-corrupt-history/profile_default/history.sqlite which triggers the error.

@minrk
Copy link
Member

minrk commented Jul 31, 2013

For 1.0? Seems simple enough, as just a try/except.

@takluyver
Copy link
Member Author

I think it should be - the bug is rare, but can leave the user unable to start IPython, and without any clear idea of how to fix it, which is rather embarrassing.

@minrk
Copy link
Member

minrk commented Jul 31, 2013

I can't think of a problem this could cause. Merging, then.

minrk added a commit that referenced this pull request Jul 31, 2013
Catch errors filling readline history on startup

In some cases, the history db can be a valid SQLite database, but contain strings with null bytes, which readline refuses to accept. This catches and ignores the resulting error.

At present, it leaves the history database untouched, and keeps trying to load readline history: if just one entry is invalid, the rest of the history may still be useful to the user.

Closes #2431
@minrk minrk merged commit b634ae2 into ipython:master Jul 31, 2013
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Catch errors filling readline history on startup

In some cases, the history db can be a valid SQLite database, but contain strings with null bytes, which readline refuses to accept. This catches and ignores the resulting error.

At present, it leaves the history database untouched, and keeps trying to load readline history: if just one entry is invalid, the rest of the history may still be useful to the user.

Closes ipython#2431
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.

TypeError: must be string without null bytes, not str
2 participants