| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import types | ||
| import unittest | ||
| from test.test_importlib import util | ||
|
|
||
| machinery = util.import_importlib('importlib.machinery') | ||
|
|
||
| from test.test_importlib.extension.test_loader import MultiPhaseExtensionModuleTests | ||
|
|
||
|
|
||
| class NonModuleExtensionTests: | ||
| setUp = MultiPhaseExtensionModuleTests.setUp | ||
| load_module_by_name = MultiPhaseExtensionModuleTests.load_module_by_name | ||
|
|
||
| def _test_nonmodule(self): | ||
| # Test returning a non-module object from create works. | ||
| name = self.name + '_nonmodule' | ||
| mod = self.load_module_by_name(name) | ||
| self.assertNotEqual(type(mod), type(unittest)) | ||
| self.assertEqual(mod.three, 3) | ||
|
|
||
| # issue 27782 | ||
| def test_nonmodule_with_methods(self): | ||
| # Test creating a non-module object with methods defined. | ||
| name = self.name + '_nonmodule_with_methods' | ||
| mod = self.load_module_by_name(name) | ||
| self.assertNotEqual(type(mod), type(unittest)) | ||
| self.assertEqual(mod.three, 3) | ||
| self.assertEqual(mod.bar(10, 1), 9) | ||
|
|
||
| def test_null_slots(self): | ||
| # Test that NULL slots aren't a problem. | ||
| name = self.name + '_null_slots' | ||
| module = self.load_module_by_name(name) | ||
| self.assertIsInstance(module, types.ModuleType) | ||
| self.assertEqual(module.__name__, name) | ||
|
|
||
|
|
||
| (Frozen_NonModuleExtensionTests, | ||
| Source_NonModuleExtensionTests | ||
| ) = util.test_both(NonModuleExtensionTests, machinery=machinery) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Extension modules may indicate to the runtime that they can run without the | ||
| GIL. Multi-phase init modules do so by calling providing | ||
| ``Py_MOD_GIL_NOT_USED`` for the ``Py_mod_gil`` slot, while single-phase init | ||
| modules call ``PyModule_ExperimentalSetGIL(mod, Py_MOD_GIL_NOT_USED)`` from | ||
| their init function. |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityEhm, can this please be renamed to PyUnstable as suggested before? We have such naming schemes for a reason.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySorry, I'll get a PR ready. I went with this name because having both Unstable and Experimental in the name felt redundant, and in this comment, @ericsnowcurrently expressed a preference for PyModule_ExperimentalSetGIL() over PyUnstable_Module_SetGIL().
Does anyone else have strong feelings on whether it should be PyUnstable_Module_ExperimentalSetGIL() or PyUnstable_Module_SetGIL()?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityPR here: #118645
IMO, the “experimental” is redundant. If we need “Experimental” too, we should rethink the entire PEP-689 naming convention.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.