Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 73 additions & 1 deletion Objects/clinic/exceptions.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 37 additions & 9 deletions Objects/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

/*[clinic input]
class BaseException "PyBaseExceptionObject *" "&PyExc_BaseException"
class BaseExceptionGroup "PyBaseExceptionGroupObject *" "&PyExc_BaseExceptionGroup"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=90558eb0fbf8a3d0]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b7c45e78cff8edc3]*/


/* Compatibility aliases */
Expand Down Expand Up @@ -1034,10 +1035,19 @@
self->msg, num_excs, num_excs > 1 ? "s" : "");
}

/*[clinic input]
@critical_section
BaseExceptionGroup.derive
excs: object
/
[clinic start generated code]*/

static PyObject *
BaseExceptionGroup_derive(PyObject *self_, PyObject *excs)
BaseExceptionGroup_derive_impl(PyBaseExceptionGroupObject *self,
PyObject *excs)
/*[clinic end generated code: output=4307564218dfbf06 input=f72009d38e98cec1]*/
{
PyBaseExceptionGroupObject *self = _PyBaseExceptionGroupObject_cast(self_);

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

‘self’ redeclared as different kind of symbol

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

‘self_’ undeclared (first use in this function); did you mean ‘self’?

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

redefinition of formal parameter 'self' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'self_': undeclared identifier [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'function': 'PyObject *' differs in levels of indirection from 'int' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

'_PyBaseExceptionGroupObject_cast': different types for formal and actual parameter 1 [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

‘self’ redeclared as different kind of symbol

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

‘self_’ undeclared (first use in this function); did you mean ‘self’?

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

redefinition of formal parameter 'self' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

'self_': undeclared identifier [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

'function': 'PyObject *' differs in levels of indirection from 'int' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (arm64)

'_PyBaseExceptionGroupObject_cast': different types for formal and actual parameter 1 [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

redefinition of formal parameter 'self' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'self_': undeclared identifier [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'function': 'PyObject *' differs in levels of indirection from 'int' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

'_PyBaseExceptionGroupObject_cast': different types for formal and actual parameter 1 [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

‘self’ redeclared as different kind of symbol

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

‘self_’ undeclared (first use in this function); did you mean ‘self’?

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

‘self’ redeclared as different kind of symbol

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

‘self_’ undeclared (first use in this function); did you mean ‘self’?

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

redefinition of formal parameter 'self' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

'self_': undeclared identifier [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

'function': 'PyObject *' differs in levels of indirection from 'int' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 1050 in Objects/exceptions.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (arm64)

'_PyBaseExceptionGroupObject_cast': different types for formal and actual parameter 1 [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]
PyObject *init_args = PyTuple_Pack(2, self->msg, excs);
if (!init_args) {
return NULL;
Expand Down Expand Up @@ -1330,8 +1340,17 @@
return retval;
}

/*[clinic input]
@critical_section
BaseExceptionGroup.split
matcher_value: object
/
[clinic start generated code]*/

static PyObject *
BaseExceptionGroup_split(PyObject *self, PyObject *matcher_value)
BaseExceptionGroup_split_impl(PyBaseExceptionGroupObject *self,
PyObject *matcher_value)
/*[clinic end generated code: output=d74db579da4df6e2 input=0c5cfbfed57e0052]*/
{
_exceptiongroup_split_matcher_type matcher_type;
if (get_matcher_type(matcher_value, &matcher_type) < 0) {
Expand All @@ -1341,7 +1360,7 @@
_exceptiongroup_split_result split_result;
bool construct_rest = true;
if (exceptiongroup_split_recursive(
self, matcher_type, matcher_value,
(PyObject *)self, matcher_type, matcher_value,
construct_rest, &split_result) < 0) {
return NULL;
}
Expand All @@ -1356,8 +1375,17 @@
return result;
}

/*[clinic input]
@critical_section
BaseExceptionGroup.subgroup
matcher_value: object
/
[clinic start generated code]*/

static PyObject *
BaseExceptionGroup_subgroup(PyObject *self, PyObject *matcher_value)
BaseExceptionGroup_subgroup_impl(PyBaseExceptionGroupObject *self,
PyObject *matcher_value)
/*[clinic end generated code: output=07dbec8f77d4dd8e input=988ffdd755a151ce]*/
{
_exceptiongroup_split_matcher_type matcher_type;
if (get_matcher_type(matcher_value, &matcher_type) < 0) {
Expand All @@ -1367,7 +1395,7 @@
_exceptiongroup_split_result split_result;
bool construct_rest = false;
if (exceptiongroup_split_recursive(
self, matcher_type, matcher_value,
(PyObject *)self, matcher_type, matcher_value,
construct_rest, &split_result) < 0) {
return NULL;
}
Expand Down Expand Up @@ -1633,9 +1661,9 @@
static PyMethodDef BaseExceptionGroup_methods[] = {
{"__class_getitem__", (PyCFunction)Py_GenericAlias,
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{"derive", (PyCFunction)BaseExceptionGroup_derive, METH_O},
{"split", (PyCFunction)BaseExceptionGroup_split, METH_O},
{"subgroup", (PyCFunction)BaseExceptionGroup_subgroup, METH_O},
BASEEXCEPTIONGROUP_DERIVE_METHODDEF
BASEEXCEPTIONGROUP_SPLIT_METHODDEF
BASEEXCEPTIONGROUP_SUBGROUP_METHODDEF
{NULL}
};

Expand Down
Loading