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


Groups > comp.lang.python > #55226

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!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
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; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '2.7': 0.14; 'windows': 0.15; '#ifdef': 0.16; "';'": 0.16; 'differs': 0.16; 'mechanism.': 0.16; 'porting': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; '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; 'extension': 0.26; 'possibly': 0.26; 'switch': 0.26; 'header:X-Complaints-To:1': 0.27; 'character': 0.29; 'errors': 0.30; 'expansion': 0.30; 'newer': 0.30; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; 'anyone': 0.31; 'interface': 0.32; 'quite': 0.32; 'raw': 0.33; '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; 'received:org': 0.40; 'between': 0.67; 'invalid': 0.68; 'received:109': 0.72; '");': 0.84; 'compiles': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Robin Becker <robin@reportlab.com>
Subject PyDoc_STRVAR error in msvc compile
Date Tue, 01 Oct 2013 17:41:59 +0100
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
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
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.564.1380645732.18130.python-list@python.org> (permalink)
Lines 64
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1380645732 news.xs4all.nl 15929 [2001:888:2000:d::a6]:41802
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:55226

Show key headers only | View raw


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.
-- 
Robin Becker

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


Thread

PyDoc_STRVAR error in msvc compile Robin Becker <robin@reportlab.com> - 2013-10-01 17:41 +0100

csiph-web