Skip to content
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

Fix possible reference leak for sqlite3 initialization #84914

Closed
erlend-aasland opened this issue May 22, 2020 · 4 comments
Closed

Fix possible reference leak for sqlite3 initialization #84914

erlend-aasland opened this issue May 22, 2020 · 4 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir

Comments

@erlend-aasland
Copy link
Contributor

BPO 40737
Nosy @corona10, @miss-islington, @erlend-aasland
PRs
  • bpo-40737: Fix possible reference leak for sqlite3 initialization #20323
  • [3.9] bpo-40737: Fix possible reference leak for sqlite3 initialization (GH-20323) #20425
  • Files
  • 0001-Use-PyModule_AddObject-correctly-in-sqlite3.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-05-26.12:39:23.498>
    created_at = <Date 2020-05-22.22:16:00.112>
    labels = ['3.8', '3.7', 'library', '3.9', '3.10']
    title = 'Fix possible reference leak for sqlite3 initialization'
    updated_at = <Date 2020-05-26.12:39:23.497>
    user = 'https://github.com/erlend-aasland'

    bugs.python.org fields:

    activity = <Date 2020-05-26.12:39:23.497>
    actor = 'corona10'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-05-26.12:39:23.498>
    closer = 'corona10'
    components = ['Library (Lib)']
    creation = <Date 2020-05-22.22:16:00.112>
    creator = 'erlendaasland'
    dependencies = []
    files = ['49183']
    hgrepos = []
    issue_num = 40737
    keywords = ['patch']
    message_count = 4.0
    messages = ['369658', '369714', '369972', '369975']
    nosy_count = 3.0
    nosy_names = ['corona10', 'miss-islington', 'erlendaasland']
    pr_nums = ['20323', '20425']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue40737'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10']

    @erlend-aasland
    Copy link
    Contributor Author

    According to the documentation, PyModule_AddObject() only decrements the reference count of value on success. The calling code must PyDECREF() manually on error.

    Fixed by attached patch.

    @erlend-aasland erlend-aasland added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir labels May 22, 2020
    @erlend-aasland
    Copy link
    Contributor Author

    This issue could probably be expanded to the whole Modules directory. A lot of the modules fail to clean up properly on PyModule_AddObject() error.

    @erlend-aasland erlend-aasland changed the title Handle PyModule_AddObject() error correctly in sqlite3 Fix possible reference leak for sqlite3 initialization May 25, 2020
    @erlend-aasland erlend-aasland changed the title Handle PyModule_AddObject() error correctly in sqlite3 Fix possible reference leak for sqlite3 initialization May 25, 2020
    @corona10
    Copy link
    Member

    New changeset 5eb45d7 by Erlend Egeberg Aasland in branch 'master':
    bpo-40737: Fix possible reference leak for sqlite3 initialization (GH-20323)
    5eb45d7

    @miss-islington
    Copy link
    Contributor

    New changeset 7df9c41 by Miss Islington (bot) in branch '3.9':
    bpo-40737: Fix possible reference leak for sqlite3 initialization (GH-20323)
    7df9c41

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants