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-99139: Improve NameError error suggestion for instances#99140

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
pablogsal merged 7 commits intopython:mainfrompablogsal:better_attr
Nov 6, 2022

Conversation

@pablogsal
Copy link
Member

@pablogsalpablogsal commentedNov 5, 2022
edited by bedevere-bot
Loading

AlexWaygood, pablogsal, ichard26, and JordanLevy99 reacted with heart emoji
Copy link
Member

@ammaraskarammaraskar left a comment

Choose a reason for hiding this comment

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

Looks great :)

Co-authored-by: Ammar Askar <ammar_askar@hotmail.com>
Copy link
Member

@isidenticalisidentical left a comment

Choose a reason for hiding this comment

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

Looks really helpful, thanks a lot@pablogsal!

pablogsal reacted with heart emoji
@pablogsalpablogsal added the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelNov 5, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@pablogsal for commitb1546e5 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelNov 5, 2022
pablogsaland others added3 commitsNovember 6, 2022 01:54
Co-authored-by: Ammar Askar <ammar_askar@hotmail.com>
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
@pablogsalpablogsal added the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelNov 6, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@pablogsal for commit4925719 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelNov 6, 2022
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
@pablogsalpablogsal merged commit99e2e60 intopython:mainNov 6, 2022
@pablogsalpablogsal deleted the better_attr branchNovember 6, 2022 13:52
if (!locals) {
gotoerror;
}
PyObject*self=PyDict_GetItem(locals,&_Py_ID(self));/* borrowed */

Choose a reason for hiding this comment

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

Do not usePyDict_GetItem. It is broken by design.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

What should we use instead for both?

Choose a reason for hiding this comment

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

PyDict_GetItemWithError andPyObject_GetAttr if limited by public API. It is suggested in the documentation. But_PyObject_LookupAttr is more convenient in the latter case.

gotoerror;
}

if (PyObject_HasAttr(self,name)) {

Choose a reason for hiding this comment

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

Do not usePyObject_HasAttr. It is broken by design.

@millerdev
Copy link

I'm surprised this useshasattr under the covers. A simple benign name error could cause side effects at run time.

>>>classTest:...def__getattr__(self,name):...ifname=="foo":...raiseSystemExit("The end.")...defbar(self):...foo... ...Test().bar()...Theend.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka left review comments

@kumaraditya303kumaraditya303kumaraditya303 requested changes

@ammaraskarammaraskarammaraskar approved these changes

@isidenticalisidenticalisidentical approved these changes

@iritkatrieliritkatrielAwaiting requested review from iritkatriel

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@pablogsal@bedevere-bot@millerdev@ammaraskar@serhiy-storchaka@isidentical@kumaraditya303

[8]ページ先頭

©2009-2025 Movatter.jp