PyDoc_STRVAR error in msvc compile

MRAB python at mrabarnett.plus.com
Wed Oct 2 11:18:03 EDT 2013


On 02/10/2013 12:28, Robin Becker wrote:
> On 02/10/2013 11:49, Dave Angel wrote:
>>> conditional string or "" then MSVC 9 seems to be ok with it.
>>> >
>> MSVC and other compilers do not not see eye to eye on the preprocessor
>> semantics.  I no longer use MSVC so I can't experiment.  I can only try
>> to recall extensive manipulation two decades ago.
>>
>> I believe it does the logic of "backslash at the end of line" first.  So
>> if there are any spaces or tabs after those backslashes (which might
>> have been lost when you pasted it here), fix them first.
>>
>> Then I think it looks for macro definitions, where the # must be the
>> first non-whitespace of the line.  Then it expands such macros, and I
>> think MSVC is unusual in that it expands them multiple times, so a macro
>> expansion can result in another macro invocation.
>>
>> I'm not sure where quotes fit in here.
>>
>> Your original message code doesn't match the expansion you show with -E,
>> so i suspect your "..." eliding hid something significant.
>
> The actual is this code from _renderPM.c
>
> https://bitbucket.org/rptlab/reportlab/src/fa65fe72b6c2aaecb7747bf14884adb996d8e87f/src/rl_addons/renderPM/_renderPM.c?at=default
>
> PyDoc_STRVAR(__DOC__,
> "Helper extension module for renderPM.\n\
> \n\
> Interface summary:\n\
> \n\
>           import _renderPM\n\
>           gstate(width,height[,depth=3,bg=0xffffff]) #create an initialised
> graphics state\n\
>           makeT1Font(fontName,pfbPath,names[,reader])     #make a T1 font\n\
>           delCache() #delete all T1 font info\n\
>           pil2pict(cols,rows,datastr,palette) hreturn PICT version of im as bytes\n"
> #ifdef  RENDERPM_FT
> "    ft_get_face(fontName) --> ft_face instance\n"
> #endif
> "\n\
>           _libart_version # base library version string\n\
>           _version                # module version string\n\
> ");
>
> when I run that through the pre-processor I get (all on a single line)
>
>
> static char __DOC__[] = "Helper extension module for renderPM.\n\nInterface
> summary:\n\n	import _renderPM\n	gstate(width,height[,depth=3,bg=0xffffff])
> #create an initialised graphics state\n
> makeT1Font(fontName,pfbPath,names[,reader])	#make a T1 font\n	delCache() #delete
> all T1 font info\n	pil2pict(cols,rows,datastr,palette) hreturn PICT version of
> im as bytes\n" #ifdef 1 "    ft_get_face(fontName) --> ft_face instance\n"
> #endif "\n	_libart_version	# base library version string\n	_version		# module
> version string\n";
>
>
>
> I tried a couple of variations of \ at the end of the line preceding #ifdef etc
> etc, but nothing seemed to work. The source is properly DOS formatted (according
> to vim) so it's not a simple line ending issue and I don't have any extra spaces
> at the end of the lines etc etc.
>
I overlooked that PyDoc_STRVAR is a macro, so, no, it doesn't work for
me either.




More information about the Python-list mailing list