This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author meador.inge
Recipients benjamin.peterson, hynek, loewis, meador.inge, pitrou, python-dev, serhiy.storchaka, stutzbach
Date 2012-07-29.17:45:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1343583917.85.0.17564324275.issue15487@psf.upfronthosting.co.za>
In-reply-to
Content
On Sun, Jul 29, 2012 at 11:50 AM, Serhiy Storchaka <report@bugs.python.org> wrote:

>> Serhiy, I didn't analyze it too in depth, but why aren't the test cases
>> using the __sizeof__ support work you implemented for issue15467?  I think
>> these tests should be using the more exact method like your other
>> '__sizeof__' patches.
>
> Because struct has not codes for Py_off_t and PyThread_type_lock.

Of course it doesn't -- those are Python specific typedefs.  'PyThread_type_lock'
is just a typedef to 'void *' and something could be figured out for 'Py_off_t'
in the support code.

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.
History
Date User Action Args
2012-07-29 17:45:17meador.ingesetrecipients: + meador.inge, loewis, pitrou, benjamin.peterson, stutzbach, python-dev, hynek, serhiy.storchaka
2012-07-29 17:45:17meador.ingesetmessageid: <1343583917.85.0.17564324275.issue15487@psf.upfronthosting.co.za>
2012-07-29 17:45:17meador.ingelinkissue15487 messages
2012-07-29 17:45:17meador.ingecreate