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

Returning 1 from the set_progress_handler handler cancels query #4120

Merged
merged 4 commits into from Nov 2, 2017

Conversation

Projects
None yet
5 participants
@simonw
Contributor

simonw commented Oct 25, 2017

This behaviour is currently undocumented by Python, but is covered in the SQLite docs here: https://sqlite.org/c3ref/progress_handler.html

@the-knights-who-say-ni

This comment has been minimized.

Show comment
Hide comment
@the-knights-who-say-ni

the-knights-who-say-ni Oct 25, 2017

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

the-knights-who-say-ni commented Oct 25, 2017

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

simonw added some commits Oct 25, 2017

@simonw

This comment has been minimized.

Show comment
Hide comment
@simonw

simonw Oct 26, 2017

Contributor

Since this is just a tiny documentation fix, I think it warrants the "skip issue" and "skip news" labels.

Contributor

simonw commented Oct 26, 2017

Since this is just a tiny documentation fix, I think it warrants the "skip issue" and "skip news" labels.

@simonw

This comment has been minimized.

Show comment
Hide comment
@simonw

simonw Nov 1, 2017

Contributor

From the history of this file, I think @berkerpeksag may be a good person to review this.

Contributor

simonw commented Nov 1, 2017

From the history of this file, I think @berkerpeksag may be a good person to review this.

@berkerpeksag

Good catch, thank you! This is indeed a tested but undocumented feature:

def CheckCancelOperation(self):
"""
Test that returning a non-zero value stops the operation in progress.
"""
con = sqlite.connect(":memory:")
progress_calls = []
def progress():
progress_calls.append(None)
return 1
con.set_progress_handler(progress, 1)
curs = con.cursor()
self.assertRaises(
sqlite.OperationalError,
curs.execute,
"create table bar (a, b)")

Show outdated Hide outdated Doc/library/sqlite3.rst

@berkerpeksag berkerpeksag merged commit ac03c03 into python:master Nov 2, 2017

3 checks passed

bedevere/issue-number Issue report skipped
bedevere/news "skip news" label found
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@miss-islington

This comment has been minimized.

Show comment
Hide comment
@miss-islington

miss-islington Nov 2, 2017

Thanks @simonw for the PR, and @berkerpeksag for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒🤖

miss-islington commented Nov 2, 2017

Thanks @simonw for the PR, and @berkerpeksag for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒🤖

@berkerpeksag

This comment has been minimized.

Show comment
Hide comment
@berkerpeksag

berkerpeksag Nov 2, 2017

Member

Thanks!

Member

berkerpeksag commented Nov 2, 2017

Thanks!

miss-islington added a commit to miss-islington/cpython that referenced this pull request Nov 2, 2017

@bedevere-bot

This comment has been minimized.

Show comment
Hide comment
@bedevere-bot

bedevere-bot Nov 2, 2017

GH-4229 is a backport of this pull request to the 3.6 branch.

bedevere-bot commented Nov 2, 2017

GH-4229 is a backport of this pull request to the 3.6 branch.

berkerpeksag added a commit to berkerpeksag/cpython that referenced this pull request Nov 2, 2017

berkerpeksag added a commit that referenced this pull request Nov 2, 2017

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