[issue34580] sqlite doc: clarify the scope of the context manager

2018-09-10 Thread Daniel Jakots


Daniel Jakots  added the comment:

LGTM

--

___
Python tracker 
<https://bugs.python.org/issue34580>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34580] sqlite doc: clarify the scope of the context manager

2018-09-08 Thread Daniel Jakots


Daniel Jakots  added the comment:

Yes, I would totally support this move as it would show users that it's 
important to close it!

--

___
Python tracker 
<https://bugs.python.org/issue34580>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34580] sqlite doc: clarify the scope of the context manager

2018-09-08 Thread Daniel Jakots


Daniel Jakots  added the comment:

Thanks, I lacked the greater picture.

Yes, adding a "con.close()" line to the snippet would clarify for me!

--

___
Python tracker 
<https://bugs.python.org/issue34580>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34580] sqlite doc: clarify the scope of the context manager

2018-09-08 Thread Daniel Jakots


Daniel Jakots  added the comment:

Thanks for working on this bug!

My message focussed on the closing aspect because that was my problem. :)

Maybe the wording should be more general like:
- "Note that this does not automatically call :meth:`close` on the connection 
object."
+ "Note that this does not automatically handle the connection object."

(I'm not sure if I should comment here or on the PR on gh)

--

___
Python tracker 
<https://bugs.python.org/issue34580>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34580] sqlite doc: clarify the scope of the context manager

2018-09-04 Thread Daniel Jakots


New submission from Daniel Jakots :

In my experience, the first encounter for beginners with the context manager is 
with files. The highlighted feature is that you don't need to close the file, 
'with' is going to do it for you.

The sqlite3 documentation talks about the context manager in "12.6.8.3. Using 
the connection as a context manager". The problem in my opinion is that people 
may believe that the context manager may manage the open/close which is not the 
case, reading the Modules/_sqlite/connection.c:pysqlite_connection_exit shows 
that it only does the commit or the rollback.

I'm not sure about the best fix. It can be either (or both) a sentence in the 
description and/or adding at then end of the code snippet "con.close()" to show 
that it still needs to be done.

Thanks!

--
messages: 324591
nosy: vigdis
priority: normal
severity: normal
status: open
title: sqlite doc: clarify the scope of the context manager
type: enhancement

___
Python tracker 
<https://bugs.python.org/issue34580>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com