[Python-checkins] r81895 - in python/branches/py3k: Lib/test/test_struct.py Misc/NEWS Modules/_struct.c

Alexander Belopolsky alexander.belopolsky at gmail.com
Fri Jun 11 18:36:46 CEST 2010


I goofed in log and NEWS entries (no mention of struct module).
What's the cvs command to change a log entry?

On Fri, Jun 11, 2010 at 12:04 PM, alexander.belopolsky
<python-checkins at python.org> wrote:
> Author: alexander.belopolsky
> Date: Fri Jun 11 18:04:59 2010
> New Revision: 81895
>
> Log:
> Issue #3129: Trailing digits in format string are no longer ignored.
>
>
> Modified:
>   python/branches/py3k/Lib/test/test_struct.py
>   python/branches/py3k/Misc/NEWS
>   python/branches/py3k/Modules/_struct.c
>
> Modified: python/branches/py3k/Lib/test/test_struct.py
> ==============================================================================
> --- python/branches/py3k/Lib/test/test_struct.py        (original)
> +++ python/branches/py3k/Lib/test/test_struct.py        Fri Jun 11 18:04:59 2010
> @@ -443,7 +443,7 @@
>
>         # Test bogus offset (issue 3694)
>         sb = small_buf
> -        self.assertRaises(TypeError, struct.pack_into, b'1', sb, None)
> +        self.assertRaises(TypeError, struct.pack_into, b'', sb, None)
>
>     def test_pack_into_fn(self):
>         test_string = b'Reykjavik rocks, eow!'
> @@ -510,6 +510,32 @@
>         def test_crasher(self):
>             self.assertRaises(MemoryError, struct.pack, "357913941b", "a")
>
> +    def test_trailing_counter(self):
> +        store = array.array('b', b' '*100)
> +
> +        # format lists containing only count spec should result in an error
> +        self.assertRaises(struct.error, struct.pack, '12345')
> +        self.assertRaises(struct.error, struct.unpack, '12345', '')
> +        self.assertRaises(struct.error, struct.pack_into, '12345', store, 0)
> +        self.assertRaises(struct.error, struct.unpack_from, '12345', store, 0)
> +
> +        # Format lists with trailing count spec should result in an error
> +        self.assertRaises(struct.error, struct.pack, 'c12345', 'x')
> +        self.assertRaises(struct.error, struct.unpack, 'c12345', 'x')
> +        self.assertRaises(struct.error, struct.pack_into, 'c12345', store, 0,
> +                           'x')
> +        self.assertRaises(struct.error, struct.unpack_from, 'c12345', store,
> +                           0)
> +
> +        # Mixed format tests
> +        self.assertRaises(struct.error, struct.pack, '14s42', 'spam and eggs')
> +        self.assertRaises(struct.error, struct.unpack, '14s42',
> +                          'spam and eggs')
> +        self.assertRaises(struct.error, struct.pack_into, '14s42', store, 0,
> +                          'spam and eggs')
> +        self.assertRaises(struct.error, struct.unpack_from, '14s42', store, 0)
> +
> +
>
>  def test_main():
>     run_unittest(StructTest)
>
> Modified: python/branches/py3k/Misc/NEWS
> ==============================================================================
> --- python/branches/py3k/Misc/NEWS      (original)
> +++ python/branches/py3k/Misc/NEWS      Fri Jun 11 18:04:59 2010
> @@ -1283,6 +1283,10 @@
>  Extension Modules
>  -----------------
>
> +- Issue #3129: Trailing digits in format string are no longer ignored.
> +  For example, "1" or "ilib123" are now invalid formats and cause
> +  ``struct.error`` to be raised.
> +
>  - Issue #7384: If the system readline library is linked against ncurses,
>   the curses module must be linked against ncurses as well. Otherwise it
>   is not safe to load both the readline and curses modules in an application.
>
> Modified: python/branches/py3k/Modules/_struct.c
> ==============================================================================
> --- python/branches/py3k/Modules/_struct.c      (original)
> +++ python/branches/py3k/Modules/_struct.c      Fri Jun 11 18:04:59 2010
> @@ -1195,8 +1195,11 @@
>                 }
>                 num = x;
>             }
> -            if (c == '\0')
> -                break;
> +            if (c == '\0') {
> +                PyErr_SetString(StructError,
> +                                "repeat count given without format specifier");
> +                return -1;
> +            }
>         }
>         else
>             num = 1;
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>


More information about the Python-checkins mailing list