diff options
author | Michael Felt <aixtools@users.noreply.github.com> | 2019-09-10 14:30:18 +0100 |
---|---|---|
committer | Ned Deily <nad@python.org> | 2019-09-10 14:30:18 +0100 |
commit | 61f34f9f63aab7503420603627ad5bd8902d904b (patch) | |
tree | dcdcab0031413a4a0a0355016f8b43de83bf5c6d /Modules | |
parent | 9cbf43adfe268fc65e68d9185b80d3305b2c4f19 (diff) | |
download | cpython-git-61f34f9f63aab7503420603627ad5bd8902d904b.tar.gz |
bpo-34720: Fix test_importlib.test_bad_traverse for AIX (GH-14238)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testmultiphase.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/_testmultiphase.c b/Modules/_testmultiphase.c index 5776df7d76..c6dfc2f01d 100644 --- a/Modules/_testmultiphase.c +++ b/Modules/_testmultiphase.c @@ -624,6 +624,14 @@ bad_traverse(PyObject *self, visitproc visit, void *arg) { testmultiphase_state *m_state; m_state = PyModule_GetState(self); + + /* The following assertion mimics any traversal function that doesn't correctly handle + * the case during module creation where the module state hasn't been created yet. + * + * The check that it is used to test only runs in debug mode, so it is OK that the + * assert() will get compiled out in fully optimised release builds. + */ + assert(m_state != NULL); Py_VISIT(m_state->integer); return 0; } |