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-146056: Fix TreeBuilder stack in xml.etree by vstinner · Pull Request #146062 · python/cpython Conversation
|
|
I added "skip news" since this issue requires calling |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| item = self->last; | ||
| self->last = Py_NewRef(self->this); | ||
| Py_XSETREF(self->last_for_tail, self->last); | ||
| Py_XSETREF(self->last_for_tail, Py_NewRef(self->last)); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated.
If rewrite this code to be more explicit or safe, I would write something like
PyObject *last = self->last; PyObject *last_for_tail = self->last_for_tail; PyObject *this = self->this; self->index--; self->this = Py_NewRef(PyList_GET_ITEM(self->stack, self->index)); self->last = Py_NewRef(this); self->last_for_tail = Py_NewRef(this); Py_DECREF(last); Py_XDECREF(last_for_tail); if (treebuilder_append_event(self, self->end_event_obj, this) < 0) { Py_DECREF(this); return NULL; } return this;
But we should also look a the other ends -- how these attributes are set in other code in this file. This is a separate issue.
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.
I wrote #146167 which uses your suggestion.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| t->comment_factory = NULL; | ||
| t->pi_factory = NULL; | ||
| t->stack = PyList_New(20); | ||
| t->stack = PyList_New(0); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This can have performance impact.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I abandon my change since a more generic change was merged: #146129. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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.