Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-119180: PEP 649 compiler changes#119361
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
985f8dfc822ffae80095e90ff2c4026c0ff79687444e541974469b3247d672eab9359ce65d55ae50cd62afae5c0e5a7b1a3f26d4431a4471fbb1d88f452eb28c4b4e3cbf9a3d5d182fcce98c19e0578fced16167f38de2087baca2355d3dff9d81b6dd1f64a62f5b3bb66ad8b1a63f5d82c0dbca0c39b5083bbc5de1b2351c98fe55f5cf1177f3b1c421783013f5d76a121e1a242301c239ba23b62e04cc8a92945ae206d24fd3280f9d0c5c1818640befff5ada6573ae7714c431811a7ca24d32ab5d073b4a6451dfd02bdaba3180daf0b1b066b3d7669361c6a1b805cdbdd7e748feba2b4f9ebd469ab278de22487ea348f486ba6b563db0058b82517fb5621f93b6f72dbca8674eabee11fd9File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -77,6 +77,11 @@ class A(builtins.object) | ||
| | __weakref__%s | ||
| class B(builtins.object) | ||
| | Methods defined here: | ||
| | | ||
| | __annotate__(...) | ||
Member
| ||
| | | ||
| | ---------------------------------------------------------------------- | ||
| | Data descriptors defined here: | ||
| | | ||
| | __dict__%s | ||
| @@ -87,8 +92,6 @@ class B(builtins.object) | ||
| | Data and other attributes defined here: | ||
| | | ||
| | NO_MEANING = 'eggs' | ||
| | | ||
| | __annotations__ ={'NO_MEANING': <class 'str'>} | ||
| class C(builtins.object) | ||
| | Methods defined here: | ||
| @@ -176,6 +179,9 @@ class A(builtins.object) | ||
| list of weak references to the object | ||
| class B(builtins.object) | ||
| Methods defined here: | ||
| __annotate__(...) | ||
| ---------------------------------------------------------------------- | ||
| Data descriptors defined here: | ||
| __dict__ | ||
| dictionary for instance variables | ||
| @@ -184,7 +190,6 @@ class B(builtins.object) | ||
| ---------------------------------------------------------------------- | ||
| Data and other attributes defined here: | ||
| NO_MEANING = 'eggs' | ||
| __annotations__ ={'NO_MEANING': <class 'str'>} | ||
| class C(builtins.object) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -105,7 +105,7 @@ def test_runsource_shows_syntax_error_for_failed_compilation(self): | ||
| def test_no_active_future(self): | ||
| console = InteractiveColoredConsole() | ||
| source = "x: int = 1; print(__annotations__)" | ||
| source = "x: int = 1; print(__annotate__(1))" | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does printing MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Printing a global doesn't go through the descriptor protocol, so printing | ||
| f = io.StringIO() | ||
| with contextlib.redirect_stdout(f): | ||
| result = console.runsource(source) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -205,12 +205,14 @@ def test_assigned(self): | ||
| def test_annotated(self): | ||
| st1 = symtable.symtable('def f():\n x: int\n', 'test', 'exec') | ||
| st2 = st1.get_children()[0] | ||
| st2 = st1.get_children()[1] | ||
carljm marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| self.assertEqual(st2.get_type(), "function") | ||
| self.assertTrue(st2.lookup('x').is_local()) | ||
| self.assertTrue(st2.lookup('x').is_annotated()) | ||
| self.assertFalse(st2.lookup('x').is_global()) | ||
| st3 = symtable.symtable('def f():\n x = 1\n', 'test', 'exec') | ||
| st4 = st3.get_children()[0] | ||
| st4 = st3.get_children()[1] | ||
| self.assertEqual(st4.get_type(), "function") | ||
| self.assertTrue(st4.lookup('x').is_local()) | ||
| self.assertFalse(st4.lookup('x').is_annotated()) | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.