New submission from Erlend E. Aasland :
Quoting Petr Viktorin in PR 27940,
https://github.com/python/cpython/pull/27940#discussion_r703424148:
- db is not set to NULL if init fails.
- This segfaults for me:
import sqlite3
conn = sqlite3.connect(':memory:')
conn.execute(
Erlend E. Aasland added the comment:
Quoting Petr from PR 28133:
Without the ability to tell SQLite to abort on trace failure, I doubt we can
do much better than the current behavior. Getting an exception and having
the data inserted seems quite irregular.
Closing this issue as won
Change by Erlend E. Aasland :
--
pull_requests: +26634
pull_request: https://github.com/python/cpython/pull/28209
___
Python tracker
<https://bugs.python.org/issue44
Change by Erlend E. Aasland :
--
keywords: +patch
pull_requests: +26648
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/28227
___
Python tracker
<https://bugs.python.org/issu
Erlend E. Aasland added the comment:
> It *would* be possible to improve the documentation, though.
+1
--
___
Python tracker
<https://bugs.python.org/issu
Erlend E. Aasland added the comment:
I modified your second example slightly:
```
import sqlite3
conn = sqlite3.connect(":memory:")
conn.text_factory=bytes
conn.row_factory = sqlite3.Row
cursor = conn.execute("CREATE TABLE foo (bar)")
numbers = range(4)
cursor.executem
Erlend E. Aasland added the comment:
Note: I ran that with PR 28227.
OTOH: I do agree that there's a lot of pitfalls here, especially in the future.
In the long run, it is probably best to deprecate reinit, and disable it in
Python
Erlend E. Aasland added the comment:
Modifying the loops to also print the values:
first fetch
b'0'
b'1'
second fetch
2
3
--
___
Python tracker
<https://bug
Erlend E. Aasland added the comment:
FYI, I've expanded the reinit tests and added a deprecation warning to the PR.
--
___
Python tracker
<https://bugs.python.org/is
Erlend E. Aasland added the comment:
Great, thanks.
--
___
Python tracker
<https://bugs.python.org/issue45126>
___
___
Python-bugs-list mailing list
Unsub
Erlend E. Aasland added the comment:
> If we deprecate but keep the buggy behavior it as it is, (1) is not needed.
> Less work for both us and the users.
Indeed.
There's still a ref leak I'd like to take care of, though: if the first audit
fails, da
Change by Erlend E. Aasland :
--
pull_requests: +26651
pull_request: https://github.com/python/cpython/pull/28231
___
Python tracker
<https://bugs.python.org/issue45
Change by Erlend E. Aasland :
--
pull_requests: +26654
pull_request: https://github.com/python/cpython/pull/28234
___
Python tracker
<https://bugs.python.org/issue45
Erlend E. Aasland added the comment:
I'll save the cleanup till Python 3.13 dev is started. I've opened a PR for
fixing the ref leak (should be backported), and a draft PR for deprecating
Connection and Cursor reinitialisation.
--
Change by Erlend E. Aasland :
--
nosy: +erlendaasland
nosy_count: 1.0 -> 2.0
pull_requests: +26657
pull_request: https://github.com/python/cpython/pull/28237
___
Python tracker
<https://bugs.python.org/issu
Change by Erlend E. Aasland :
--
pull_requests: +26658
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/28238
___
Python tracker
<https://bugs.python.org/issu
New submission from Erlend E. Aasland :
For SQLite 3.14.0 and newer, we're using the v2 trace API. This means that the
trace callback receives a pointer to the sqlite3_stmt object. We can use the
sqlite3_stmt pointer to retrieve expanded SQL string.
The following stat
Change by Erlend E. Aasland :
--
keywords: +patch
pull_requests: +26660
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/28240
___
Python tracker
<https://bugs.python.org/issu
Change by Erlend E. Aasland :
--
title: [sqlite3] expand bound values in traced statements if possible ->
[sqlite3] expand bound values in traced statements when possible
___
Python tracker
<https://bugs.python.org/issu
Erlend E. Aasland added the comment:
I did some experiments using the connection object as a "backref" in the
callback context, but it seems that the GC does not play well with such ref
circles; I ended up with a lot of ref leaks (yes, I modified the traverse and
clear slots to
Change by Erlend E. Aasland :
--
pull_requests: +26661
pull_request: https://github.com/python/cpython/pull/28242
___
Python tracker
<https://bugs.python.org/issue42
Erlend E. Aasland added the comment:
Updated title to include sqlite3.Cursor as well, since cursors and connections
are very much entwined.
--
title: [sqlite3] cleanup and harden connection init -> [sqlite3] cleanup and
harden Connection and Cursor __ini
Erlend E. Aasland added the comment:
Serhiy, I believe I've addressed your review remarks on PR 27642. Would you
mind taking a look at it again if you have time?
--
___
Python tracker
<https://bugs.python.org/is
Change by Erlend E. Aasland :
--
pull_requests: +26712
pull_request: https://github.com/python/cpython/pull/28298
___
Python tracker
<https://bugs.python.org/issue45
Change by Erlend E. Aasland :
--
pull_requests: +26713
pull_request: https://github.com/python/cpython/pull/28299
___
Python tracker
<https://bugs.python.org/issue5
New submission from Erlend E. Aasland :
Use unittest.defaultTestLoader instead of unittest.TestLoader() when possible,
to avoid creating unnecessary many instances.
--
components: Tests
messages: 401674
nosy: erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status
Change by Erlend E. Aasland :
--
keywords: +patch
pull_requests: +26715
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/28301
___
Python tracker
<https://bugs.python.org/issu
Erlend E. Aasland added the comment:
> Also, TestLoader has mutable attribute "errors". I am not sure that it is
> good idea to share it between unrelated tests.
Noted. I'm closing this.
--
resolution: -> rejected
stage: patch review -> reso
Change by Erlend E. Aasland :
--
nosy: +erlendaasland
___
Python tracker
<https://bugs.python.org/issue45113>
___
___
Python-bugs-list mailing list
Unsubscribe:
Erlend E. Aasland added the comment:
Thanks, Steve. I'll pull in main and see how the CI fares.
--
___
Python tracker
<https://bugs.python.org/is
Erlend E. Aasland added the comment:
_makeLoader is not deprecated yet, so we might keep this open a little bit more.
--
___
Python tracker
<https://bugs.python.org/issue5
Erlend E. Aasland added the comment:
> It is an internal function. We can remove it without deprecation.
How convenient :)
--
___
Python tracker
<https://bugs.python.org/iss
Change by Erlend E. Aasland :
--
nosy: +erlendaasland
___
Python tracker
<https://bugs.python.org/issue45116>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Erlend E. Aasland :
I propose to add wrappers for the SQLite sqlite3_limit() C API. Using this API,
it is possible to query and set limits on a connection basis. This will make it
easier (and faster) to test various corner cases in the test suite without
relying on
Erlend E. Aasland added the comment:
Thanks for reviewing, Pablo!
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Erlend E. Aasland added the comment:
Christian, how about adding an audit event for something like
sqlite3.Connection.setlimit()? My initial thought is: yes.
--
nosy: +christian.heimes
___
Python tracker
<https://bugs.python.org/issue45
Change by Erlend E. Aasland :
--
keywords: +patch
pull_requests: +26864
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/28463
___
Python tracker
<https://bugs.python.org/issu
Change by Erlend E. Aasland :
--
nosy: +erlendaasland
___
Python tracker
<https://bugs.python.org/issue43760>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Erlend E. Aasland :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Erlend E. Aasland :
--
pull_requests: +26886
pull_request: https://github.com/python/cpython/pull/28490
___
Python tracker
<https://bugs.python.org/issue44
Erlend E. Aasland added the comment:
Now that pysqlite_statement_reset() is only used in cursor.c, I suggest to move
it to cursor.c and make it a static function.
--
___
Python tracker
<https://bugs.python.org/issue44
Change by Erlend E. Aasland :
--
nosy: +erlendaasland
___
Python tracker
<https://bugs.python.org/issue45255>
___
___
Python-bugs-list mailing list
Unsubscribe:
Erlend E. Aasland added the comment:
> Could it instead throw a FileNotFoundError if the db simply doesn't exist at
> the specified path?
We pass the database path pretty much straight to sqlite3_open_v2(), via the
os.PathLike interface, so any errors we get come straight from SQ
Change by Erlend E. Aasland :
--
status: open -> pending
___
Python tracker
<https://bugs.python.org/issue45255>
___
___
Python-bugs-list mailing list
Un
Change by Erlend E. Aasland :
--
pull_requests: +26906
pull_request: https://github.com/python/cpython/pull/28509
___
Python tracker
<https://bugs.python.org/issue45
Erlend E. Aasland added the comment:
> Now that pysqlite_statement_reset() is only used in cursor.c, I suggest to
> move it to cursor.c and make it a static function.
I'll wait until PR 25984 is merged before opening a PR for relocating
pysqlite_stat
Erlend E. Aasland added the comment:
Ouch, that's quite a regression! Thanks for the heads up! I'll have a look at
it right away.
--
___
Python tracker
<https://bugs.python.o
Erlend E. Aasland added the comment:
I'm unable to reproduce this regression on my machine (macOS, debug build, no
optimisations). Are you able to reproduce, Ken?
--
___
Python tracker
<https://bugs.python.org/is
Erlend E. Aasland added the comment:
> I'm unable to reproduce this regression on my machine (macOS, debug build, no
> optimisations) [...]
Correction: I _am_ able to reproduce this.
--
___
Python tracker
<https://bugs.python.
Erlend E. Aasland added the comment:
Explicitly resetting statements when we're done with them removes the
performance regression; SQLite works more efficient when we keep the number of
non-reset statements low.
--
___
Python tracker
&
Erlend E. Aasland added the comment:
I'll revert PR 27844 for now (except the tests).
Since SQLite works better when we keep the number of non-reset statements to a
minimum, we need to ensure that we reset statements when we're done with them
(sqlite3_step() returns SQLITE_DONE o
Change by Erlend E. Aasland :
--
pull_requests: +26956
pull_request: https://github.com/python/cpython/pull/28574
___
Python tracker
<https://bugs.python.org/issue44
Change by Erlend E. Aasland :
--
resolution: wont fix -> fixed
___
Python tracker
<https://bugs.python.org/issue45089>
___
___
Python-bugs-list mailing list
Un
Erlend E. Aasland added the comment:
Replacing the timestamp converter with datetime.datetime.fromisoformat sounds
good to me.
--
___
Python tracker
<https://bugs.python.org/issue45
Change by Erlend E. Aasland :
--
nosy: +erlendaasland
___
Python tracker
<https://bugs.python.org/issue29410>
___
___
Python-bugs-list mailing list
Unsubscribe:
Erlend E. Aasland added the comment:
> [...] if sqlite3 starts returning aware datetimes, existing code might break.
True.
> [...] perhaps this could be fixed in conjunction with changing sqlite3's API
> to allow per-database converters and adapters
Another option could be to
Change by Erlend E. Aasland :
--
nosy: +erlendaasland
___
Python tracker
<https://bugs.python.org/issue45374>
___
___
Python-bugs-list mailing list
Unsubscribe:
Erlend E. Aasland added the comment:
> I'd be interested in working on this myself, if you think it's something that
> a new CPython contributor could handle.
Please, go ahead :)
However, I think this should be discussed on Discourse first (open a topic in
the Core Deve
Erlend E. Aasland added the comment:
See also:
- bpo-19065: sqlite3 timestamp adapter chokes on timezones
- bpo-26651 Deprecate register_adapter() and register_converter() in sqlite3
(Adding Berker to nosy list.)
--
nosy: +berker.peksag
Erlend E. Aasland added the comment:
Yes, deprecating the preconfigured adapters and converters, but keeping the
ability to register adapters/converters sounds like a very good idea to me. As
you point out, Marc-Andre, they are application specific. Also, implementing
converters and
Change by Erlend E. Aasland :
--
versions: +Python 3.11 -Python 3.6
___
Python tracker
<https://bugs.python.org/issue26651>
___
___
Python-bugs-list mailin
Change by Erlend E. Aasland :
--
pull_requests: +27123
pull_request: https://github.com/python/cpython/pull/28790
___
Python tracker
<https://bugs.python.org/issue45
Change by Erlend E. Aasland :
--
pull_requests: +27128
pull_request: https://github.com/python/cpython/pull/28809
___
Python tracker
<https://bugs.python.org/issue16
Erlend E. Aasland added the comment:
FYI: We've been using sqlite3_close_v2(), when available, since 2017 (see
86a670543ff97d52fd9b8ca0477f8b6d27ee946d), but we now call it with GIL held.
I'm leaning towards closing this as out-of-date. There is no reproducer, there
has been no mo
Erlend E. Aasland added the comment:
>From https://sqlite.org/c3ref/close.html:
If sqlite3_close_v2() is called with unfinalized prepared statements,
unclosed BLOB handlers, and/or unfinished sqlite3_backups, it returns
SQLITE_OK regardless, but instead of deallocating the datab
New submission from Erlend E. Aasland :
While working on bpo-45126 / GH-28227 (and while working on the AC conversion,
bpo-40956), I've been slightly frustrated on the implementation of sqlite3
"isolation level". The code is messy, and we've got two connection members tha
Erlend E. Aasland added the comment:
+1!
See also bpo-43502
--
nosy: +erlendaasland
___
Python tracker
<https://bugs.python.org/issue45490>
___
___
Python-bug
Erlend E. Aasland added the comment:
Previous discussion on Discourse:
https://discuss.python.org/t/what-to-do-with-unsafe-macros/7771
--
___
Python tracker
<https://bugs.python.org/issue45
Change by Erlend E. Aasland :
--
keywords: +patch
pull_requests: +27325
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/29053
___
Python tracker
<https://bugs.python.org/issu
Change by Erlend E. Aasland :
--
pull_requests: +27326
pull_request: https://github.com/python/cpython/pull/29054
___
Python tracker
<https://bugs.python.org/issue36
Erlend E. Aasland added the comment:
If you are building CPython against a specific version of SQLite (for example
one you've compiled yourself), make sure that you adjust _both_ CFLAGS and
LDFLAGS.
Note: since bpo-40810 / GH-24106, SQLite 3.7.15 or newer is required.
Closing this as
Change by Erlend E. Aasland :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Erlend E. Aasland added the comment:
I'm closing this for now. As I see it, there is little added value, and it
would be hard to make a good API for all invariants. If this idea surfaces
again, we can always reopen this issue.
Thanks for you interest in improving CP
Change by Erlend E. Aasland :
--
pull_requests: +27341
pull_request: https://github.com/python/cpython/pull/29073
___
Python tracker
<https://bugs.python.org/issue42
Erlend E. Aasland added the comment:
It seems to me that this issue can be closed as fixed. Do you have further PR's
for this, Petr?
--
nosy: +erlendaasland
status: open -> pending
___
Python tracker
<https://bugs.python.org
Change by Erlend E. Aasland :
--
nosy: +erlendaasland
___
Python tracker
<https://bugs.python.org/issue45459>
___
___
Python-bugs-list mailing list
Unsubscribe:
Erlend E. Aasland added the comment:
FYI, see bpo-43916 regarding the introduction and rationale of introducing
Py_TPFLAGS_DISALLOW_INSTANTIATION.
Slightly related: bpo-43908
--
___
Python tracker
<https://bugs.python.org/issue45
Erlend E. Aasland added the comment:
>> Can I do something for this pending PEP?
>
> Ask Victor, he should know more. But as far as I know, no one started on it
> yet.
Quoting PEP 630 (active PEP):
Whenever this PEP mentions extension modules, the advice also applies to
b
Erlend E. Aasland added the comment:
> I no longer think that we should define Py_BUILD_CORE_MODULE
> unconditionally. Instead I propose to move the defines into each C module.
+1. Explicit is nice.
--
nosy: +erlendaasland
___
Python t
Change by Erlend E. Aasland :
--
pull_requests: +27435
pull_request: https://github.com/python/cpython/pull/29160
___
Python tracker
<https://bugs.python.org/issue45
Erlend E. Aasland added the comment:
> My understanding is that this entire class of code changes has been put on
> hold pending Steering Council approval.
Can you please point me to the official SC statement regarding this? I cannot
find it.
> It represents a great deal of code
New submission from Erlend E. Aasland :
Currently, we call _pysqlite_seterror() if sqlite3_open_v2() returns !=
SQLITE_OK. However, if a memory failure occurs during sqlite3_open_v2(), the
database handle is explicitly set to NULL. This _may_ cause
_pysqlite_seterror() to segfault, since we
Change by Erlend E. Aasland :
--
keywords: +patch
pull_requests: +27444
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/29171
___
Python tracker
<https://bugs.python.org/issu
Erlend E. Aasland added the comment:
New failure today:
https://github.com/python/cpython/runs/3979900415?check_suite_focus=true
test_sendfile_close_peer_in_the_middle_of_receiving
(test.test_asyncio.test_sendfile.SelectEventLoopTests) ... ok
Erlend E. Aasland added the comment:
Thanks, Petr. Yes, that is correct. PEP 630 (I assume you meant 630, not 640)
still describes the _rationale_ very well. I guess what's needed is a Standards
Track PEP based on PEP 630 (IIUC).
--
___
P
Erlend E. Aasland added the comment:
Petr:
> Hmm, the best I can find is
> https://github.com/python/steering-council/blob/main/updates/2021-02-steering-council-update.md#february-08
Perfect, thanks!
Christian: Thanks for your input. If this was a discussion on Discourse, I'd
Erlend E. Aasland added the comment:
Oh, I found PEP 3121 (Extension Module Initialization and Finalization). It is
a Standards Track PEP and it is accepted.
The abstract is pretty short. Let me just repost it here, for convenience:
Extension module initialization currently has a few
New submission from Erlend E. Aasland :
Some DB-API 2.0 attributes are undocumented:
- apilevel
- threadsafety
- paramstyle
These attributes should be documented.
See also:
- bpo-8196
-
https://discuss.python.org/t/is-sqlite3-threadsafety-the-same-thing-as-sqlite3-threadsafe-from-the-c
Change by Erlend E. Aasland :
--
keywords: +patch
pull_requests: +27482
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/29219
___
Python tracker
<https://bugs.python.org/issu
Change by Erlend E. Aasland :
--
nosy: +erlendaasland
___
Python tracker
<https://bugs.python.org/issue37095>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Erlend E. Aasland :
Currently, the sqlite3 module docstring is the old pysqlite copyright comment
in the start of Lib/sqlite3/__init__.py. This is not very helpful to the
general user. Suggesting to add a more helpful docstring, a la the 're' or
'array'
Change by Erlend E. Aasland :
--
keywords: +patch
pull_requests: +27488
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/29224
___
Python tracker
<https://bugs.python.org/issu
Erlend E. Aasland added the comment:
A side-effect of keeping tests inside the package, is that they appear in the
package contents module docstring, which may be slightly confusing to new users.
>>> import sqlite3
>>> help(sqlite3)
Help on package sqlite3:
NAME
sq
Change by Erlend E. Aasland :
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue45613>
___
___
Python-bugs-list mailing list
Unsub
Change by Erlend E. Aasland :
--
nosy: +paul.moore
___
Python tracker
<https://bugs.python.org/issue45613>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Erlend E. Aasland :
Currently, the sqlite3 DB-API 2.0 attribute 'threadsafety' is hard-coded to 1,
meaning "threads may share the module, but not connections". This is not always
true, since it depends on the default SQLite threaded mode, selected at
c
Erlend E. Aasland added the comment:
FYI, it is also possible to change the threaded mode using sqlite3_config(),
however that API is not exposed to the sqlite3 module, and there is no plans
for doing so in the near future :)
--
___
Python
Change by Erlend E. Aasland :
--
keywords: +patch
pull_requests: +27491
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/29227
___
Python tracker
<https://bugs.python.org/issu
Erlend E. Aasland added the comment:
BTW, I've verified that the overhead of adding this query is negligible.
$ python -m pyperf compare_to --min-speed 1 main.json patched.json
Benchmark hidden because not significant (1): sqlite_synth
git switch -
Switched to branch 'main'
Change by Erlend E. Aasland :
--
nosy: +erlendaasland
___
Python tracker
<https://bugs.python.org/issue45614>
___
___
Python-bugs-list mailing list
Unsubscribe:
601 - 700 of 829 matches
Mail list logo