{"record":{"id":"4b35fc2c244cff68","repo":"nodejs/node","slug":"invalid-sysconfig-get-config-var-ext-suffix","errorCode":null,"errorMessage":"invalid sysconfig.get_config_var('EXT_SUFFIX')","messagePattern":"invalid sysconfig\\.get_config_var\\('EXT_SUFFIX'\\)","errorType":"exception","errorClass":"SystemError","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/packaging/tags.py","lineNumber":234,"sourceCode":"\ndef _generic_abi() -> List[str]:\n    \"\"\"\n    Return the ABI tag based on EXT_SUFFIX.\n    \"\"\"\n    # The following are examples of `EXT_SUFFIX`.\n    # We want to keep the parts which are related to the ABI and remove the\n    # parts which are related to the platform:\n    # - linux:   '.cpython-310-x86_64-linux-gnu.so' => cp310\n    # - mac:     '.cpython-310-darwin.so'           => cp310\n    # - win:     '.cp310-win_amd64.pyd'             => cp310\n    # - win:     '.pyd'                             => cp37 (uses _cpython_abis())\n    # - pypy:    '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73\n    # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib'\n    #                                               => graalpy_38_native\n\n    ext_suffix = _get_config_var(\"EXT_SUFFIX\", warn=True)\n    if not isinstance(ext_suffix, str) or ext_suffix[0] != \".\":\n        raise SystemError(\"invalid sysconfig.get_config_var('EXT_SUFFIX')\")\n    parts = ext_suffix.split(\".\")\n    if len(parts) < 3:\n        # CPython3.7 and earlier uses \".pyd\" on Windows.\n        return _cpython_abis(sys.version_info[:2])\n    soabi = parts[1]\n    if soabi.startswith(\"cpython\"):\n        # non-windows\n        abi = \"cp\" + soabi.split(\"-\")[1]\n    elif soabi.startswith(\"cp\"):\n        # windows\n        abi = soabi.split(\"-\")[0]\n    elif soabi.startswith(\"pypy\"):\n        abi = \"-\".join(soabi.split(\"-\")[:2])\n    elif soabi.startswith(\"graalpy\"):\n        abi = \"-\".join(soabi.split(\"-\")[:3])\n    elif soabi:\n        # pyston, ironpython, others?\n        abi = soabi","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/packaging/tags.py#L216-L252","documentation":"SystemError raised by packaging.tags when sysconfig.get_config_var('EXT_SUFFIX') returns a value that is not a non-empty string beginning with '.'. The function relies on EXT_SUFFIX to derive the running interpreter's ABI tag (e.g. cp310), so a malformed value means tag inference cannot proceed safely.","triggerScenarios":"Running on a Python build where EXT_SUFFIX is None, empty, or lacks the leading dot - typically a broken, stripped, or unusual embeddable distribution, or a Python compiled without shared-module support. The warn=True _get_config_var already emitted a warning before this guard fires.","commonSituations":"Custom or embedded Python builds (e.g. conda variants, pyenv builds with odd configure flags, musl builds), CI images with a minimal Python, or environments where sysconfig data is incomplete.","solutions":["Run `python -c \"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))\"` to inspect the actual value.","Reinstall or rebuild the Python interpreter from a standard distribution so EXT_SUFFIX is set correctly.","If unavoidable, call packaging.tags functions that accept explicit interpreter/platform arguments rather than auto-detection, or pin to a known-good interpreter in CI."],"exampleFix":"# before (auto-derive on a broken interpreter)\nfrom packaging.tags import sys_tags\nabi = next(iter(sys_tags())).abi\n\n# after\nimport sysconfig\next = sysconfig.get_config_var('EXT_SUFFIX')\nassert isinstance(ext, str) and ext.startswith('.'), ext\nfrom packaging.tags import sys_tags","handlingStrategy":"validation","validationCode":"import sysconfig\ndef has_valid_ext_suffix() -> bool:\n    ext = sysconfig.get_config_var('EXT_SUFFIX')\n    return isinstance(ext, str) and ext.startswith('.')","typeGuard":null,"tryCatchPattern":"try:\n    from packaging.tags import sys_tags\n    tags = list(sys_tags())\nexcept SystemError as e:\n    if 'EXT_SUFFIX' in str(e):\n        pass  # fall back to explicit interpreter/platform tags","preventionTips":["Pin CI to a standard CPython distribution.","Sanity-check sysconfig values at application startup in custom builds.","Prefer explicit tag construction for embedded interpreters."],"tags":["packaging","tags","sysconfig","environment","abi"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}