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

TypeError: Protocols cannot be instantiated #1332

Open
jessielaf opened this issue Sep 2, 2021 · 4 comments
Open

TypeError: Protocols cannot be instantiated #1332

jessielaf opened this issue Sep 2, 2021 · 4 comments
Assignees

Comments

@jessielaf
Copy link

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.

@jakob-keller
Copy link

jakob-keller commented 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
Copy link

msbuhl commented 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

@Byron Byron assigned Byron and Yobmod and unassigned Byron Sep 5, 2021
@Yobmod
Copy link
Contributor

Yobmod commented 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.

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Oct 20, 2021
gitpython-developers/GitPython#1332

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Matthew Thode <prometheanfire@gentoo.org>
simu added a commit to projectsyn/commodore that referenced this issue Oct 28, 2021
gitpython-3.1.20 (imported via Kapitan 0.30.0rc0) triggers a regression
in Python 3.9.7, with errors like

```
simon@wyvern:~/work/syn/commodore $ poetry run commodore component new test
Adding component test...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 327, in main
    commodore.main(prog_name="commodore", auto_envvar_prefix="COMMODORE")
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 264, in component_new
    f.create()
  File "/home/simon/work/syn/commodore/commodore/component/template.py", line 100, in create
    git.commit(repo, "Initial commit", self.config)
  File "/home/simon/work/syn/commodore/commodore/git.py", line 230, in commit
    repo.index.commit(commit_message, author=author, committer=author)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 1000, in commit
    tree = self.write_tree()
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 574, in write_tree
    root_tree = Tree(self.repo, binsha, path='')
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/tree.py", line 215, in __init__
    super(Tree, self).__init__(repo, binsha, mode, path)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 168, in __init__
    super(IndexObject, self).__init__(repo, binsha)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 56, in __init__
    super(Object, self).__init__()
  File "/usr/lib/python3.9/typing.py", line 1083, in _no_init
    raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated
```

This issue has been reported in
gitpython-developers/GitPython#1332 and should
be fixed with a workaround in the next release of gitpython.

Additionally, the regression should be fixed in the next Python 3.9
patch release, cf. https://bugs.python.org/issue45121
simu added a commit to projectsyn/commodore that referenced this issue Oct 28, 2021
gitpython-3.1.20 (imported via Kapitan 0.30.0rc0) triggers a regression
in Python 3.9.7, with errors like

```
simon@wyvern:~/work/syn/commodore $ poetry run commodore component new test
Adding component test...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 327, in main
    commodore.main(prog_name="commodore", auto_envvar_prefix="COMMODORE")
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 264, in component_new
    f.create()
  File "/home/simon/work/syn/commodore/commodore/component/template.py", line 100, in create
    git.commit(repo, "Initial commit", self.config)
  File "/home/simon/work/syn/commodore/commodore/git.py", line 230, in commit
    repo.index.commit(commit_message, author=author, committer=author)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 1000, in commit
    tree = self.write_tree()
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 574, in write_tree
    root_tree = Tree(self.repo, binsha, path='')
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/tree.py", line 215, in __init__
    super(Tree, self).__init__(repo, binsha, mode, path)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 168, in __init__
    super(IndexObject, self).__init__(repo, binsha)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 56, in __init__
    super(Object, self).__init__()
  File "/usr/lib/python3.9/typing.py", line 1083, in _no_init
    raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated
```

This issue has been reported in
gitpython-developers/GitPython#1332 and should
be fixed with a workaround in the next release of gitpython.

Additionally, the regression should be fixed in the next Python 3.9
patch release, cf. https://bugs.python.org/issue45121
simu added a commit to projectsyn/commodore that referenced this issue Oct 28, 2021
gitpython-3.1.20 (imported via Kapitan 0.30.0rc0) triggers a regression
in Python 3.9.7, with errors like

```
simon@wyvern:~/work/syn/commodore $ poetry run commodore component new test
Adding component test...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 327, in main
    commodore.main(prog_name="commodore", auto_envvar_prefix="COMMODORE")
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 264, in component_new
    f.create()
  File "/home/simon/work/syn/commodore/commodore/component/template.py", line 100, in create
    git.commit(repo, "Initial commit", self.config)
  File "/home/simon/work/syn/commodore/commodore/git.py", line 230, in commit
    repo.index.commit(commit_message, author=author, committer=author)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 1000, in commit
    tree = self.write_tree()
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 574, in write_tree
    root_tree = Tree(self.repo, binsha, path='')
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/tree.py", line 215, in __init__
    super(Tree, self).__init__(repo, binsha, mode, path)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 168, in __init__
    super(IndexObject, self).__init__(repo, binsha)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 56, in __init__
    super(Object, self).__init__()
  File "/usr/lib/python3.9/typing.py", line 1083, in _no_init
    raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated
```

This issue has been reported in
gitpython-developers/GitPython#1332 and should
be fixed with a workaround in the next release of gitpython.

Additionally, the regression should be fixed in the next Python 3.9
patch release, cf. https://bugs.python.org/issue45121
simu added a commit to projectsyn/commodore that referenced this issue Oct 28, 2021
gitpython-3.1.20 (imported via Kapitan 0.30.0rc0) triggers a regression
in Python 3.9.7, with errors like

```
simon@wyvern:~/work/syn/commodore $ poetry run commodore component new test
Adding component test...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 327, in main
    commodore.main(prog_name="commodore", auto_envvar_prefix="COMMODORE")
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 264, in component_new
    f.create()
  File "/home/simon/work/syn/commodore/commodore/component/template.py", line 100, in create
    git.commit(repo, "Initial commit", self.config)
  File "/home/simon/work/syn/commodore/commodore/git.py", line 230, in commit
    repo.index.commit(commit_message, author=author, committer=author)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 1000, in commit
    tree = self.write_tree()
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 574, in write_tree
    root_tree = Tree(self.repo, binsha, path='')
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/tree.py", line 215, in __init__
    super(Tree, self).__init__(repo, binsha, mode, path)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 168, in __init__
    super(IndexObject, self).__init__(repo, binsha)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 56, in __init__
    super(Object, self).__init__()
  File "/usr/lib/python3.9/typing.py", line 1083, in _no_init
    raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated
```

This issue has been reported in
gitpython-developers/GitPython#1332 and should
be fixed with a workaround in the next release of gitpython.

Additionally, the regression should be fixed in the next Python 3.9
patch release, cf. https://bugs.python.org/issue45121
simu added a commit to projectsyn/commodore that referenced this issue Oct 29, 2021
gitpython-3.1.20 (imported via Kapitan 0.30.0rc0) triggers a regression
in Python 3.9.7, with errors like

```
simon@wyvern:~/work/syn/commodore $ poetry run commodore component new test
Adding component test...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 327, in main
    commodore.main(prog_name="commodore", auto_envvar_prefix="COMMODORE")
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 264, in component_new
    f.create()
  File "/home/simon/work/syn/commodore/commodore/component/template.py", line 100, in create
    git.commit(repo, "Initial commit", self.config)
  File "/home/simon/work/syn/commodore/commodore/git.py", line 230, in commit
    repo.index.commit(commit_message, author=author, committer=author)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 1000, in commit
    tree = self.write_tree()
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 574, in write_tree
    root_tree = Tree(self.repo, binsha, path='')
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/tree.py", line 215, in __init__
    super(Tree, self).__init__(repo, binsha, mode, path)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 168, in __init__
    super(IndexObject, self).__init__(repo, binsha)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 56, in __init__
    super(Object, self).__init__()
  File "/usr/lib/python3.9/typing.py", line 1083, in _no_init
    raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated
```

This issue has been reported in
gitpython-developers/GitPython#1332 and should
be fixed with a workaround in the next release of gitpython.

Additionally, the regression should be fixed in the next Python 3.9
patch release, cf. https://bugs.python.org/issue45121
simu added a commit to projectsyn/commodore that referenced this issue Oct 29, 2021
gitpython-3.1.20 (imported via Kapitan 0.30.0rc0) triggers a regression
in Python 3.9.7, with errors like

```
simon@wyvern:~/work/syn/commodore $ poetry run commodore component new test
Adding component test...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 327, in main
    commodore.main(prog_name="commodore", auto_envvar_prefix="COMMODORE")
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 264, in component_new
    f.create()
  File "/home/simon/work/syn/commodore/commodore/component/template.py", line 100, in create
    git.commit(repo, "Initial commit", self.config)
  File "/home/simon/work/syn/commodore/commodore/git.py", line 230, in commit
    repo.index.commit(commit_message, author=author, committer=author)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 1000, in commit
    tree = self.write_tree()
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 574, in write_tree
    root_tree = Tree(self.repo, binsha, path='')
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/tree.py", line 215, in __init__
    super(Tree, self).__init__(repo, binsha, mode, path)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 168, in __init__
    super(IndexObject, self).__init__(repo, binsha)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 56, in __init__
    super(Object, self).__init__()
  File "/usr/lib/python3.9/typing.py", line 1083, in _no_init
    raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated
```

This issue has been reported in
gitpython-developers/GitPython#1332 and should
be fixed with a workaround in the next release of gitpython.

Additionally, the regression should be fixed in the next Python 3.9
patch release, cf. https://bugs.python.org/issue45121
simu added a commit to projectsyn/commodore that referenced this issue Oct 29, 2021
gitpython-3.1.20 (imported via Kapitan 0.30.0rc0) triggers a regression
in Python 3.9.7, with errors like

```
simon@wyvern:~/work/syn/commodore $ poetry run commodore component new test
Adding component test...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 327, in main
    commodore.main(prog_name="commodore", auto_envvar_prefix="COMMODORE")
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 264, in component_new
    f.create()
  File "/home/simon/work/syn/commodore/commodore/component/template.py", line 100, in create
    git.commit(repo, "Initial commit", self.config)
  File "/home/simon/work/syn/commodore/commodore/git.py", line 230, in commit
    repo.index.commit(commit_message, author=author, committer=author)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 1000, in commit
    tree = self.write_tree()
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 574, in write_tree
    root_tree = Tree(self.repo, binsha, path='')
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/tree.py", line 215, in __init__
    super(Tree, self).__init__(repo, binsha, mode, path)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 168, in __init__
    super(IndexObject, self).__init__(repo, binsha)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 56, in __init__
    super(Object, self).__init__()
  File "/usr/lib/python3.9/typing.py", line 1083, in _no_init
    raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated
```

This issue has been reported in
gitpython-developers/GitPython#1332 and should
be fixed with a workaround in the next release of gitpython.

Additionally, the regression should be fixed in the next Python 3.9
patch release, cf. https://bugs.python.org/issue45121
simu added a commit to projectsyn/commodore that referenced this issue Oct 29, 2021
gitpython-3.1.20 (imported via Kapitan 0.30.0rc0) triggers a regression
in Python 3.9.7, with errors like

```
simon@wyvern:~/work/syn/commodore $ poetry run commodore component new test
Adding component test...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 327, in main
    commodore.main(prog_name="commodore", auto_envvar_prefix="COMMODORE")
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/simon/work/syn/commodore/commodore/cli.py", line 264, in component_new
    f.create()
  File "/home/simon/work/syn/commodore/commodore/component/template.py", line 100, in create
    git.commit(repo, "Initial commit", self.config)
  File "/home/simon/work/syn/commodore/commodore/git.py", line 230, in commit
    repo.index.commit(commit_message, author=author, committer=author)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 1000, in commit
    tree = self.write_tree()
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/index/base.py", line 574, in write_tree
    root_tree = Tree(self.repo, binsha, path='')
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/tree.py", line 215, in __init__
    super(Tree, self).__init__(repo, binsha, mode, path)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 168, in __init__
    super(IndexObject, self).__init__(repo, binsha)
  File "/home/simon/.cache/pypoetry/virtualenvs/syn-commodore-mfZDsTMQ-py3.9/lib/python3.9/site-packages/git/objects/base.py", line 56, in __init__
    super(Object, self).__init__()
  File "/usr/lib/python3.9/typing.py", line 1083, in _no_init
    raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated
```

This issue has been reported in
gitpython-developers/GitPython#1332 and should
be fixed with a workaround in the next release of gitpython.

Additionally, the regression should be fixed in the next Python 3.9
patch release, cf. https://bugs.python.org/issue45121
@1Mark
Copy link

1Mark commented Nov 12, 2021

I had the same issue using python3.9.7 and GitPython 3.1.19. After upgrading to 3.1.24 the error went away.

@Yobmod can we close this?

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

No branches or pull requests

6 participants