diff options
author | Eric Smith <eric@trueblade.com> | 2008-01-27 21:07:59 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2008-01-27 21:07:59 (GMT) |
commit | 7b69c6c3afba79518865313e1b41845a6b534fb6 (patch) | |
tree | 1a2f2f8e142378ff212cc4f57083e8a983cbe297 /Objects | |
parent | 412dc9c88f040abf4b23017c5e5e4d8b880d247d (diff) | |
download | cpython-7b69c6c3afba79518865313e1b41845a6b534fb6.zip cpython-7b69c6c3afba79518865313e1b41845a6b534fb6.tar.gz cpython-7b69c6c3afba79518865313e1b41845a6b534fb6.tar.bz2 |
Restrict format presentation types to those specified in the 'Standard Format Specifiers' section of PEP 3101.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/stringlib/formatter.h | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/Objects/stringlib/formatter.h b/Objects/stringlib/formatter.h index b4f6e3c..49b3566 100644 --- a/Objects/stringlib/formatter.h +++ b/Objects/stringlib/formatter.h @@ -788,37 +788,6 @@ FORMAT_STRING(PyObject* value, PyObject* args) /* no type conversion needed, already a string. do the formatting */ result = format_string_internal(value, &format); break; -#if 0 - case 'b': - case 'c': - case 'd': - case 'o': - case 'x': - case 'X': - /* convert to integer */ - /* XXX: make a stringlib function to do this when backporting, - since FromUnicode differs from FromString */ - tmp = PyLong_FromUnicode(STRINGLIB_STR(value), STRINGLIB_LEN(value), 0); - if (tmp == NULL) - goto done; - result = format_long_internal(tmp, &format); - break; - - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - case 'n': - case '%': - /* convert to float */ - tmp = PyFloat_FromString(value); - if (tmp == NULL) - goto done; - result = format_float_internal(tmp, &format); - break; -#endif default: /* unknown */ PyErr_Format(PyExc_ValueError, "Unknown conversion type %c", @@ -855,15 +824,6 @@ FORMAT_LONG(PyObject* value, PyObject* args) /* type conversion? */ switch (format.type) { -#if 0 - case 's': - /* convert to string/unicode */ - tmp = STRINGLIB_TOSTR(value); - if (tmp == NULL) - goto done; - result = format_string_internal(tmp, &format); - break; -#endif case 'b': case 'c': case 'd': @@ -874,21 +834,6 @@ FORMAT_LONG(PyObject* value, PyObject* args) result = format_long_internal(value, &format); break; - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - case 'n': - case '%': - /* convert to float */ - tmp = PyNumber_Float(value); - if (tmp == NULL) - goto done; - result = format_float_internal(value, &format); - break; - default: /* unknown */ PyErr_Format(PyExc_ValueError, "Unknown conversion type %c", @@ -925,28 +870,6 @@ FORMAT_FLOAT(PyObject *value, PyObject *args) /* type conversion? */ switch (format.type) { -#if 0 - case 's': - /* convert to string/unicode */ - tmp = STRINGLIB_TOSTR(value); - if (tmp == NULL) - goto done; - result = format_string_internal(tmp, &format); - break; -#endif - case 'b': - case 'c': - case 'd': - case 'o': - case 'x': - case 'X': - /* convert to integer */ - tmp = PyNumber_Long(value); - if (tmp == NULL) - goto done; - result = format_long_internal(tmp, &format); - break; - case 'e': case 'E': case 'f': |