Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-32788: Better error handling in sqlite3.#3723

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commentedSep 24, 2017
edited
Loading

@serhiy-storchakaserhiy-storchaka added skip news type-bugAn unexpected behavior, bug, or error labelsSep 24, 2017
@serhiy-storchakaserhiy-storchaka changed the titlebpo-31572: Get rid ofPyDict_GetItem() andPyObject_HasAttrString() insqlite3.bpo-31572: Get rid of PyDict_GetItem() and PyObject_HasAttrString() in sqlite3.Sep 24, 2017
@serhiy-storchakaserhiy-storchaka changed the titlebpo-31572: Get rid of PyDict_GetItem() and PyObject_HasAttrString() in sqlite3.bpo-32788: Better error handling in sqlite3.Feb 7, 2018
Copy link
Member

@berkerpeksagberkerpeksag left a comment

Choose a reason for hiding this comment

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

I have an old computer with no SQLite installed at the moment, but I think most of the patch looks good and safe to me. I have a question and a couple of comments:

  • Did you notice these by reading the code or noticed while using the module? For example,pysqlite_cache_get() (although it's exposed the cache implementation is an implementation detail and basically useless for third-party uses:https://bugs.python.org/issue30262) is only used by_pysqlite_query_execute() and it only accepts a string object. The only exception that may be raised here is OOM.

  • I'm fine with making old code PEP 7 compliant if you've already change the signature of the function, but in cases like below, I think it's better to keep the old code as-is:

    -static int check_cursor(pysqlite_Cursor* cur)+static int+check_cursor(pysqlite_Cursor* cur)

    The rest is fine because you've addedstatic to them.

  • I haven't look at the code inmicroprotocols.c recently, so I still need a bit more time to review it and the code relevant to it (e.g.statement.c)

@serhiy-storchaka
Copy link
MemberAuthor

Did you notice these by reading the code or noticed while using the module?

By reading the code. Initially I wanted to only fix cases with PyDict_GetItem() and PyObject_HasAttrString(). Then noticed that exceptions are silenced in other cases, and couldn't stop until analyzed all code that silences or replaces exceptions, and also other suspicious code in the_sqlite3 module.

I think it's better to keep the old code as-is:

Do you mean just this function or all cases in which the only change is inserting a newline before the function name?

I haven't look at the code inmicroprotocols.c recently, so I still need a bit more time to review it and the code relevant to it (e.g.statement.c)

PEP 246 was rejected as a general protocol, but I think it is worth to fix its concrete implementation in sqlite3.

This PR is purposed for the master branch only, because of the chance of breaking user code. But some changes can be backported. I am wondering if it is worth to document and test some user-visible behavior changes. I can split this PR on several parts if you prefer.

@berkerpeksag
Copy link
Member

Do you mean just this function or all cases in which the only change is inserting a newline before the function name?

I missed thatpysqlite_cursor_init() andpysqlite_cursor_dealloc() were already havestatic keyword. So, let's revert back to the old style in the following functions:

  • check_cursor()
  • pysqlite_cursor_init()
  • pysqlite_cursor_dealloc()

I am wondering if it is worth to document and test some user-visible behavior changes.

I think that would be great if you have time to do so :)

@serhiy-storchaka
Copy link
MemberAuthor

@berkerpeksag, have I addressed all your comments? Could you please take a look at this PR again?

@serhiy-storchaka
Copy link
MemberAuthor

I am going to merge this PR.

Copy link
Member

@berkerpeksagberkerpeksag left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! I'd like to deprecate and eventually get rid of this pre-PEP 246 protocol.

BTW, I'm moving to a new country in a month, so I don't have time to closely check my GitHub notifications. Feel free to send me an email if I'm blocking a pull request.

@serhiy-storchaka
Copy link
MemberAuthor

Good luck with your move! 🚋✈️ 🚗 🏠 👍

berkerpeksag reacted with hooray emoji

@serhiy-storchakaserhiy-storchaka merged commitfc662ac intopython:masterDec 10, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@berkerpeksagberkerpeksagberkerpeksag approved these changes

Assignees
No one assigned
Labels
skip newstype-bugAn unexpected behavior, bug, or error
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@serhiy-storchaka@berkerpeksag@the-knights-who-say-ni@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp