| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I did realize I ran ruff with my settings from another project. I'll have to amend this when I get a chance, but let me know if this change looks ok otherwise. |
Sorry, something went wrong.
|
Thanks @ralian PEP-383 says:
In pygit2 we don't have vars or args I think, so we only care about paths. maybe_string/to_bytes are general helpers used not only for filesystem paths. I would rather add 2 new helpers: for example decode_fs_path/encode_fs_path; then the work will be to go through the code and use the correct helper (if in doubt keep the old helper call and flag it for discussion). Also, there is a reference leak in Repository_status : - err = PyDict_SetItemString(dict, path, status);
+ PyObject *py_path = PyUnicode_DecodeFSDefault(path);
+ if (py_path == NULL)
+ goto error;
+
+ err = PyDict_SetItem(dict, py_path, status);
+ Py_DECREF(py_path);
Py_CLEAR(status);If py_path is NULL then status is not cleared. |
Sorry, something went wrong.
|
Hi David, Thanks for the feedback. The new helper functions are a good idea, this weekend I will take a crack at that and fix the half broken test too (I have it fixed locally.) For the reference leak good point. I don't like using goto for this exact reason, but I was trying to match the style of the rest of the codebase. I will think about a better way to handle this, but worst case I can just clear the status in that branch before the goto. Will |
Sorry, something went wrong.
|
I updated and fixed some things with your suggestions @jdavid . I split out that helper function and think I moved everything appropriate over to it; it increases the footprint of the PR, so I am happy to do this either way. Let me know what you think! |
Sorry, something went wrong.
|
Hi William, It just remains to:
|
Sorry, something went wrong.
|
My apologies, I had run ruff but not mypy. I rewrote that part of repository_status but obviously had the same issue, so I went ahead and just wrapped an extra Py_CLEAR(status); in that code path. |
Sorry, something went wrong.
|
Once again, forgot to amend with the mypy fixes. Apologies, still getting used to this workflow. |
Sorry, something went wrong.
- Simplify encode_fs_path by removing redundant branches. - Fix decode_fs_path overload for NULL pointers. - Use decode_fs_path for BlameHunk.orig_path and Submodule.path. - Update changelog. Assisted-by: Kimi K3
|
Merged, thanks! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Work related to #1451