[gdb/python] Handle deprecation of PyErr_{Fetch,Restore} in 3.12

Starting python version 3.12, PyErr_Fetch and PyErr_Restore are deprecated.

Use PyErr_GetRaisedException and PyErr_SetRaisedException instead, for
python >= 3.12.

Tested on aarch64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
1 file changed