diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 4 | ||||
-rw-r--r-- | Python/ceval.c | 3 | ||||
-rw-r--r-- | Python/errors.c | 13 | ||||
-rw-r--r-- | Python/modsupport.c | 51 |
4 files changed, 32 insertions, 39 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 97c1303..4213fc3 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Python/ceval.c b/Python/ceval.c index 727bc0c..97f38ab 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1671,6 +1671,9 @@ rem(v, w) DECREF(w); return x; } + if (is_stringobject(v)) { + return formatstring(v, w); + } err_setstr(TypeError, "bad operand type(s) for %"); return NULL; } diff --git a/Python/errors.c b/Python/errors.c index 5814dd7..9f53255 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved @@ -56,6 +56,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "allobjects.h" +#include "modsupport.h" #include <errno.h> #ifndef errno @@ -153,13 +154,11 @@ err_errno(exc) err_set(KeyboardInterrupt); return NULL; } - v = newtupleobject(2); + v = mkvalue("(is)", errno, strerror(errno)); if (v != NULL) { - settupleitem(v, 0, newintobject((long)errno)); - settupleitem(v, 1, newstringobject(strerror(errno))); + err_setval(exc, v); + DECREF(v); } - err_setval(exc, v); - XDECREF(v); return NULL; } diff --git a/Python/modsupport.c b/Python/modsupport.c index b464c8e..d998ad8 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -28,17 +28,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "modsupport.h" #include "import.h" -#ifdef HAVE_PROTOTYPES -#define USE_STDARG -#endif - -#ifdef USE_STDARG -#include <stdarg.h> -#else -#include <varargs.h> -#endif - - object * initmodule(name, methods) char *name; @@ -454,7 +443,7 @@ do_mkvalue(p_format, p_va) case '(': return do_mktuple(p_format, p_va, ')', countformat(*p_format, ')')); - + case 'b': case 'h': case 'i': @@ -466,7 +455,7 @@ do_mkvalue(p_format, p_va) case 'f': case 'd': return newfloatobject((double)va_arg(*p_va, double)); - + case 'c': { char p[1]; @@ -532,32 +521,34 @@ object *mkvalue(char *format, ...) object *mkvalue(va_alist) va_dcl #endif { - int n; - char *f; va_list va; object* retval; #ifdef USE_STDARG va_start(va, format); #else char *format; - va_start(va); format = va_arg(va, char *); #endif - f = format; - n = countformat(f, '\0'); - if (n < 0) - retval = NULL; /* Error in the format */ - else if (n == 0) { - retval = None; - INCREF(retval); - } - else if (n == 1) - retval = do_mkvalue(&f, &va); - else - retval = do_mktuple(&f, &va, '\0', n); + retval = vmkvalue(format, va); va_end(va); - if (retval == NULL) - fprintf(stderr, "format \"%s\", f \"%s\"\n", format, f); return retval; } + +object * +vmkvalue(format, va) + char *format; + va_list va; +{ + char *f = format; + int n = countformat(f, '\0'); + if (n < 0) + return NULL; + if (n == 0) { + INCREF(None); + return None; + } + if (n == 1) + return do_mkvalue(&f, &va); + return do_mktuple(&f, &va, '\0', n); +} |