diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2025-05-12 22:37:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-12 22:37:55 (GMT) |
commit | 3467656b18d188511df33d05be918f6d1f6ceae5 (patch) | |
tree | bc41ff2308a7d8bc17a6799bf16da2bb0ca57115 /Lib/test/test_crossinterp.py | |
parent | c1aa5f82d9442f5a15676e962aba3501951c542e (diff) | |
download | cpython-3467656b18d188511df33d05be918f6d1f6ceae5.zip cpython-3467656b18d188511df33d05be918f6d1f6ceae5.tar.gz cpython-3467656b18d188511df33d05be918f6d1f6ceae5.tar.bz2 |
[3.14] gh-132775: Add _PyFunction_GetXIData() (gh-133955)
(cherry picked from commit 8cf4947b0f, AKA gh-133481)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Diffstat (limited to 'Lib/test/test_crossinterp.py')
-rw-r--r-- | Lib/test/test_crossinterp.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Lib/test/test_crossinterp.py b/Lib/test/test_crossinterp.py index b366a29..cddacbc 100644 --- a/Lib/test/test_crossinterp.py +++ b/Lib/test/test_crossinterp.py @@ -758,6 +758,40 @@ class CodeTests(_GetXIDataTests): ]) +class ShareableFuncTests(_GetXIDataTests): + + MODE = 'func' + + def test_stateless(self): + self.assert_roundtrip_not_equal([ + *defs.STATELESS_FUNCTIONS, + # Generators can be stateless too. + *defs.FUNCTION_LIKE, + ]) + + def test_not_stateless(self): + self.assert_not_shareable([ + *(f for f in defs.FUNCTIONS + if f not in defs.STATELESS_FUNCTIONS), + ]) + + def test_other_objects(self): + self.assert_not_shareable([ + None, + True, + False, + Ellipsis, + NotImplemented, + 9999, + 'spam', + b'spam', + (), + [], + {}, + object(), + ]) + + class PureShareableScriptTests(_GetXIDataTests): MODE = 'script-pure' |