Compilation fail because of doc string

80 views
Skip to first unread message

Talanor

unread,
Aug 30, 2012, 9:57:32 AM8/30/12
to cython...@googlegroups.com
Hello,

i've been using your tool again. And I randomly found a strange behaviour.
Well, in fact, it is not strange, but unexpected..

The problem can be summarized by this line of python :

''.join([])

When i compiled it, cython told me :
test.py:1:2: Syntax error in doc string

Is it a normal behaviour?
I must admit I didn't look for this kind of errors on the whole web but
didn't found it in the first google results.

Thank you

Talanor

unread,
Sep 4, 2012, 2:25:53 PM9/4/12
to cython...@googlegroups.com
 Hello!

I don't know if you saw this :-°

Nobody answered me, so I guess you didn't.

The problem is that cython doesn't like variables doc strings.
I mean : cython tries to assign the docstring to the related fonction/module instead of ignoring it and assigning None as the docstring like cpython does.

Stefan Behnel

unread,
Sep 4, 2012, 2:54:30 PM9/4/12
to cython...@googlegroups.com
Talanor, 04.09.2012 20:25:
> Le jeudi 30 août 2012 15:57:36 UTC+2, Talanor a écrit :
>> i've been using your tool again. And I randomly found a strange behaviour.
>> Well, in fact, it is not strange, but unexpected..
>>
>> The problem can be summarized by this line of python :
>>
>> ''.join([])
>>
>> When i compiled it, cython told me :
>> test.py:1:2: Syntax error in doc string
>>
>> Is it a normal behaviour?
>> I must admit I didn't look for this kind of errors on the whole web but
>> didn't found it in the first google results.
>
> The problem is that cython doesn't like variables doc strings.
> I mean : cython tries to assign the docstring to the related
> fonction/module instead of ignoring it and assigning None as the docstring
> like cpython does.

Yes, thanks for the report. Looks like a bug in the parser.

Stefan

Stefan Behnel

unread,
Sep 4, 2012, 3:03:13 PM9/4/12
to cython...@googlegroups.com
Stefan Behnel, 04.09.2012 20:54:
BTW, it would be cool if you could write up a fix for it and send us a pull
request. Look for "docstring" in Parsing.py.

Stefan

Talanor

unread,
Sep 5, 2012, 9:39:32 AM9/5/12
to cython...@googlegroups.com
Ok, i'm on it, i think I have a fix. I'm testing it and i'll send you a
pull request when i'm done.

Thank you

Talanor

unread,
Sep 5, 2012, 11:21:30 AM9/5/12
to cython...@googlegroups.com
On 09/04/2012 09:03 PM, Stefan Behnel wrote:
Here's the pull request: https://github.com/cython/cython/pull/149

Thanks

Talanor

unread,
Sep 22, 2012, 9:45:16 AM9/22/12
to cython...@googlegroups.com
On 09/04/2012 09:03 PM, Stefan Behnel wrote:
>
> BTW, it would be cool if you could write up a fix for it and send us a pull
> request. Look for "docstring" in Parsing.py.
>
> Stefan
>
Hey, may I remind you that I sent a pull request =)

Here it is : https://github.com/cython/cython/pull/149

Thank you.

Stefan Behnel

unread,
Sep 22, 2012, 10:33:27 AM9/22/12
to cython...@googlegroups.com
Talanor, 22.09.2012 15:45:
Sorry for the long delay and thanks for insisting. I commented the changes.
I think you're almost there, but the node handling needs to be done
differently.

Stefan

Talanor

unread,
Oct 1, 2012, 6:10:05 AM10/1/12
to cython...@googlegroups.com
Hey,

is it ok the way I did it?

thank you.

Talanor

unread,
Oct 5, 2012, 3:40:57 AM10/5/12
to cython...@googlegroups.com
Hello,

I don't know if you are notified when I push the changes on my branch
for the pull request, if you are, please, tell me, I won't mail you
anymore about it x)

thank you

Robert Bradshaw

unread,
Oct 5, 2012, 4:10:33 PM10/5/12
to cython...@googlegroups.com
Rather than introduce a _visit_DocString method that recursively calls
the right super, I might simply write an extract_docstring(node)
method, but that's just a suggestion.

In any case, can you create a new pull request with just this change
in the history? Also, can you add a test?
Reply all
Reply to author
Forward
0 new messages