Skip to content

Conversation

@isidentical
Copy link
Member

@isidenticalisidentical commented Jul 23, 2021

There seems to be different cases where the _PyDisplay_Line() function returns 0 without displaying the actual line but also without having any errors raised.

/* use the right encoding to decode the file as unicode */
fd=PyObject_AsFileDescriptor(binary);
if (fd<0){
Py_DECREF(io);
Py_DECREF(binary);
return0;
}

if (fob==NULL){
PyErr_Clear();
res=_PyObject_CallMethodIdNoArgs(binary, &PyId_close);
Py_DECREF(binary);
if (res)
Py_DECREF(res);
else
PyErr_Clear();
return0;
}

This patch ensures that the line is retrieved and displayed.

https://bugs.python.org/issue43950

@sweeneyde
Copy link
Member

Would it be better to fix _Py_DisplaySourceLine() instead?

@isidentical
Copy link
MemberAuthor

isidentical commented Jul 23, 2021 via email

@pablogsal
Copy link
Member

Can we add a regression test for this? (Like the one on the BPO issue?)

@isidenticalisidentical added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 23, 2021
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @isidentical for commit 8db4e0c 🤖

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-buildbots Test PR w/ buildbots; report in status section label Jul 23, 2021
@isidentical
Copy link
MemberAuthor

It seems like refleaks bots also fail on the main too, so that can be ignored.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@isidentical@sweeneyde@pablogsal@bedevere-bot@the-knights-who-say-ni