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

Failing (or warning?) with Python 3.12 alpha 7 #1571

Closed
henryiii opened this issue Apr 6, 2023 · 2 comments · Fixed by #1700
Closed

Failing (or warning?) with Python 3.12 alpha 7 #1571

henryiii opened this issue Apr 6, 2023 · 2 comments · Fixed by #1700

Comments

@henryiii
Copy link

henryiii commented Apr 6, 2023

I think things like this

return shutil.rmtree(path, False, onerror)
is causing a problem, due to https://docs.python.org/3.12/whatsnew/3.12.html#shutil (see python/cpython#102829 ). While I do have warnings as errors on in my test suite, this is not reporting a warning like wheel does, it's an error when calling repo.index.commit("first commit"):

/opt/hostedtoolcache/Python/3.12.0-alpha.7/x64/lib/python3.12/site-packages/git/refs/symbolic.py:172: in _get_ref_info_helper
    repodir = _git_dir(repo, ref_path)
        cls        = <class 'git.refs.head.Head'>
        ref_path   = 'refs/heads/main'
        repo       = <git.repo.base.Repo '/tmp/pytest-of-runner/pytest-0/test_plugin_metadata0/pkg/.git'>
        tokens     = None
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

repo = <git.repo.base.Repo '/tmp/pytest-of-runner/pytest-0/test_plugin_metadata0/pkg/.git'>
path = 'refs/heads/main'

    def _git_dir(repo: "Repo", path: Union[PathLike, None]) -> PathLike:
        """Find the git dir that's appropriate for the path"""
        name = f"{path}"
        if name in ["HEAD", "ORIG_HEAD", "FETCH_HEAD", "index", "logs"]:
            return repo.git_dir
>       return repo.common_dir
E       SystemError: <function Repo.common_dir at 0x7ffba93f3060> returned a result with an exception set

name       = 'refs/heads/main'
path       = 'refs/heads/main'
repo       = <git.repo.base.Repo '/tmp/pytest-of-runner/pytest-0/test_plugin_metadata0/pkg/.git'>

/opt/hostedtoolcache/Python/3.12.0-alpha.7/x64/lib/python3.12/site-packages/git/refs/symbolic.py:55: SystemError

GHA's 3.12-dev just updated to alpha 7, which is why I am now seeing this error.

@Byron
Copy link
Member

Byron commented Apr 7, 2023

Thanks for reporting! Any help with this will be appreciated.

@EliahKagan
Copy link
Contributor

EliahKagan commented Sep 12, 2023

Does this still happen with Python 3.12 RC2? Since #1654, Python 3.12 (currently at RC2) runs on this project's CI, and all checks have been passing. Based on python/cpython#103632, python/cpython#103551, and others, it looks to me like it was a bug in Python 3.12 alpha 7 itself, which was since fixed, rather than in GitPython. If that is the case, then this could be closed.

I think it may be worthwhile to use onexc conditionally when running on Python 3.12 and later. (The old onerror way has to be kept for 3.11 and lower, but it seems to me that using onexc where available is still worth doing, primarily because it will automatically work on a future version of Python that removes onerror, which is planned for 3.14, and secondarily to get clean builds/checks when tools are used that detect deprecated usage.) However, although that appeared related to this issue, I actually think it is independent.

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

Successfully merging a pull request may close this issue.

3 participants