[Python-Dev] test_struct failure on 64 bit platforms

Tim Peters tim.peters at gmail.com
Wed May 31 15:05:52 CEST 2006


[Bob]
>> The warning is correct, and so is the size. Only native formats have
>> native sizes; l and i are exactly 4 bytes on all platforms when using
>> =, >, <, or !. That's what "std size and alignment" means.

[Neal]
> Ah, you are correct.  I see this is the behaviour in 2.4.  Though I
> wouldn't call 4 bytes a standard size on a 64-bit platform.

"standard" is a technical word with precise meaning here, and is
defined by the struct module docs, in contrast to "native".  It means
whatever they say it means :-)  "Portable" may have been a more
intuitive word than "standard" here -- read "standard" in the struct
context in the sense of "standardized, regardless of native platform
size or alignment or endian quirks".

> Would someone augment the warnings module to make testing
> more reasonable?

What's required?  I know of two things:

1. There's no advertised way to save+restore the internal
   filter list, or to remove a filter entry, so tests that want
   to make a temporary change have to break into the internals.

2. There's no advertised way to disable "only gripe once per source
   line" behavior.  This gets in the way of testing that warnings get
   raised when running tests more than once, or using a common
   function to raise warnings from multiple call sites.

These get in the way of Zope and ZODB testing too, BTW.
Unfortunately, looks like the new test_struct code bumped into both of
them at once.


More information about the Python-Dev mailing list