[PATCH] D26082: Support for Python 3 in libclang python bindings

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 10:06:23 PDT 2016


compnerd accepted this revision.
compnerd added a comment.
This revision is now accepted and ready to land.

It would be nice if there is a simple way to handle the possible performance impact for python 2.  Worst case, we can deal with it when it becomes an issue.



================
Comment at: bindings/python/clang/cindex.py:518
 
-        for i in xrange(0, count):
+        for i in range(0, count):
             token = Token()
----------------
IIRC, `range` and `xrange` did have some performance difference.  This would slow down the bindings on python 2.  The difference is obviously not immediately visible unless count is very high.  I wonder if we can do anything here to detect the python version and dispatch to `xrange` in python 2.


https://reviews.llvm.org/D26082





More information about the cfe-commits mailing list