Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55229 > unrolled thread
| Started by | MRAB <python@mrabarnett.plus.com> |
|---|---|
| First post | 2013-10-01 18:26 +0100 |
| Last post | 2013-10-01 18:26 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: PyDoc_STRVAR error in msvc compile MRAB <python@mrabarnett.plus.com> - 2013-10-01 18:26 +0100
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2013-10-01 18:26 +0100 |
| Subject | Re: PyDoc_STRVAR error in msvc compile |
| Message-ID | <mailman.566.1380648371.18130.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web