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 zach.ware
Recipients larry, serhiy.storchaka, zach.ware
Date 2014-01-21.18:08:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390327709.54.0.923265073295.issue20323@psf.upfronthosting.co.za>
In-reply-to
Content
Larry Hastings wrote:
> Does your proposed solution work properly when docstrings are turned
> off?  Try undefining WITH_DOC_STRINGS.  I bet you need to make the
> size 1 in that case.

For certain values of "properly", yes.  It builds with no warnings or errors on Windows, but I don't know how it does on memory usage.  It's easy enough to define PyDoc_VAR_WITH_SIZE alongside PyDoc_STR and use '1' instead of 'size' when WITH_DOC_STRINGS is undefined, though.

> Also, the length must be len(f.docstring) + 1, to account for the
> trailing \0.

I thought so as well, but testing both ways showed no difference.  To provoke a difference, I defined length as len(f.docstring) - 1, which threw a compiler warning about an overflow.  Adding 1 is probably safer, though.

> Also, error C2133 doesn't look like it's applicable.  On line 71 it's
> not being stored in a structure.  Dumb MSVC.

I can't argue that one :)

> Also PyDoc_SIZEDVAR is a bad name.  PyDoc_SIZED_VAR would be an
> improvement, but I think PyDoc_VAR_WITH_SIZE is the name you want
>there.

Fair enough.

> And, I'm still not a +1 on this approach.  Can you propose something
> else?

I gave the 4 alternatives I could think of; I'll keep thinking and throw out anything else I come up with.

> Finally, I will note that the "buffer" preset would work just fine in
> this file, if you dumped the buffer just above the PyMethodDef array.

Indeed; winsound is just a convenient testbed since it's such a small module, but the problem will affect any module that can really benefit from the two-pass output system.
History
Date User Action Args
2014-01-21 18:08:29zach.waresetrecipients: + zach.ware, larry, serhiy.storchaka
2014-01-21 18:08:29zach.waresetmessageid: <1390327709.54.0.923265073295.issue20323@psf.upfronthosting.co.za>
2014-01-21 18:08:29zach.warelinkissue20323 messages
2014-01-21 18:08:29zach.warecreate