Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-106521: Add PyObject_GetOptionalAttr() function#106522

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commentedJul 7, 2023
edited by github-actionsbot
Loading

It is a new name of former _PyObject_LookupAttr().


📚 Documentation preview 📚:https://cpython-previews--106522.org.readthedocs.build/

It is a new name of former _PyObject_LookupAttr().
@serhiy-storchakaserhiy-storchaka requested review froma team andencukou ascode ownersJuly 7, 2023 18:33
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

To ease the review, you might keep the old name with an alias#define _PyObject_LookupAttr PyObject_GetOptionalAttr, and then write a second PR to update usage of the old name. (Well, just split the PR in two parts.)



.. c:function:: int PyObject_GetOptionalAttrString(PyObject *obj, const char *attr_name, PyObject **result);

Copy link
Member

Choose a reason for hiding this comment

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

You may just say:

Similar to :c:func:`PyObject_GetOptionalAttr`, but *name* is a UTF-8 encoded string.

To not copy/paste the documentation.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

In all other functions withString suffix the documentation is repeated. If we are going to change this, it should be changed for all function at once.

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull requestJul 11, 2023
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the update.

@serhiy-storchaka
Copy link
MemberAuthor

Thank you for review@carljm and@vstinner, and especially for your documentation suggestions.

carljm and erlend-aasland reacted with hooray emoji

@serhiy-storchakaserhiy-storchaka merged commit579aa89 intopython:mainJul 11, 2023
@serhiy-storchakaserhiy-storchaka deleted the PyObject_GetOptionalAttr branchJuly 11, 2023 19:13
hauntsaninja pushed a commit to python/mypy that referenced this pull requestJul 7, 2024
`_PyObject_LookupAttrId` was removed / replaced with`PyObject_GetOptionalAttrString` inpython/cpython#106522.https://docs.python.org/dev/c-api/object.html#c.PyObject_GetOptionalAttrStringFixes```cpp  /home/runner/work/mypy/mypy/mypyc/lib-rt/pythonsupport.h: In function ‘update_bases’: (diff)  /home/runner/work/mypy/mypy/mypyc/lib-rt/pythonsupport.h:51:13: error: implicit declaration of function ‘_PyObject_LookupAttrId’; did you mean ‘_PyObject_GetAttrId’? [-Werror=implicit-function-declaration] (diff)     51 |         if (_PyObject_LookupAttrId(base, &PyId___mro_entries__, &meth) < 0) { (diff)        |             ^~~~~~~~~~~~~~~~~~~~~~ (diff)        |             _PyObject_GetAttrId (diff)```
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@carljmcarljmcarljm left review comments

@vstinnervstinnervstinner approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@serhiy-storchaka@carljm@vstinner@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp