Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #55229

Re: PyDoc_STRVAR error in msvc compile

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
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; 'syntax': 0.04; 'compiler': 0.07; 'error:': 0.07; 'linux,': 0.07; 'python3': 0.07; '#endif': 0.09; "'#'": 0.09; 'exit': 0.09; '2.7': 0.14; 'windows': 0.15; '#ifdef': 0.16; "';'": 0.16; 'differs': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'mechanism.': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'porting': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'wrote:': 0.18; 'module': 0.19; 'trying': 0.19; 'seems': 0.21; 'command': 0.22; 'import': 0.22; 'hack': 0.22; 'previously': 0.22; 'header :User-Agent:1': 0.23; 'error': 0.23; 'char': 0.24; 'looks': 0.24; "i've": 0.25; 'extension': 0.26; 'possibly': 0.26; 'switch': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'character': 0.29; 'errors': 0.30; 'expansion': 0.30; 'newer': 0.30; "i'm": 0.30; 'program,': 0.31; 'code': 0.31; 'getting': 0.31; 'anyone': 0.31; 'interface': 0.32; 'quite': 0.32; 'minimal': 0.33; 'raw': 0.33; 'received:84': 0.35; 'but': 0.35; 'should': 0.36; 'to:addr:python- list': 0.38; 'visual': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'between': 0.67; 'header:Reply-To:1': 0.67; 'invalid': 0.68; 'reply-to:no real name:2**0': 0.71; '");': 0.84; 'compiles': 0.84; 'reply-to:addr:python.org': 0.84
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=PIY2p5aC c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=LqG8EI-UCiYA:10 a=Ta871D-plWYA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=n1oe47EORhEA:10 a=BbawEP67pbygJydr6ZwA:9 a=wPNLvfGTeEIA:10
X-AUTH mrabarnett:2500
Date Tue, 01 Oct 2013 18:26:15 +0100
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.0
MIME-Version 1.0
To python-list@python.org
Subject Re: PyDoc_STRVAR error in msvc compile
References <524AFB57.9090500@chamonix.reportlab.co.uk>
In-Reply-To <524AFB57.9090500@chamonix.reportlab.co.uk>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To python-list@python.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.566.1380648371.18130.python-list@python.org> (permalink)
Lines 65
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1380648371 news.xs4all.nl 15910 [2001:888:2000:d::a6]:54059
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:55229

Show key headers only | View raw


On 01/10/2013 17:41, Robin Becker wrote:
> I'm trying to port C code  that compiles under 2.7 to 3.3; the intention is to
> make things work under both.
>
> I used to use raw strings for the module documentation, but my porting guide
> suggests that I should be using PyDoc_STRVAR. That works for me using linux, but
> I'm getting errors under windows compiles
>
> My usage looks like this
>
>
> PyDoc_STRVAR(__DOC__,
> "Helper extension module for xxx.\n\
> \n\
> Interface summary:\n\
> \n\
> 	import _xxx\n\
> 	......\n"
> #ifdef	ZZZZ
> "    ZZZZ stuff\n"
> #endif
> "\n\
> 	.........\n\
> ");
>
>
> but it seems that the MSVC compiler for python-2.7 cannot hack this and I get
> messages like this
>
>> _xxx.c
>> C:\code\hg-repos\test_ext\xxx\_xxx.c(66) : error C2121: '#' : invalid character : possibly the
>> result of a macro expansion
>> C:\code\hg-repos\test_ext\xxx\_xxx.c(66) : error C2146: syntax error : missing ';' before ident
>> ifier 'ifdef'
>> C:\code\hg-repos\test_ext\xxx\_xxx.c(66) : error C2143: syntax error : missing '{' before 'cons
>> tant'
>> C:\code\hg-repos\test_ext\xxx\_xxx.c(66) : error C2059: syntax error : '<Unknown>'
>> C:\code\hg-repos\test_ext\xxx\_xxx.c(66) : error C2121: '#' : invalid character : possibly the
>> result of a macro expansion
>> error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2
>
> line 66 is the closing paranthesis.
>
> Anyone got any ideas?
>
> Previously I used code like this
>
> static char moduleDoc ="Helper extension module for xxx.\n\
> \n\
> Interface summary:\n\
> \n\
> 	import _xxx\n\
> 	......\n"
> #ifdef	ZZZZ
> "    ZZZZ stuff\n"
> #endif
> "\n\
> 	.........\n\
> ";
>
> but the registration and usage differs quite a lot between python2 & python3 so
> I thought to switch to the newer mechanism.
>
I've tried it in a minimal console program, and it seems to work for me.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: PyDoc_STRVAR error in msvc compile MRAB <python@mrabarnett.plus.com> - 2013-10-01 18:26 +0100

csiph-web