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

FabgzWriter file handler property is improperly initialized #159

Closed
jsstevenson opened this issue Jun 13, 2024 · 0 comments · Fixed by #160
Closed

FabgzWriter file handler property is improperly initialized #159

jsstevenson opened this issue Jun 13, 2024 · 0 comments · Fixed by #160
Labels
bug Something isn't working

Comments

@jsstevenson
Copy link
Contributor

Describe the bug
Pretty simple -- FabgzWriter initializes a self.fh property, when it should be self._fh. This can mess up the functioning of the __del__ method during some code paths, although I think the impact is minimal.

To Reproduce

Run the test cases (eg test_fabgz.py::test_errors)

tests/test_fabgz.py::test_errors                                                                                                                                                                                                                                                                     
  /Users/jss009/code/biocommons.seqrepo/.venv-312/lib/python3.12/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function FabgzWriter.__del__ at 0x107a83560>                                                                              
                                                                                                                                                                                                                                                                                                     
  Traceback (most recent call last):                                                                                                              
    File "/Users/jss009/code/biocommons.seqrepo/src/biocommons/seqrepo/fastadir/fabgz.py", line 173, in __del__                                                                                                                                                                                      
      if self._fh is not None:                                                                                                                                                                                                                                                                       
         ^^^^^^^^                                                                                                                                                                                                                                                                                    
  AttributeError: 'FabgzWriter' object has no attribute '_fh'. Did you mean: 'fh'?                                                                
                                                                                                                                                  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))                                                                                                                                                                                                                                      

Expected behavior
The property should exist upon object destruction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant