Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'static': 0.04; 'url:bitbucket': 0.05; '(all': 0.07; 'string': 0.09; '#endif': 0.09; 'logic': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'seemed': 0.09; 'spaces': 0.09; 'times,': 0.14; '"..."': 0.16; '#create': 0.16; '#delete': 0.16; '#ifdef': 0.16; 'backslashes': 0.16; 'conditional': 0.16; 'definitions,': 0.16; 'expands': 0.16; 'experiment.': 0.16; 'formatted': 0.16; 'line)': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'string\\n': 0.16; 'tabs': 0.16; 'variations': 0.16; 'vim)': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'library': 0.18; 'module': 0.19; 'first.': 0.19; 'properly': 0.19; 'skip:g 40': 0.19; 'url:default': 0.19; 'fit': 0.20; 'seems': 0.21; 'import': 0.22; 'header:User-Agent:1': 0.23; 'char': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'extension': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'skip:p 30': 0.29; "doesn't": 0.30; 'dos': 0.30; 'expansion': 0.30; "i'm": 0.30; 'work.': 0.31; '(which': 0.31; 'code': 0.31; 'lines': 0.31; 'font': 0.31; 'quotes': 0.31; 'interface': 0.32; 'run': 0.32; 'another': 0.32; 'actual': 0.34; 'skip:_ 10': 0.34; "can't": 0.35; 'something': 0.35; 'etc': 0.35; 'but': 0.35; 'there': 0.35; 'version': 0.36; 'url:org': 0.36; 'two': 0.37; 'skip:m 40': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'dave': 0.60; 'ago.': 0.61; 'eye': 0.61; 'lost': 0.61; 'simple': 0.61; 'first': 0.61; 'show': 0.63; 'such': 0.63; 'skip:n 10': 0.64; 'url:c': 0.67; 'believe': 0.68; 'received:109': 0.72; 'unusual': 0.74; 'ending': 0.78; '");': 0.84; '(according': 0.84; 'etc,': 0.84; 'angel': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robin Becker Subject: Re: PyDoc_STRVAR error in msvc compile Date: Wed, 02 Oct 2013 12:28:31 +0100 References: <524AFB57.9090500@chamonix.reportlab.co.uk> <524B05B7.4060906@mrabarnett.plus.com> <524BE099.8040004@chamonix.reportlab.co.uk> <524BEEFD.50202@chamonix.reportlab.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 109.174.168.73 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: Cc: Dave Angel X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 65 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1380713327 news.xs4all.nl 15938 [2001:888:2000:d::a6]:52313 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:55312 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. -- Robin Becker