csjark module

Peter Otten __peter__ at web.de
Wed Sep 21 10:15:06 EDT 2016


bezenchu at gmail.com wrote:

> On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten wrote:
>> bezenchu at gmail.com wrote:
>> 
>> > On Wednesday, September 21, 2016 at 1:14:14 PM UTC+3, Peter Otten
>> > wrote:
>> >> bezenchu at gmail.com wrote:
>> >> 
>> >> > After setting up csjark (http://csjark.readthedocs.io/), I'm trying
>> >> > to test on of my C header files which has following statements:
>> >> > 
>> >> > typedef struct {
>> >> >    unsigned long X;
>> >> >    __int64 Y;
>> >> > } abc;
>> >> > 
>> >> > 
>> >> > If I'm changing __int64 to unsigned long I'm not getting this error
>> >> > For the __int64 i'm getting the mention error. Am I missing
>> >> > something?
>> >> > 
>> >> > 
>> >> > In addition, I'm getting following error:
>> >> > Attribute error("'tuple object has no attibute 'children'",)
>> >> > 
>> >> > I'd be glad to have some assistance.
>> >> 
>> >> It looks like development of csjark has stopped in 2011. Try
>> >> installing a pycparser version from that time frame -- 2.05 should be
>> >> a good candidate according to
>> >> <https://github.com/eliben/pycparser/blob/master/CHANGES> so if you
>> >> are using pip after
>> >> 
>> >> $ pip install pycparser==2.05
>> >> 
>> >> csjark might work.
>> > 
>> > I've installed all the required SW, but still getting the same error
>> 
>> When you invoke the interactive interpreter what does
>> 
>> >>> import pycparser
>> >>> pycparser.__version__
>> '2.05'
>> 
>> produce on your system?
> 
> I have version 2.07 (which is the one used for the development)

For cjshark to work (or at least not fail in the way you observed) you need 
2.5.

2.7 returns 2-tuples where 2.5 does not. Compare for example:

https://github.com/eliben/pycparser/blob/release_v2.07/pycparser/c_ast.py#L149

    def children(self):
        nodelist = []
        if self.name is not None: nodelist.append(("name", self.name))
        if self.subscript is not None: nodelist.append(("subscript", 
self.subscript))
        return tuple(nodelist)

and

https://github.com/eliben/pycparser/blob/release_v2.05/pycparser/c_ast.py#L136

    def children(self):
        nodelist = []
        if self.name is not None: nodelist.append(self.name)
        if self.subscript is not None: nodelist.append(self.subscript)
        return tuple(nodelist)

I wonder why you didn't just try what I suggested...




More information about the Python-list mailing list