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: exception __suppress_context__ test failures on OS X ppc systems
Type: behavior Stage: resolved
Components: Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, georg.brandl, ned.deily, pitrou, python-dev, vstinner
Priority: critical Keywords: patch

Created on 2012-08-08 23:16 by ned.deily, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
char.patch benjamin.peterson, 2012-08-09 00:05 review
exception.patch vstinner, 2012-08-09 00:09 review
Messages (6)
msg167734 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-08-08 23:16
== CPython 3.3.0b1 (default:efb30bdcfa1e, Aug 8 2012, 15:43:49) [GCC 4.0.1 (Apple Inc. build 5493)]
==   Darwin-8.11.0-Power_Macintosh-powerpc-32bit big-endian
==   /private/tmp/test_python_13864
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1)
[...]
======================================================================
FAIL: testChainingDescriptors (test.test_exceptions.ExceptionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/test/test_exceptions.py", line 432, in testChainingDescriptors
    self.assertTrue(e.__suppress_context__)
AssertionError: False is not true

----------------------------------------------------------------------

Other similar test failures include multiple test cases in test_ipaddress, test_raise, and test_traceback, for example:


======================================================================
FAIL: test_address_errors (test.test_ipaddress.NetworkTestCase_v6)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/ipaddress.py", line 1580, in _ip_int_from_string
    ip_int |= self._parse_hextet(parts[i])
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/ipaddress.py", line 1605, in _parse_hextet
    raise ValueError("Only hex digits permitted in %r" % hextet_str)
ValueError: Only hex digits permitted in 'axy'

During handling of the above exception, another exception occurred:

ipaddress.AddressValueError: Only hex digits permitted in 'axy' in '1234:axy::b'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/test/test_ipaddress.py", line 439, in test_address_errors
    assertBadAddress("1234:axy::b", "Only hex digits")
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/test/test_ipaddress.py", line 432, in assertBadAddress
    self.factory(addr)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/contextlib.py", line 66, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/test/test_ipaddress.py", line 50, in assertCleanError
    self.assertTrue(exc.exception.__suppress_context__)
AssertionError: False is not true

The same universal build runs without error on an Intel Mac with the same os version.  The ppc failures are seen on both PPC OS X 10.5 and 10.4 systems.
msg167738 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-08-08 23:30
It appears similar failures are occuring on Sparc platforms (see issue15589) another big-endian platform.
msg167739 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2012-08-09 00:05
Does this fix it?
msg167740 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2012-08-09 00:09
__suppress_context__ is a member using T_BOOL type. T_BOOL expects the C type "char", whereas the field in the PyBaseExceptionObject is a C "int". Attached patch changes the type and should fix the issue.

The test fails because writing into the field uses:

 *(char*)field = value;

Which does not work in big endian if the field is a pointer to an int.
msg167743 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-08-09 00:23
New changeset e2df976b8a33 by Benjamin Peterson in branch 'default':
use char instead of int to please T_BOOL (closes #15597)
http://hg.python.org/cpython/rev/e2df976b8a33
msg167749 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-08-09 01:14
The patch does indeed fix all of the __suppress_context__ related test failures previously seen, i.e. test_exceptions, test_ipaddress, test_raise, and test_traceback.
History
Date User Action Args
2022-04-11 14:57:34adminsetgithub: 59802
2012-08-09 01:14:20ned.deilysetmessages: + msg167749
2012-08-09 00:23:07python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg167743

resolution: fixed
stage: needs patch -> resolved
2012-08-09 00:09:38vstinnersetfiles: + exception.patch

messages: + msg167740
2012-08-09 00:05:34benjamin.petersonsetfiles: + char.patch
keywords: + patch
messages: + msg167739
2012-08-08 23:56:55ned.deilysetnosy: + georg.brandl
2012-08-08 23:30:38ned.deilysetmessages: + msg167738
2012-08-08 23:28:49vstinnersetnosy: + vstinner
2012-08-08 23:16:48ned.deilycreate