Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-140550: Update xxlimited with 3.15 limited API & PEP 697#142827
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Draft
encukou wants to merge13 commits intopython:mainChoose a base branch fromencukou:xxlimited-3.15
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Draft
Changes from1 commit
Commits
Show all changes
13 commits Select commitHold shift + click to select a range
8147b92 Copy xxlimited to xxlimited_3_13
encukou65f3fd0 Run tests for all the xxlimited* modules
encukouaa43538 Adjust module names in the 3_13 module
encukou323695f Update xxlimited to 3.15 limited API (with opaque PyObject)
encukou597652b Comments & cleanups
encukou22464eb Add Py_mod_abi
encukoucc5e8f3 Remove unused import
encukou945b450 Don't flag static PyABIInfo variables
encukou3b3ae7c Refcounting fix
encukouff0f300 Style
encukou29f1690 Expand TODO
encukoud9728de Remove comment that might be misleading
encukou0bc0198 PyUnicode_EqualToUTF8 can't error (and doesn't type-check)
encukouFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Run tests for all the xxlimited* modules
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit65f3fd08de8a3ba7e94d78c5f4de5e6f3a1e2125
There are no files selected for viewing
101 changes: 60 additions & 41 deletionsLib/test/test_xxlimited.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -3,17 +3,38 @@ | ||
| import types | ||
| xxlimited = import_helper.import_module('xxlimited') | ||
| # if import of xxlimited succeeded, the other ones should be importable. | ||
| import xxlimited_3_13 | ||
| import xxlimited_35 | ||
| MODULES = { | ||
| (3, 15): xxlimited, | ||
| (3, 13): xxlimited_3_13, | ||
| (3, 5): xxlimited_35, | ||
| } | ||
| def test_with_xxlimited_modules(since=None, until=None): | ||
| def _decorator(func): | ||
| def _wrapper(self, *args, **kwargs): | ||
| for version, module in MODULES.items(): | ||
| if since and version < since: | ||
| continue | ||
| if until and version >= until: | ||
| continue | ||
| with self.subTest(version=version): | ||
ZeroIntensity marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| func(self, module, *args, **kwargs) | ||
| return _wrapper | ||
| return _decorator | ||
| class XXLimitedTests(unittest.TestCase): | ||
| @test_with_xxlimited_modules() | ||
| def test_xxo_new(self, module): | ||
| xxo = module.Xxo() | ||
| @test_with_xxlimited_modules() | ||
| def test_xxo_attributes(self, module): | ||
| xxo = module.Xxo() | ||
| with self.assertRaises(AttributeError): | ||
| xxo.foo | ||
| with self.assertRaises(AttributeError): | ||
| @@ -26,40 +47,46 @@ def test_xxo_attributes(self): | ||
| with self.assertRaises(AttributeError): | ||
| xxo.foo | ||
| @test_with_xxlimited_modules() | ||
| def test_foo(self, module): | ||
| # the foo function adds 2 numbers | ||
| self.assertEqual(module.foo(1, 2), 3) | ||
| @test_with_xxlimited_modules() | ||
| def test_str(self, module): | ||
| self.assertIsSubclass(module.Str, str) | ||
| self.assertIsNot(module.Str, str) | ||
| custom_string = module.Str("abcd") | ||
| self.assertEqual(custom_string, "abcd") | ||
| self.assertEqual(custom_string.upper(), "ABCD") | ||
| @test_with_xxlimited_modules() | ||
| def test_new(self, module): | ||
| xxo = module.new() | ||
| self.assertEqual(xxo.demo("abc"), "abc") | ||
| @test_with_xxlimited_modules() | ||
| def test_xxo_demo(self, module): | ||
| xxo = module.Xxo() | ||
| self.assertEqual(xxo.demo("abc"), "abc") | ||
| self.assertEqual(xxo.demo(0), None) | ||
| @test_with_xxlimited_modules(since=(3, 13)) | ||
| def test_xxo_demo_extra(self, module): | ||
| xxo = module.Xxo() | ||
| other = module.Xxo() | ||
| self.assertEqual(xxo.demo(xxo), xxo) | ||
| self.assertEqual(xxo.demo(other), other) | ||
| @test_with_xxlimited_modules(since=(3, 13)) | ||
| def test_error(self, module): | ||
| with self.assertRaises(module.Error): | ||
| raise module.Error | ||
| @test_with_xxlimited_modules(since=(3, 13)) | ||
| def test_buffer(self, module): | ||
| xxo = module.Xxo() | ||
| self.assertEqual(xxo.x_exports, 0) | ||
| b1 = memoryview(xxo) | ||
| self.assertEqual(xxo.x_exports, 1) | ||
| @@ -69,21 +96,13 @@ def test_buffer(self): | ||
| self.assertEqual(b1[0], 1) | ||
| self.assertEqual(b2[0], 1) | ||
| @test_with_xxlimited_modules(until=(3, 5)) | ||
| def test_roj(self): | ||
| # the roj function always fails | ||
| with self.assertRaises(SystemError): | ||
| self.module.roj(0) | ||
| @test_with_xxlimited_modules(until=(3, 5)) | ||
| def test_null(self): | ||
| null1 = self.module.Null() | ||
| null2 = self.module.Null() | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.