| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Is adding version necessary? Would not keeping a strong reference to a child be enough? Look at the list.remove() code.
Sorry, something went wrong.
Oh yes. I'll try using this one as a basis. |
Sorry, something went wrong.
Ah I know why I couldn't make it work! it's because the children is not a list itself, but just a huge memory area that was dynamically allocated using PyMem_Malloc. What do you suggest I do? |
Sorry, something went wrong.
|
The list storage is also just a huge memory area that was dynamically allocated using PyMem_Malloc. I do not see difference. At worst, you can get different exceptions (or no exception) in C and Python implementations, but this is fine. |
Sorry, something went wrong.
The difference is that the list object uses Py_SIZE but it's not possible to use this on the current implementation of element trees (or is there?) |
Sorry, something went wrong.
|
Py_SIZE or self->extra->length -- there is not much difference between them. Both just read a word from memory. You may need to check that self->extra was not set to NULL during iteration, this is the only difference. |
Sorry, something went wrong.
I'm pretty sure I first tried using INCREF/DECREF as usual and encountered an issue with that but I can't remember how. I'll try reproducing this tomorrow. |
Sorry, something went wrong.
…M3uCn.rst Co-authored-by: Victor Stinner <vstinner@python.org>
|
@vstinner @serhiy-storchaka friendly ping in case you forgot about this one |
Sorry, something went wrong.
|
As I wrote, I don't think that 200 lines of tests are needed. I would prefer way less tests. |
Sorry, something went wrong.
|
I can remove the special test case which makes the test explode as it's only the Python implementation if you want. It would reduce the test by half at least (most of the line length is taken by comments that are needed to explain the discrepency between the Python and the C implementation). |
Sorry, something went wrong.
|
@vstinner I've removed the pedantic check. However, we still need to have that much of tests because del root[:] and root.clear() behave differently although they should do the same. The reproducer I had did not make crash del root[:], but it made crash root.clear(). |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. The C code change LGTM, I didn't review the tests.
Sorry, something went wrong.
|
Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
Sorry, something went wrong.
…en concurrent mutations happen (pythonGH-126124) (cherry picked from commit bab1398) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
GH-131929 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
…en concurrent mutations happen (pythonGH-126124) (cherry picked from commit bab1398) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
|
GH-131930 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
No need for versioning. Holding a strong reference on the child being compared is enough if we additionally check that the number of children is not changed after the comparison.
The test coverage could be refined but I don't think I need to overcomplicate it even more. I still think we can have a UAF because when one clears the list in __eq__ but I couldn't find a way to trigger it so I just increfed the item before calling __eq__. If anyone thinks it's not needed, please tell me why.
The patch for find* may be more complicated, which is why I splitted the task into three (one for introducing the versioning so that we can work on those failures in parallel).