{"record":{"id":"d8c3d54491a08d1d","repo":"python/cpython","slug":"aix-builddate-is-not-defined-or-invalid-build-da","errorCode":null,"errorMessage":"AIX_BUILDDATE is not defined or invalid: {build_date!r}","messagePattern":"AIX_BUILDDATE is not defined or invalid: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"Lib/_aix_support.py","lineNumber":106,"sourceCode":"    # type: () -> List[int]\n    gnu_type = sysconfig.get_config_var(\"BUILD_GNU_TYPE\")\n    if not gnu_type:\n        raise ValueError(\"BUILD_GNU_TYPE is not defined\")\n    return _aix_vrtl(vrmf=gnu_type)\n\n\ndef aix_buildtag():\n    # type: () -> str\n    \"\"\"\n    Return the platform_tag of the system Python was built on.\n    \"\"\"\n    # AIX_BUILDDATE is defined by configure with:\n    # lslpp -Lcq bos.rte | awk -F:  '{ print $NF }'\n    build_date = sysconfig.get_config_var(\"AIX_BUILDDATE\")\n    try:\n        build_date = int(build_date)\n    except (ValueError, TypeError):\n        raise ValueError(f\"AIX_BUILDDATE is not defined or invalid: \"\n                         f\"{build_date!r}\")\n    return _aix_tag(_aix_bgt(), build_date)\n","sourceCodeStart":88,"sourceCodeEnd":109,"githubUrl":"https://github.com/python/cpython/blob/bc6749cc3b5ae4a5e88a6cc2d5b3bebbe354eae6/Lib/_aix_support.py#L88-L109","documentation":"In debug mode, BaseSelectorEventLoop.sock_recv() verifies the socket is non-blocking before scheduling the read, because a blocking socket could freeze the loop while the coroutine thinks it is async. The check (self._debug and sock.gettimeout() != 0) raises ValueError so the misuse surfaces immediately rather than as a mysterious hang.","triggerScenarios":"Enabling asyncio debug mode and calling await loop.sock_recv(sock, n) with a socket in blocking mode or with a positive timeout — the socket default (timeout None) triggers it as soon as debug is on. Sockets from socket.create_connection or third-party connection helpers usually arrive blocking.","commonSituations":"Turning on PYTHONASYNCIODEBUG or debug=True to diagnose a hang, and this earlier error appears; sockets created by libraries (paho, protobuf RPC layers) with settimeout(30) then passed to sock_*; tests that enable loop debug globally via fixtures.","solutions":["Set sock.setblocking(False) (or settimeout(0.0)) before any await loop.sock_recv on it","Route blocking-configured sockets through regular thread-based I/O instead of loop sock_* APIs","Standardize a helper that creates loop-ready sockets (socket + setblocking(False)) for all async paths"],"exampleFix":"# before\nsock = socket.create_connection((host, port))  # blocking\nawait loop.sock_recv(sock, 4096)  # debug: ValueError\n# after\nsock = socket.create_connection((host, port))\nsock.setblocking(False)\nawait loop.sock_recv(sock, 4096)","handlingStrategy":"validation","validationCode":"def nb(sock):\n    if sock.gettimeout() != 0:\n        sock.setblocking(False)\n    return sock\n\ndata = await loop.sock_recv(nb(sock), 4096)","typeGuard":null,"tryCatchPattern":"try:\n    await loop.sock_recv(sock, n)\nexcept ValueError as e:\n    if 'non-blocking' in str(e):\n        sock.setblocking(False)\n        return await loop.sock_recv(sock, n)\n    raise","preventionTips":["setblocking(False) on every socket passed to loop sock_* APIs","Use asyncio.wait_for for timeouts instead of socket timeouts","Centralize socket creation in an async-aware factory","Assert gettimeout() == 0 in tests that exercise loop I/O"],"tags":["asyncio","socket","debug-mode","non-blocking"],"backgroundTag":null,"analyzedSha":"bc6749cc3b5ae4a5e88a6cc2d5b3bebbe354eae6","analyzedAt":"2026-08-14T22:01:13.976Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}