Proper use of ctypes to call _Py_Mangle?

非 Y 不嫁゛ 提交于 2019-12-08 06:36:24
Noctis Skytower

Thanks to comments by eryksun, the answer to the problem is rather simple:

>>> from ctypes import pythonapi, py_object
>>> py_mangle = pythonapi._Py_Mangle
>>> py_mangle.argtypes = py_object, py_object
>>> py_mangle.restype = py_object
>>> py_mangle('Demo', '__test')
'_Demo__test'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!