pytest icon indicating copy to clipboard operation
pytest copied to clipboard

Set `sys.last_exc` in addition to `last_type`/`last_value`/`last_traceback` on Python>=3.12

Open bluetech opened this issue 1 year ago • 1 comments
trafficstars

Python 3.12 added sys.last_exc. We should set it like we do the older variants.

bluetech avatar Jan 21 '24 20:01 bluetech

Hey @bluetech, I submitted a PR: https://github.com/pytest-dev/pytest/pull/11934

As last_exc is the same as last_value (from trying locally and looking at python here), and have added an if to check we're only using it on Python versions >= 3.12.0. Let me know if I need to do anything else!

robotherapist avatar Feb 05 '24 20:02 robotherapist