~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Modules/_bytesio.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
219
219
    if (!PyArg_ParseTuple(args, "|O:read", &arg))
220
220
        return NULL;
221
221
 
222
 
    if (PyInt_Check(arg)) {
223
 
        size = PyInt_AsSsize_t(arg);
 
222
    if (PyIndex_Check(arg)) {
 
223
        size = PyNumber_AsSsize_t(arg, PyExc_OverflowError);
224
224
        if (size == -1 && PyErr_Occurred())
225
225
            return NULL;
226
226
    }
288
288
    if (!PyArg_ParseTuple(args, "|O:readline", &arg))
289
289
        return NULL;
290
290
 
291
 
    if (PyInt_Check(arg)) {
292
 
        size = PyInt_AsSsize_t(arg);
 
291
    if (PyIndex_Check(arg)) {
 
292
        size = PyNumber_AsSsize_t(arg, PyExc_OverflowError);
293
293
        if (size == -1 && PyErr_Occurred())
294
294
            return NULL;
295
295
    }
334
334
    if (!PyArg_ParseTuple(args, "|O:readlines", &arg))
335
335
        return NULL;
336
336
 
337
 
    if (PyInt_Check(arg)) {
338
 
        maxsize = PyInt_AsSsize_t(arg);
 
337
    if (PyIndex_Check(arg)) {
 
338
        maxsize = PyNumber_AsSsize_t(arg, PyExc_OverflowError);
339
339
        if (maxsize == -1 && PyErr_Occurred())
340
340
            return NULL;
341
341
    }
419
419
    if (!PyArg_ParseTuple(args, "|O:truncate", &arg))
420
420
        return NULL;
421
421
 
422
 
    if (PyInt_Check(arg)) {
423
 
        size = PyInt_AsSsize_t(arg);
 
422
    if (PyIndex_Check(arg)) {
 
423
        size = PyNumber_AsSsize_t(arg, PyExc_OverflowError);
424
424
        if (size == -1 && PyErr_Occurred())
425
425
            return NULL;
426
426
    }
445
445
        if (resize_buffer(self, size) < 0)
446
446
            return NULL;
447
447
    }
448
 
    self->pos = size;
449
448
 
450
449
    return PyInt_FromSsize_t(size);
451
450
}