[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2017-09-30 Thread Zachary Ware

Zachary Ware  added the comment:

With two-pass gone, this is gone.

--
resolution: remind -> out of date
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-04-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The file preset is default now, but if you will consider Argument Clinic as 
general tool for use in third-party software, the bug still is here.

--
priority: normal - low

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-04-22 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - remind
versions: +Python 3.6 -Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-04-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ah, if the two-pass preset is gone, then of course the bug is gone too.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-04-22 Thread Larry Hastings

Larry Hastings added the comment:

I thought the bug only happened with the two-pass preset.  The two-pass 
preset is gone, because I broke it, and nobody was using it anyway, so I 
removed it.

(I don't even remember what two-pass was trying to do.  It's possible the 
same effect could be achieved with the modern every destination has an 
arbitrary number of separate numbered buffers you can put text into 
technology.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-04-21 Thread Larry Hastings

Larry Hastings added the comment:

Is this problem gone, now that Serhiy changed everything over to the file 
preset?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-02-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
components: +Argument Clinic
nosy: +steve.dower, tim.golden

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-02-25 Thread Zachary Ware

Zachary Ware added the comment:

That may be for the best.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-02-25 Thread Larry Hastings

Larry Hastings added the comment:

Perhaps, now that Guido allows us to redirect into a separate file, we should 
simply abandon the two-pass approach.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-02-25 Thread Steve Dower

Steve Dower added the comment:

Not sure how helpful this is, but the following code compiles fine for me (VC 
12.0 and 14.0):

#include stdio.h

char myStr[];
struct { char* a; } myStruct = { myStr };

int main() {
printf(%s, myStruct.a);
return 0;
}

static char myStr[] = 123456789;

Any reason you can't define the forward definition like this? (It only seems to 
work with myStr[] and not *myStr, for some reason.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-02-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What if add const in PyDoc_VAR?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-02-25 Thread Steve Dower

Steve Dower added the comment:

You need to leave static out of the forward definition and then add it in the 
initialization. The variable is not accessible from other object files - I 
checked.

const char[] and static const char[] should work the same, though I haven't 
tried it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-02-25 Thread Zachary Ware

Zachary Ware added the comment:

(My last comment was aimed at Larry's comment about abandoning two-pass...)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2015-02-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

You forgot static in the declaration Steve.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-08-04 Thread Zachary Ware

Zachary Ware added the comment:

You're right, of course; I don't know how I got a non-screwball result in prior 
testing.  Here's an updated patch.

I have not come up with any better alternative.

--
stage:  - patch review
Added file: http://bugs.python.org/file36259/issue20323.v2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-08-02 Thread Mark Lawrence

Changes by Mark Lawrence breamore...@yahoo.co.uk:


--
versions: +Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-01-21 Thread Zachary Ware

Zachary Ware added the comment:

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.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-01-21 Thread Larry Hastings

Larry Hastings added the comment:

If in C you define
static char a[5] = abcde
C suppresses the trailing '\0'.  That it continued to work okay was a lucky 
break--you must not have looked in many docstrings, or you lucked out and they 
happened to be padded with zeroes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-01-21 Thread Larry Hastings

Larry Hastings added the comment:

I had to throw it in a struct to prevent gcc from rearranging the variables.  
But this demonstrates the problem--when it prints the string, it doesn't stop 
at the end.

-
#include stdio.h

typedef struct
{
int a;
char b[8];
int c;
} abc_t;

int main(int argc, char *argv[])
{
abc_t abc = {-1, abcdefgh, -1};
printf(abc %i%s%i\n, abc.a, abc.b, abc.c);
return 0;
}
-

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-01-20 Thread Zachary Ware

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 rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-01-20 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


--
components: +Build, Demos and Tools, Windows
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-01-20 Thread Larry Hastings

Larry Hastings added the comment:

I don't understand the problem--you didn't give me enough context.  Can you 
attach a file that demonstrates the problem?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-01-20 Thread Zachary Ware

Zachary Ware added the comment:

Attached is PC/winsound.c, as converted in issue20172, but using the two-pass 
preset output scheme.

Compiling with this file produces these errors:

..\PC\winsound.c(71): error C2133: 'winsound_PlaySound__doc__' : unknown size 
[P:\ath\to\cpython\PCbuild\winsound.vcxproj]
..\PC\winsound.c(79): error C2133: 'winsound_Beep__doc__' : unknown size 
[P:\ath\to\cpython\PCbuild\winsound.vcxproj]
..\PC\winsound.c(87): error C2133: 'winsound_MessageBeep__doc__' : unknown size 
[P:\ath\to\cpython\PCbuild\winsound.vcxproj]

MSVC doesn't like declaring the unsized array without an asignment.

--
Added file: http://bugs.python.org/file33586/winsound.c

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-01-20 Thread Larry Hastings

Larry Hastings added the comment:

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.

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

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

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.

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

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.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-01-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Why PyDoc_VAR prototype is used at all? There are only two occurrences of 
PyDoc_VAR in current code, and one of them actually can be replaced by 
PyDoc_STRVAR.

--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20323] Argument Clinic: docstring_prototype output causes build failure on Windows

2014-01-20 Thread Larry Hastings

Larry Hastings added the comment:

Serhiy: PyDoc_VAR is used in the two-pass approach as a forward declaration 
for docstrings.  Imagine if, in winsound.c, sound_methods was defined above the 
dump buffer block.  The expansion of WINSOUND_PLAYSOUND_METHODDEF would 
include a reference to winsound_PlaySound__doc__, which hadn't been defined yet.

winsound.c is simple enough, it doesn't need the two-pass approach.  But 
two-pass would work well for _pickle.c, where there are four or five 
PyMethodDef structures in the middle of the file.  Part of this is just Zachary 
experimenting with two-pass.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com