Python libxml2:xpathEval vs xpathEval2?

时间:2013-07-31 18:45:44

标签: python libxml2

在libxml2帮助中,我发现:

xpathEval(self, expr)
      # Selecting nodes using XPath, a bit slow because the context
      # is allocated/freed every time but convenient.

xpathEval2(self, expr)

令人困惑的是xpathEval2不包含进一步的评论。他们之间有什么区别?

1 个答案:

答案 0 :(得分:0)

在我的版本中没有区别,请看python代码:

    def xpathEval2(self, expr):
      return self.xpathEval(expr)

但是有一节评论说明该方法是为了加速解析,但有一些内存泄漏:

#    # Selecting nodes using XPath, faster because the context
#    # is allocated just once per xmlDoc.
#    #
#    # Removed: DV memleaks c.f. #126735

检查您的实施以获得更准确的信息。