-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-111789: Use PyDict_GetItemRef() in sqlite #111829
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
gh-111789: Use PyDict_GetItemRef() in sqlite #111829
Conversation
serhiy-storchaka
commented
Nov 7, 2023
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Use PyDict_GetItemRef() #111789
Modules/_sqlite/cursor.c
Outdated
current_param = PyObject_GetItem(parameters, binding_name_obj); | ||
} | ||
PyObject *current_param; | ||
(void)PyMapping_GetOptionalItem(parameters, binding_name_obj, ¤t_param); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyMapping_GetOptionalItem()
includes a special case for dict, so there is no performance loss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks; the resulting code is cleaner, thus positively affecting readability and maintainability.
It can be even more simplified if use |
Use new C API functions PyDict_GetItemRef() and PyMapping_GetOptionalItemString().
Use new C API functions PyDict_GetItemRef() and PyMapping_GetOptionalItemString().