Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#34507 closed Bug (duplicate)

AttributeError: Can't pickle local object 'convert_exception_to_response.<locals>.inner'

Reported by: Mateusz Kurowski Owned by: nobody
Component: Error reporting Version: 4.2
Severity: Normal Keywords: pickle, exception, response, test
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

tblib==1.7.0
django==4.2
Error
Traceback (most recent call last):
  File "/usr/lib/python3.11/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/usr/lib/python3.11/unittest/case.py", line 623, in run
    self._callTestMethod(testMethod)
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/unittest/case.py", line 579, in _callTestMethod
    if method() is not None:
    ^^^^^^^^^^^^^^^^^
  File ".../tests/test_views.py", line 315, in test_GET
    with self.subTest("member can view"):
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/unittest/case.py", line 537, in subTest
    with self._outcome.testPartExecutor(self._subtest, subTest=True):
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/unittest/case.py", line 72, in testPartExecutor
    self.result.addSubTest(test_case.test_case, test_case, exc_info)
    ^^^^^^^^^^^^^^^^^
  File "...env/lib/python3.11/site-packages/django/test/runner.py", line 307, in addSubTest
    self.check_subtest_picklable(test, subtest)
    ^^^^^^^^^^^^^^^^^
  File "...venv/lib/python3.11/site-packages/django/test/runner.py", line 269, in check_subtest_picklable
    self._confirm_picklable(subtest)
    ^^^^^^^^^^^^^^^^^
  File "...venv/lib/python3.11/site-packages/django/test/runner.py", line 186, in _confirm_picklable
    pickle.loads(pickle.dumps(obj))
    ^^^^^^^^^^^^^^^^^
AttributeError: Can't pickle local object 'convert_exception_to_response.<locals>.inner'


Change History (4)

comment:1 by Natalia Bidart, 17 months ago

Resolution: needsinfo
Status: newclosed

Hello Mateusz Kurowski, could you please add more details about how to reproduce this issue? Please refer to this guide about reporting bugs. Thanks!

comment:2 by Mariusz Felisiak, 17 months ago

This may be a duplicate of #32114.

comment:3 by Mateusz Kurowski, 17 months ago

Hey, I apologize for not providing more details earlier. I believe Mariusz may be correct in saying that this is a duplicate issue. The problem occurs when I make a request to the view that raises an exception. This issue only occurs while in a subtest.

comment:4 by Mariusz Felisiak, 17 months ago

Component: UncategorizedError reporting
Resolution: needsinfoduplicate
Type: UncategorizedBug

Thanks.

Duplicate of #32114.

Note: See TracTickets for help on using tickets.
Back to Top