Opened 13 years ago

Last modified 9 years ago

#3362 new Patches

PySte crashes with TypeError

Reported by: nneonneo@… Owned by: Dave Abrahams
Milestone: Boost 1.40.0 Component: python USE GITHUB
Version: Boost 1.39.0 Severity: Problem
Keywords: Cc:

Description

Certain C++ declarations can create unnamed classes, which cause GCCXML output to omit the name field. This in turn will trigger the following nasty exception (only the last part of the long traceback is shown):

  File "C:\Python26\lib\site-packages\Pyste\GCCXMLParser.py", line 350, in ParsePointerType
    type = self.GetType(element.get('type'))
  File "C:\Python26\lib\site-packages\Pyste\GCCXMLParser.py", line 126, in GetType
    decl = self.GetDecl(id)
  File "C:\Python26\lib\site-packages\Pyste\GCCXMLParser.py", line 108, in GetDecl
    self.ParseElement(id, elem)
  File "C:\Python26\lib\site-packages\Pyste\GCCXMLParser.py", line 70, in ParseElement
    func(id, element)
  File "C:\Python26\lib\site-packages\Pyste\GCCXMLParser.py", line 319, in ParseStruct
    self.ParseClass(id, element)
  File "C:\Python26\lib\site-packages\Pyste\GCCXMLParser.py", line 306, in ParseClass
    self.AddDecl(class_)
  File "C:\Python26\lib\site-packages\Pyste\GCCXMLParser.py", line 57, in AddDecl
    if decl.FullName() in self._names:
  File "C:\Python26\lib\site-packages\Pyste\declarations.py", line 49, in FullName
    return namespace + self.name
TypeError: cannot concatenate 'str' and 'NoneType' objects

The fix is quite simple: change

    def ParseClass(self, id, element):
        name = element.get('name')

to

    def ParseClass(self, id, element):
        name = element.get('name', id)

on line 290 of GCCXMLParser.py.

Change History (1)

comment:1 by jobnoorman@…, 9 years ago

This problem still exists in current trunk (moved to line 295). Will this ever be fixed or is Pyste dead and should I look for an alternative?

Note: See TracTickets for help on using tickets.