Open
Description
I am having a issue with getting the date from a git commit. I keep getting this error:
Traceback (most recent call last):
File "/code/manage.py", line 19, in <module>
main()
File "/code/manage.py", line 15, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/code/commits/management/commands/scan_commits.py", line 35, in handle
self.create_commits_branch(project, branch)
File "/code/commits/management/commands/scan_commits.py", line 57, in create_commits_branch
date=datetime.fromtimestamp(git_commit.committed_date),
File "/usr/local/lib/python3.9/site-packages/gitdb/util.py", line 253, in __getattr__
self._set_cache_(attr)
File "/usr/local/lib/python3.9/site-packages/git/objects/commit.py", line 199, in _set_cache_
self._deserialize(BytesIO(stream.read()))
File "/usr/local/lib/python3.9/site-packages/git/objects/commit.py", line 528, in _deserialize
self.tree = Tree(self.repo, hex_to_bin(readline().split()[1]), Tree.tree_id << 12, '')
File "/usr/local/lib/python3.9/site-packages/git/objects/tree.py", line 215, in __init__
super(Tree, self).__init__(repo, binsha, mode, path)
File "/usr/local/lib/python3.9/site-packages/git/objects/base.py", line 168, in __init__
super(IndexObject, self).__init__(repo, binsha)
File "/usr/local/lib/python3.9/site-packages/git/objects/base.py", line 56, in __init__
super(Object, self).__init__()
File "/usr/local/lib/python3.9/typing.py", line 1083, in _no_init
raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated
I get this error with the python 3.9 in docker. Using version 3.1.20 of GitPython.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
jakob-keller commentedon Sep 2, 2021
I am experiencing the same issue since upgrading to GitPython 3.1.20 and Python 3.9.7. Downgrading GitPython to 3.1.18 fixed it for me.
This could be related to bc37d15
msbuhl commentedon Sep 3, 2021
I got this error with Python 3.9.7
A downgrade to Python 3.9.6 fixed it for me
Using GitPython 3.1.20
Yobmod commentedon Sep 9, 2021
Hi,
Yeah, this is caused by a change in how python enforces protocol initilisation.
But it should also be worked-around in main already ( #1318) - it worked for 3.10.0, just have to test 3.9.7.
3.9.7 tests passed, So will be fixed on next release.
dev-python/GitPython: 3.9.7 stable amd64/x86/arm64
Pin Python 3.9 version to 3.9.6
Pin Python 3.9 version to 3.9.6
Pin Python 3.9 version to 3.9.6
Pin Python 3.9 version to 3.9.6
Pin Python 3.9 version to 3.9.6
Pin Python 3.9 version to 3.9.6
Pin Python 3.9 version to 3.9.6
Pin Python 3.9 version to 3.9.6
1Mark commentedon Nov 12, 2021
I had the same issue using
python3.9.7
andGitPython 3.1.19
. After upgrading to3.1.24
the error went away.@Yobmod can we close this?