Commit Graph

141 Commits

Author SHA1 Message Date
Victor Stinner 9089a26591
bpo-29240: PyUnicode_DecodeLocale() uses UTF-8 on Android (#5272)
PyUnicode_DecodeLocaleAndSize(), PyUnicode_DecodeLocale() and
PyUnicode_EncodeLocale() now use always use the UTF-8 encoding on
Android, instead of the current locale encoding.

On Android API 19, mbstowcs() and wcstombs() are broken and cannot be
used.
2018-01-22 19:07:32 +01:00
Victor Stinner 7ed7aead95
bpo-29240: Fix locale encodings in UTF-8 Mode (#5170)
Modify locale.localeconv(), time.tzname, os.strerror() and other
functions to ignore the UTF-8 Mode: always use the current locale
encoding.

Changes:

* Add _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx(). On decoding or
  encoding error, they return the position of the error and an error
  message which are used to raise Unicode errors in
  PyUnicode_DecodeLocale() and PyUnicode_EncodeLocale().
* Replace _Py_DecodeCurrentLocale() with _Py_DecodeLocaleEx().
* PyUnicode_DecodeLocale() now uses _Py_DecodeLocaleEx() for all
  cases, especially for the strict error handler.
* Add _Py_DecodeUTF8Ex(): return more information on decoding error
  and supports the strict error handler.
* Rename _Py_EncodeUTF8_surrogateescape() to _Py_EncodeUTF8Ex().
* Replace _Py_EncodeCurrentLocale() with _Py_EncodeLocaleEx().
* Ignore the UTF-8 mode to encode/decode localeconv(), strerror()
  and time zone name.
* Remove PyUnicode_DecodeLocale(), PyUnicode_DecodeLocaleAndSize()
  and PyUnicode_EncodeLocale() now ignore the UTF-8 mode: always use
  the "current" locale.
* Remove _PyUnicode_DecodeCurrentLocale(),
  _PyUnicode_DecodeCurrentLocaleAndSize() and
  _PyUnicode_EncodeCurrentLocale().
2018-01-15 10:45:49 +01:00
Serhiy Storchaka e613e6add5 bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). (#2285)
Raise a ValueError if the second argument is NULL and the wchar_t\*
string contains null characters.
2017-06-27 16:03:14 +03:00
Louie Lu 88c38b32b7 bpo-28415: Note 0 conversion different between Python and C (#885) 2017-04-27 11:36:35 +08:00
Serhiy Storchaka 84b8e92e46 bpo-29918: Add missed "const" modifiers in C API documentation. (#846) 2017-03-30 10:01:03 +03:00
Serhiy Storchaka c85a26628c bpo-28749: Fixed the documentation of the mapping codec APIs. (#487)
Added the documentation for PyUnicode_Translate().
2017-03-19 08:15:17 +02:00
Serhiy Storchaka 2a404b63d4 Issue #28769: The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8()
is now of type "const char *" rather of "char *".
2017-01-22 23:07:07 +02:00
Serhiy Storchaka fc600834d8 Issue #29087: Removed the documentation of non-existing UCS4 support functions. 2016-12-28 09:20:00 +02:00
Serhiy Storchaka 44223e9550 Issue #29087: Removed the documentation of non-existing UCS4 support functions. 2016-12-28 09:19:45 +02:00
Serhiy Storchaka af9181a4f2 Issue #29087: Removed the documentation of non-existing UCS4 support functions. 2016-12-28 09:19:15 +02:00
Xiang Zhang b211068f5c Issue #28822: Adjust indices handling of PyUnicode_FindChar(). 2016-12-20 22:52:33 +08:00
Xiang Zhang 47888da90b Issue #29009: Merge 3.5. 2016-12-19 18:39:02 +08:00
Xiang Zhang bfbc29cb8f Issue #29009: Remove outdated doc of PyUnicode_RichCompare. 2016-12-19 18:35:14 +08:00
Serhiy Storchaka 419967b832 Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. 2016-12-06 00:13:34 +02:00
Serhiy Storchaka 9a953dbb34 Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. 2016-12-06 00:17:45 +02:00
Serhiy Storchaka 01452af645 Issue #28750: Fixed docs of of unicode-escape an raw-unicode-escape C API.
Patch by Xiang Zhang.
2016-11-20 17:21:04 +02:00
Serhiy Storchaka cf36835fc5 Issue #28750: Fixed docs of of unicode-escape an raw-unicode-escape C API.
Patch by Xiang Zhang.
2016-11-20 17:20:19 +02:00
Serhiy Storchaka 92b9a1f911 Issue #19569: Suggested more appropriate replacements for deprecated Unicode
C API functions.
2016-11-20 12:14:08 +02:00
Serhiy Storchaka f675a37ed3 Issue #19569: Suggested more appropriate replacements for deprecated Unicode
C API functions.
2016-11-20 12:13:44 +02:00
Serhiy Storchaka 3b73ea1278 Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:19:20 +02:00
Serhiy Storchaka f4934ea77d Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:17:58 +02:00
Serhiy Storchaka 159f97b2d7 Issue #28496: Mark up constants 0, 1 and -1 that denote return values or
special input values as literal text.
2016-10-27 21:42:15 +03:00
Serhiy Storchaka 1ecf7d204d Issue #28496: Mark up constants 0, 1 and -1 that denote return values or
special input values as literal text.
2016-10-27 21:41:19 +03:00
Serhiy Storchaka 989db5c880 Issue #19795: Mark up None as literal text. 2016-10-19 16:37:13 +03:00
Serhiy Storchaka ecf41da83e Issue #19795: Mark up None as literal text. 2016-10-19 16:29:26 +03:00
Berker Peksag b8bddec4e0 Issue #28432: Merge from 3.5 2016-10-17 00:46:37 +03:00
Berker Peksag 90e028970a Issue #28432: Fix first parameter name in PyUnicode_EncodeLocale documentation
Patch by Xiang Zhang.
2016-10-17 00:45:56 +03:00
Serhiy Storchaka 21d9f10c94 Merge from 3.5. 2016-10-08 22:46:01 +03:00
Serhiy Storchaka 9c0e1f83af Issue #28379: Added sanity checks and tests for PyUnicode_CopyCharacters().
Patch by Xiang Zhang.
2016-10-08 22:45:38 +03:00
Serhiy Storchaka b3648576cd Issue #28295: Fixed the documentation and added tests for PyUnicode_AsUCS4().
Original patch by Xiang Zhang.
2016-10-02 21:30:35 +03:00
Serhiy Storchaka cc164232aa Issue #28295: Fixed the documentation and added tests for PyUnicode_AsUCS4().
Original patch by Xiang Zhang.
2016-10-02 21:29:26 +03:00
Steve Dower cc16be85c0 Issue #27781: Change file system encoding on Windows to UTF-8 (PEP 529) 2016-09-08 10:35:16 -07:00
Benjamin Peterson 47ff0734b8 more PY_LONG_LONG to long long 2016-09-08 09:15:54 -07:00
Brett Cannon a571120410 Issue #27182: Add support for path-like objects to PyUnicode_FSDecoder(). 2016-09-06 19:36:01 -07:00
Brett Cannon ec6ce879c7 Issue #26027: Support path-like objects in PyUnicode-FSConverter().
This is to add support for os.exec*() and os.spawn*() functions. Part
of PEP 519.
2016-09-06 15:50:29 -07:00
Benjamin Peterson ed4aa83ff7 require a long long data type (closes #27961) 2016-09-05 17:44:18 -07:00
Berker Peksag 544ae59b8e Issue #18353: Remove PyUnicode_WRITE_CHAR macro link from c-api/unicode.rst
Patch by Corey Brune.
2016-04-24 03:06:44 +03:00
Serhiy Storchaka 6a7b3a77b4 Issue #26778: Fixed "a/an/and" typos in code comment and documentation. 2016-04-17 08:32:47 +03:00
Martin Panter 20d325574e Issue #15984: Correct PyUnicode_FromObject() and _FromEncodedObject() docs 2016-04-15 00:56:21 +00:00
Martin Panter 6245cb3c01 Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
This affects documentation, code comments, and a debugging messages.
2016-04-15 02:14:19 +00:00
Serhiy Storchaka cd881b850c Fixed documentation of functions with const char* arguments. 2015-06-21 17:12:16 +03:00
Serhiy Storchaka 03863d2b29 Fixed documentation of functions with const char* arguments. 2015-06-21 17:11:21 +03:00
R David Murray 812bc1b86b Merge: #23088: Clarify null termination of bytes and strings in C API. 2015-05-13 20:32:19 -04:00
R David Murray 0a560a11af #23088: Clarify null termination of bytes and strings in C API.
Patch by Martin Panter, reviewed by Serhiy Storchaka and R. David Murray.
2015-05-13 20:31:53 -04:00
Georg Brandl 3be472b5f7 Closes #23181: codepoint -> code point 2015-01-14 08:26:30 +01:00
Serhiy Storchaka 92bf919ed0 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:26:10 +02:00
Serhiy Storchaka b757c83ec6 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:25:22 +02:00
Victor Stinner 8786ea36d0 (Merge 3.4) Closes #22580: Fix documentation of PyUnicode_Tailmatch()
The result type is Py_ssize_t (and not int).
2014-10-09 11:11:49 +02:00
Victor Stinner 13d3aa502d Closes #22580: Fix documentation of PyUnicode_Tailmatch()
The result type is Py_ssize_t (and not int).
2014-10-09 11:11:25 +02:00
Victor Stinner f6a271ae98 Issue #18395: Rename ``_Py_char2wchar()`` to :c:func:`Py_DecodeLocale`, rename
``_Py_wchar2char()`` to :c:func:`Py_EncodeLocale`, and document these
functions.
2014-08-01 12:28:48 +02:00