Open DonLarry opened 4 months ago
Line 55 says:
loop.set_exception_handler(err_handler)
If
loop
is None andhandler
is not None when the class constructor is called, then:
loop
remainsNone
at line 55, and we will get an AttributeError saying that NoneType has no attribute set_exception_handler.self.loop
will be updated whenupdate_event_loop
method is invoked at line 31.So, we should use
self.loop
or assignself.loop
toloop
before using it.
Do you have a proof of concept that calls the exception?
Do you have a proof of concept that calls the exception?
Yes, I do. Try to run this simple code for example:
from pypresence import Presence
def f(a, b):
pass
Presence(client_id=123, handler=f)
I'm getting the following error:
Traceback (most recent call last):
File "...\a.py", line 6, in <module>
Presence(client_id=123, handler=f)
File "...\venv\Lib\site-packages\pypresence\presence.py", line 13, in __init__
super().__init__(*args, **kwargs)
File "...\venv\Lib\site-packages\pypresence\baseclient.py", line 55, in __init__
loop.set_exception_handler(err_handler)
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'set_exception_handler'
Line 55 says:
If
loop
is None andhandler
is not None when the class constructor is called, then:loop
remainsNone
at line 55, and we will get an AttributeError saying that NoneType has no attribute set_exception_handler.self.loop
will be updated whenupdate_event_loop
method is invoked at line 31.So, we should use
self.loop
or assignself.loop
toloop
before using it.