[Python-checkins] r51119 - in python/trunk: Lib/test/test_struct.py Misc/NEWS Modules/_struct.c

Neal Norwitz nnorwitz at gmail.com
Fri Aug 11 17:25:09 CEST 2006


On 8/11/06, Bob Ippolito <bob at redivi.com> wrote:
> They're all documented in _struct.c
>
>
> /* If PY_STRUCT_FLOAT_COERCE is defined, the struct module will allow
> float
>     arguments for integer formats with a warning for backwards
>     compatibility. */

Yet in the python code below, PY_STRUCT_FLOAT_COERCE can have the
values 0, 1, or 2.

n

>
>
> -bob
>
> On Aug 10, 2006, at 9:33 PM, Neal Norwitz wrote:
>
> >> Modified: python/trunk/Lib/test/test_struct.py
> >> =====================================================================
> >> =========
> >> --- python/trunk/Lib/test/test_struct.py        (original)
> >> +++ python/trunk/Lib/test/test_struct.py        Sat Aug  5
> >> 01:59:21 2006
> >> @@ -15,9 +15,11 @@
> >>  except ImportError:
> >>      PY_STRUCT_RANGE_CHECKING = 0
> >>      PY_STRUCT_OVERFLOW_MASKING = 1
> >> +    PY_STRUCT_FLOAT_COERCE = 2
> >>  else:
> >> -    PY_STRUCT_RANGE_CHECKING = _struct._PY_STRUCT_RANGE_CHECKING
> >> -    PY_STRUCT_OVERFLOW_MASKING = _struct._PY_STRUCT_OVERFLOW_MASKING
> >> +    PY_STRUCT_RANGE_CHECKING = getattr(_struct,
> >> '_PY_STRUCT_RANGE_CHECKING', 0)
> >> +    PY_STRUCT_OVERFLOW_MASKING = getattr(_struct,
> >> '_PY_STRUCT_OVERFLOW_MASKING', 0)
> >> +    PY_STRUCT_FLOAT_COERCE = getattr(_struct,
> >> '_PY_STRUCT_FLOAT_COERCE', 0)
> >
> > It would be really nice to document what each of these values mean.
> > It's confusing without reading the code and seems odd to me.
> > Particularly PY_STRUCT_FLOAT_COERCE.
> >
> > I closed the bug report/patch associated with this checkin.
> >
> > Thanks,
> > n
>
>


More information about the Python-checkins mailing list