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

Repository repr causes segfault #775

Closed
RazerM opened this issue Mar 9, 2018 · 0 comments
Closed

Repository repr causes segfault #775

RazerM opened this issue Mar 9, 2018 · 0 comments

Comments

@RazerM
Copy link
Contributor

RazerM commented Mar 9, 2018

I initially thought this was a pytest bug: pytest-dev/pytest/issues/3293

Minimal example:

from pygit2 import Repository

class MyRepository(Repository):
    def __init__(self, *args, **kwargs):
        self.path # causes segfault
        super().__init__(*args, **kwargs)
        
MyRepository('.')

self->repo isn't initialized when the getter is called:

pygit2/src/repository.c

Lines 519 to 523 in 2d4c1f5

PyObject *
Repository_path__get__(Repository *self, void *closure)
{
return to_path(git_repository_path(self->repo));
}

This will also show up if you try to step through Repository.__init__ in the PyCharm debugger when it calls repr on self.

@jdavid jdavid closed this as completed in 0f64ac4 Mar 10, 2018
thecjharries added a commit to thecjharries/pygit2 that referenced this issue Mar 18, 2018
commit f618e30b21401aca34f77c7b7e05c710528697ae
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Sun Mar 18 08:23:37 2018 -0500

    Pass decoded value via valua and raw value via raw_value

commit 5a4203b
Merge: 8ca94fc 0c1f2d8
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 21:08:12 2018 -0500

    Merge branch 'feature/update-docs' into feature/return-config-entry-from-iter

commit 0c1f2d8
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 21:06:51 2018 -0500

    Add ConfigEntry docs

commit 67701ed
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 21:05:59 2018 -0500

    Update __iter__ docs

commit cdd9566
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 21:04:24 2018 -0500

    Document properties

commit 8f74752
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 21:02:51 2018 -0500

    Document decode_as_string

commit f938b49
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 21:01:59 2018 -0500

    Document _from_c

commit 8ca94fc
Merge: 835e711 52de16a
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 20:15:49 2018 -0500

    Merge branch 'feature/iterate-over-config-entries' into feature/return-config-entry-from-iter

commit 52de16a
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 20:15:08 2018 -0500

    Update test_iterator to consume ConfigEntr[ies]

commit e7798bb
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 20:03:39 2018 -0500

    Return entry, a ConfigEntry from ConfigIterator.__next__

commit 835e711
Merge: bbcb464 55604ca
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 20:02:45 2018 -0500

    Merge branch 'feature/decode-name' into feature/return-config-entry-from-iter

commit 55604ca
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:57:25 2018 -0500

    Return properly decoded entry.name

commit 44326fa
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:57:06 2018 -0500

    Decode ConfigEntry name without prompting

commit bbcb464
Merge: 74544d6 1c47ece
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:56:29 2018 -0500

    Merge branch 'feature/decode-value' into feature/return-config-entry-from-iter

commit 1c47ece
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:54:45 2018 -0500

    Return entry.value_string from __getitem__

commit cb873be
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:52:14 2018 -0500

    Return entry.value_string from ConfigMultivarIterator

commit 2e14065
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:51:53 2018 -0500

    Add value_string property, decode_as_string(entry.value)

commit 9d10675
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:51:13 2018 -0500

    Add decode_as_string method

commit 74544d6
Merge: 3d76e44 ae6eead
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:28:08 2018 -0500

    Merge branch 'feature/expose-entry-properties' into feature/return-config-entry-from-iter

commit ae6eead
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:26:07 2018 -0500

    Return simplified name from __next__

commit 6ca5789
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:25:11 2018 -0500

    Add name property

commit c9fdd27
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:24:47 2018 -0500

    Add level property

commit 3d76e44
Merge: 0f64ac4 f471b6d
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:23:54 2018 -0500

    Merge branch 'feature/return-config-entry-name-from-iter' into feature/return-config-entry-from-iter

commit f471b6d
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:20:30 2018 -0500

    Expose the proper name (entry._entry.name)

commit 6ef0abb
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:20:17 2018 -0500

    Return a ConfigEntry from _next_entry

commit f48d0d8
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:19:27 2018 -0500

    Only free the entry if it did not come from an iterator

commit df0e8b6
Author: CJ Harries <cj@wizardsoftheweb.pro>
Date:   Fri Mar 16 19:19:00 2018 -0500

    Add from_iterator creation flag

commit 0f64ac4
Author: J. David Ibáñez <jdavid.ibp@gmail.com>
Date:   Sat Mar 10 17:04:14 2018 +0100

    Fix segfault when calling repr(repo) before init

    Fixes libgit2#775

commit 2d4c1f5
Author: Brandon Milton <bmilton@fb.com>
Date:   Mon Mar 5 09:18:43 2018 -0800

    Remove Repository.parse_diff, remove repo check from Diff.merge

commit 711e9eb
Author: Brandon Milton <bmilton@fb.com>
Date:   Sat Mar 3 11:14:40 2018 -0800

    Add static Diff.parse_diff

commit f1e9c3b
Merge: e2eaa46 fefd09e
Author: J. David Ibáñez <jdavid.ibp@gmail.com>
Date:   Sat Mar 3 14:29:53 2018 +0100

    Merge remote-tracking branch 'ZenSecurity/master'

commit fefd09e
Author: Mikhail Yushkovskiy <mailto@zensecurity.su>
Date:   Sat Mar 3 14:09:32 2018 +0300

    Add my name, for the fame

commit e2eaa46
Author: J. David Ibáñez <jdavid.ibp@gmail.com>
Date:   Sat Mar 3 10:52:45 2018 +0100

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

No branches or pull requests

1 participant