homepage

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_buffer fails on OS X universal 64-/32-bit builds
Type: behavior Stage: resolved
Components: Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: mark.dickinson, ned.deily, pitrou, python-dev, skrah
Priority: normal Keywords: patch

Created on 2012年05月10日 23:20 by ned.deily, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issueXXXXX_test_buffer.patch ned.deily, 2012年05月10日 23:20 review
Messages (7)
msg160382 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012年05月10日 23:20
test_buffer can fail when run on an OS X 64-/32-bit universal build of Python is run in 32-bit mode.
$ /usr/local/bin/python3.3 -m test test_buffer
[1/1] test_buffer
1 test OK.
$ /usr/local/bin/python3.3-32 -m test -v test_buffer
== CPython 3.3.0a3 (v3.3.0a3:0b53b70a40a0, May 1 2012, 11:39:35) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
== Darwin-11.4.0-x86_64-i386-64bit little-endian
== /private/var/folders/fm/9wjgctqx61n796zt88qmmnxc0000gn/T/test_python_56263
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)
[1/1] test_buffer
[...]
test_memoryview_construction (test.test_buffer.TestBufferProtocol) ... FAIL
test_ndarray_format_shape (test.test_buffer.TestBufferProtocol) ... FAIL
test_ndarray_format_strides (test.test_buffer.TestBufferProtocol) ... FAIL
test_ndarray_getbuf (test.test_buffer.TestBufferProtocol) ... FAIL
test_ndarray_multidim (test.test_buffer.TestBufferProtocol) ... FAIL
test_ndarray_slice_assign_single (test.test_buffer.TestBufferProtocol) ... FAIL
[...]
The test is incorrectly testing a compile-time configuration variable which is not meaningful for universal builds since each architecture can have different values. Further, the platform.architecture fallback test is also unreliable; as noted in the docs for the platform module, sys.maxsize should be used for run-time tests. The attached patch fixes the test for OS X.
msg160402 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2012年05月11日 08:56
The sysconfig docs say: "configuration variables relevant for the
current platform"
If get_config_var('SIZEOF_VOID_P') is meaningless for universal builds,
then IMO it should return None. None would then mean either "not found"
or "irrelevant".
msg160405 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012年05月11日 11:20
Well, no need to ever use SIZEOF_VOID_P. sys.maxsize should always tell you whether the build is 32-bit or 64-bit.
msg160413 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2012年05月11日 12:39
The tests for arrays with suboffsets literally need sizeof(void *).
I don't think C guarantees SIZEOF_VOID_P == SIZEOF_SIZE_T. If HAVE_SSIZE_T
is defined in pyport.h, AFAICS no such check is made.
Of course these concerns may be entirely theoretical. :)
msg160492 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年05月12日 21:13
New changeset 8f22e5be18c8 by Stefan Krah in branch 'default':
Issue #14779: Do not use get_config_var('SIZEOF_VOID_P') on OS X 64-/32-bit
http://hg.python.org/cpython/rev/8f22e5be18c8 
msg160494 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2012年05月12日 21:44
Apparently the AS/400 had 128 bit pointers and IBM's "System i" still has them:
http://comments.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/651
http://www-01.ibm.com/support/docview.wss?uid=swg27019425
So I'll leave the SIZEOF_VOID_P test as the preferred method. Perhaps
the best way to sidestep all these issues would be to write a small
C module for getting type sizes.
msg160912 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年05月16日 18:43
New changeset 967b06d56a69 by Stefan Krah in branch 'default':
Issue #14779: Get sizeof(void *) directly rather than relying on sysconfig.
http://hg.python.org/cpython/rev/967b06d56a69 
History
Date User Action Args
2022年04月11日 14:57:30adminsetgithub: 58984
2012年05月16日 18:43:11python-devsetmessages: + msg160912
2012年05月12日 22:36:19skrahsetstatus: open -> closed
type: behavior
resolution: fixed
stage: patch review -> resolved
2012年05月12日 21:44:39skrahsetmessages: + msg160494
2012年05月12日 21:13:57python-devsetnosy: + python-dev
messages: + msg160492
2012年05月11日 12:39:23skrahsetmessages: + msg160413
2012年05月11日 11:20:15pitrousetnosy: + mark.dickinson, pitrou
messages: + msg160405
2012年05月11日 08:56:15skrahsetmessages: + msg160402
2012年05月10日 23:20:54ned.deilycreate

AltStyle によって変換されたページ (->オリジナル) /