Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: wrapper of adios.File close errors #215

Open
liangwang0734 opened this issue Sep 11, 2020 · 0 comments
Open

Python: wrapper of adios.File close errors #215

liangwang0734 opened this issue Sep 11, 2020 · 0 comments

Comments

@liangwang0734
Copy link

liangwang0734 commented Sep 11, 2020

  • 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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant