[Python-3000-checkins] r59181 - python/branches/py3k/Modules/_csv.c

Guido van Rossum guido at python.org
Mon Nov 26 03:46:26 CET 2007


On Nov 24, 2007 4:52 PM, georg.brandl <python-3000-checkins at python.org> wrote:
> Modified: python/branches/py3k/Modules/_csv.c
> ==============================================================================
> --- python/branches/py3k/Modules/_csv.c (original)
> +++ python/branches/py3k/Modules/_csv.c Sun Nov 25 01:52:21 2007
> @@ -793,14 +793,13 @@
>                                              "newline inside string");
>                          return NULL;
>                  }
> -               if (!PyUnicode_Check(lineobj))
> -               {
> -                       PyErr_Format(error_obj,
> -                                    "Iterator should return strings, "
> -                                    "not %.200s "
> -                                    "(did you open the file in text mode?)",
> +               if (!PyUnicode_Check(lineobj)) {
> +                       PyErr_Format(error_obj, "iterator should return "
> +                                    "strings, not %.200s (did you open "
> +                                    "the file in text mode?)",

To be honest, I liked the way the long string literal was broken
across lines before better. Breaking at punctuation makes it more
likely that grepping through the source for a fragment of an error
message will yield a hit. And sometimes, when faced with a mysterious
error message, there's no substitute for grepping... :-)

>                                      lineobj->ob_type->tp_name
>                                 );
> +                       Py_DECREF(lineobj);
>                         return NULL;
>                 }
>                  ++self->line_num;

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000-checkins mailing list