Skip to content

Conversation

chirizxc
Copy link
Contributor

@chirizxc chirizxc commented Sep 10, 2025

@python-cla-bot
Copy link

python-cla-bot bot commented Sep 10, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@Eclips4 Eclips4 linked an issue Sep 10, 2025 that may be closed by this pull request
@picnixz
Copy link
Member

picnixz commented Sep 10, 2025

Err.... Actually... I'm very sorry but I think we should use the term "id". Here what I mean. The sqlite docs (https://sqlite.org/c3ref/blob_open.html) say ROWID (https://sqlite.org/lang_createtable.html#rowid). I think it's more precise than index because nothing guarantees that the first row has index 1 and there are tables without indices.

More precisely, the sqlite3 docs say:

This interfaces opens a handle to the BLOB located in row iRow, column zColumn, table zTable in database zDb; in other words, the same BLOB that would be selected by:

SELECT zColumn FROM zDb.zTable WHERE rowid = iRow;

For instance in https://sqlite.org/queryplanner.html#_lookup_by_rowid, the rowId does not match the "index" if we were to consider the table as an array. So maybe ID is better (and the C code could be improved instead).

cc @erlend-aasland

@erlend-aasland
Copy link
Contributor

Let's go with rowid, since that's what it is (according to the SQLite docs).

@erlend-aasland
Copy link
Contributor

We should also fix the docstring. And I'm inclined to also improve the parameter name (rename it from row to rowid), for improved clarity.

@erlend-aasland erlend-aasland added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Sep 17, 2025
@erlend-aasland erlend-aasland changed the title gh-138736: fix sqlite3.Connection.blobopen row type gh-138736: Fix sqlite3.Connection.blobopen *row* type and naming Sep 17, 2025
@erlend-aasland erlend-aasland enabled auto-merge (squash) September 17, 2025 15:27
@erlend-aasland
Copy link
Contributor

Thanks, @chirizxc!

@erlend-aasland erlend-aasland merged commit 8eb1062 into python:main Sep 17, 2025
45 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Sep 17, 2025
@miss-islington-app

This comment was marked as outdated.

@miss-islington-app

This comment was marked as outdated.

@miss-islington-app

This comment was marked as outdated.

@bedevere-app
Copy link

bedevere-app bot commented Sep 17, 2025

GH-139062 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Sep 17, 2025
erlend-aasland pushed a commit to erlend-aasland/cpython that referenced this pull request Sep 17, 2025
…er type and naming (python#138738)

The 'row' parameter represents a ROWID. Clarify this in docs and docstrings.

(cherry picked from commit 8eb1062)
@bedevere-app
Copy link

bedevere-app bot commented Sep 17, 2025

GH-139063 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Sep 17, 2025
erlend-aasland added a commit that referenced this pull request Sep 17, 2025
…e and naming (#138738) (#139063)

The 'row' parameter represents a ROWID. Clarify this in docs and docstrings.

(cherry picked from commit 8eb1062)

Co-authored-by: chiri <[email protected]>
encukou pushed a commit that referenced this pull request Oct 7, 2025
…e and naming (#138738) (GH-139062)

(cherry picked from commit 8eb1062)

Co-authored-by: chiri <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

wrong type of row in sqlite3.Connection.blobopen
4 participants