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

[3.11] gh-99886: Fix crash when freeing objects with managed dictionaries #99902

Merged
merged 7 commits into from
Dec 4, 2022

Conversation

Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented Nov 30, 2022

@Fidget-Spinner Fidget-Spinner changed the title gh-99886: Fix crash when freeing objects with managed dictionaries [3.11] gh-99886: Fix crash when freeing objects with managed dictionaries Nov 30, 2022
Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

We should probably remove the reference to the values array, before we clear it.

Objects/dictobject.c Outdated Show resolved Hide resolved
Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

I don't know the internal parts good enough to comment on them; I trust you here :) The test looks ok, but perhaps we should add a more general test case; buildbots without SQLite installed won't have the sqlite3 module, so this test won't run.

Lib/test/test_sqlite3/test_regression.py Outdated Show resolved Hide resolved
@Fidget-Spinner
Copy link
Member Author

... perhaps we should add a more general test case; buildbots without SQLite installed won't have the sqlite3 module, so this test won't run.

I agree. However I'm not sure what exactly is causing this. My general idea is that something is causing the tp_traverse function to be called multiple times on the same instance, but I don't know why inheriting from sqlite.Cursor causes this. I will try to create a test case without sqlite but it's possible that I won't be able to find it before the next 3.11 release :(. Sorry.

@erlend-aasland
Copy link
Contributor

I agree. However I'm not sure what exactly is causing this. My general idea is that something is causing the tp_traverse function to be called multiple times on the same instance, but I don't know why inheriting from sqlite.Cursor causes this. I will try to create a test case without sqlite but it's possible that I won't be able to find it before the next 3.11 release :(. Sorry.

No sweat! Thanks so much for the quick fix!

Copy link
Contributor

@kumaraditya303 kumaraditya303 left a comment

Choose a reason for hiding this comment

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

LGTM

@Fidget-Spinner Fidget-Spinner merged commit 9e38553 into python:3.11 Dec 4, 2022
@Fidget-Spinner
Copy link
Member Author

Thanks for the reviews, Erlend and Kumar!

@Fidget-Spinner Fidget-Spinner deleted the fix_sqlite_crash branch December 4, 2022 06:41
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.

5 participants