[issue43181] Python macros don’t shield arguments

2021-03-15 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > If possible, I would prefer to only replace macros with static inline > functions if the changes avoids clear macro pitfalls. Yes, of course. Should I create a meta issue for this, or do you prefer raising one issue p

[issue15698] PEP 3121, 384 Refactoring applied to pyexpat module

2021-03-15 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Fixed by GH-2. -- nosy: +erlendaasland, vstinner ___ Python tracker <https://bugs.python.org/issue15698> ___ ___

[issue12777] Inconsistent use of VOLUME_NAME_* with GetFinalPathNameByHandle

2021-03-15 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: This seems to have been fixed in 2018 in bpo-33016 by GH-6010. -- nosy: +erlendaasland ___ Python tracker <https://bugs.python.org/issue12

[issue1103350] send/recv SEGMENT_SIZE should be used more in socketmodule

2021-03-15 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: FYI, the SEGMENT_SIZE define was removed by af01f668173d4061893148b54a0f01b91c7716c2 (bpo-16136). -- nosy: +erlendaasland ___ Python tracker <https://bugs.python.org/issue1103

[issue43181] Python macros don’t shield arguments

2021-03-15 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > As I wrote previously, I dislike macros. If someone is changed, I would > prefer to convert the function into a static inline function which doesn't > have macros pitfalls. Should we create a meta issue for this? Most macros are trivial

[issue42686] include built-in Math functions in SQLite to 3.35.0 of march 2021

2021-03-14 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: See bpo-43492 for upgrading the macOS & Windows installers to SQLite 3.35.0. -- ___ Python tracker <https://bugs.python.org/iss

[issue43492] Upgrade to SQLite 3.35.0 in macOS and Windows

2021-03-14 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : SQLite 3.35.0 was released a couple of days ago: https://www.sqlite.org/releaselog/3_35_0.html Suggesting to hold off for a week or two, to see if a bug-fix release happens. -- components: Windows, macOS messages: 388685 nosy

[issue43267] [sqlite3] Redundant type checks in pysqlite_statement_bind_parameter()

2021-03-11 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: $ python -m pyperf compare_to -G main.json patched.json Faster (1): - bind: 63.6 us +- 1.2 us -> 61.8 us +- 0.9 us: 1.03x faster $ git diff --shortstat master 1 file changed, 41 insertions(+), 74 deletions(-) -- keywords: +patch Added f

[issue43454] [sqlite3] Add support for R*Tree callbacks

2021-03-11 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Unfortunately, there's no way to detect R*Tree support in sqlite3.h. We could run a script that dumps the compile options, and generate a config.h file from that: $ for L in $(sqlite3 ":memory:" "pragma compile_options"); do ech

[issue43454] [sqlite3] Add support for R*Tree callbacks

2021-03-10 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Test run output (see attached test file): $ ./python.exe test_rtree.py ARGS: ((-80.77490234375, -80.77469635009766, 35.377593994140625, 35.377803802490234), (45.3, 22.9, 5.0)) KWARGS: {'num_queued': [0, 1], 'context': None, 'level': 0, 'max_level': 1

[issue43454] [sqlite3] Add support for R*Tree callbacks

2021-03-10 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: FYI, PoC patch attached. Lacks tests and some #ifdefs. Let me know if I should create a PR out of it. -- keywords: +patch Added file: https://bugs.python.org/file49866/patch.diff ___ Python tracker <ht

[issue43440] Enable rtree support in SQLite

2021-03-09 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: I've opened bpo-43454 for R*Tree callbacks. -- ___ Python tracker <https://bugs.python.org/issue43440> ___ ___ Pytho

[issue43454] [sqlite3] Add support for R*Tree callbacks

2021-03-09 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : Ref. bpo-43440 Now that both Windows and macOS builds compile SQLite with R*Tree support, we should consider adding support for R*Tree callbacks. SQLite has two API's: - sqlite3_rtree_query_callback() for SQLite 3.8.5 and newer

[issue43440] Enable rtree support in SQLite

2021-03-09 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Anytime :) I'll create an issue for rtree callbacks. -- ___ Python tracker <https://bugs.python.org/issue43

[issue43444] [sqlite3] Move MODULE_NAME def from setup.py to module.h

2021-03-09 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23569 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24801 ___ Python tracker <https://bugs.python.org/issu

[issue43440] Enable rtree support in SQLite

2021-03-09 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > does compile options set in setup.py propagate to the Windows build, or do we > need to set it both places? Er, forget it. setup.py is of course only used to build the sqlite3 module, not s

[issue43444] [sqlite3] Move MODULE_NAME def from setup.py to module.h

2021-03-09 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : Berker, can we please move the MODULE_NAME define from setup.py to Modules/_sqlite/module.h? I'm tired of all the undeclared identifier warnings. No other module defines their MODULE_NAME in setup.py. -- components: Library (Lib) messages

[issue43440] Enable rtree support in SQLite

2021-03-09 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23565 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24797 ___ Python tracker <https://bugs.python.org/issu

[issue43440] Enable rtree support in SQLite

2021-03-09 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: We should also consider adding support for R*Tree query callbacks using sqlite3_rtree_query_callback() for SQLite >= 3.8.5, and sqlite3_rtree_geometry_callback() for older versions. -- ___ Python trac

[issue43440] Enable rtree support in SQLite

2021-03-09 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > does compile options set in setup.py propagate to the Windows build, or do we > need to set it both places? Seems like it doesn't; correct me if I'm wrong. PR coming up. -- ___ Python tracker

[issue43440] Enable rtree support in SQLite

2021-03-09 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Actually, the macOS build already builds with R*Tree support enabled, but it is missing from PCbuild/sqlite3.vcxproj. I'm not very familiar with the Windows build; does compile options set in setup.py propagate to the Windows build, or do we need

[issue43440] Enable rtree support in SQLite

2021-03-08 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: I can put up a PR for it. I don’t see any reason not to enable it. -- ___ Python tracker <https://bugs.python.org/issue43

[issue43440] Enable rtree support in SQLite

2021-03-08 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Unless I’m mistaken, that’s enabled simply by compiling with SQLITE_ENABLE_RTREE defined. -- ___ Python tracker <https://bugs.python.org/issue43

[issue43434] sqlite3.Connection(...) bypasses 'sqlite3.connect' audit hooks

2021-03-08 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch Added file: https://bugs.python.org/file49858/patch.diff ___ Python tracker <https://bugs.python.org/issue43

[issue43434] sqlite3.Connection(...) bypasses 'sqlite3.connect' audit hooks

2021-03-08 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : The module level connect method is guarded by PySys_Audit(), but sqlite3.Connection.__init__() is not. It is possible to bypass the module level connect() method simply by creating a new sqlite3.Connection object directly. Easily fixed by either

[issue43396] Use more descriptive variable names in sqlite3 docs

2021-03-04 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- pull_requests: +23516 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/24746 ___ Python tracker <https://bugs.python.org/issu

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Attached patch consists of two commits: one to rename "conn" to "con", and one to rename "c" to "cur". Are you ok with that, Berker? -- Added file: https://bugs.python.org/file49851/patch.diff __

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: 'con' and 'cur' seems to be used in a majority of the examples. I suggest normalising to always using these two in code examples. -- ___ Python tracker <https://bugs.python.org/issue43

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Right, got me confused as well! I guess a clarification would be an improvement :) -- ___ Python tracker <https://bugs.python.org/issue43

[issue43398] [sqlite3] sqlite3.connect() segfaults if given a faulty Connection factory

2021-03-04 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : If the connection factory __init__ method fails, we hit a seg. fault when pysqlite_do_all_statements() is called to clean up the defect connection: PyList_Size received a NULL pointer. Suggested fix: Split pysqlite_do_all_statements() in two: one

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23515 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24745 ___ Python tracker <https://bugs.python.org/issu

[issue43396] Non-existent method sqlite3.Connection.fetchone() used in docs

2021-03-04 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Correct, fetchone() is a cursor method. Thanks for the report! -- nosy: +berker.peksag, erlendaasland ___ Python tracker <https://bugs.python.org/issue43

[issue43369] [sqlite3] Handle out-of-memory errors in sqlite3_column_*()

2021-03-03 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Quoting from the SQLite docs: "As long as the input parameters are correct, these routines will only fail if an out-of-memory error occurs during a format conversion" -- ___ Python track

[issue43369] [sqlite3] Handle out-of-memory errors in sqlite3_column_*()

2021-03-03 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23496 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24723 ___ Python tracker <https://bugs.python.org/issu

[issue43060] Convert _decimal C API from pointer array to struct

2021-03-02 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > But converting the decimal c api may breaks the compatibility, because some > macros like `PyDec_TypeCheck_INDEX` have been exposed in headers. True. Is there many external users of this API? I could not find any relevant examples

[issue43350] [sqlite3] Active statements are reset twice in _pysqlite_query_execute()

2021-03-01 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Hm, I guess we could use sqlite3_stmt_busy() instead of the in_use flag. -- ___ Python tracker <https://bugs.python.org/issue43

[issue43350] [sqlite3] Active statements are reset twice in _pysqlite_query_execute()

2021-03-01 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > There are three calls of pysqlite_statement_reset() in > _pysqlite_query_execute() Yes, but only two before the cache is queried. > So additional call of pysqlite_statement_reset() does not harm. That's true, but removing redundant c

[issue43350] [sqlite3] Active statements are reset twice in _pysqlite_query_execute()

2021-03-01 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23466 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24681 ___ Python tracker <https://bugs.python.org/issu

[issue43350] [sqlite3] Active statements are reset twice in _pysqlite_query_execute()

2021-03-01 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : In _pysqlite_query_execute(), if the cursor already has a statement object, it is reset twice before the cache is queried. -- components: Library (Lib) messages: 387850 nosy: berker.peksag, erlendaasland, serhiy.storchaka priority: normal

[issue43349] [doc] incorrect tuning(7) manpage link

2021-03-01 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23465 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24680 ___ Python tracker <https://bugs.python.org/issu

[issue43349] [doc] incorrect tuning(7) manpage link

2021-02-28 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > FreeBSD only (?) system call [...] Correction, it's not a sys call. It belongs to the misc manpage section. -- ___ Python tracker <https://bugs.python.org/issu

[issue43349] [doc] incorrect tuning(7) manpage link

2021-02-28 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : In https://docs.python.org/3.10/library/resource.html#resource.RLIMIT_SWAP, tuning(7) points to https://manpages.debian.org/tuning(7), however this is a FreeBSD only (?) system call, so the link is incorrect. I suggest linking to either: - https

[issue43296] [sqlite3] Fix sqlite3_value_blob() usage

2021-02-28 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23459 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24674 ___ Python tracker <https://bugs.python.org/issu

[issue43296] [sqlite3] Fix sqlite3_value_blob() usage

2021-02-26 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > If sqlite3_value_blob() returns NULL, we should check if sqlite3_errcode() > equals SQLITE_NOMEM and raise MemoryError if it does. This also applies to sqlite3_value_text(). It also applies to sqlite3_value_bytes() if a conversion takes pla

[issue43296] [sqlite3] Fix sqlite3_value_blob() usage

2021-02-26 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- title: [sqlite3] sqlite3_value_bytes() should be called after sqlite3_value_blob() -> [sqlite3] Fix sqlite3_value_blob() usage ___ Python tracker <https://bugs.python.org/issu

[issue43294] [sqlite3] unused variables in Connection begin, commit, and rollback

2021-02-26 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23443 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24658 ___ Python tracker <https://bugs.python.org/issu

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Addendum to msg387641: > The latter only leaves a valid Cursor->statement->st pointer (sqlite3_stmt > pointer) if the Statement object was successfully created, and the > sqlite3_stmt successfully prepared. sqlite3_prepare_v2() a

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: msg387668 was a little bit hasty. I'll try again: Dong-hee Na: > Hmm by the way the current implementation returns SQLITE_OK if the statement > is NULL, but it looks like return SQLITE_MISUSE if we apply this patch. > Does it not cause any

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > int rc = sqlite3_reset(NULL); >printf("reset with NULL: %d %s\n", rc, sqlite3_errstr(rc)); Sorry, wrong test: int rc = sqlite3_step(NULL); printf("step with NULL: %d %s\n", rc, sqlite3_errstr(rc)); $ ./a.

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Ah, at last I found the source of the confusion: The SQLite changelog. Quoting from msg387619 and https://sqlite.org/changes.html: > From the SQLite 3.5.3 changelog: > - sqlite3_step() returns SQLITE_MISUSE instead of crashing when

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Introduced by Christian Heimes 2007-12-14 in commit 380532117c2547bb0dedf6f85efa66d18a9abb88, which is a merge from SVN (?) checkin r59471 by Gerhard Häring (https://mail.python.org/pipermail/python-checkins/2007-December/063968.html

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > Look at issue in which the workaround was added. Does it contain some > examples? I'll check. Thanks. -- ___ Python tracker <https://bugs.python.org/i

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > I wonder if it is possible at all to reach this branch. If it is not, then > I'm pretty sure Cursor.in_use is redundant Typo: should be Statement.in_use Corner error cases may cause the _pysqlite_query_execute() loop to exit w

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > _pysqlite_query_execute() has one coverage gap: lines 478-488 (if > (self->statement->in_use)) are never executed. I wonder if it is possible at all to reach this branch. If it is not, then I'm pretty sure Cursor.in_use is redundant,

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-24 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Regarding test coverage: _pysqlite_query_execute() has one coverage gap: lines 478-488 (if (self->statement->in_use)) are never executed. Except from that, the only missing are the hard-to-trigger goto error's (for example PyLi

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-24 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: pysqlite_cursor_iternext() has four users: - sqlite3.Cursor.fetchone() - sqlite3.Cursor.fetchall() - sqlite3.Cursor.fetchmany() - sqlite3.Cursor.__next__() All of these methods pass self to pysqlite_cursor_iternext(). pysqlite_cursor_iternext() starts

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-24 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: There are six users of pysqlite_step(): $ grep -nrE "\" Modules/_sqlite Modules/_sqlite/util.c:27:int pysqlite_step(sqlite3_stmt* statement, pysqlite_Connection* connection) Modules/_sqlite/connection.c:393:rc = pysqlite_step(state

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-24 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: I’ll check all uses and see if we’ve got everything covered by the test suite. This is one of the core functions of the sqlite3 module (all queries call step at least once, but often multiple times), so I’d expect coverage is pretty good

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-24 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: I believe we can proceed with this as planned. Serhiy, do you have additional comments or change requests? -- ___ Python tracker <https://bugs.python.org/issue43

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-24 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23423 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24638 ___ Python tracker <https://bugs.python.org/issu

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-24 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: >From the SQLite 3.5.3 changelog: - sqlite3_step() returns SQLITE_MISUSE instead of crashing when called with a NULL parameter. -- ___ Python tracker <https://bugs.python.org/issu

[issue43314] [sqlite3] remove pre SQLite 3.7.7 support code

2021-02-24 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23422 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24637 ___ Python tracker <https://bugs.python.org/issu

[issue43314] [sqlite3] remove pre SQLite 3.7.7 support code

2021-02-24 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : I missed the SQLITE_OPEN_URI #ifdef in GH-24106. The "open URI" interface was added in 3.7.7. The dead code can safely be removed. $ grep -r SQLITE_OPEN_URI sqlite-3.7.6/ $ grep -r SQLITE_OPEN_URI sqlite-3.7.7/ [...] sqlite-3.7.7/sqlite3

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-23 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Larry Brasfield's comment https://sqlite.org/forum/forumpost/6430fc589d?t=h aligns with https://bugs.python.org/issue43251#msg387428 I'll think twice before posting there again, though. -- ___ Python

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-23 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Sure! Here it is: https://sqlite.org/forum/forumpost/574c6bc66c -- ___ Python tracker <https://bugs.python.org/issue43

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-23 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: After discussing the matter briefly on the SQLite forum, I'm no longer 100% certain about this. There seems to be uncertainty about which other conditions can produce NULL, although memory error seems to be the most probable. I consider closing both

[issue35056] Test leaks of memory not managed by Python allocator

2021-02-23 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- nosy: +erlendaasland ___ Python tracker <https://bugs.python.org/issue35056> ___ ___ Python-bugs-list mailing list Unsub

[issue43296] [sqlite3] sqlite3_value_bytes() should be called after sqlite3_value_blob()

2021-02-22 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Related: If sqlite3_value_blob() returns NULL, we should check if sqlite3_errcode() equals SQLITE_NOMEM and raise MemoryError if it does. If not, we should initialise cur_py_value to None, because as the PyBytes_FromStringAndSize docs says: "

[issue24905] Allow incremental I/O to blobs in sqlite3

2021-02-22 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- nosy: +erlendaasland ___ Python tracker <https://bugs.python.org/issue24905> ___ ___ Python-bugs-list mailing list Unsub

[issue43296] [sqlite3] sqlite3_value_bytes() should be called after sqlite3_value_blob()

2021-02-22 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : The sqlite3_value_*() API is almost identical to the sqlite3_column_*() API. sqlite3_value_bytes() should be called after we've converted the value using sqlite3_value_blob(). See also bpo-43249. -- components: Library (Lib) messages

[issue43294] [sqlite3] unused variables in Connection begin, commit, and rollback

2021-02-22 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : In Modules/_sqlite/connection.c: pysqlite_connection_commit_impl(), pysqlite_connection_rollback_impl(), and _pysqlite_connection_begin() all call sqlite3_prepare_v2() with the fourth parameter (pzTail) set. This (output) parameter is never used

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-21 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : pysqlite_step() contains a NULL check needed for SQLite 3.5 and earlier. This can be removed. -- components: Library (Lib) messages: 387476 nosy: berker.peksag, erlendaasland, serhiy.storchaka priority: normal severity: normal status: open

[issue43267] [sqlite3] Redundant type checks in pysqlite_statement_bind_parameter()

2021-02-21 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > I am not sure that the difference is significant enough to justify the > optimization. I would guess it's negligible. I did some quick timeit tests, but the results were pretty much equal, so I guess I'd have to use a more precise ben

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-21 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23388 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24609 ___ Python tracker <https://bugs.python.org/issu

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-21 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Will do. Thanks for pushing the investigation. -- ___ Python tracker <https://bugs.python.org/issue43251> ___ ___ Pytho

[issue43269] [sqlite3] Clean up function scoping

2021-02-20 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- pull_requests: +23383 pull_request: https://github.com/python/cpython/pull/24605 ___ Python tracker <https://bugs.python.org/issue43

[issue43269] [sqlite3] Clean up function scoping

2021-02-20 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Serhiy also mentioned that marking functions definitions with the extern keyword is not very common in the CPython source base. https://github.com/python/cpython/pull/24578#discussion_r579506678 I suggest cleaning up those as well, while we're

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-20 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: "SELECT 1" yields "1" as column name. "SELECT <...> AS N" yields "N" as column name. "SELECT NULL" yields "NULL" as column name. We can't set the column name via the API, so that's

[issue43265] [sqlite3] Improve backup error handling

2021-02-20 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Regarding 1: After thinking about it, I see nothing wrong with raising ValueError error. No need to change current behaviour. -- ___ Python tracker <https://bugs.python.org/issue43

[issue43265] [sqlite3] Improve backup error handling

2021-02-20 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: 3.9, I presume? Yeah, I guess so. -- ___ Python tracker <https://bugs.python.org/issue43265> ___ ___ Python-bugs-list m

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-20 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: That's inside sqlite3_value_text() and friends, then? Let's investigate further before concluding. -- ___ Python tracker <https://bugs.python.org/issue43

[issue43265] [sqlite3] Improve backup error handling

2021-02-19 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: The unit test suite shows one case of improved "exception text". I'd say it's an improvement. $ ./python.exe # with GH-24586 applied >>> import sqlite3 >>> c1 = sqlite3.connect(":memory:") >>> c2 = sql

[issue43265] [sqlite3] Improve backup error handling

2021-02-19 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- title: Improve sqlite3 backup error handling -> [sqlite3] Improve backup error handling ___ Python tracker <https://bugs.python.org/issu

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-19 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- title: sqlite3_column_name() failures should raise MemoryError -> [sqlite3] sqlite3_column_name() failures should raise MemoryError ___ Python tracker <https://bugs.python.org/issu

[issue43251] sqlite3_column_name() failures should raise MemoryError

2021-02-19 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > Well, it returns NULL in case of out of memory, but is it the only cause? Can > NULL be returned for other reasons? According to the SQLite docs, no. Looking at the source code, we see that it also returns NULL if the second parameter (

[issue43267] [sqlite3] Redundant type checks in pysqlite_statement_bind_parameter()

2021-02-19 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > It is a kind of optimization. PyLong_Check is very fast (only one comparison, AFAICS), so there is no gain in first doing PyLong_CheckExact and then PyLong_Check. Ditto for unicode. PyFloat_Check is the most expensive check, but it comes bef

[issue43265] Improve sqlite3 backup error handling

2021-02-19 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23366 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24586 ___ Python tracker <https://bugs.python.org/issu

[issue43265] Improve sqlite3 backup error handling

2021-02-19 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: > I'm not sure about 1) because if target == source it means a user error. > OperationalError is usually used for non-user errors. Yes, my bad. ProgrammingError would be better. target == source results in SQLITE_ERROR, BTW. I'll throw up a PR

[issue43269] [sqlite3] Clean up function scoping

2021-02-19 Thread Erlend Egeberg Aasland
Erlend Egeberg Aasland added the comment: Ref. https://github.com/python/cpython/pull/24569#issuecomment-782014177, Berker. -- ___ Python tracker <https://bugs.python.org/issue43

[issue43269] [sqlite3] Clean up function scoping

2021-02-19 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23357 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24578 ___ Python tracker <https://bugs.python.org/issu

[issue43269] [sqlite3] Clean up function scoping

2021-02-19 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : There's a lot of file scoped functions without the static storage-class specifier. All file local functions should have the static storage-class specifier. -- components: Library (Lib) messages: 387310 nosy: berker.peksag, erlendaasland

[issue43258] Prevent needless allocation of sqlite3 aggregate function context

2021-02-19 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- pull_requests: +23353 pull_request: https://github.com/python/cpython/pull/24574 ___ Python tracker <https://bugs.python.org/issue43

[issue43267] [sqlite3] Redundant type checks in pysqlite_statement_bind_parameter()

2021-02-19 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : The type checks at the start of pysqlite_statement_bind_parameter() are redundant: We first check for exact types (*_CheckExact()), and then we check again for exact or subtyped versions (*_Check()). (Adding to the redundantness: the result

[issue43251] sqlite3_column_name() failures should raise MemoryError

2021-02-19 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- title: sqlite3_column_name() failures should call PyErr_NoMemory() -> sqlite3_column_name() failures should raise MemoryError ___ Python tracker <https://bugs.python.org/issu

[issue43266] "String conversion and formatting" formatting messes up array subscripting

2021-02-19 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23352 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24573 ___ Python tracker <https://bugs.python.org/issu

[issue43266] "String conversion and formatting" formatting messes up array subscripting

2021-02-19 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : str[size-1] is rendered incorrectly in https://docs.python.org/3.10/c-api/conversion.html The original intent was probably to apply italics to the variables names only. This can be fixed by prefixing the first bracket with a backslash. However

[issue43265] Improve sqlite3 backup error handling

2021-02-19 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : There are some issues with the error handling in pysqlite_connection_backup_impl(): 1. ValueError is returned if the target connection equals source connection. Should be OperationalError, IMHO. 2. The aforementioned check is already performed

[issue43258] Prevent needless allocation of sqlite3 aggregate function context

2021-02-18 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- keywords: +patch pull_requests: +23348 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24569 ___ Python tracker <https://bugs.python.org/issu

[issue43258] Prevent needless allocation of sqlite3 aggregate function context

2021-02-18 Thread Erlend Egeberg Aasland
New submission from Erlend Egeberg Aasland : If no rows match an aggregate query, _pysqlite_step_callback() is never called, and _pysqlite_final_callback() is called once. In order to prevent needless context allocation, we should pass 0 as the second argument to sqlite3_aggregate_context

[issue43249] sqlite3_column_bytes() should be called after sqlite3_column_blob()

2021-02-18 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- pull_requests: +23346 pull_request: https://github.com/python/cpython/pull/24565 ___ Python tracker <https://bugs.python.org/issue43

<    1   2   3   4   5   6   7   >