Closed el-dee closed 12 months ago
I can reproduce this problem. Sample repro script:
import xr
apl = xr.ApiLayerProperties()
print(apl)
Expected Behavior: It should print something and not raise an exception. Actual behavior, AttributeError is raised like in the synopsis.
self = <[AttributeError("'ApiLayerProperties' object has no attribute 'next_structure'") raised in repr()] ApiLayerProperties object at 0x1bc680f5840>
def __str__(self) -> str:
return f"xr.ApiLayerProperties(layer_name={self.layer_name}, spec_version={self.spec_version}, layer_version={self.layer_version}, description={self.description}, next_structure={self.next_structure}, structure_type={self.structure_type})"
E AttributeError: 'ApiLayerProperties' object has no attribute 'next_structure'
We renamed those attributes because next
and type
are python built-in functions. This problem is likely fixed in commit d021703b9b368171ef24be78955eca68779f8283
There are still a couple of next_structure
and structure_type
in src/xr/platform/linux.py
. Updating the file is trivial, but I'm not 100% sure where to do the modification in the generator.
@el-deel thank you. Hmm it seems src/xr/platform/linux.py
did not get updated in the March updates. I'll try to repair this over the weekend.
When trying to print any object created by pyopenxr, the program crashes with an exception similar to this :
The root cause is that the name of the
next
andtype
fields are changed into respectivelynext_structure
andstructure_type
but the fields themselves keep their original name and so the code :fails.