Commit Graph

1868 Commits

Author SHA1 Message Date
Ezio Melotti 931b8aac80 #12753: Add support for Unicode name aliases and named sequences. 2011-10-21 21:57:36 +03:00
Victor Stinner 55c7e00fc0 Simplify _PyUnicode_COMPACT_DATA() macro 2011-10-18 23:32:53 +02:00
Victor Stinner 3a50e7056e Issue #12281: Rewrite the MBCS codec to handle correctly replace and ignore
error handlers on all Windows versions. The MBCS codec is now supporting all
error handlers, instead of only replace to encode and ignore to decode.
2011-10-18 21:21:00 +02:00
Antoine Pitrou e60698317d Fix build under Windows 2011-10-15 16:38:20 +02:00
Martin v. Löwis bd928fef42 Rename _Py_identifier to _Py_IDENTIFIER. 2011-10-14 10:20:37 +02:00
Victor Stinner f5cff56a1b Issue #13088: Add shared Py_hexdigits constant to format a number into base 16 2011-10-14 02:13:11 +02:00
Victor Stinner 8813104e53 Simplify PyUnicode_MAX_CHAR_VALUE
Use PyUnicode_IS_ASCII instead of PyUnicode_IS_COMPACT_ASCII, so the following
test can be removed:

   PyUnicode_DATA(op) == (((PyCompactUnicodeObject *)(op))->utf8)
2011-10-13 01:12:01 +02:00
Antoine Pitrou 6b4883dec0 PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy. 2011-10-12 02:54:14 +02:00
Victor Stinner 794d567b17 any_find_slice() doesn't use callbacks anymore
* Call directly the right find/rfind method: allow inlining functions
 * Remove Py_LOCAL_CALLBACK (added for any_find_slice)
2011-10-10 03:21:36 +02:00
Martin v. Löwis 87da872c69 Drop extra semicolon. 2011-10-09 11:54:42 +02:00
Martin v. Löwis afe55bba33 Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Martin v. Löwis c47adb04b3 Change PyUnicode_KIND to 1,2,4. Drop _KIND_SIZE and _CHARACTER_SIZE. 2011-10-07 20:55:35 +02:00
Georg Brandl db6c7f5c33 Update C API docs for PEP 393. 2011-10-07 11:19:11 +02:00
Antoine Pitrou c61c8d7a5e Issue #12911: Fix memory consumption when calculating the repr() of huge tuples or lists.
This introduces a small private API for this common pattern.
The issue has been discovered thanks to Martin's huge-mem buildbot.
2011-10-06 19:04:12 +02:00
Antoine Pitrou eeb7eea1f9 Issue #12911: Fix memory consumption when calculating the repr() of huge tuples or lists.
This introduces a small private API for this common pattern.
The issue has been discovered thanks to Martin's huge-mem buildbot.
2011-10-06 18:57:27 +02:00
Victor Stinner b066cc6aba Fix PyUnicode_CHARACTER_SIZE and PyUnicode_KIND_SIZE 2011-10-06 15:54:53 +02:00
Antoine Pitrou dbf697ae5c Fix compilation warnings under 64-bit Windows 2011-10-06 15:34:41 +02:00
Éric Araujo 0f4ee93b06 Branch merge 2011-10-06 13:22:21 +02:00
Victor Stinner 1d4b35f4e5 rephrase PyUnicode_1BYTE_KIND documentation 2011-10-06 01:51:19 +02:00
Victor Stinner fb9ea8c57e Don't check for the maximum character when copying from unicodeobject.c
* Create copy_characters() function which doesn't check for the maximum
   character in release mode
 * _PyUnicode_CheckConsistency() is no more static to be able to use it
   in _PyUnicode_FormatAdvanced() (in formatter_unicode.c)
 * _PyUnicode_CheckConsistency() checks the string hash
2011-10-06 01:45:57 +02:00
Éric Araujo 80a348c0a0 Fix typo 2011-10-05 01:11:12 +02:00
Antoine Pitrou 310638ea81 Try to fix linking failures under Windows 2011-10-04 14:44:35 +02:00
Antoine Pitrou 36225c6a99 Try to fix linking failures under Windows 2011-10-04 14:43:47 +02:00
Victor Stinner 30134f53fc Complete documentation of compact ASCII strings 2011-10-04 01:32:45 +02:00
Victor Stinner a41463c203 Document utf8_length and wstr_length states
Ensure these states with assertions in _PyUnicode_CheckConsistency().
2011-10-04 01:05:08 +02:00
Victor Stinner 7f11ad4594 Unicode: document when the wstr pointer is shared with data
Add also related assertions to _PyUnicode_CheckConsistency().
2011-10-04 00:00:20 +02:00
Victor Stinner 8cfcbed4e3 Improve string forms and PyUnicode_Resize() documentation
Remove also the FIXME for resize_copy(): as discussed with Martin, copy the
string on resize if the string is not resizable is just fine.
2011-10-03 23:19:21 +02:00
Victor Stinner c3cec7868b Add asciilib: similar to ucs1, ucs2 and ucs4 library, but specialized to ASCII
ucs1, ucs2 and ucs4 libraries have to scan created substring to find the
maximum character, whereas it is not need to ASCII strings. Because ASCII
strings are common, it is useful to optimize ASCII.
2011-10-05 21:24:08 +02:00
Victor Stinner 4d0d54bcba Document requierements of Unicode kinds 2011-10-05 01:31:05 +02:00
Georg Brandl 07de325672 More fixes. 2011-10-05 16:47:38 +02:00
Georg Brandl c6bc4c6897 Fix a few typos in the unicode header. 2011-10-05 16:23:09 +02:00
Georg Brandl 4975a9b44d Fix grammar. 2011-10-05 16:12:21 +02:00
Victor Stinner b9275c104e Speedup str[a:b] and PyUnicode_FromKindAndData
* str[a:b] doesn't scan the string for the maximum character if the string
   is ascii only
 * PyUnicode_FromKindAndData() stops if we are sure that we cannot use a
   shorter character type. For example, _PyUnicode_FromUCS1() stops if we
   have at least one character in range U+0080-U+00FF
2011-10-05 14:01:42 +02:00
Victor Stinner 85041a54bd _PyUnicode_CheckConsistency() checks utf8 field consistency 2011-10-03 14:42:39 +02:00
Victor Stinner a3b334da6d PyUnicode_Ready() now sets ascii=1 if maxchar < 128
ascii=1 is no more reserved to PyASCIIObject. Use
PyUnicode_IS_COMPACT_ASCII(obj) to check if obj is a PyASCIIObject (as before).
2011-10-03 13:53:37 +02:00
Victor Stinner 910337b42e Add _PyUnicode_CheckConsistency() macro to help debugging
* Document Unicode string states
 * Use _PyUnicode_CheckConsistency() to ensure that objects are always
   consistent.
2011-10-03 03:20:16 +02:00
Victor Stinner 37943769ef PyUnicode_READ_CHAR() ensures that the string is ready 2011-10-02 20:33:18 +02:00
Victor Stinner 7a48ff7e06 Use Py_UCS1 instead of unsigned char in unicodeobject.h 2011-10-02 00:55:25 +02:00
Victor Stinner cd9950fd09 PyUnicode_WriteChar() raises IndexError on invalid index
PyUnicode_WriteChar() raises also a ValueError if the string has more than 1
reference.
2011-10-02 00:34:53 +02:00
Victor Stinner 9f789e7f63 _PyUnicode_AsKind() is *not* part of the stable ABI 2011-10-01 03:57:28 +02:00
Victor Stinner 4584a5ba1a PyUnicode_CHARACTER_SIZE(): add a reference to PyUnicode_KIND_SIZE() 2011-10-01 02:39:37 +02:00
Victor Stinner 034f6cf10c Add PyUnicode_Copy() function, include it to the public API 2011-09-30 02:26:44 +02:00
Victor Stinner d8f6510acc _PyUnicode_Ready() cannot be used on ready strings anymore
* Change its prototype: PyObject* instead of PyUnicodeoObject*.
 * Remove an old assertion, the result of PyUnicode_READY (_PyUnicode_Ready)
   must be checked instead
2011-09-29 19:43:17 +02:00
Victor Stinner bc8b81bc4e Move _PyUnicode_UTF8() and _PyUnicode_UTF8_LENGTH() outside unicodeobject.h
Move these macros to unicodeobject.c
2011-09-29 19:31:34 +02:00
Victor Stinner a0702ab1fe Add a note in PyUnicode_CopyCharacters() doc: it doesn't write null character
Cleanup also the code (avoid the goto).
2011-09-29 14:14:38 +02:00
Victor Stinner f0ddadcf2e Rename Py_BUILD_ASSERT to Py_BUILD_ASSERT_EXPR
To make it clearer that Py_BUILD_ASSERT_EXPR(cond) cannot be used as
assert(cond).
2011-09-29 12:43:18 +02:00
Victor Stinner 573696a9ca pymacro.h: Inline _Py_ARRAY_LENGTH_CHECK() and add http://ccodearchive.net/ 2011-09-29 12:12:39 +02:00
Victor Stinner dfb866d127 Enhance Py_ARRAY_LENGTH(): fail at build time if the argument is not an array
Move other various macros to pymcacro.h

Thanks Rusty Russell for having written these amazing C macros!
2011-09-29 01:12:24 +02:00
Victor Stinner 2bdc7f591b Move code related to compile from Python.h to compile.h 2011-09-29 01:04:08 +02:00
Victor Stinner f5ca1a21a5 PyUnicode_CopyCharacters() fails if 'to' has more than 1 reference 2011-09-28 23:54:59 +02:00