Skip to main content

Python interface to c++filt / abi::__cxa_demangle

Project description

Demangling C++ symbols in Python / interface to abi::__cxa_demangle



pip install cxxfilt

Use demangle to demangle a C++ mangled symbol name:

>>> import cxxfilt
>>> cxxfilt.demangle('_ZNSt22condition_variable_anyD2Ev')

Non-mangled name will be kept intact:

>>> cxxfilt.demangle('main')

To demangle an internal symbol, use external_only=False:

>>> cxxfilt.demangle('N3foo12BarExceptionE')
>>> cxxfilt.demangle('N3foo12BarExceptionE', external_only=False)

Invalid mangled names will trigger an InvalidName exception:

>>> cxxfilt.demangle('_ZQQ')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/path/to/python-cxxfilt/cxxfilt/", line 77, in demangle
    return demangleb(mangled_name.encode()).decode()
  File "/path/to/python-cxxfilt/cxxfilt/", line 69, in demangleb
    raise InvalidName(mangled_name)
cxxfilt.InvalidName: b'_ZQQ'

Use demangleb to demangle name in bytes:

>>> cxxfilt.demangleb(b'_ZNSt22condition_variable_anyD2Ev')

Supported environments

Python 2.7 / 3.3+

Tested on Arch Linux and FreeBSD. Should work on unix systems with libc and libc++/libstdc++

Will not work on Windows.


run in shell:


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cxxfilt, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size cxxfilt-0.2.0.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page