Skip to content

gh-129928: Raise more accurate exception for sqlite3 UDF creation misuse #129941

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

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Feb 10, 2025

Consistently raise ProgrammingError if the user tries to create an UDF
with an invalid number of parameters.

…on misuse

Consistently raise ProgrammingError if the user tries to create an UDF
with an invalid number of parameters.
@erlend-aasland erlend-aasland force-pushed the sqlite/check-num-params branch from fa21de0 to 8424b44 Compare February 10, 2025 07:46
check_num_params(pysqlite_Connection *self, const int n, const char *name)
{
int limit = sqlite3_limit(self->db, SQLITE_LIMIT_FUNCTION_ARG, -1);
assert(limit >= 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as we call this on a valid database pointer (checked via pysqlite_check_connection), we can assert we won't fail here.

@erlend-aasland erlend-aasland merged commit 3a2e7aa into python:main Feb 11, 2025
42 checks passed
@erlend-aasland erlend-aasland deleted the sqlite/check-num-params branch February 11, 2025 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant