[Python-checkins] r81717 - python/branches/py3k-cdecimal/Modules/cdecimal/io.c
stefan.krah
python-checkins at python.org
Sat Jun 5 09:59:37 CEST 2010
Author: stefan.krah
Date: Sat Jun 5 09:59:37 2010
New Revision: 81717
Log:
1) Take the default for 'capitals' from the current context.
2) Must use maxcontext.
Modified:
python/branches/py3k-cdecimal/Modules/cdecimal/io.c
Modified: python/branches/py3k-cdecimal/Modules/cdecimal/io.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/cdecimal/io.c (original)
+++ python/branches/py3k-cdecimal/Modules/cdecimal/io.c Sat Jun 5 09:59:37 2010
@@ -665,7 +665,7 @@
}
int
-mpd_parse_fmt_str(mpd_spec_t *spec, const char *fmt)
+mpd_parse_fmt_str(mpd_spec_t *spec, const char *fmt, int caps)
{
char *cp = (char *)fmt;
int have_align = 0, n;
@@ -673,7 +673,7 @@
/* defaults */
spec->min_width = 0;
spec->prec = -1;
- spec->type = 'G';
+ spec->type = caps ? 'G' : 'g';
spec->align = '>';
spec->sign = '-';
spec->dot = "";
@@ -1081,8 +1081,8 @@
flags |= MPD_FMT_SIGN_PLUS;
}
- workctx = *ctx;
- workctx.traps = workctx.status = 0;
+ mpd_maxcontext(&workctx);
+ workctx.round = ctx->round;
if (mpd_isspecial(&tmp)) {
/* no percent formatting */
flags |= MPD_FMT_TOSCI;
@@ -1165,7 +1165,7 @@
{
mpd_spec_t spec;
- if (!mpd_parse_fmt_str(&spec, fmt)) {
+ if (!mpd_parse_fmt_str(&spec, fmt, 1)) {
*status |= MPD_Invalid_operation;
return NULL;
}
More information about the Python-checkins
mailing list