~ubuntu-branches/ubuntu/oneiric/python2.5/oneiric

« back to all changes in this revision

Viewing changes to Modules/_struct.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-12-21 08:57:49 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20081221085749-bijjr25h8na5jdsu
Tags: 2.5.3-0ubuntu1
* New upstream version.
* Regenerate the included documentation.
* Add an option --install-layout=deb, which is ignored for 2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
645
645
                return -1;
646
646
#if (SIZEOF_LONG > SIZEOF_INT)
647
647
        if ((x < ((long)INT_MIN)) || (x > ((long)INT_MAX)))
648
 
                return _range_error(f, 0);
 
648
                RANGE_ERROR(x, f, 0, -1);
649
649
#endif
650
650
        y = (int)x;
651
651
        memcpy(p, (char *)&y, sizeof y);
657
657
{
658
658
        unsigned long x;
659
659
        unsigned int y;
660
 
        if (get_ulong(v, &x) < 0)
661
 
                return _range_error(f, 1);
 
660
        if (get_wrapped_ulong(v, &x) < 0)
 
661
                return -1;
662
662
        y = (unsigned int)x;
663
663
#if (SIZEOF_LONG > SIZEOF_INT)
664
664
        if (x > ((unsigned long)UINT_MAX))
665
 
                return _range_error(f, 1);
 
665
                RANGE_ERROR(y, f, 1, -1);
666
666
#endif
667
667
        memcpy(p, (char *)&y, sizeof y);
668
668
        return 0;
682
682
np_ulong(char *p, PyObject *v, const formatdef *f)
683
683
{
684
684
        unsigned long x;
685
 
        if (get_ulong(v, &x) < 0)
686
 
                return _range_error(f, 1);
 
685
        if (get_wrapped_ulong(v, &x) < 0)
 
686
                return -1;
687
687
        memcpy(p, (char *)&x, sizeof x);
688
688
        return 0;
689
689
}