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

explicit cast to avoid warnings #117

Closed
wants to merge 1 commit into from

Conversation

memsharded
Copy link

Might solve: #112

The error in Python3 pip (9) installation in Windows, is because localized compilers will be issuing a warning due to this implicit conversion. Once the warning dissapears, the output string can be encoded.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.436% when pulling 9929dfa on memsharded:develop into e0d82df on GrahamDumpleton:develop.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.436% when pulling 9929dfa on memsharded:develop into e0d82df on GrahamDumpleton:develop.

@memsharded
Copy link
Author

Is it possible that the CI is red for reasons not related to this PR? I cannot find the relation between the code change and the CI errors. Many thanks for your help!

@memsharded
Copy link
Author

Hi @GrahamDumpleton

Some feedback on this PR? I think it should be low risk, and would solve #112.
Is there something else I could do to help with this?

Many thanks!

@GrahamDumpleton
Copy link
Owner

Sorry for the delay. It just got lost in my inbox.

The change is going to have to be a bit more involved than just adding a cast. This is because in Python 3.2+ the return type for hash functions has changed.

Py_hash_t PyObject_Hash(PyObject *o)

Compute and return the hash value of an object o. On failure, return -1. This is the equivalent of the Python expression hash(o).

Changed in version 3.2: The return type is now Py_hash_t. This is a signed integer the same size as Py_ssize_t.

So going to have to use Py_hash_t as return type, not cast necessary, with a check for Python version less than 3.2, for defining a typedef of:

typedef long Py_hash_t;

I don't understand how this could fix the pip issue on Windows, which didn't even notice was mentioned when mail first came in.

@memsharded
Copy link
Author

No problem, thanks for answering!

I understand, I didn't realize about those Py3 differences.

I don't understand how this could fix the pip issue on Windows, which didn't even notice was mentioned when mail first came in.

The issue is:

  • pip install starts to install
  • The native code is tried to be compiled, with the installed compiler, typical Visual Studio
  • Visual Studio can be localized, and output warnings in the current locale, including non-ascii characters
  • The implicit cast is shown as a warning by Visual Studio
  • Pip is unable to encode the output of the build due to that warning, and fails (bug in pip)

The final result is that pip9 will fail to install any python package in Windows with Visual Studios localized for any python extension that produce certain compilation warnings.

@GrahamDumpleton
Copy link
Owner

Closing. Fixed by 7bd955d

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

Successfully merging this pull request may close these issues.

3 participants