
report at bugs
Jul 29, 2012, 10:55 AM
Post #12 of 13
(123 views)
Permalink
|
|
[issue15487] Correct __sizeof__ support for buffered I/O
[In reply to]
|
|
Antoine Pitrou added the comment: Le dimanche 29 juillet 2012 à 17:45 +0000, Meador Inge a écrit : > Anyway, the way you are implementing the tests has the same issue as Martin pointed > out for the 'object.__sizeof__' method in issue15402. I could replace the > 'buffered_sizeof' implementation with: > > static PyObject * > buffered_sizeof(buffered *self, void *unused) > { > Py_ssize_t res; > > res = 1; > if (self->buffer) > res += self->buffer_size; > return PyLong_FromSsize_t(res); > } > > and the tests will still pass. That's true but, OTOH, I don't think it's very important. First, because it is a rather unlikely mistake. Second, because the important thing is to check that the internal buffer is part of the returned size, which is what Serhiy's test checks for. ---------- _______________________________________ Python tracker <report [at] bugs> <http://bugs.python.org/issue15487> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
|