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
[patch] assert tp_traverse in PyType_GenericAlloc() #46003
Comments
Attached is a very short patch against r59568 which asserts tp_traverse |
Bryan: can you provide a test case without external dependencies? If |
Well, there's no Python bug per se, hence no test case; this patch just I've attached an updated patch against r72055. It's a trivial change, |
It would be probably be better to put this check in PyType_Ready() instead. |
Are you sure this assertion is correct? tp_traverse is optional. |
I submitted this patch 14 years ago and am sure of nothing. :) |
tp_traverse is optional, so we should not add this assertion. |
This issue was fixed differently in bpo-44263, by adding a test in PyType_Ready(): // bpo-44263: tp_traverse is required if Py_TPFLAGS_HAVE_GC is set.
// Note: tp_clear is optional.
if (type->tp_flags & Py_TPFLAGS_HAVE_GC
&& type->tp_traverse == NULL)
{
PyErr_Format(PyExc_SystemError,
"type %s has the Py_TPFLAGS_HAVE_GC flag "
"but has no traverse function",
type->tp_name);
return -1;
} commit ee76375
|
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: