This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_struct failure on ARM
Type: Stage: patch review
Components: Extension Modules Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: mark.dickinson, skrah
Priority: normal Keywords: buildbot, patch

Created on 2010-07-16 20:11 by mark.dickinson, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
bp_bool2.patch skrah, 2010-07-17 16:24
Messages (10)
msg110485 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-07-16 20:11
test_struct currently fails on the ARM buildbots;  see:

http://www.python.org/dev//buildbot/builders/ARMv4%20Debian%203.x/builds/275/steps/test/logs/stdio


======================================================================
FAIL: test_bool (test.test_struct.StructTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pybot/buildarea-armeabi/3.x.klose-linux-armeabi/build/Lib/test/test_struct.py", line 521, in test_bool
    "ExplodingBool())" % (prefix + '?'))
AssertionError: Expected IOError: struct.pack('>?', ExplodingBool())
msg110489 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-07-16 20:29
I don't really know where to start with this.  At the point of failure, struct.pack('<?', ExplodingBool()) has already been tested (and presumably raised the expected IOError).

Moreover, the struct module uses the same function, bp_bool, for packing with both '<?' and '>?', so it's a bit mystifying that one of these fails while the other passes.
msg110571 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2010-07-17 16:09
The usage of char in bp_bool will not work if char is unsigned. Hopefully
that is the cause.
msg110576 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2010-07-17 16:24
'sizeof y' is obviously wrong now in the memcpy. Next attempt.
msg110624 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-07-18 07:31
Thanks, Stefan!  Fixed (I hope) in r82941 (py3k).

Now I'm puzzled about why the test passes for '<?'.  But let's see what the buildbots do.
msg110625 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-07-18 08:02
Merged to release31-maint in r82942, release27-maint in r82945, release26-maint in r82946.

(And added missing Misc/NEWS entries for this change in r82943, r82944.)
msg110630 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2010-07-18 10:37
> Now I'm puzzled about why the test passes for '<?'.

Somewhere along the way native_table is used instead of lilendian_table,
so np_bool is called.
msg110635 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-07-18 11:38
> Somewhere along the way native_table is used instead of lilendian_table,
> so np_bool is called.

Hmm.  This doesn't alleviate my confusion. :)

The relevant part of test_struct looks like:

    for prefix in tuple("<>!=")+('',):
        # other tests
        try:
            struct.pack(prefix + '?', ExplodingBool())
        except IOError:
            pass
        else:
            self.fail("Expected IOError: struct.pack(%r, "
                      "ExplodingBool())" % (prefix + '?'))

So the '<?' test should happen directly before the '>?' test.  But the '<?' test was apparently passing, while the '>?' one was failing.  I don't see how native_table is relevant here, but am probably missing something.

On the other hand, with the pre-patch code, we end up with a method that sets a Python error but then returns a return value that indicates no error happened, and all sorts of unpredictable things can happen at that point...
msg110641 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2010-07-18 12:09
Mark Dickinson <report@bugs.python.org> wrote:
> > Somewhere along the way native_table is used instead of lilendian_table,
> > so np_bool is called.
> 
> Hmm.  This doesn't alleviate my confusion. :)

I suppose I sounded a bit like the Oracle of Delphi here. :)

I compiled with OPT="-O0 -g -funsigned-char" and stepped through the code (pre-patch).
With '<', np_bool is substituted for bp_bool (apparently in PyInit__struct).

np_bool correctly returns -1, so the problem does not occur.
msg110644 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-07-18 13:16
Ah yes; I missed that bit of PyInit__struct;  thank you!

Setting to pending; I'll close once the buildbots have reported back (it might take some days for the ARM buildbots to catch up).

Many thanks for the diagnosis.
History
Date User Action Args
2022-04-11 14:57:03adminsetgithub: 53523
2010-07-24 14:30:07mark.dickinsonsetstatus: pending -> closed
2010-07-18 13:16:09mark.dickinsonsetstatus: open -> pending

messages: + msg110644
2010-07-18 12:09:34skrahsetmessages: + msg110641
2010-07-18 11:38:06mark.dickinsonsetmessages: + msg110635
2010-07-18 10:37:09skrahsetstatus: pending -> open

messages: + msg110630
2010-07-18 09:31:50mark.dickinsonsetstatus: open -> pending
resolution: fixed
versions: + Python 2.6, Python 2.7
2010-07-18 08:02:08mark.dickinsonsetmessages: + msg110625
2010-07-18 07:31:26mark.dickinsonsetassignee: mark.dickinson
messages: + msg110624
2010-07-17 16:28:21skrahsetfiles: - bp_bool.patch
2010-07-17 16:24:28skrahsetfiles: + bp_bool2.patch

messages: + msg110576
2010-07-17 16:09:46skrahsetstage: patch review
2010-07-17 16:09:25skrahsetfiles: + bp_bool.patch

nosy: + skrah
messages: + msg110571

keywords: + patch
2010-07-16 20:29:20mark.dickinsonsetmessages: + msg110489
2010-07-16 20:11:24mark.dickinsoncreate