[Python-Dev] debugging test_importlib.test_bad_traverse - script status is SUCCESS - but FAIL is expected.
Michael
aixtools at felt.demon.nl
Tue Sep 18 05:48:53 EDT 2018
On 17/09/2018 09:39, Michael wrote:
> I read the discussion related to issue32374. That seems to be sure that
> other events that could
> cause the test to fail (i.e., the program executes successfully) are
> caught early, and/or ignored
> so that the program fails - and the test succeeds.
After reading below, I would appreciate knowing whether to ask that
issue32374 be reopened and the test adjusted so that the test is
"SkipIf" AIX? Or, something else? I'll work on something else, but I do
not want to guess the current intent of this test module.
+++++++
In: Modules/_testmultiphase.c - found where AIX and Linux differ
in their response to accessing a NULL pointer, in this case
m_state->integer
+624 static int
+625 bad_traverse(PyObject *self, visitproc visit, void *arg) {
+626 testmultiphase_state *m_state;
+627 FILE *err = fopen("/tmp/err","a");
+628
+629 m_state = PyModule_GetState(self);
+630
+631 fprintf(err,"%s:%d\n", __FILE__,__LINE__); fflush(err);
+632 fprintf(err, "m_state:08%lx &m_state->integer:%08lx\n",
+633 m_state, &(m_state->integer));
+634 fclose(err);
+635 Py_VISIT(m_state->integer);
+636 /*
+637 #define Py_VISIT(op)
+638 do {
+639 if (m_state->integer) {
+640 int vret = visit((PyObject *)(m_state->integer), arg);
+641 if (vret) {
+642 return vret;
+643 }
+644 }
+645 } while (0);
+646 */
+647 return 0;
+648 }
The "m_state" and m_state->integer values are identical, but the
response is not.
root at x066:[/data/prj/python/git]uname
AIX
/data/prj/python/git/python3-3.8/Modules/_testmultiphase.c:631
m_state:080 &m_state->integer:00000000
root at x074:/data/prj/python/git# uname
Linux
/data/prj/python/git/Python3-3.8.0/Modules/_testmultiphase.c:631
m_state:080 &m_state->integer:00000000
++++++ Test program to demonstrate +++++++
AIX does not segmentfault on access of a NULL pointer
++++++++++++++++++++++++++++++++++++++++++
root at x074:/data/prj/python/git# cat nullpr.c
#include<stdio.h>
main()
{
int *vpt = NULL;
fprintf(stdout, "vpt = %08lx\n", vpt);
if (*vpt)
fprintf(stdout,"True\n");
else
fprintf(stdout,"False\n");
}
root at x074:/data/prj/python/git# rm -f nullpr; make nullpr; ./nullpr
make: Warning: File 'nullpr.c' has modification time 387 s in the future
cc nullpr.c -o nullpr
nullpr.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
main()
^
make: warning: Clock skew detected. Your build may be incomplete.
vpt = 00000000
Segmentation fault
++++++++++ AIX does not 'Segmenttation fault' +++++++++++++
root at x066:[/data/prj/python/git]rm -r nullpr; make nullpr; ./nullpr
cc nullpr.c -o nullpr
vpt = 00000000
False
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180918/2a4a60b4/attachment.sig>
More information about the Python-Dev
mailing list