Skip to content

Fix 1767#1769

Merged
oberstet merged 2 commits into
crossbario:masterfrom
oberstet:fix_1767
Nov 21, 2025
Merged

Fix 1767#1769
oberstet merged 2 commits into
crossbario:masterfrom
oberstet:fix_1767

Conversation

@oberstet
Copy link
Copy Markdown
Contributor

Description

Fix NVX runtime detection to check actual CFFI modules


Related Issue(s)

Closes or relates to #1767


Checklist

  • I have referenced relevant issue numbers above
  • I have performed a self-review of my code and it follows
    the style guidelines of this project
  • I have added new or used existing tests that prove my fix
    is effective or that my feature works
  • I have added necessary documentation (if appropriate) and
    updated the changelog
  • I have added an AI assistance disclosure file (required!)
    in this PR

Problem:
When installing from source with AUTOBAHN_USE_NVX=0 (no NVX build), the
runtime detection incorrectly reported HAS_NVX=True, causing crashes when
attempting to use NVX functionality.

Root Cause:
The detection was importing Python wrapper modules (autobahn.nvx._xormasker
and autobahn.nvx._utf8validator) which are always importable as they're
Python files. The actual CFFI extension modules (_nvx_xormasker and
_nvx_utf8validator) are only imported lazily inside the wrapper classes'
__init__ methods, so their availability wasn't being checked.

Solution:
Changed detection to directly import the CFFI extension modules:
- import _nvx_utf8validator
- import _nvx_xormasker

This correctly detects whether NVX was actually built at install time:
- If NVX was built: CFFI modules exist → HAS_NVX=True
- If NVX wasn't built: CFFI modules don't exist → ImportError → HAS_NVX=False

Testing:
- With CFFI modules available: HAS_NVX=True, USES_NVX=True ✓
- With CFFI modules blocked: HAS_NVX=False, USES_NVX=False ✓

This ensures the pure Python fallback is correctly used when NVX isn't built.

Fixes crossbario#1767

Note: This work was completed with AI assistance (Claude Code).
@oberstet oberstet merged commit c67ed62 into crossbario:master Nov 21, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant