- Notifications
You must be signed in to change notification settings - Fork752
fixed bug of method PyString_FromString#670
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
a0f4c33
e9451db
7aaa644
083abfc
9c724e3
b8c6917
42999f7
1f3255a
36def5d
084d743
92ea629
947cb01
c5ec6b3
a3da211
050f8cc
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1190,7 +1190,11 @@ internal static bool PyString_Check(IntPtr ob) | ||
internal static IntPtr PyString_FromString(string value) | ||
{ | ||
#if PYTHON3 | ||
return PyUnicode_FromKindAndData(_UCS, value, value.Length); | ||
#elif PYTHON2 | ||
return PyString_FromStringAndSize(value, value.Length); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Maybe check here whether the string is ASCII? I'm not sure where this one is used, but we should probably distinguish the case where we actually want Unicode (and should also return that on Python 2) from the cases that should be ASCII-only on Python 2 (like identifiers). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. @filmor can you file a separate issue for this with a suggested fix? this PR is now ready to merge! | ||
#endif | ||
} | ||
#if PYTHON3 | ||
@@ -1205,13 +1209,6 @@ internal static IntPtr PyBytes_AS_STRING(IntPtr ob) | ||
return ob + BytesOffset.ob_sval; | ||
} | ||
[DllImport(_PythonDll, CallingConvention = CallingConvention.Cdecl)] | ||
internal static extern IntPtr PyUnicode_FromStringAndSize(IntPtr value, int size); | ||
#elif PYTHON2 | ||