Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
gh-115231: fill __module__ for built-in staticmethods#115232
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
Merged
+29 −1
Merged
Changes fromall commits
Commits
Show all changes
17 commits Select commitHold shift + click to select a range
9b31877 gh-115231: fill __module__ attribute for built-in staticmethods
skirpichevbe1c7ef PyObject_GetAttr -> PyObject_GetOptionalAttr
skirpichev1f854ee Merge branch 'main' into static-bltin-__module__-115231
skirpichevc4dec10 fill __module__ attribute for built-in classmethods too
skirpichev1e25d84 use PyObject_GetAttr & ignore exceptions
skirpichev63b05a0 Merge branch 'master' into static-bltin-__module__-115231
skirpichev777bc8d address review: use type_module()
skirpichevd1650bf + rename news
skirpichevd0f5bb0 Merge branch 'main' into static-bltin-__module__-115231
skirpicheve20339b XXX Revert "address review: use type_module()"
skirpichev4ba1288 Merge branch 'main' into static-bltin-__module__-115231
skirpichev543a5b3 Address review: use type_module()
skirpichevb3fbb8c Merge branch 'master' into static-bltin-__module__-115231
skirpichev6666a1a Revert "fill __module__ attribute for built-in classmethods too"
skirpichev386f383 +1
skirpichev598a964 Update Objects/typeobject.c
skirpichev0481304 Merge branch 'main' into static-bltin-__module__-115231
vstinnerFile 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
There are no files selected for viewing
18 changes: 18 additions & 0 deletionsLib/test/test_funcattrs.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 |
|---|---|---|
| @@ -459,6 +459,24 @@ class BuiltinFunctionPropertiesTest(unittest.TestCase): | ||
| # XXX Not sure where this should really go since I can't find a | ||
| # test module specifically for builtin_function_or_method. | ||
| def test_builtin__module__(self): | ||
| import math | ||
skirpichev marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| # builtin function: | ||
| self.assertEqual(len.__module__, 'builtins') | ||
| self.assertEqual(math.sin.__module__, 'math') | ||
| # instance method: | ||
| self.assertRaises(AttributeError, getattr, int.to_bytes, '__module__') | ||
| self.assertEqual(int.to_bytes.__objclass__.__module__, 'builtins') | ||
| # builtin classmethod: | ||
| self.assertEqual(int.from_bytes.__module__, None) | ||
| self.assertEqual(int.from_bytes.__self__.__module__, 'builtins') | ||
skirpichev marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| # builtin staticmethod: | ||
| self.assertEqual(bytes.maketrans.__module__, 'builtins') | ||
| def test_builtin__qualname__(self): | ||
| import time | ||
2 changes: 2 additions & 0 deletionsMisc/NEWS.d/next/Core_and_Builtins/2024-02-10-05-42-26.gh-issue-115231.6T7dzi.rst
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 |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Setup ``__module__`` attribute for built-in static methods. Patch by Sergey | ||
| B Kirpichev. |
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
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.