license-expression icon indicating copy to clipboard operation
license-expression copied to clipboard

Fix LicenseWithExceptionSymbol missing Expression class variables

Open arbassett-qnx opened this issue 9 months ago • 0 comments

LicenseWithExceptionSymbol class AND,OR,Symbol variables coming from expression were not being set during init this causes issues when using python operators like and when the symbol is only LicenseWithExceptionSymbol

ex.

l1 = spdx_licensing.parse("GPL-3.0-or-later WITH GCC-exception-3.1")
l2 = spdx_licensing.parse("MIT")
l3 = l1 & l2

This will cause an exception as AND is NONE

Traceback (most recent call last):
  File "test.py", line 19, in <module>
    l3 = l1 & l2
         ~~~^~~~
  File ".venv/lib/python3.12/site-packages/boolean/boolean.py", line 864, in __and__
    return self.AND(self, other)
           ^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not callable

The fix is a copy of BooleanAlgebra init which does the same but for all types

arbassett-qnx avatar Mar 27 '25 20:03 arbassett-qnx