Skip to content

Conversation

@nybblista
Copy link
Contributor

@nybblista nybblista commented Feb 9, 2026

Add test for the PyFunction_GetAnnotations function.

@nybblista
Copy link
Contributor Author

@vstinner

PyObject *annotations = PyFunction_GetAnnotations(func);
if(annotations != NULL){
return Py_NewRef(annotations);
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else {
}
else {

@nybblista
Copy link
Contributor Author

The other test functions in the function.c file use the same else style, so I kept it for consistency.

Comment on lines +129 to +130
PyObject *annotations = PyFunction_GetAnnotations(func);
if (annotations != NULL) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this whole function can be rewritten as return Py_XNewRef(PyFunction_GetAnnotations(func)).

@ZeroIntensity ZeroIntensity added skip news needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes tests Tests in the Lib/test dir labels Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants