[New-bugs-announce] [issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

Zachary Ware report at bugs.python.org
Tue Jan 21 07:05:43 CET 2014


New submission from Zachary Ware:

The current two-pass output for the two-pass preset causes compile errors on Windows.  A sample:

..\PC\winsound.c(71): error C2133: 'winsound_PlaySound__doc__' : unknown size

Line 71 (clinic-generated docstring_prototype):

PyDoc_VAR(winsound_PlaySound__doc__);

Here's a bit more info on the error: http://msdn.microsoft.com/en-us/library/c13wk277%28v=vs.100%29.aspx

There are a few viable alternatives that I can see.

1) Give PyDoc_VAR a reasonable default size.  I don't like this; it seems fragile.

2) Remove docstring_prototype as an outputtable entity.  I don't like this much either, it should be a reasonable thing to do.

3) Add a new PyDoc_SIZEDVAR macro, taking name and size.  Argument Clinic will know the needed size and can fill it in, but it would be largely useless for manual usage.  I think this is my preferred route.

4) Instead of reusing PyDoc_VAR (or a new PyDoc_SIZEDVAR), just have Clinic output the whole expanded macro, with size; e.g. "static char winsound_PlaySound__doc__[195]".  This does have the downside that any future change to docstrings that would have been a simple change to the macro would have to be done in Argument Clinic, with lots of churn in every clinicized file.

Here's a patch that implements option 3.

----------
files: pydoc_sizedvar.diff
keywords: patch
messages: 208616
nosy: larry, zach.ware
priority: normal
severity: normal
status: open
title: Argument Clinic: docstring_prototype output causes build failure on Windows
type: compile error
Added file: http://bugs.python.org/file33585/pydoc_sizedvar.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20323>
_______________________________________


More information about the New-bugs-announce mailing list