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: Default missing lists in AST to the empty list by JelleZijlstra · Pull Request #104834 · python/cpython Conversation
|
|
(This PR is on top of the changes from #104828.) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ideally I'd like this to go into 3.12 to fix the BC issues in #104799, but maybe it's too late. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
So I understand correctly, this changes the representation of a missing list from I am a little concerned (just a little) about the performance implications. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
No, it changes from raising a TypeError to PyList_New(0). This is easier to see in the generated code than in the code generator: @@ -9306,10 +9404,12 @@ obj2ast_expr(struct ast_state *state, PyObject* obj, expr_ty* out, PyArena* return 1; } if (tmp == NULL) { - PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from DictComp"); - return 1; + tmp = PyList_New(0); + if (tmp == NULL) { + return 1; + } } - else { + { int res; Py_ssize_t len; Py_ssize_t i; So this shouldn't affect performance for code that was already working. |
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-104834) (cherry picked from commit 77d2579) Co-authored-by: Jelle Zijlstra <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
|
GH-105213 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.
…104834) (#105213) (cherry picked from commit 77d2579) Co-authored-by: Jelle Zijlstra <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
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.