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 asyncpg with Py_DEBUG mode #719

Merged
merged 3 commits into from
Apr 26, 2021
Merged

Fix asyncpg with Py_DEBUG mode #719

merged 3 commits into from
Apr 26, 2021

Conversation

shadchin
Copy link
Contributor

If Py_DEBUG enabled, then newly allocated memory is filled with the byte 0xCD (CLEANBYTE) https://docs.python.org/3/c-api/memory.html#c.PyMem_SetupDebugHooks

This breaks checks for pointer == NULL and results in crash.

From documentation PyObject_GC_Track https://docs.python.org/3/c-api/gcsupport.html#c.PyObject_GC_Track

This should be called once all the fields followed by the tp_traverse handler become valid, usually near the end of the constructor.

Copy link
Member

@elprans elprans left a comment

Choose a reason for hiding this comment

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

Good catch. Thanks!

@elprans elprans merged commit a113d90 into MagicStack:master Apr 26, 2021
@shadchin shadchin deleted the patch-1 branch April 27, 2021 11:19
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.

2 participants