marrow / mailer

A light-weight, modular, message representation and mail delivery framework for Python.
MIT License
279 stars 62 forks source link

'TransportPool' object has no attribute '_log' #99

Closed homeworkprod closed 2 years ago

homeworkprod commented 2 years ago

Hey Alice, I came across an error on the current next branch with Python 3.9 that I couldn't yet figure out.

I so far encountered it in a pytest run, so this is actually pytest output. Maybe not ideal, but I hope it makes sense to you anyway.

myproject/email.py:26: in init_app
    app.marrowmailer = Mailer(mailer_config)
venv/lib/python3.9/site-packages/marrow/mailer/__init__.py:47: in __init__
    self.manager = Manager(manager_config, partial(Transport, transport_config))
venv/lib/python3.9/site-packages/marrow/mailer/manager/immediate.py:18: in __init__
    self.transport = TransportPool(Transport)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <marrow.mailer.manager.util.TransportPool object at 0x7fd3ecd1b220>, factory = functools.partial(<class 'marrow.mailer.transport.mock.MockTransport'>, {'use': 'mock'})

    def __init__(self, factory):
        self.factory = factory
        self.transports = queue.Queue()
>       self._log = getLogger(__name__)
E    AttributeError: 'TransportPool' object has no attribute '_log'

venv/lib/python3.9/site-packages/marrow/mailer/manager/util.py:23: AttributeError

Thanks for looking into it!

amcgregor commented 2 years ago

Apologies for the delay; adding the missing slot permits assignment of that attribute. Admittedly, Python's error message ("has no attribute") is unhelpful, when the operation is clearly attempting to assign it. Corrected in 0da238e.

homeworkprod commented 2 years ago

Thanks! It didn't really occur to me to look at the slots.