ornladios / ADIOS

The old ADIOS 1.x code repository. Look for ADIOS2 for new repo
https://csmd.ornl.gov/adios
Other
54 stars 40 forks source link

Python: wrapper of adios.File close errors #215

Open liangwang0734 opened 3 years ago

liangwang0734 commented 3 years ago

occasionally throws

class adiosFileWrapper(adios.File): pass

occasionally throws

class adiosFileWrapper1(adios.File):

def init(self, name, **kwargs):

super(adiosFileWrapper_noDel, self).init(name, **kwargs)

pass

occasionally throws

class adiosFileWrapper2(adios.File):

def init(self, name, **kwargs):

super(adiosFileWrapper_hasDel, self).init(name, **kwargs)

pass

#

def del(self):

super(adiosFileWrapper_hasDel, self).del()

does not seem to throw, but perhaps insecure (raw file handler might be dangling)

class adiosFileWrapper3(adios.File):

def init(self, name, **kwargs):

super(adiosFileWrapper_hasDel, self).init(name, **kwargs)

pass

def del(self):

pass

filename = 'test.bp'

occasionally throws

file = adiosFileWrapper(filename) file.close()

fine

file = adios.File(filename) file.close()


Errors emitted from `adiosFileWrapper`:

Exception ignored in: <built-in method del of adiosFileWrapper object at 0x7f86a21bead0> Traceback (most recent call last): File "adios.pyx", line 1066, in adios.file.del File "adios.pyx", line 1078, in adios.file.close AssertionError: Not an open file

-----------
Possibly relevant [code](https://github.com/ornladios/ADIOS/blob/f33031ee206d552b286674d0f1641b9aca6b9100/wrappers/numpy/adios.pyx#L1067):
```python
# adios.File __dell__ method
    def __del__(self):
        """ Close file on destruction. """
        if self.fp != NULL:
            self.close()