Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C API: Add PyObject_GetOptionalAttr() function #106521

Closed
serhiy-storchaka opened this issue Jul 7, 2023 · 2 comments
Closed

C API: Add PyObject_GetOptionalAttr() function #106521

serhiy-storchaka opened this issue Jul 7, 2023 · 2 comments
Labels
topic-C-API type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Jul 7, 2023

It is a new name of former _PyObject_LookupAttr() added in #76752.

int PyObject_GetOptionalAttr(PyObject *obj, PyObject *attr_name, PyObject **result);

Discussion about making it public and naming: https://discuss.python.org/t/make-pyobject-lookupattr-public/29104.

See also other new functions with similar interface in #106307 and #106004.

Linked PRs

@serhiy-storchaka serhiy-storchaka added type-feature A feature request or enhancement topic-C-API labels Jul 7, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jul 7, 2023
It is a new name of former _PyObject_LookupAttr().
serhiy-storchaka added a commit that referenced this issue Jul 11, 2023
It is a new name of former _PyObject_LookupAttr().

Add also PyObject_GetOptionalAttrString().
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Jul 11, 2023
@vstinner
Copy link
Member

I added PyObject_GetOptionalAttr() and PyObject_GetOptionalAttrString() to pythoncapi-compat: python/pythoncapi-compat@157d6d4

@carljm
Copy link
Member

carljm commented Jul 13, 2023

PRs are merged, this looks done.

@carljm carljm closed this as completed Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-C-API type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants