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

error C2275: 'PyObject' : illegal use of this type as an expression #53

Closed
DK-at-FC opened this issue Jan 23, 2012 · 4 comments
Closed

Comments

@DK-at-FC
Copy link

Installing in Windows crashes in setup.py

python setup.py install
at Microsoft Visual Studio 9.0\VC\BIN\cl.exe ...
pygit2.c(496) : error C2275: 'PyObject' : illegal use of this type as an expression

Error is caused by variable declaration in the middle of the method in Repository_read;

Fix is to move the declaration to the beginning of the method

static PyObject *
Repository_read(Repository *self, PyObject *py_hex)
{
    git_oid oid;
    int err;
    git_odb_object *obj;
    size_t len;
    PyObject* tuple; // add declaration in line 487

...

    tuple = Py_BuildValue( // Remove tuple declaration in line 497
jdavid added a commit that referenced this issue Jan 25, 2012
@jdavid
Copy link
Member

jdavid commented Jan 25, 2012

Applied the change you have suggested. Close the issue if it works for you.

Thanks.

@DK-at-FC
Copy link
Author

Great! Thanks David.

jdavid added a commit that referenced this issue Feb 6, 2012
Changes since v0.15.1:

- Update to libgit2 v0.16.0
- Improve support for references
- New method Index.read_tree
- Rename Index.create_tree to Index.write_tree
- Fix compilation error with MSVC (issue #53)
- Fix a few segfaults (including issue #55)
@damonchen
Copy link

windows platform could not compile for the same error in branch.c, I use vc compile with chinese locale, so information is:

src\branch.c(160) : error C2275: “PyObject”: 将此类型用作表达式非法

so how to compile with msvc vs2008

@jdavid
Copy link
Member

jdavid commented Dec 10, 2013

Should be fixed, see #298

rickprice added a commit to ActiveState/numpy that referenced this issue Sep 19, 2023
…Windows

Caused by there being a variable definition after the function start.

As an example:
libgit2/pygit2#53
rickprice added a commit to ActiveState/numpy that referenced this issue Sep 19, 2023
…Windows

Caused by there being a variable definition after the function start.

As an example:
libgit2/pygit2#53
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

3 participants