◐ Shell
reader mode source ↗
Skip to content

bpo-31770: Prevent a crash and refleaks when calling sqlite3.Cursor.__init__() more than once#3968

Merged
vstinner merged 6 commits into
python:masterfrom
orenmn:bpo31770-fix-crash-and-refleaks
Nov 7, 2017
Merged

bpo-31770: Prevent a crash and refleaks when calling sqlite3.Cursor.__init__() more than once#3968
vstinner merged 6 commits into
python:masterfrom
orenmn:bpo31770-fix-crash-and-refleaks

Conversation

@orenmn

@orenmn orenmn commented Oct 12, 2017

Copy link
Copy Markdown
Contributor

In addition, add a test to test_sqlite to make sure that the crash is no more.

https://bugs.python.org/issue31770

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hide comment

LGTM, except of "del ref".

@serhiy-storchaka: Would you mind to double-check this PR please?

It seems like "self->in_weakreflist" is already set to NULL by the memory allocator, so it's safe to remove "self->in_weakreflist = NULL;".

@vstinner

Copy link
Copy Markdown
Member

I didn't approve the PR yet because of my question on "del ref".

@vstinner

vstinner commented Oct 15, 2017 via email

Copy link
Copy Markdown
Member

@orenmn

orenmn commented Oct 20, 2017

Copy link
Copy Markdown
Contributor Author

IIUC, calling gc_collect() without doing del ref wouldn't really cause the collection of ref, because there is still one reference to it until the method is over. The call to gc_collect() is to make sure ref is collected, as Serhiy advised.
Is it ok, Victor, or am i missing something?

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @orenmn for the PR, and @Haypo for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 7, 2017
@bedevere-bot

Copy link
Copy Markdown

GH-4301 is a backport of this pull request to the 3.6 branch.

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @orenmn for the PR, and @Haypo for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7.
🐍🍒⛏🤖

@bedevere-bot

Copy link
Copy Markdown

GH-4302 is a backport of this pull request to the 2.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 7, 2017
vstinner pushed a commit that referenced this pull request Nov 7, 2017
…_init__() more than once (GH-3968) (#4302)

(cherry picked from commit e56ab74)
vstinner pushed a commit that referenced this pull request Nov 7, 2017
…_init__() more than once (GH-3968) (#4301)

(cherry picked from commit e56ab74)
embray pushed a commit to embray/cpython that referenced this pull request Nov 9, 2017
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.

6 participants