GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-104799: PEP 695 backward compatibility for ast.unparse by JelleZijlstra · Pull Request #105846 · python/cpython Conversation
|
| self.traverse(deco) | ||
| self.fill("class " + node.name) | ||
| self._type_params_helper(node.type_params) | ||
| if hasattr(node, "type_params"): |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I assume it would be harder to just make sure that these nodes always have a type_params attribute, even if the relevant argument wasn't passed to the constructor?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes, that might be something to pursue for 3.13 though.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| def test_function(self): | ||
| node = ast.FunctionDef( | ||
| name="f", | ||
| args=ast.arguments(posonlyargs=[], args=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]), |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
#105858 would make this so much easier; manual creation like this feels ridiculously tedious at the moment
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ast.fix_missing_locations(node) | ||
| self.assertEqual(ast.unparse(node), "def f[T]():\n pass") | ||
|
|
||
| def test_function_with_type_params_and_bound(self): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Worth also adding a test_function_with_type_params_and_constraints, for completeness?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Feels a bit repetitive, it's the same at the AST level.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fair enough!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry @JelleZijlstra, I had trouble checking out the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…onGH-105846) (cherry picked from commit 957a974) Co-authored-by: Jelle Zijlstra <[email protected]>
|
GH-105862 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…105846) (#105862) (cherry picked from commit 957a974) Co-authored-by: Jelle Zijlstra <[email protected]>
* main: pythongh-104799: PEP 695 backward compatibility for ast.unparse (python#105846) pythongh-105834: Add tests for calling `issubclass()` between two protocols (python#105835) CI: Remove docs build from Azure Pipelines (python#105823) pythongh-105844: Consistently use 'minor version' for X.Y versions (python#105851) Fix inaccuracies in "Assorted Topics" section of "Defining Extension Types" tutorial (python#104969) pythongh-105433: Add `pickle` tests for PEP695 (python#105443) bpo-44530: Document the change in MAKE_FUNCTION behavior (python#93189) pythonGH-103124: Multiline statement support for pdb (pythonGH-103125) pythonGH-105588: Add missing error checks to some obj2ast_* converters (pythonGH-105589)
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.