isislovecruft / python-gnupg

A modified version of python-gnupg, including security patches, extensive documentation, and extra features.
Other
426 stars 171 forks source link

self.status = '\n'.join([self.status, "key considered"]) - TypeError: sequence item 0: expected str instance, NoneType found #292

Open waterflow80 opened 1 month ago

waterflow80 commented 1 month ago

There's an unexpected behavior when running gpg.verify_file(..), I'm getting:

Traceback (most recent call last):
  File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File ".../venv/lib/python3.8/site-packages/gnupg/_meta.py", line 650, in _read_response
    result._handle_status(keyword, value)
  File ".../venv/lib/python3.8/site-packages/gnupg/_parsers.py", line 1505, in _handle_status
    self.status = '\n'.join([self.status, "key considered"])
TypeError: sequence item 0: expected str instance, NoneType found

I think the problem is here:

   elif key == "KEY_CONSIDERED":
            self.status = '\n'.join([self.status, "key considered"])
...

Not sure why @coilysiren did it that way in this commit.

I fixed it when like this:

elif key == "KEY_CONSIDERED":
self.status = "key considered"

which is the same way self.status is assigned for all other values of self.key.

I'll make a PR for this, but it seems like the project has been inactive for a while now, so I think it is worth using the original python-gnupg instead.