bdk-blender/source/blender/python
Campbell Barton 324e6ca147 PyAPI: call 'sys.excepthook' for text editor exceptions
Resolves #115090, where exceptions from the text editor called
`sys.excepthook` in v3.6 but not in v4.0.

The error was caused by PyC_ExceptionBuffer calling PyErr_Display
instead of PyErr_Print.

While technically a regression in [0], the behavior in 3.6x wasn't
working properly either since a user-defined `sys.excepthook` could
prevent PyC_ExceptionBuffer from accessing the exception text.

Resolve with the following changes:

- BPy_errors_to_report has been updated not to print errors.
  Previously BPy_errors_to_report would *sometimes* print the error,
  which complicated situations where the caller wanted predictable
  behavior (always printing or never printing).

- `PyErr_Print()` must be used to display errors to the output,
  this will call `sys.excepthook` as it used to.

It's better not to rely on side effects of BPy_errors_to_report()
for error handling.

[0]: 6a0f98aeef

---

Conflicts manually resolved, original fix from:

- 2e1486da60
2023-12-02 22:58:18 +11:00
..
bmesh Revert changes from main commits that were merged into blender-v4.0-release 2023-10-30 21:40:35 +01:00
generic Fix #115151, step one: Fallback to ID_OB in case of defined unknown ID type. 2023-11-27 17:53:50 +01:00
gpu Revert changes from main commits that were merged into blender-v4.0-release 2023-10-30 21:40:35 +01:00
intern PyAPI: call 'sys.excepthook' for text editor exceptions 2023-12-02 22:58:18 +11:00
mathutils Cleanup: Move BKE_object.hh to C++ 2023-10-09 23:41:53 +02:00
BPY_extern_clog.h License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
BPY_extern_python.h PyAPI: free internal Python data using sys.exit(..) 2023-09-19 15:50:41 +10:00
BPY_extern_run.h License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
BPY_extern.h License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
CMakeLists.txt License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
rna_dump.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00