diff options
author | Eric Smith <eric@trueblade.com> | 2008-02-17 19:48:00 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2008-02-17 19:48:00 (GMT) |
commit | 8fd3eba0501a77eec463179f529f56025ff4b40b (patch) | |
tree | d459220bd52a30ce3de89b89ed1db077e7b5d4a4 /Objects/stringlib/unicodedefs.h | |
parent | 18c66898b0a14761786161c07d89d65c8f088601 (diff) | |
download | cpython-8fd3eba0501a77eec463179f529f56025ff4b40b.zip cpython-8fd3eba0501a77eec463179f529f56025ff4b40b.tar.gz cpython-8fd3eba0501a77eec463179f529f56025ff4b40b.tar.bz2 |
Fixes for shared 2.6 code that implements PEP 3101, advanced string
formatting.
Includes:
- Modifying tests for basic types to use __format__ methods, instead
of builtin "format".
- Adding PyObject_Format.
- General str/unicode cleanup discovered when backporting to 2.6.
- Removing datetimemodule.c's time_format, since it was identical
to date_format.
The files in Objects/stringlib that implement PEP 3101 (stringdefs.h,
unicodedefs.h, formatter.h, string_format.h) are identical in trunk
and py3k. Any changes from here on should be made to trunk, and
changes will propogate to py3k).
Diffstat (limited to 'Objects/stringlib/unicodedefs.h')
-rw-r--r-- | Objects/stringlib/unicodedefs.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/stringlib/unicodedefs.h b/Objects/stringlib/unicodedefs.h index 64777be..f402a98 100644 --- a/Objects/stringlib/unicodedefs.h +++ b/Objects/stringlib/unicodedefs.h @@ -6,6 +6,7 @@ compiled as unicode. */ #define STRINGLIB_IS_UNICODE 1 +#define STRINGLIB_OBJECT PyUnicodeObject #define STRINGLIB_CHAR Py_UNICODE #define STRINGLIB_TYPE_NAME "unicode" #define STRINGLIB_PARSE_CODE "U" @@ -20,7 +21,12 @@ #define STRINGLIB_NEW PyUnicode_FromUnicode #define STRINGLIB_RESIZE PyUnicode_Resize #define STRINGLIB_CHECK PyUnicode_Check + +#if PY_VERSION_HEX < 0x03000000 +#define STRINGLIB_TOSTR PyObject_Unicode +#else #define STRINGLIB_TOSTR PyObject_Str +#endif #define STRINGLIB_WANT_CONTAINS_OBJ 1 |