Message138637
| Author |
benjamin.peterson |
| Recipients |
Arfrever, amaury.forgeotdarc, benjamin.peterson, georg.brandl, vinay.sajip |
| Date |
2011年06月19日.15:45:46 |
| SpamBayes Score |
6.5573824e-11 |
| Marked as misclassified |
No |
| Message-id |
<BANLkTikOz82ah-g4wz_O5q2j+h4C6=_KOQ@mail.gmail.com> |
| In-reply-to |
<1308498191.86.0.698855233158.issue12291@psf.upfronthosting.co.za> |
| Content |
2011年6月19日 Vinay Sajip <report@bugs.python.org>:
>
> Vinay Sajip <vinay_sajip@yahoo.co.uk> added the comment:
>
> This seems a bit hacky, and I'm not sure how reliable it is. I added this after the read_object call:
>
> if (is_file) {
> PyObject * newpos;
> int cp, np;
>
> cp = ftell(rf.fp);
> newpos = PyObject_CallMethod(f, "seek", "ii", cp, SEEK_SET);
Why not 0?
> assert(newpos != NULL);
> np = PyLong_AsLong(newpos);
> Py_DECREF(newpos);
> assert(cp == np);
> }
>
> When I run the code lots of times, I sometimes get assertion failures at the
>
> assert(newpos != NULL)
That's because the call is failing. Why?
>
> line. It's not an EOF condition thing, necessarily: I do get expected behaviour at least sometimes when seeking to the end of file.
> |
|