Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested fixes by iCR, OpenRefactory, Inc. #1486

Closed

Conversation

openrefactory
Copy link

This issue was detected in branch main of GitPython project on the version with commit hash 73bde1. This is an instance of an improper method call

Fixes for improper method call:
In file: base.py, there is a method from_tree that creates a temporary file using an unsafe API mktemp. The use of this method is discouraged in the Python documentation. iCR suggested that a temporary file should be created using NamedTemporaryFile which is a a safe API. iCR replaced the usage of mktemp with NamedTemporaryFile.

In file: util.py, there is a method __init__ that creates a temporary file using an unsafe API mktemp. The use of this method is discouraged in the Python documentation. iCR suggested that a temporary file should be created using NamedTemporaryFile which is a a safe API. iCR replaced the usage of mktemp with NamedTemporaryFile.

This issue was detected by OpenRefactory's Intelligent Code Repair (iCR). We are running iCR on libraries in the PyPI repository to identify issues and fix them. More info at: pypi.openrefactory.com

@Byron
Copy link
Member

Byron commented Aug 31, 2022

It's by design, the temporary file has to be opened and written by git in a separate process, and is later renamed. If a human is going to make this PR work though which I doubt, please feel free to open a new one with a personal note.

@Byron Byron closed this Aug 31, 2022
@EliahKagan
Copy link
Contributor

EliahKagan commented Dec 22, 2023

In case anyone finds this when searching for other PRs, the issues mentioned here were effectively fixed (among other changes):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants