{"id":4924,"library":"cxxfilt","title":"Python C++ Symbol Demangler","description":"Cxxfilt provides a Python interface to demangle C++ symbol names, typically found in compiled binaries or stack traces. It wraps the functionality of system utilities like `c++filt` or `abi::__cxa_demangle`. The current version is 0.3.0, and it is actively maintained on GitHub.","status":"active","version":"0.3.0","language":"en","source_language":"en","source_url":"https://github.com/afq984/python-cxxfilt","tags":["c++","demangle","abi","debugging","symbols"],"install":[{"cmd":"pip install cxxfilt","lang":"bash","label":"Install stable release"}],"dependencies":[{"reason":"Required for versions 0.3.0 and above.","package":"Python 3.6+","optional":false},{"reason":"The library is a wrapper around native C++ demangling functions, which require these system libraries to be present for actual demangling to occur.","package":"System C/C++ libraries (libc, libc++/libstdc++)","optional":false}],"imports":[{"note":"The primary function for demangling C++ symbols.","symbol":"demangle","correct":"import cxxfilt\nsymbol_name = '_ZNSt22condition_variable_anyD2Ev'\ndemangled_name = cxxfilt.demangle(symbol_name)"}],"quickstart":{"code":"import cxxfilt\n\nmangled_symbol = '_ZNSt22condition_variable_anyD2Ev'\ndemangled_symbol = cxxfilt.demangle(mangled_symbol)\nprint(f\"Mangled: {mangled_symbol}\")\nprint(f\"Demangled: {demangled_symbol}\")\n\n# To check if the underlying demangler is valid (e.g., if system libraries are present)\n# The import itself no longer fails if libraries are missing since v0.3.0.\nis_demangler_valid = not isinstance(cxxfilt.default_demangler, cxxfilt.DeferedErrorDemangler)\nprint(f\"Is demangler valid: {is_demangler_valid}\")","lang":"python","description":"Demangle a common C++ mangled symbol and check the validity of the internal demangler."},"warnings":[{"fix":"Upgrade to Python 3.6+ or pin `cxxfilt<0.3` for Python 2.7 projects.","message":"Python 2.7 is no longer supported in `cxxfilt` versions 0.3.0 and above. For Python 2.7 compatibility, use `cxxfilt` version < 0.3.","severity":"breaking","affected_versions":"0.3.0+"},{"fix":"Consider using alternative tools or a Linux/macOS environment for demangling C++ symbols on Windows. Contributions for Windows support are welcome.","message":"The library does not officially support Windows environments. It is primarily tested on Linux and macOS, and is expected to work on Unix-like systems with `libc` and `libc++/libstdc++`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that `libc` and either `libc++` or `libstdc++` are installed on your system. You can programmatically check for demangler validity using `not isinstance(cxxfilt.default_demangler, cxxfilt.DeferedErrorDemangler)`.","message":"Although `import cxxfilt` no longer fails if system C/C++ libraries are unavailable (since v0.3.0), attempting to demangle symbols will fail or raise `LibraryNotFound` or `InternalError` if the underlying native demangling functions are not accessible.","severity":"gotcha","affected_versions":"0.3.0+"},{"fix":"Implement error handling (e.g., `try-except cxxfilt.InvalidName`) when demangling user-provided or untrusted symbol names.","message":"The `cxxfilt.demangle()` function can raise an `InvalidName` exception if the provided string is not a valid C++ ABI mangled name.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}