-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-128509: Add PyUnstable_IsImmortal for finding immortal objects
#129182
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
Changes from 5 commits
58ac265
8a64537
4b55134
6bddf33
412a42b
21cf2c4
8d20c00
831626c
422edf9
6014587
48c974c
dd19a02
99e897f
0448daf
5b949b1
d1c9b1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,20 @@ def test_immortal_builtins(self): | |
| for obj in ([], {}, set()): | ||
| self.assertFalse(_testinternalcapi.is_static_immortal(obj)) | ||
|
|
||
| def test_immortal(self): | ||
| # Not extensive | ||
| known_immortals = (True, False, None, 0, ()) | ||
| for immortal in known_immortals: | ||
| with self.subTest(immortal=immortal): | ||
| self.assertTrue(_testcapi.is_immortal(immortal)) | ||
|
|
||
| # Some arbitrary mutable objects | ||
| non_immortals = (object(), self, [object()]) | ||
| for non_immortal in non_immortals: | ||
| with self.subTest(non_immortal=non_immortal): | ||
| self.assertFalse(_testcapi.is_immortal(non_immortal)) | ||
|
|
||
|
||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Add :c:func:`PyUnstable_IsImmortal` for determining whether an object is | ||
| :term:`immortal`. |
Uh oh!
There was an error while loading. Please reload this page.