libclang.dll and Python 3.5.2 binding


I have a simple goal, but struggle with it for quite a long time now. I want to parse C++ code, that’s it…
After searching for a while, I adopted Eli’s advice over here and tried to work with Python and libclang.
Now, I must give you head-start warning: I’m a complete n00b in Python, and even more than that about Clang.

I understand that the existing code in binding\python\clang\ is not completely lined up with the last version of Python, so I started try fixing it.
At the beggining it was pretty easy, making cosmetics fixes for print function and AttributeError calls, but then I hit this:

With Python 3.5.2 64 bit, linking against libclang.dll extracted from LLVM-3.8.1-win64.exe I keep getting the following error, trying to make an cindex.Index object:

Traceback (most recent call last):
  File "", line 22, in <module>
    index = clang.cindex.Index.create()
  File "D:\Project\clang\", line 2218, in create
    return Index(conf.lib.clang_createIndex(excludeDecls, 0))
  File "D:\Project\clang\", line 1971, in __init__
    assert isinstance(obj, c_object_p) and obj

With Python 2.7 I passed this error (but failed on node.get_childern())
I tried already on different computers, and got the same error over and over.
I debugged it with pdb, and found out that obj in clang\, line 1971 is just an int, not clang.cindex.LP_c_void_p object, as it gets with Python2.7.
Another thing I’ve noticed with the debugger is, with Python 2.7 the call stack is:

> d:\project\clang\><CDLL 'D... 21695c0>
-> return value
(Pdb) n
> d:\project\clang\
-> def __init__(self, obj):

but with Python 3.5.2 it is:

> d:\project\clang\><CDLL 'D:\Pro... at 0x27a2cf8>
-> return value
(Pdb) n
> c:\program files\python35\lib\ctypes\
-> def __getattr__(self, name):
(Pdb) r
> c:\program files\python35\lib\ctypes\><_FuncPtr obj...000000296B458>
-> return func
(Pdb) n
> d:\project\clang\
-> def __init__(self, obj):

Meaning that in Python 3.5.2, there’s always a call to the getattr() function in lib\ (which resides in class CDLL), while in Python 2.7 - this call doesn’t exist. Have no idea why.
Any help will be highly appriciated.