Visitar URL original
gh-96696: Fix ResourceWarning in test.test_frame by sweeneyde · Pull Request #96831 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20220916103059/https://github.com/python/cpython/pull/96831
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

gh-96696: Fix ResourceWarning in test.test_frame #96831

Merged
merged 1 commit into from Sep 15, 2022

Conversation

sweeneyde
Copy link
Member

@sweeneyde sweeneyde commented Sep 14, 2022 •

@sweeneyde
Copy link
Member Author

sweeneyde commented Sep 14, 2022

I checked that this fails before 1b46d11 and passes after.

@sweeneyde sweeneyde requested a review from markshannon Sep 14, 2022
@sweeneyde sweeneyde added the 🔨 test-with-buildbots Test the PR with the buildbot fleet and report in the status section label Sep 14, 2022
@bedevere-bot
Copy link

bedevere-bot commented Sep 14, 2022

🤖 New build scheduled with the buildbot fleet by @sweeneyde for commit 9d327d9 🤖

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test the PR with the buildbot fleet and report in the status section label Sep 14, 2022
@sweeneyde
Copy link
Member Author

sweeneyde commented Sep 14, 2022

For example, https://buildbot.python.org/all/#/builders/474 is green for the first time in months.

@markshannon
Copy link
Member

markshannon commented Sep 15, 2022

It was a bit tricky to get a test to fail on older versions.
Can you confirm that the test still fails prior to #95886? Thanks.

@sweeneyde
Copy link
Member Author

sweeneyde commented Sep 15, 2022

Yep, this test case would fail before #95886:

PS C:\Users\sween\Source\Repos\cpython2\cpython> .\python.bat -m test test_frame
Running Debug|x64 interpreter...
0:00:00 Run tests sequentially
0:00:00 [1/1] test_frame
test test_frame failed -- Traceback (most recent call last):
  File "C:\Users\sween\Source\Repos\cpython2\cpython\Lib\test\test_frame.py", line 262, in test_issue95818
    assert_python_ok("-c", code)
  File "C:\Users\sween\Source\Repos\cpython2\cpython\Lib\test\support\script_helper.py", line 166, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\sween\Source\Repos\cpython2\cpython\Lib\test\support\script_helper.py", line 151, in _assert_python
    res.fail(cmd_line)
  File "C:\Users\sween\Source\Repos\cpython2\cpython\Lib\test\support\script_helper.py", line 76, in fail
    raise AssertionError("Process return code is %d\n"
AssertionError: Process return code is 3
command line: ['C:\\Users\\sween\\Source\\Repos\\cpython2\\cpython\\PCbuild\\amd64\\python_d.exe', '-X', 'faulthandler', '-c', '\nimport gc\ngc.set_threshold(1,1,1)\nclass GCHello:\n    def __del__(self):\n        print("Destroyed from gc")\ndef gen():\n    yield\nfd = open(\'C:\\\\Users\\\\sween\\\\Source\\\\Repos\\\\cpython2\\\\cpython\\\\Lib\\\\test\\\\test_frame.py\')\nl = [fd, GCHello()]\nl.append(l)\ndel fd\ndel l\ngen()\n']

stdout:
---

---

stderr:
---
A s s e r t i o n   f a i l e d :   ! _ P y F r a m e _ I s I n c o m p l e t e ( f r a m e ) ,   f i l e   C : \ U s e r s \ s w e e n \ S o u r c e \ R e p o s \ c p y t h o n 2 \ c p y t h o n \ I n c l u d e \ i n t e r n a l \ p y c o r e _ f r a m e . h ,   l i n e   1 6 4
 Fatal Python error: Aborted

Current thread 0x00002384 (most recent call first):
  Garbage-collecting
  File "<string>", line 7 in gen
  File "<string>", line 14 in <module>
---

test_frame failed (1 failure)

== Tests result: FAILURE ==

1 test failed:
    test_frame

Total duration: 1.9 sec
Tests result: FAILURE

@markshannon
Copy link
Member

markshannon commented Sep 15, 2022

Thanks for checking.

@markshannon markshannon merged commit 303bd88 into python:main Sep 15, 2022
86 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented Sep 15, 2022

Thanks @sweeneyde for the PR, and @markshannon for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot
Copy link

bedevere-bot commented Sep 15, 2022

GH-96850 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 15, 2022
(cherry picked from commit 303bd880475b510481d86a8c48b62d21d0e3bb53)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
@sweeneyde sweeneyde deleted the resource_warning branch Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants