Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Jun 5, 2024
1 parent b65558e commit b7cfc17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/greenlet/tests/test_greenlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,9 @@ def creator():
# Unfortunately, this doesn't actually clear the references, they're in the
# fast local array.
if not wait_for_cleanup:
result[0].gr_frame.f_locals.clear()
# f_locals has no clear method in Python 3.13
if hasattr(result[0].gr_frame.f_locals, 'clear'):
result[0].gr_frame.f_locals.clear()
else:
self.assertIsNone(result[0].gr_frame)

Expand Down
9 changes: 9 additions & 0 deletions src/greenlet/tests/test_greenlet_trash.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,17 @@

import unittest

try:
from greenlet._greenlet import get_tstate_trash_delete_nesting
except ImportError:
get_tstate_trash_delete_nesting = None


class TestTrashCanReEnter(unittest.TestCase):

# Python 3.13 has not "trash delete nesting" anymore (but "delete later")
@unittest.skipIf(get_tstate_trash_delete_nesting is None,
'need get_tstate_trash_delete_nesting()')
def test_it(self):
# Try several times to trigger it, because it isn't 100%
# reliable.
Expand Down

0 comments on commit b7cfc17

Please sign in to comment.