iustin / pyxattr

A python module for accessing filesystem Extended Attributes
https://pyxattr.k1024.org/
GNU Lesser General Public License v2.1
30 stars 15 forks source link

Correct And Simplify Memory Handling in xattr_get #17

Closed ldo closed 4 years ago

ldo commented 6 years ago

I notice your xattr_get routine is missing a check for an error from the PyList_Append call.

While I was at it, I took the opportunity to rework the xattr_get logic to reduce the complexity of the control paths, eliminating all the gotos. As you can see from the enclosed patch, it becomes much easier to verify that everything will be be correctly disposed regardless of what errors might occur.

ldo-xattr_get.patch.txt

ldo commented 6 years ago

Sorry, noticed an omission in the patch. Update enclosed.

ldo-xattr_get.patch.txt

iustin commented 4 years ago

Hi,

Refactoring the way error handling is dome is, I consider, more a matter of taste. I'd like to discuss that separately from fixing an actual bug. Can you rebase and split the patch into bug-fix and rework-error-handling?

ldo commented 4 years ago

Code quality has nothing to do with “taste” (whatever that might mean).

iustin commented 4 years ago

Error handling methods, as long as correct, are a matter of style, and not of "quality". I'll fix the PyList_Append error checking, if you do want to send a pull request for the refactoring, please do that separately.