Skip to content

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

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

Merged
merged 1 commit into from
Sep 15, 2022

Conversation

sweeneyde
Copy link
Member

@sweeneyde sweeneyde commented Sep 14, 2022

@sweeneyde sweeneyde added tests Tests in the Lib/test dir skip news needs backport to 3.11 only security fixes labels Sep 14, 2022
@sweeneyde
Copy link
Member Author

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

@sweeneyde sweeneyde added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Sep 14, 2022
@bedevere-bot
Copy link

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

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

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

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

@markshannon
Copy link
Member

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

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

Thanks for checking.

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

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

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

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Sep 15, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 15, 2022
(cherry picked from commit 303bd88)

Co-authored-by: Dennis Sweeney <[email protected]>
@sweeneyde sweeneyde deleted the resource_warning branch September 15, 2022 17:32
miss-islington added a commit that referenced this pull request Sep 17, 2022
(cherry picked from commit 303bd88)

Co-authored-by: Dennis Sweeney <[email protected]>
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.

4 participants