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

billiard.einfo.Frame: add f_back attribute #257

Merged
merged 1 commit into from
Nov 1, 2018
Merged

Conversation

terceiro
Copy link
Contributor

Standard Python frame objects have a f_back attribute, which is used
in places such as the Django AdminEmailHandler. The lack of this
attribute in the billiard Frame causes a crash when celery is used in
Django apps, configured to use Django logging, and AdminEmailHandler is
in use. See for example Django bug #27543:

https://code.djangoproject.com/ticket/27543

In general, this also makes the billiard Frame object more compatible
with any code that handles frames, and could be using f_back.

Standard Python frame objects have a `f_back` attribute, which is used
in places such as the Django AdminEmailHandler. The lack of this
attribute in the billiard Frame causes a crash when celery is used in
Django apps, configured to use Django logging, and AdminEmailHandler is
in use. See for example Django bug #27543:

https://code.djangoproject.com/ticket/27543

In general, this also makes the billiard Frame object more compatible
with any code that handles frames, and could be using `f_back`.
@thedrow thedrow merged commit 06faccf into celery:master Nov 1, 2018
@thedrow
Copy link
Member

thedrow commented Nov 1, 2018

Thanks for the contribution.

@terceiro terceiro deleted the f-back branch November 1, 2018 18:03
@ianhoffman
Copy link

Hey @thedrow and @terceiro -- just wanted to check in real quick and ask what's up with this bugfix. Anything still needed to do to get it into the development branch of celery? I'd be interested in helping if possible.

@thedrow
Copy link
Member

thedrow commented Nov 28, 2018

Only lack of time is preventing me from releasing.
I'll try to get to it.

@ianhoffman
Copy link

Thanks! I'll keep an eye out. In the meantime have fixed by (in case this is useful to anyone):

class MyEmailHandler(AdminEmailHandler):
    def emit(self, record):
        if record.exc_info:
            from billiard import einfo
            exc_typ, exc_val, tb = record.exc_info
            if isintance(tb, einfo.Traceback):
                record.exc_info = exc_type, exc_val, exc_val.__traceback__
        super().emit(record)

@thedrow
Copy link
Member

thedrow commented Dec 3, 2018

Released.

@ianhoffman
Copy link

Thanks @thedrow! Getting this into production soon.

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

Successfully merging this pull request may close these issues.

3 participants