Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

cmd.py: AutoInterrupt.__del__: Avoid some unwanted tracebacks by catching some more errors#576

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

xsteve
Copy link

I see the following in an application that uses GitPython:
When the application raises an unknown exception it terminates with sys.exit(2)

When the exception is raised by GitPython I see that I land in the following line (although my application is running on Linux):
call(("TASKKILL /F /T /PID %s 2>nul 1>nul" % str(proc.pid)), shell=True)

Here I get the following exception (not always but in some cases):
Exception ignored in: <bound method GitRepository.del of <GitRepository '/big/yocto/msc-ldk'>>
Traceback (most recent call last):
File "/home/srei/work/git/GitPython/git/repo/base.py", line 182, indel
File "/home/srei/work/git/GitPython/git/cmd.py", line 965, in clear_cache
File "/home/srei/work/git/GitPython/git/cmd.py", line 265, indel
File "/usr/lib/python3.4/subprocess.py", line 537, in call
TypeError: 'NoneType' object is not callable

I took a look at the attribute error exception: it was the following:
'NoneType' object has no attribute 'SIGTERM'

I fixed this problem by wrapping the call line in a try: except block

However there remained another problem (that happened also only in rare cases):
Exception ignored in: <bound method GitRepository.del of <GitRepository '/big/yocto/msc-ldk'>>
Traceback (most recent call last):
File "/home/srei/work/git/GitPython/git/repo/base.py", line 182, indel
File "/home/srei/work/git/GitPython/git/cmd.py", line 967, in clear_cache
File "/home/srei/work/git/GitPython/git/cmd.py", line 254, indel
File "/usr/lib/python3.4/subprocess.py", line 1686, in terminate
File "/usr/lib/python3.4/subprocess.py", line 1681, in send_signal
TypeError: an integer is required (got type NoneType)

I fixed this one by adding a general except for proc.terminate and proc.wait

It would be really great when you would merge this improvement. These sporadic tracebacks are really annoying

@codecov-io
Copy link

Codecov Report

Merging#576 intomaster willincrease coverage by1.35%.

@@            Coverage Diff             @@##           master     #576      +/-   ##==========================================+ Coverage   93.12%   94.47%   +1.35%==========================================  Files          63       63                Lines        9932     9937       +5     ==========================================+ Hits         9249     9388     +139+ Misses        683      549     -134
Impacted FilesCoverage Δ
git/cmd.py84.88% <ø> (-0.53%)
git/repo/base.py96.11% <ø> (+0.24%)
git/test/test_docs.py100% <ø> (+0.39%)
git/objects/submodule/base.py94.54% <ø> (+1.45%)
git/remote.py92.97% <ø> (+1.68%)
git/exc.py96.36% <ø> (+1.81%)
git/test/test_repo.py97.39% <ø> (+2.25%)
git/test/test_base.py98.85% <ø> (+2.29%)
git/test/test_index.py97.36% <ø> (+3.38%)
... and4 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update552a0aa...53b576a. Read thecomment docs.

@Byron
Copy link
Member

Thanks for the PR. As the code is terrible enough as it is, I believed it would be a better solution to just not try to use TASKKILL unless we are on windows, which should fix your problem.

Maybe this fixes your problem already, and if not, some more exception handling might indeed be needed, just because Python really is a mess when shutting down its own process.

@xsteve
Copy link
Author

I found some time to test your improvement.
It works a lot better now.

However now I see another class of errors.

I have described them in issue#610

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@xsteve@codecov-io@Byron

[8]ページ先頭

©2009-2025 Movatter.jp