FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-43950: ensure source_line is present when specializing the traceback by isidentical · Pull Request #27313 · python/cpython · GitHub

/ cpython Public

bpo-43950: ensure source_line is present when specializing the traceback - #27313

Merged
pablogsal merged 3 commits into
python:mainfrom
colnotab:ensure-source-line-is-displayed
Jul 24, 2021
Merged

bpo-43950: ensure source_line is present when specializing the traceback#27313
pablogsal merged 3 commits into
python:mainfrom
colnotab:ensure-source-line-is-displayed

Conversation

isidentical commented Jul 23, 2021
edited
Loading

Copy link
Copy Markdown
Member

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.

cpython/Python/traceback.c

Lines 414 to 420 in 4512848

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

cpython/Python/traceback.c

Lines 436 to 446 in 4512848

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

This patch ensures that the line is retrieved and displayed.

https://bugs.python.org/issue43950

Copy link
Copy Markdown
Member

Would it be better to fix _Py_DisplaySourceLine() instead?

isidentical commented Jul 23, 2021 via email

Copy link
Copy Markdown
Member Author

Copy link
Copy Markdown
Member

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

isidentical added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 23, 2021

Copy link
Copy Markdown

🤖 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-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 23, 2021

Copy link
Copy Markdown
Member Author

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

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL