github / codeql

CodeQL: the libraries and queries that power security researchers around the world, as well as code scanning in GitHub Advanced Security
https://codeql.github.com
MIT License
7.51k stars 1.49k forks source link

LGTM.com - false positive - Unnecessary deletion of local variable #6953

Open stiepan opened 2 years ago

stiepan commented 2 years ago

Description of the false positive

LGTM generates alert about unnecessary deletion of a local variable at the end of a function. The variable stores an exception instance and is deleted in a finally clause to prevent creation of reference cycle when the exception is raised (Python adds a traceback to the raised exception, the traceback stores a frame that contains local variables with the exception among them).

URL to the alert on the project page on LGTM.com

https://lgtm.com/projects/g/NVIDIA/DALI/snapshot/908e133b686dacc440a81f3bc0c17b38c860745e/files/dali/python/nvidia/dali/_multiproc/pool.py?sort=name&dir=ASC&mode=heatmap#x845c6afe4552fbea:1

hmakholm commented 2 years ago

Indeed, this looks like a false positive. Thank you for reporting it!

Our current focus is on improving our security analysis. Because your report does not relate to a security query, we will put this on our backlog and prioritize it if we get enough reports of the same underlying issue in other projects. If you think that your report is related to our security analysis, please clarify that in a comment. Either way, we'll let you know here as soon as it's fixed!

As you might know, all of our queries are open source. If you do have an idea for a code change, we encourage you to open a pull request. GitHub Code Scanning and LGTM.com have facilities for suppressing individual alerts or disabling a query.

stiepan commented 2 years ago

I don't think it is related to security. Thank you for prompt reply and confirming the issue.