-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
gh-61162: Clarify sqlite3 connection context manager docs #93890
Conversation
Explicitly note that transactions are only closed if there is an open transation, and that transactions are _not_ implicitly opened in context manager __enter__.
cc. @python/proofreaders @Kodiologist, would you like to review this? |
I can't do an inline review as lines have been deleted and added. I'd suggest though focussing on the happy path of an open transaction and a successful body first, i.e.: With an open transaction, connection objects can be used as context managers
that automatically commit or rollback transactions. If the body of the ``with``
statement finishes without exceptions, the transaction is committed. If an
exception is raised and not caught, the transaction is rolled back.
If there is no open transaction, the context manager is a no-op. A |
Thanks, that's an improvement! PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
A
I'm not a real CPython maintainer, but this looks good to me. Thanks. |
You don't need to be; "external" reviews are appreciated :) Thanks for reviewing! Note: I pinged you since you commented recently on the issue. |
I'll let this PR sit around a day or two before merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some Sphinx and writing suggestions
Misc/NEWS.d/next/Documentation/2022-06-16-10-10-59.gh-issue-61162.1ypkG8.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
I'll say it again, and see what happens: I'll let this PR sit around for a couple of days more before merging :) Thanks, Proofreaders 🪄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @erlend-aasland !
Status check is done, and it's a success ✅ . |
Thanks @erlend-aasland for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
Sorry @erlend-aasland, I had trouble checking out the |
GH-94012 is a backport of this pull request to the 3.10 branch. |
Thanks @erlend-aasland for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
GH-94013 is a backport of this pull request to the 3.11 branch. |
Explicitly note that transactions are only closed if there is an open
transation at
__exit__
, and that transactions are not implicitlyopened during
__enter__
.Co-authored-by: CAM Gerlach CAM.Gerlach@Gerlach.CAM
Co-authored-by: Stanley 46876382+slateny@users.noreply.github.com
Automerge-Triggered-By: GH:erlend-aasland