Problems with Pyste from CVS.
Hi, I just updated my local CVS checkout of Boost. I tried running Pyste and got the following traceback. The same exact pyste file worked fine a little while earlier with an older checkout (June 25th) of CVS. If you need any more information let me know. I can also try and generate a smaller test case that I can include here (right now I don't have one). Thanks. prabhu -------------------------------------------------- Traceback (most recent call last): File "/usr/local/bin/pyste.py", line 11, in ? status = pyste.Main() File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/pyste.py", line 195, in Main declarations, parsed_header = parser.parse(header, all_tails) File "/usr/local/stow/pyste//lib/python2.2/site-packages/Pyste/CppParser.py", line 82, in parse declarations = ParseDeclarations(xmlfile) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 437, in ParseDeclarations parser.Parse(filename) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 36, in Parse self.ParseElement(id, element) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 60, in ParseElement func(id, element) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 371, in ParseOperatorMethod self.ParseMethod(id, element, ClassOperator) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 356, in ParseMethod classname = self.GetDecl(element.get('context'))._FullName() File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 98, in GetDecl self.ParseElement(id, elem) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 60, in ParseElement func(id, element) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 291, in ParseClass class_._AddMember(member) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/declarations.py", line 123, in _AddMember m._is_unique = False AttributeError: 'str' object has no attribute '_is_unique'
Hi Prabhu, Prabhu Ramachandran wrote:
Hi,
I just updated my local CVS checkout of Boost. I tried running Pyste and got the following traceback. The same exact pyste file worked fine a little while earlier with an older checkout (June 25th) of CVS.
If you need any more information let me know. I can also try and generate a smaller test case that I can include here (right now I don't have one).
I test case would be great! If you can isolate to a single file of yours, you could also send me the parsed xml file (run with --debug), so I can reproduce the problem here. I have changed some of Pyste internals to accomodate meta-programming in the Pyste files, so some bugs might come up. Thanks a lot, Nicodemus.
Hi,
"N" == nicodemus <nicodemus@globalite.com.br> writes:
>> If you need any more information let me know. I can also try >> and generate a smaller test case that I can include here (right >> now I don't have one). N> I test case would be great! If you can isolate to a single file N> of yours, you could also send me the parsed xml file (run with N> --debug), so I can reproduce the problem here. Thanks for the quick response! I found a _minimal_ test case that has triggers the problem for me. // -------------------- namespace test { class A { public: A() {} int _name; }; }// namespace test // -------------------- Further testing shows that its the '_name' thats causing problems. I change that to '_nam' and it works! Wierd. Besides, it has to be a data or member function of the class. A normal function with name _name works fine. Hope this helps. prabhu
Hi Prabhu, Prabhu Ramachandran wrote:
I found a _minimal_ test case that has triggers the problem for me.
// -------------------- namespace test {
class A { public: A() {} int _name; };
}// namespace test // --------------------
Further testing shows that its the '_name' thats causing problems. I change that to '_nam' and it works! Wierd. Besides, it has to be a data or member function of the class. A normal function with name _name works fine.
Yep, as I feared. 8( I have been doing some internal changes to Pyste to support meta-programming, and my plan was to allow the user to access information about the declarations using "_" to acess the attributes: namespace test { struct C { void Foo(const int, double); }; } ---- C = Class('test::C', ...) print C._name # prints "C" print C._FullName() # prints "test::C" print C.Foo._parameters[0]._FullName() # prints "const int" And so on. But of course, it didn't occur to me that the attributes of the objects would get in conflict with the declarations. Well, duh! Anyway, I will reverse this changes, since they clearly don't work. I have to find a way to allow the user to access the attributes, and what I've thought so far is providing access to them using operator []: print C['name'] print C['fullname'] print C['parameters'][0]['fullname'] But I think it makes the syntax confusing... 8( Any one has any ideas? They are most welcome. Regards, Nicodemus.
Nicodemus <nicodemus@globalite.com.br> writes:
Any one has any ideas? They are most welcome.
Names containing double underscores or starting with an underscore followed by a capital letter are reserved to the C++ implementation, so they can't conflict with anything the user might legally define as a class member. -- Dave Abrahams Boost Consulting www.boost-consulting.com
David Abrahams wrote:
Nicodemus <nicodemus@globalite.com.br> writes:
Any one has any ideas? They are most welcome.
Names containing double underscores or starting with an underscore followed by a capital letter are reserved to the C++ implementation, so they can't conflict with anything the user might legally define as a class member.
Thanks for the suggestion Dave! But "void _Foo(int) {}" compiles fine with intel 7.1.0. I am not saying that you are wrong, but apparently some code with an underscore followed by a capital letter compiles fine depending on the compiler. So I assume that there is code that uses invalid names, even thought the specification says otherwise...
Nicodemus <nicodemus@globalite.com.br> writes:
David Abrahams wrote:
Nicodemus <nicodemus@globalite.com.br> writes:
Any one has any ideas? They are most welcome.
Names containing double underscores or starting with an underscore followed by a capital letter are reserved to the C++ implementation, so they can't conflict with anything the user might legally define as a class member.
Thanks for the suggestion Dave!
But "void _Foo(int) {}" compiles fine with intel 7.1.0.
I am not saying that you are wrong, but apparently some code with an underscore followed by a capital letter compiles fine depending on the compiler.
Almost any compiler will compile that without complaint. The standard library has to compiles *somehow* ;-)
So I assume that there is code that uses invalid names, even thought the specification says otherwise...
Sure, but we can only be expected to work reliably on correct code. -- Dave Abrahams Boost Consulting www.boost-consulting.com
David Abrahams wrote:
Nicodemus <nicodemus@globalite.com.br> writes:
David Abrahams wrote:
Names containing double underscores or starting with an underscore followed by a capital letter are reserved to the C++ implementation, so they can't conflict with anything the user might legally define as a class member.
Thanks for the suggestion Dave!
But "void _Foo(int) {}" compiles fine with intel 7.1.0.
I am not saying that you are wrong, but apparently some code with an underscore followed by a capital letter compiles fine depending on the compiler.
Almost any compiler will compile that without complaint. The standard library has to compiles *somehow* ;-)
So I assume that there is code that uses invalid names, even thought the specification says otherwise...
Sure, but we can only be expected to work reliably on correct code.
Yeah, seems good enough. 8) Thanks again for the suggestion. Regards, Nicodemus.
Prabhu Ramachandran wrote:
Hi,
I just updated my local CVS checkout of Boost. I tried running Pyste and got the following traceback. The same exact pyste file worked fine a little while earlier with an older checkout (June 25th) of CVS.
If you need any more information let me know. I can also try and generate a smaller test case that I can include here (right now I don't have one).
Thanks. prabhu
-------------------------------------------------- Traceback (most recent call last): File "/usr/local/bin/pyste.py", line 11, in ? status = pyste.Main() File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/pyste.py", line 195, in Main declarations, parsed_header = parser.parse(header, all_tails) File "/usr/local/stow/pyste//lib/python2.2/site-packages/Pyste/CppParser.py", line 82, in parse declarations = ParseDeclarations(xmlfile) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 437, in ParseDeclarations parser.Parse(filename) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 36, in Parse self.ParseElement(id, element) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 60, in ParseElement func(id, element) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 371, in ParseOperatorMethod self.ParseMethod(id, element, ClassOperator) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 356, in ParseMethod classname = self.GetDecl(element.get('context'))._FullName() File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 98, in GetDecl self.ParseElement(id, elem) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 60, in ParseElement func(id, element) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/GCCXMLParser.py", line 291, in ParseClass class_._AddMember(member) File "/usr/local/stow/pyste/lib/python2.2/site-packages/Pyste/declarations.py", line 123, in _AddMember m._is_unique = False AttributeError: 'str' object has no attribute '_is_unique'
I reverted the changes that I have made before, and this bug should be gone now. Thanks for all your work on reporting this Prabhu! Regards, Nicodemus.
participants (3)
-
David Abrahams -
Nicodemus -
Prabhu Ramachandran