summaryrefslogtreecommitdiffstats
path: root/Python/formatter_unicode.c
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2007-08-25 02:26:07 (GMT)
committerEric Smith <eric@trueblade.com>2007-08-25 02:26:07 (GMT)
commit8c6632636807c35bee40210ed8483c1eca82664f (patch)
tree50f386d98ce14116eaf9d83085b82ff11bdb3e69 /Python/formatter_unicode.c
parente4dc32488446240942123cf4e9e7296ad97e20bf (diff)
downloadcpython-8c6632636807c35bee40210ed8483c1eca82664f.zip
cpython-8c6632636807c35bee40210ed8483c1eca82664f.tar.gz
cpython-8c6632636807c35bee40210ed8483c1eca82664f.tar.bz2
Implementation of PEP 3101, Advanced String Formatting.
Known issues: The string.Formatter class, as discussed in the PEP, is incomplete. Error handling needs to conform to the PEP. Need to fix this warning that I introduced in Python/formatter_unicode.c: Objects/stringlib/unicodedefs.h:26: warning: `STRINGLIB_CMP' defined but not used Need to make sure sign formatting is correct, more tests needed. Need to remove '()' sign formatting, left over from an earlier version of the PEP.
Diffstat (limited to 'Python/formatter_unicode.c')
-rw-r--r--Python/formatter_unicode.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c
new file mode 100644
index 0000000..114fe30
--- /dev/null
+++ b/Python/formatter_unicode.c
@@ -0,0 +1,13 @@
+/* implements the unicode (as opposed to string) version of the
+ built-in formatters for string, int, float. that is, the versions
+ of int.__float__, etc., that take and return unicode objects */
+
+#include "Python.h"
+#include "formatter_unicode.h"
+
+#include "../Objects/stringlib/unicodedefs.h"
+
+#define FORMAT_STRING unicode_unicode__format__
+#define FORMAT_LONG unicode_long__format__
+#define FORMAT_FLOAT unicode_float__format__
+#include "../Objects/stringlib/formatter.h"