## Description

Fix `Task.handle_failure` not wrapping the exception correctly in case of unpicklealbe exceptions.

Other changes:
* add the traceback object too when wrapping an unpickleable exception
* added tests to ensure that `Task.handle_failure` and `Task.handle_retry` work as expected

This work is a continuation of the fixes I made in https://github.com/celery/celery/pull/8133.

<!-- Please describe your pull request.

NOTE: All patches should be made against main, not a maintenance branch like
3.1, 2.5, etc.  That is unless the bug is already fixed in main, but not in
that version series.

If it fixes a bug or resolves a feature request,
be sure to link to that issue via (Fixes #4412) for example.
-->

Fix `Task.handle_ignore` not wrapping exceptions properly. ## Description

Fix `Task.handle_failure` not wrapping the exception correctly in case of unpicklealbe exceptions.

Other changes:
* add the traceback object too when wrapping an unpickleable exception
* added tests to ensure that `Task.handle_failure` and `Task.handle_retry` work as expected

This work is a continuation of the fixes I made in https://github.com/celery/celery/pull/8133.

<!-- Please describe your pull request.

NOTE: All patches should be made against main, not a maintenance branch like
3.1, 2.5, etc.  That is unless the bug is already fixed in main, but not in
that version series.

If it fixes a bug or resolves a feature request,
be sure to link to that issue via (Fixes #4412) for example.
-->

[build_sphinx]
source-dir = docs/
build-dir = docs/_build
all_files = 1

[flake8]
# classes can be lowercase, arguments and variables can be uppercase
# whenever it makes the code more readable.
max-line-length = 117
extend-ignore =
    # incompatible with black https://github.com/psf/black/issues/315#issuecomment-395457972
    E203,
    # Missing docstring in public method
    D102,
    # Missing docstring in public package
    D104,
    # Missing docstring in magic method
    D105,
    # Missing docstring in __init__
    D107,
    # First line should be in imperative mood; try rephrasing
    D401,
    # No blank lines allowed between a section header and its content
    D412,
    # ambiguous variable name '...'
    E741,
    # ambiguous class definition '...'
    E742,
per-file-ignores =
   t/*,setup.py,examples/*,docs/*,extra/*:
       # docstrings
       D,

[bdist_rpm]
requires = pytz >= 2016.7
           billiard >=4.0.2,<5.0
           kombu >= 5.2.1,<6.0.0

[bdist_wheel]
universal = 0

[metadata]
license_file = LICENSE

[build_sphinx]
source-dir = docs/
build-dir = docs/_build
all_files = 1

[flake8]
# classes can be lowercase, arguments and variables can be uppercase
# whenever it makes the code more readable.
max-line-length = 117
extend-ignore =
    # incompatible with black https://github.com/psf/black/issues/315#issuecomment-395457972
    E203,
    # Missing docstring in public method
    D102,
    # Missing docstring in public package
    D104,
    # Missing docstring in magic method
    D105,
    # Missing docstring in __init__
    D107,
    # First line should be in imperative mood; try rephrasing
    D401,
    # No blank lines allowed between a section header and its content
    D412,
    # ambiguous variable name '...'
    E741,
    # ambiguous class definition '...'
    E742,
per-file-ignores =
   t/*,setup.py,examples/*,docs/*,extra/*:
       # docstrings
       D,

[bdist_rpm]
requires = pytz >= 2016.7
           billiard >=4.0.2,<5.0
           kombu >= 5.2.1,<6.0.0

[bdist_wheel]
universal = 0

[metadata]
license_file = LICENSE
