Skip to content

Python: wrapper of adios.File close errors #215

@liangwang0734

Description

@liangwang0734
  • Wrapping over adios.File might not be a designed usage but would be convenient for user-specific data.
  • Currently, upon file closing errors are occasionally thrown:
# '1.13.1'
print(adios.__version__)

# 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:

# adios.File __dell__ method
    def __del__(self):
        """ Close file on destruction. """
        if self.fp != NULL:
            self.close()
  • Why the errors show up only in wrappers not original adios.File?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions