-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Inconsistent usage of TCHAR, WCHAR, LPSTR, LPWSTR, LPCTSTR, char, etc #655
Comments
Yes, there surely are different problems with unicode handling. Issues
|
I am going to create separate tickets for each one of these issues. |
That sounds like there's 2 issues. 1 - Inconsistent string handling in C (the intial problem). I think there should be a decision on the API to consistently return the same type for both Python2 and Python3. It'll probably be easiest and simplest to always return PyUnicode though there may be API breaking changes. My main concern on this ticket was if we are using char string types internally in C (and using ascii API calls instead of unicode API calls) and returning PyUnicode since we would be losing information. |
Yes, I agree that at least on Windows we should always return unicode. In general UNIX systems have more "discipline", meaning it's unlikely we'll bump into an exe, user or network interface with non-ASCII chars, so returning As for UNIX we can think about returning unicode for
Exactly. We should be consistent and try to use
If you think the two things should be treated differently feel free to address the |
I think the errors / discrepancies we see are due to a combination of the two issues. I don't know if they should be treated differently as fixing the error requires fixing both issues. Once we have a test suite, we can go through each psutil API call and fix them up as appropriate. |
I'm gonna create a branch later today (or tomorrow) with a couple of preliminary tests. |
Sounds good. Also I'm not sure if it makes sense for the behavior on Windows and Linux to be different. Having an API which returns different types based on the OS seems wrong, especially if you are using psutil for a cross platform application. At the same time it sucks for one OS to pay the overhead due to another OS misbehaving. I think there just needs to be a decision made to always return |
Some more insight into the ascii/unicode battle from the Python side: |
If you have determined a way forward on this I'd love to help patch it up. |
Sorry for the delay. It's been a crazy week. @mrjefftang I gave you write access. |
In Python 3 this is the only thing (process related) which is plain broken and should be fixed independently from the str/unicode unification:
|
Havent tested it yet but #670 should take care of the net_* unicode issues identified here. |
I fixed |
|
Thinking back about the approach we decided to use here I take back the proposal of returning |
I changed my mind once again: unexpectedly returning a different type ( @mrjefftang : I realize I've improperly been using this issue as the original subject was |
…ken on Python 2 so disable tests which check for exact path match
The Windows section uses all sorts of different string types. It's not clear to me without delving through it thoroughly to see if these types are the correct usage.
This inconsistency is likely to lead to some unicode issues like that seen in #652 . There may be parts of the psutil API for Windows which may not function correctly when given a multibyte character string.
The text was updated successfully, but these errors were encountered: