46 int lineno = tb->tb_lineno;
48 PyObject *lineno_py = _PyObject_GetAttrId((PyObject *)tb, &PyId_tb_lineno);
50 if (PyLong_Check(lineno_py)) {
51 const int lineno_test = PyLong_AsLongLong(lineno_py);
54 if (!((lineno_test == -1) && PyErr_Occurred())) {
88 *message = _PyObject_GetAttrId(err, &PyId_msg);
93 v = _PyObject_GetAttrId(err, &PyId_filename);
99 *filename = _PyUnicode_FromId(&PyId_string);
100 if (*filename ==
nullptr) {
103 Py_INCREF(*filename);
109 v = _PyObject_GetAttrId(err, &PyId_lineno);
113 hold = PyLong_AsSsize_t(
v);
115 if (hold < 0 && PyErr_Occurred()) {
120 v = _PyObject_GetAttrId(err, &PyId_offset);
129 hold = PyLong_AsSsize_t(
v);
131 if (hold < 0 && PyErr_Occurred()) {
137 if (Py_TYPE(err) == (PyTypeObject *)PyExc_SyntaxError) {
138 v = _PyObject_GetAttrId(err, &PyId_end_lineno);
141 *end_lineno = *lineno;
143 else if (
v == Py_None) {
144 *end_lineno = *lineno;
148 hold = PyLong_AsSsize_t(
v);
150 if (hold < 0 && PyErr_Occurred()) {
156 v = _PyObject_GetAttrId(err, &PyId_end_offset);
161 else if (
v == Py_None) {
166 hold = PyLong_AsSsize_t(
v);
168 if (hold < 0 && PyErr_Occurred()) {
176 *end_lineno = *lineno;
180 v = _PyObject_GetAttrId(err, &PyId_text);
194 Py_XDECREF(*message);
195 Py_XDECREF(*filename);
201 const char *filepath,
int *r_lineno,
int *r_offset,
int *r_lineno_end,
int *r_offset_end)
203 bool success =
false;
204 PyObject *exception, *value, *tb;
212 PyErr_Fetch(&exception, &value, (PyObject **)&tb);
213 if (exception ==
nullptr) {
216 PyObject *base_exception_type =
nullptr;
217 if (PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError)) {
218 base_exception_type = PyExc_SyntaxError;
221 PyErr_NormalizeException(&exception, &value, &tb);
223 if (base_exception_type == PyExc_SyntaxError) {
229 PyObject *filepath_exc_py, *text_py;
240 const char *filepath_exc = PyUnicode_AsUTF8(filepath_exc_py);
243 (
ELEM(filepath_exc[0],
'\\',
'/') &&
BLI_path_cmp(filepath_exc + 1, filepath) == 0))
251 for (PyTracebackObject *tb_iter = (PyTracebackObject *)tb;
252 tb_iter && (PyObject *)tb_iter != Py_None;
253 tb_iter = tb_iter->tb_next)
257 const int match = ((
BLI_path_cmp(tb_filepath, filepath) == 0) ||
258 (
ELEM(tb_filepath[0],
'\\',
'/') &&
270 PyErr_Restore(exception, value, tb);
static int parse_syntax_error(PyObject *err, PyObject **message, PyObject **filename, int *lineno, int *offset, int *end_lineno, int *end_offset, PyObject **text)
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int