You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am struggling with strange behavior related to a segmentation fault while trying to implement a derived class to hold data in an Array. Could I get some advice? I've extracted the minimal code that reproduces the error, and below I present code snippets that cause the segmentation fault and those that do not.
The following code results in a segmentation fault
class Base:
InBuffer : Array[UInt[64]]
OutBufferA : Array[UInt[64]]
OutBufferB : Array[UInt[64]]
def __init__(self,BufferSize:int):
self.OutBufferA = Array[UInt[64]](BufferSize)
self.OutBufferB = Array[UInt[64]](BufferSize)
self.InBuffer = Array[UInt[64]](10)
def Exe(self,Id:int):
pass
class TestMod(Base):
def __init__(self,BufferSize:int):
super().__init__(BufferSize)
def Exe(self,Id:int):
print(Id)
if __name__ == "__main__":
In : Array[UInt[64]]
line : str
In = Array[UInt[64]](2 ** 17)
TestM : TestMod
TestM = TestMod(2 ** 17)
TestM.InBuffer = In
TestM.Exe(1)
with open("TestDt.txt","r") as fin:
for line in fin:
pass
TestM.Exe(2)
result:
run: line 19: 1594182 Segmentation fault
Commenting out
#TestM.InBuffer = In
or
Commenting out read file code
#with open("TestDt.txt","r") as fin:
# for line in fin:
# pass
resolves the segmentation fault.
result:
1
2
* Terminal will be reused by tasks, press any key to close it.
Thanks for the report, @iSunfield -- this looks like an issue with inheritance. We'll take a look and follow up ASAP. If you use static inheritance via class TestMod(Static[Base]) it seems to work.
I am struggling with strange behavior related to a segmentation fault while trying to implement a derived class to hold data in an Array. Could I get some advice? I've extracted the minimal code that reproduces the error, and below I present code snippets that cause the segmentation fault and those that do not.
The following code results in a segmentation fault
Commenting out
or
Commenting out read file code
resolves the segmentation fault.
"TestDt.txt" is below.
8,
+0.000000000 ,+0.000000000 ,+0.000000000 ,+0.000000000 ,+0.000000000 ,+0.000000000 ,+0.000000000 ,+0.000000000 ,
The text was updated successfully, but these errors were encountered: